3 #include "Video/Video.h"
4 #include <opencv2/core/core.hpp>
5 #include <opencv2/highgui/highgui.hpp>
20 void beginFrame(
size_t jpegSize)
override {
23 LOGI(
"jpegSize: %d", (
int)jpegSize);
25 if (img_vector.size() < jpegSize) {
26 img_vector.resize(jpegSize);
29 this->open = jpegSize;
30 this->size = jpegSize;
33 create_window =
false;
35 cv::namedWindow(window);
47 size_t write(
const uint8_t *data,
size_t len)
override {
48 memcpy(&img_vector[pos], data, len);
55 bool create_window =
true;
56 std::vector<uint8_t> img_vector;
57 const char *window =
"Movie";
66 cv::Mat data(1, size, CV_8UC1, (
void *)&img_vector[0]);
68 cv::Mat mat = cv::imdecode(data, 0);
69 cv::imshow(window, mat);