diff --git a/src/zm_event.cpp b/src/zm_event.cpp index 7be82a716..7a81bd120 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -331,7 +331,7 @@ void Event::AddFrame( Image *image, struct timeval timestamp, int score, Image * } else { - Info(( "Can't glob '%s': %s", diag_glob, glob_status )); + Info(( "Can't glob '%s': %d", diag_glob, glob_status )); } } else @@ -404,6 +404,7 @@ void Event::StreamEvent( int event_id, int rate, int scale ) } fprintf( stdout, "Content-Type: multipart/x-mixed-replace;boundary=ZoneMinderFrame\r\n\r\n" ); + fprintf( stdout, "--ZoneMinderFrame\r\n" ); //int n_frames = mysql_num_rows( result ); //Info(( "Got %d frames, at rate %d, scale %d", n_frames, rate, scale )); @@ -441,6 +442,8 @@ void Event::StreamEvent( int event_id, int rate, int scale ) static char filepath[PATH_MAX]; sprintf( filepath, "%s/%03d-capture.jpg", eventpath, atoi(dbrow[0]) ); + fprintf( stdout, "Content-Length: %d\r\n", n_bytes ); + fprintf( stdout, "Content-Type: image/jpeg\r\n\r\n" ); if ( scale == 100 ) { if ( (fdj = fopen( filepath, "r" )) ) @@ -466,9 +469,7 @@ void Event::StreamEvent( int event_id, int rate, int scale ) write( fileno(stdout), 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" ); + fprintf( stdout, "\r\n\r\n--ZoneMinderFrame\r\n" ); fflush( stdout ); } if ( mysql_errno( &dbconn ) ) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index bb536a6e5..c4bd7c702 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -1078,6 +1078,7 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose ) void Monitor::StreamImages( unsigned long idle, unsigned long refresh, time_t ttl, int scale ) { fprintf( stdout, "Content-Type: multipart/x-mixed-replace;boundary=ZoneMinderFrame\r\n\r\n" ); + fprintf( stdout, "--ZoneMinderFrame\r\n" ); int last_read_index = image_buffer_count; static JOCTET img_buffer[ZM_MAX_IMAGE_SIZE]; @@ -1125,10 +1126,10 @@ void Monitor::StreamImages( unsigned long idle, unsigned long refresh, time_t tt scaled_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" ); + 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" ); } usleep( refresh*1000 ); for ( int i = 0; shared_data->state == IDLE && i < loop_count; i++ )