Added handling for other video formats.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@955 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2004-03-14 22:49:12 +00:00
parent d71bc21694
commit e8ec46c2ad
2 changed files with 46 additions and 3 deletions

View File

@ -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;

View File

@ -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 );