diff --git a/src/zm_event.cpp b/src/zm_event.cpp index 30753bd75..4f5be7784 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -448,7 +448,6 @@ void Event::StreamEvent( int event_id, int scale, int rate, int maxfps ) } fprintf( stdout, "Content-Type: multipart/x-mixed-replace;boundary=ZoneMinderFrame\r\n\r\n" ); - fprintf( stdout, "--ZoneMinderFrame\r\n" ); FILE *fdj = NULL; int n_bytes = 0; @@ -500,10 +499,11 @@ void Event::StreamEvent( int event_id, int scale, int rate, int maxfps ) image.EncodeJpeg( buffer, &n_bytes ); } + fprintf( stdout, "--ZoneMinderFrame\r\n" ); fprintf( stdout, "Content-Length: %d\r\n", n_bytes ); fprintf( stdout, "Content-Type: image/jpeg\r\n\r\n" ); - write( fileno(stdout), buffer, n_bytes ); - fprintf( stdout, "\r\n\r\n--ZoneMinderFrame\r\n" ); + fwrite( buffer, n_bytes, 1, stdout ); + fprintf( stdout, "\r\n\r\n" ); fflush( stdout ); last_delta = this_delta; db_written = true; diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index f1d288c77..398a4b6bd 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -1265,7 +1265,6 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose ) void Monitor::StreamImages( int scale, int maxfps, time_t ttl ) { fprintf( stdout, "Content-Type: multipart/x-mixed-replace;boundary=ZoneMinderFrame\r\n\r\n" ); - fprintf( stdout, "--ZoneMinderFrame\r\n" ); int fps = int(GetFPS()); if ( !fps ) @@ -1328,10 +1327,11 @@ void Monitor::StreamImages( int scale, int maxfps, time_t ttl ) } snap_image->EncodeJpeg( img_buffer, &img_buffer_size ); + fprintf( stdout, "--ZoneMinderFrame\r\n" ); fprintf( stdout, "Content-Length: %d\r\n", img_buffer_size ); fprintf( stdout, "Content-Type: image/jpeg\r\n\r\n" ); fwrite( img_buffer, img_buffer_size, 1, stdout ); - fprintf( stdout, "\r\n\r\n--ZoneMinderFrame\r\n" ); + fprintf( stdout, "\r\n\r\n" ); if ( ttl ) {