mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-10 17:43:43 +00:00
frame_copy_meta()
This commit is contained in:
@@ -68,27 +68,27 @@ void frame_append_data(frame_s *frame, const uint8_t *data, size_t size) {
|
|||||||
frame->used = new_used;
|
frame->used = new_used;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define COPY(_field) dest->_field = src->_field
|
||||||
|
|
||||||
void frame_copy(const frame_s *src, frame_s *dest) {
|
void frame_copy(const frame_s *src, frame_s *dest) {
|
||||||
assert(dest->managed);
|
assert(dest->managed);
|
||||||
|
|
||||||
frame_set_data(dest, src->data, src->used);
|
frame_set_data(dest, src->data, src->used);
|
||||||
|
|
||||||
# define COPY(_field) dest->_field = src->_field
|
|
||||||
|
|
||||||
// Don't copy the role
|
|
||||||
COPY(used);
|
COPY(used);
|
||||||
|
frame_copy_meta(src, dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
void frame_copy_meta(const frame_s *src, frame_s *dest) {
|
||||||
|
// Don't copy the role
|
||||||
COPY(width);
|
COPY(width);
|
||||||
COPY(height);
|
COPY(height);
|
||||||
COPY(format);
|
COPY(format);
|
||||||
|
|
||||||
COPY(grab_ts);
|
COPY(grab_ts);
|
||||||
COPY(encode_begin_ts);
|
COPY(encode_begin_ts);
|
||||||
COPY(encode_end_ts);
|
COPY(encode_end_ts);
|
||||||
|
|
||||||
# undef COPY
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef COPY
|
||||||
|
|
||||||
bool frame_compare(const frame_s *a, const frame_s *b) {
|
bool frame_compare(const frame_s *a, const frame_s *b) {
|
||||||
return (
|
return (
|
||||||
a->allocated && b->allocated
|
a->allocated && b->allocated
|
||||||
|
|||||||
@@ -59,4 +59,5 @@ void frame_set_data(frame_s *frame, const uint8_t *data, size_t size);
|
|||||||
void frame_append_data(frame_s *frame, const uint8_t *data, size_t size);
|
void frame_append_data(frame_s *frame, const uint8_t *data, size_t size);
|
||||||
|
|
||||||
void frame_copy(const frame_s *src, frame_s *dest);
|
void frame_copy(const frame_s *src, frame_s *dest);
|
||||||
|
void frame_copy_meta(const frame_s *src, frame_s *dest);
|
||||||
bool frame_compare(const frame_s *a, const frame_s *b);
|
bool frame_compare(const frame_s *a, const frame_s *b);
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ int unjpeg(const frame_s *src, frame_s *dest) {
|
|||||||
|
|
||||||
jpeg_finish_decompress(&jpeg);
|
jpeg_finish_decompress(&jpeg);
|
||||||
|
|
||||||
|
frame_copy_meta(src, dest);
|
||||||
dest->width = jpeg.output_width;
|
dest->width = jpeg.output_width;
|
||||||
dest->height = jpeg.output_height;
|
dest->height = jpeg.output_height;
|
||||||
dest->format = V4L2_PIX_FMT_RGB24;
|
dest->format = V4L2_PIX_FMT_RGB24;
|
||||||
|
|||||||
Reference in New Issue
Block a user