diff --git a/onvif/modules/MYMETA.json b/onvif/modules/MYMETA.json index e8376a7d8..cab2ae939 100644 --- a/onvif/modules/MYMETA.json +++ b/onvif/modules/MYMETA.json @@ -4,13 +4,13 @@ "Jan Hochstein" ], "dynamic_config" : 0, - "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010", "license" : [ "unknown" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", - "version" : "2" + "version" : 2 }, "name" : "ONVIF", "no_index" : { @@ -36,5 +36,5 @@ }, "release_status" : "stable", "version" : "", - "x_serialization_backend" : "JSON::PP version 2.27400_02" + "x_serialization_backend" : "JSON::PP version 4.02" } diff --git a/onvif/modules/MYMETA.yml b/onvif/modules/MYMETA.yml index 35eac3142..ea47256fc 100644 --- a/onvif/modules/MYMETA.yml +++ b/onvif/modules/MYMETA.yml @@ -7,7 +7,7 @@ build_requires: configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 -generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010' license: unknown meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html diff --git a/onvif/proxy/MYMETA.json b/onvif/proxy/MYMETA.json index e8376a7d8..cab2ae939 100644 --- a/onvif/proxy/MYMETA.json +++ b/onvif/proxy/MYMETA.json @@ -4,13 +4,13 @@ "Jan Hochstein" ], "dynamic_config" : 0, - "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010", "license" : [ "unknown" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", - "version" : "2" + "version" : 2 }, "name" : "ONVIF", "no_index" : { @@ -36,5 +36,5 @@ }, "release_status" : "stable", "version" : "", - "x_serialization_backend" : "JSON::PP version 2.27400_02" + "x_serialization_backend" : "JSON::PP version 4.02" } diff --git a/onvif/proxy/MYMETA.yml b/onvif/proxy/MYMETA.yml index 35eac3142..ea47256fc 100644 --- a/onvif/proxy/MYMETA.yml +++ b/onvif/proxy/MYMETA.yml @@ -7,7 +7,7 @@ build_requires: configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 -generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010' license: unknown meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html diff --git a/src/zm_eventstream.cpp b/src/zm_eventstream.cpp index f9938bb22..09335ddf1 100644 --- a/src/zm_eventstream.cpp +++ b/src/zm_eventstream.cpp @@ -810,29 +810,38 @@ bool EventStream::sendFrame(int delta_us) { if ( send_raw ) { #if HAVE_SENDFILE - fprintf(stdout, "Content-Length: %d\r\n\r\n", (int)filestat.st_size); + if ( 0 > fprintf(stdout, "Content-Length: %d\r\n\r\n", (int)filestat.st_size) ) { + fclose(fdj); /* Close the file handle */ + Info("Unable to send raw frame %u: %s", curr_frame_id, strerror(errno)); + return false; + } if ( zm_sendfile(fileno(stdout), fileno(fdj), 0, (int)filestat.st_size) != (int)filestat.st_size ) { /* sendfile() failed, use standard way instead */ img_buffer_size = fread(img_buffer, 1, sizeof(temp_img_buffer), fdj); if ( fwrite(img_buffer, img_buffer_size, 1, stdout) != 1 ) { fclose(fdj); /* Close the file handle */ - Error("Unable to send raw frame %u: %s", curr_frame_id, strerror(errno)); + Info("Unable to send raw frame %u: %s", curr_frame_id, strerror(errno)); return false; } } #else - fprintf(stdout, "Content-Length: %d\r\n\r\n", img_buffer_size); - if ( fwrite(img_buffer, img_buffer_size, 1, stdout) != 1 ) { + if ( + (0 > fprintf(stdout, "Content-Length: %d\r\n\r\n", img_buffer_size) ) + || + ( fwrite(img_buffer, img_buffer_size, 1, stdout) != 1 ) + ) { fclose(fdj); /* Close the file handle */ - Error("Unable to send raw frame %u: %s", curr_frame_id, strerror(errno)); + Info("Unable to send raw frame %u: %s", curr_frame_id, strerror(errno)); return false; } #endif fclose(fdj); /* Close the file handle */ } else { Debug(3, "Content length: %d", img_buffer_size); - fprintf(stdout, "Content-Length: %d\r\n\r\n", img_buffer_size); - if ( fwrite(img_buffer, img_buffer_size, 1, stdout) != 1 ) { + if ( + (0 > fprintf(stdout, "Content-Length: %d\r\n\r\n", img_buffer_size) ) + || + ( fwrite(img_buffer, img_buffer_size, 1, stdout) != 1 ) ) { Error("Unable to send stream frame: %s", strerror(errno)); return false; } diff --git a/src/zm_image.cpp b/src/zm_image.cpp index aa5c4918a..1b8b33c8a 100644 --- a/src/zm_image.cpp +++ b/src/zm_image.cpp @@ -2073,7 +2073,7 @@ void Image::Annotate( const char *p_text, const Coord &coord, const unsigned int } } else { - Panic("Annotate called with unexpected colours: %d",colours); + Error("Annotate called with unexpected colours: %d", colours); return; } diff --git a/src/zm_monitorstream.cpp b/src/zm_monitorstream.cpp index 4a44a2ea9..57bb09c56 100644 --- a/src/zm_monitorstream.cpp +++ b/src/zm_monitorstream.cpp @@ -328,11 +328,12 @@ bool MonitorStream::sendFrame(const char *filepath, struct timeval *timestamp) { struct timeval frameStartTime; gettimeofday(&frameStartTime, NULL); - fputs("--" BOUNDARY "\r\nContent-Type: image/jpeg\r\n", stdout); - fprintf(stdout, "Content-Length: %d\r\n" - "X-Timestamp: %d.%06d\r\n" - "\r\n", img_buffer_size, (int)timestamp->tv_sec, (int)timestamp->tv_usec); - if ( fwrite(img_buffer, img_buffer_size, 1, stdout) != 1 ) { + if ( + (0 > fprintf(stdout, "Content-Length: %d\r\nX-Timestamp: %d.%06d\r\n\r\n", + img_buffer_size, (int)timestamp->tv_sec, (int)timestamp->tv_usec)) + || + (fwrite(img_buffer, img_buffer_size, 1, stdout) != 1) + ) { if ( !zm_terminate ) Warning("Unable to send stream frame: %s", strerror(errno)); return false; @@ -413,10 +414,12 @@ bool MonitorStream::sendFrame(Image *image, struct timeval *timestamp) { Error("Unexpected frame type %d", type); return false; } - fprintf(stdout, "Content-Length: %d\r\n" - "X-Timestamp: %d.%06d\r\n" - "\r\n", img_buffer_size, (int)timestamp->tv_sec, (int)timestamp->tv_usec); - if ( fwrite(img_buffer, img_buffer_size, 1, stdout) != 1 ) { + if ( + ( 0 > fprintf(stdout, "Content-Length: %d\r\nX-Timestamp: %d.%06d\r\n\r\n", + img_buffer_size, (int)timestamp->tv_sec, (int)timestamp->tv_usec) ) + || + (fwrite(img_buffer, img_buffer_size, 1, stdout) != 1) + ) { if ( !zm_terminate ) { // If the pipe was closed, we will get signalled SIGPIPE to exit, which will set zm_terminate Warning("Unable to send stream frame: %s", strerror(errno));