mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-02-27 12:16:31 +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;
|
||||
}
|
||||
|
||||
#define COPY(_field) dest->_field = src->_field
|
||||
|
||||
void frame_copy(const frame_s *src, frame_s *dest) {
|
||||
assert(dest->managed);
|
||||
|
||||
frame_set_data(dest, src->data, src->used);
|
||||
|
||||
# define COPY(_field) dest->_field = src->_field
|
||||
|
||||
// Don't copy the role
|
||||
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(height);
|
||||
COPY(format);
|
||||
|
||||
COPY(grab_ts);
|
||||
COPY(encode_begin_ts);
|
||||
COPY(encode_end_ts);
|
||||
|
||||
# undef COPY
|
||||
}
|
||||
|
||||
#undef COPY
|
||||
|
||||
bool frame_compare(const frame_s *a, const frame_s *b) {
|
||||
return (
|
||||
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_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);
|
||||
|
||||
@@ -64,6 +64,7 @@ int unjpeg(const frame_s *src, frame_s *dest) {
|
||||
|
||||
jpeg_finish_decompress(&jpeg);
|
||||
|
||||
frame_copy_meta(src, dest);
|
||||
dest->width = jpeg.output_width;
|
||||
dest->height = jpeg.output_height;
|
||||
dest->format = V4L2_PIX_FMT_RGB24;
|
||||
|
||||
Reference in New Issue
Block a user