X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Favformat%2Fproducer_avformat.c;h=ea262d8fbd60a9377ae26ca4ff5a60cde39f1b6e;hb=b4db352cab396eb5179e2deaf58bb05dcdfb0c69;hp=3889e3e2d473dd8eb26eefdbc651f1fa2f6e07fd;hpb=b2b147cc8b58c7db9dac27d4a3001afaff4f4fc4;p=melted diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index 3889e3e..ea262d8 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -169,6 +169,9 @@ static int producer_open( mlt_producer this, char *file ) AVFormatParameters *params = NULL; char *standard = NULL; char *mrl = strchr( file, ':' ); + + // AV option (0 = both, 1 = video, 2 = audio) + int av = 0; // Only if there is not a protocol specification that avformat can handle if ( mrl && !url_exist( file ) ) @@ -228,6 +231,8 @@ static int producer_open( mlt_producer this, char *file ) standard = strdup( value ); params->standard = standard; } + else if ( !strcmp( name, "av" ) ) + av = atoi( value ); } free( name ); mrl = strchr( mrl, '&' ); @@ -271,14 +276,15 @@ static int producer_open( mlt_producer this, char *file ) mlt_properties_set_double( properties, "start_time", context->start_time ); // Check if we're seekable (something funny about mpeg here :-/) - mlt_properties_set_int( properties, "seekable", av_seek_frame( context, -1, mlt_properties_get_double( properties, "start_time" ) ) >= 0 ); + if ( strcmp( file, "pipe:" ) ) + mlt_properties_set_int( properties, "seekable", av_seek_frame( context, -1, mlt_properties_get_double( properties, "start_time" ) ) >= 0 ); // Store selected audio and video indexes on properties mlt_properties_set_int( properties, "audio_index", audio_index ); mlt_properties_set_int( properties, "video_index", video_index ); // We're going to cheat here - for a/v files, we will have two contexts (reasoning will be clear later) - if ( audio_index != -1 && video_index != -1 ) + if ( av == 0 && strcmp( file, "pipe:" ) && audio_index != -1 && video_index != -1 ) { // We'll use the open one as our video_context mlt_properties_set_data( properties, "video_context", context, 0, producer_file_close, NULL ); @@ -290,7 +296,7 @@ static int producer_open( mlt_producer this, char *file ) // Audio context mlt_properties_set_data( properties, "audio_context", context, 0, producer_file_close, NULL ); } - else if ( video_index != -1 ) + else if ( av != 2 && video_index != -1 ) { // We only have a video context mlt_properties_set_data( properties, "video_context", context, 0, producer_file_close, NULL ); @@ -418,7 +424,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form // Fast forward - seeking is inefficient for small distances - just ignore following frames ignore = position - expected; } - else if ( position < expected || position - expected >= 12 ) + else if ( codec_context->gop_size == 0 || ( position < expected || position - expected >= 12 ) ) { // Set to the real timecode av_seek_frame( context, -1, mlt_properties_get_double( properties, "start_time" ) + real_timecode * 1000000.0 ); @@ -431,7 +437,8 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form // Duplicate the last image if necessary if ( mlt_properties_get_data( properties, "current_image", NULL ) != NULL && - ( paused || mlt_properties_get_double( properties, "current_time" ) >= real_timecode ) ) + ( paused || mlt_properties_get_double( properties, "current_time" ) >= real_timecode ) && + strcmp( mlt_properties_get( properties, "resource" ), "pipe:" ) ) { // Get current image and size int size = 0;