bool Event::WriteFrameImage( Image *image, struct timeval timestamp, const char *event_file, bool alarm_frame ) { if ( config.timestamp_on_capture ) { if ( !config.opt_frame_server || !SendFrameImage( image, alarm_frame) ) { if ( alarm_frame && (config.jpeg_alarm_file_quality > config.jpeg_file_quality) ) image->WriteJpeg( event_file, config.jpeg_alarm_file_quality ); else image->WriteJpeg( event_file ); } } else { Image ts_image( *image ); monitor->TimestampImage( &ts_image, ×tamp ); if ( !config.opt_frame_server || !SendFrameImage( &ts_image, alarm_frame) ) { if ( alarm_frame && (config.jpeg_alarm_file_quality > config.jpeg_file_quality) ) ts_image.WriteJpeg( event_file, config.jpeg_alarm_file_quality ); else ts_image.WriteJpeg( event_file ); } } return( true ); }
bool Event::WriteFrameImage( Image *image, struct timeval timestamp, const char *event_file, bool alarm_frame ) { Image* ImgToWrite; Image* ts_image = NULL; if ( config.timestamp_on_capture ) // stash the image we plan to use in another pointer regardless if timestamped. { ts_image = new Image(*image); monitor->TimestampImage( ts_image, ×tamp ); ImgToWrite=ts_image; } else ImgToWrite=image; if ( !config.opt_frame_server || !SendFrameImage(ImgToWrite, alarm_frame) ) { int thisquality = ( alarm_frame && (config.jpeg_alarm_file_quality > config.jpeg_file_quality) ) ? config.jpeg_alarm_file_quality : 0 ; // quality to use, zero is default ImgToWrite->WriteJpeg( event_file, thisquality, (monitor->Exif() ? timestamp : (timeval){0,0}) ); // exif is only timestamp at present this switches on or off for write } if(ts_image) delete(ts_image); // clean up if used. return( true ); }