From 328f4542486cbcda0e52f882716f3262eb5d00b3 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 18 Jul 2023 20:31:00 -0400 Subject: [PATCH] Define and allocate, and assign image_pixelformats in shmem --- src/zm_monitor.cpp | 2 ++ src/zm_monitor.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 69377a0d2..1d84efe80 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -966,6 +966,7 @@ bool Monitor::connect() { if (alarm_image.Buffer() + image_size > mem_ptr + mem_size) { Warning("We will exceed memsize by %td bytes!", (alarm_image.Buffer() + image_size) - (mem_ptr + mem_size)); } + image_pixelformats = (AVPixelFormat *)(shared_images + (image_buffer_count*image_size)); if (purpose == CAPTURE) { memset(mem_ptr, 0, mem_size); @@ -2813,6 +2814,7 @@ bool Monitor::Decode() { index++; index = index % image_buffer_count; image_buffer[index]->Assign(*(packet->image)); + image_pixelformats[index] = packet->image->AVPixFormat(); shared_timestamps[index] = zm::chrono::duration_cast(packet->timestamp.time_since_epoch()); shared_data->signal = (capture_image and signal_check_points) ? CheckSignal(capture_image) : true; shared_data->last_write_index = index; diff --git a/src/zm_monitor.h b/src/zm_monitor.h index f38517925..68b71a172 100644 --- a/src/zm_monitor.h +++ b/src/zm_monitor.h @@ -519,6 +519,7 @@ protected: struct timeval *shared_timestamps; unsigned char *shared_images; std::vector image_buffer; + AVPixelFormat *image_pixelformats; int video_stream_id; // will be filled in PrimeCapture int audio_stream_id; // will be filled in PrimeCapture