diff --git a/src/zm_event.cpp b/src/zm_event.cpp index 7a81bd120..534614d53 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -528,7 +528,7 @@ void Event::StreamMpeg( int event_id, const char *format, int bitrate, int maxfp frame_mod *= 2; } - Info(( "Duration:%d, Frames:%d, BFPS:%d, EFPS:%d, FM:%d", atoi(dbrow[2]), atoi(dbrow[3]), base_fps, effective_fps, frame_mod )); + //Info(( "Duration:%d, Frames:%d, BFPS:%d, EFPS:%d, FM:%d", atoi(dbrow[2]), atoi(dbrow[3]), base_fps, effective_fps, frame_mod )); mysql_free_result( result ); @@ -546,7 +546,28 @@ void Event::StreamMpeg( int event_id, const char *format, int bitrate, int maxfp exit( mysql_errno( &dbconn ) ); } - fprintf( stdout, "Content-type: video/x-ms-asf\r\n\r\n"); + const char *mime_type = "video/mpeg"; + if ( !strcmp( format, "asf" ) ) + { + mime_type = "video/x-ms-asf"; + } + else if ( !strcmp( format, "mpeg" ) || !strcmp( format, "mpg" ) ) + { + mime_type = "video/x-mpeg"; + } + else if ( !strcmp( format, "mpv2" ) || !strcmp( format, "mpev2" ) ) + { + mime_type = "video/x-mpeg2"; + } + else if ( !strcmp( format, "avi" ) ) + { + mime_type = "video/x-msvideo"; + } + else if ( !strcmp( format, "mov" ) ) + { + mime_type = "video/x-quicktime"; + } + fprintf( stdout, "Content-type: %s\r\n\r\n", mime_type ); VideoStream *vid_stream = 0; int id = 1, last_id = 0; diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index c4bd7c702..fee405cc2 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -1153,7 +1153,29 @@ void Monitor::StreamImages( unsigned long idle, unsigned long refresh, time_t tt void Monitor::StreamMpeg( const char *format, int bitrate, int maxfps, int scale, int buffer ) { - fprintf( stdout, "Content-type: video/x-ms-asf\r\n\r\n"); + // Warning, most of these won't work for real-time streaming + const char *mime_type = "video/mpeg"; + if ( !strcmp( format, "asf" ) ) + { + mime_type = "video/x-ms-asf"; + } + else if ( !strcmp( format, "mpeg" ) || !strcmp( format, "mpg" ) ) + { + mime_type = "video/x-mpeg"; + } + else if ( !strcmp( format, "mpv2" ) || !strcmp( format, "mpev2" ) ) + { + mime_type = "video/x-mpeg2"; + } + else if ( !strcmp( format, "avi" ) ) + { + mime_type = "video/x-msvideo"; + } + else if ( !strcmp( format, "mov" ) ) + { + mime_type = "video/x-quicktime"; + } + fprintf( stdout, "Content-type: %s\r\n\r\n", mime_type ); bool timed_frames = (bool)config.Item( ZM_WEB_VIDEO_TIMED_FRAMES );