]> git.sesse.net Git - mlt/commitdiff
Use new avio functions in avformat module.
authorDan Dennedy <dan@dennedy.org>
Fri, 22 Apr 2011 20:01:34 +0000 (13:01 -0700)
committerDan Dennedy <dan@dennedy.org>
Fri, 22 Apr 2011 20:01:34 +0000 (13:01 -0700)
src/modules/avformat/consumer_avformat.c
src/modules/avformat/producer_avformat.c

index a348568ea3621cc0f3f8919c7789eb6c9ebbcdea..4f5c5d8747cf70f1af07b8ed98d217888cb0a052 100644 (file)
@@ -1195,7 +1195,11 @@ static void *consumer_thread( void *arg )
                // Open the output file, if needed
                if ( !( fmt->flags & AVFMT_NOFILE ) ) 
                {
-                       if ( url_fopen( &oc->pb, filename, URL_WRONLY ) < 0 ) 
+#if LIBAVFORMAT_VERSION_MAJOR > 52
+                       if ( avio_open( &oc->pb, filename, AVIO_FLAG_WRITE ) < 0 )
+#else
+                       if ( url_fopen( &oc->pb, filename, URL_WRONLY ) < 0 )
+#endif
                        {
                                mlt_log_error( MLT_CONSUMER_SERVICE( consumer ), "Could not open '%s'\n", filename );
                                mlt_properties_set_int( properties, "running", 0 );
@@ -1682,7 +1686,9 @@ on_fatal_error:
 
        // Close the output file
        if ( !( fmt->flags & AVFMT_NOFILE ) )
-#if LIBAVFORMAT_VERSION_INT >= ((52<<16)+(0<<8)+0)
+#if LIBAVFORMAT_VERSION_MAJOR > 52
+               avio_close( oc->pb );
+#elif LIBAVFORMAT_VERSION_INT >= ((52<<16)+(0<<8)+0)
                url_fclose( oc->pb );
 #else
                url_fclose( &oc->pb );
index 97f2df749959a5a135c0e6e5d0ef69836ed7ea3f..5a1f76e7129b4e52dc722b1fa272510036a9ed1d 100644 (file)
@@ -561,7 +561,11 @@ static int producer_open( producer_avformat self, mlt_profile profile, char *fil
        int av = 0;
 
        // Only if there is not a protocol specification that avformat can handle
+#if LIBAVFORMAT_VERSION_MAJOR > 52
+       if ( mrl && !avio_check( file, 0 ) )
+#else
        if ( mrl && !url_exist( file ) )
+#endif
        {
                // 'file' becomes format abbreviation
                mrl[0] = 0;
@@ -678,9 +682,13 @@ static int producer_open( producer_avformat self, mlt_profile profile, char *fil
                        if ( context->pb )
                        {
                                // protocols can indicate if they support seeking
+#if LIBAVFORMAT_VERSION_MAJOR > 52
+                               self->seekable = context->pb->seekable;
+#else
                                URLContext *uc = url_fileno( context->pb );
                                if ( uc )
                                        self->seekable = !uc->is_streamed;
+#endif
                        }
                        if ( self->seekable )
                        {