timestamp image before scaling. Fixes lack of scaling when TIMESTAMP_ON_CAPTURE

is off
This commit is contained in:
Isaac Connor 2021-11-19 11:59:19 -05:00
parent 2e62826e6c
commit 56fdae0f19
1 changed files with 7 additions and 5 deletions

View File

@ -378,9 +378,9 @@ bool MonitorStream::sendFrame(const char *filepath, const timeval &timestamp) {
} // end bool MonitorStream::sendFrame(const char *filepath, struct timeval *timestamp) } // end bool MonitorStream::sendFrame(const char *filepath, struct timeval *timestamp)
bool MonitorStream::sendFrame(Image *image, const timeval &timestamp) { bool MonitorStream::sendFrame(Image *image, const timeval &timestamp) {
Image *send_image = prepareImage(image);
if (!config.timestamp_on_capture) if (!config.timestamp_on_capture)
monitor->TimestampImage(send_image, timestamp); monitor->TimestampImage(image, timestamp);
Image *send_image = prepareImage(image);
fputs("--" BOUNDARY "\r\n", stdout); fputs("--" BOUNDARY "\r\n", stdout);
#if HAVE_LIBAVCODEC #if HAVE_LIBAVCODEC
@ -864,14 +864,16 @@ void MonitorStream::SingleImage(int scale) {
Debug(1, "write index: %d %d", monitor->shared_data->last_write_index, index); Debug(1, "write index: %d %d", monitor->shared_data->last_write_index, index);
Image *snap_image = monitor->image_buffer[index]; Image *snap_image = monitor->image_buffer[index];
if (!config.timestamp_on_capture) {
monitor->TimestampImage(snap_image, monitor->shared_timestamps[index]);
}
if ( scale != ZM_SCALE_BASE ) { if ( scale != ZM_SCALE_BASE ) {
scaled_image.Assign(*snap_image); scaled_image.Assign(*snap_image);
scaled_image.Scale(scale); scaled_image.Scale(scale);
snap_image = &scaled_image; snap_image = &scaled_image;
} }
if ( !config.timestamp_on_capture ) {
monitor->TimestampImage(snap_image, monitor->shared_timestamps[index]);
}
snap_image->EncodeJpeg(img_buffer, &img_buffer_size); snap_image->EncodeJpeg(img_buffer, &img_buffer_size);
fprintf(stdout, fprintf(stdout,