]> git.sesse.net Git - mlt/commitdiff
producer_avformat.c: bugfix regression playing audio-only files.
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 9 Jul 2008 12:43:35 +0000 (12:43 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 9 Jul 2008 12:43:35 +0000 (12:43 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1156 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/avformat/producer_avformat.c

index 5d4a55fac8f565ed8bdd04eff3badf87a797e0f9..8d4c591fd8fa3fd56ae345ab832b93b7c56800c2 100644 (file)
@@ -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 )
        {