From f489a65bd2aee45d9d4d280636d2de247d658c1c Mon Sep 17 00:00:00 2001 From: ddennedy Date: Wed, 9 Jul 2008 12:43:35 +0000 Subject: [PATCH] producer_avformat.c: bugfix regression playing audio-only files. git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1156 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/modules/avformat/producer_avformat.c | 24 +++++++++++++++++++----- 1 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index 5d4a55f..8d4c591 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -680,20 +680,22 @@ static void producer_set_up_video( mlt_producer this, mlt_frame frame ) // Fetch the video_context AVFormatContext *context = mlt_properties_get_data( properties, "video_context", NULL ); - if ( !context ) + + // Get the video_index + int index = mlt_properties_get_int( properties, "video_index" ); + + // Reopen the file if necessary + if ( !context && index != -1 ) { - // Reopen the file mlt_events_block( properties, this ); producer_open( this, mlt_service_profile( MLT_PRODUCER_SERVICE(this) ), mlt_properties_get( properties, "resource" ) ); context = mlt_properties_get_data( properties, "video_context", NULL ); + index = mlt_properties_get_int( properties, "video_index" ); mlt_properties_set_data( properties, "dummy_context", NULL, 0, NULL, NULL ); mlt_events_unblock( properties, this ); } - // Get the video_index - int index = mlt_properties_get_int( properties, "video_index" ); - // Get the frame properties mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame ); @@ -1042,6 +1044,18 @@ static void producer_set_up_audio( mlt_producer this, mlt_frame frame ) // Get the audio_index int index = mlt_properties_get_int( properties, "audio_index" ); + // Reopen the file if necessary + if ( !context && index != -1 ) + { + mlt_events_block( properties, this ); + producer_open( this, mlt_service_profile( MLT_PRODUCER_SERVICE(this) ), + mlt_properties_get( properties, "resource" ) ); + context = mlt_properties_get_data( properties, "audio_context", NULL ); + index = mlt_properties_get_int( properties, "audio_index" ); + mlt_properties_set_data( properties, "dummy_context", NULL, 0, NULL, NULL ); + mlt_events_unblock( properties, this ); + } + // Deal with audio context if ( context != NULL && index != -1 ) { -- 1.7.4.4