[vlc-commits] avformat demux: use new input APIs

Rafaël Carré git at videolan.org
Sun Jan 29 07:06:18 CET 2012


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Sun Jan 29 00:44:11 2012 -0500| [49944dcb5ac7ecc39da86bdb300bd7be8c9d2e47] | committer: Rafaël Carré

avformat demux: use new input APIs

print avformat_find_stream_info errors

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=49944dcb5ac7ecc39da86bdb300bd7be8c9d2e47
---

 modules/demux/avformat/demux.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 28920e2..f427744 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -114,6 +114,7 @@ int OpenDemux( vlc_object_t *p_this )
     int64_t       i_start_time = -1;
     bool          b_can_seek;
     char         *psz_url;
+    int           error;
 
     if( p_demux->psz_file )
         psz_url = strdup( p_demux->psz_file );
@@ -242,9 +243,15 @@ int OpenDemux( vlc_object_t *p_this )
     psz_url = NULL;
 
     vlc_avcodec_lock(); /* avformat calls avcodec behind our back!!! */
-    if( av_find_stream_info( p_sys->ic ) < 0 )
+#if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(17<<8)+0)
+    error = avformat_find_stream_info( p_sys->ic, NULL /* options */ );
+#else
+    error = av_find_stream_info( p_sys->ic );
+#endif
+    if( error < 0 )
     {
-        msg_Warn( p_demux, "av_find_stream_info failed" );
+        errno = AVUNERROR(error);
+        msg_Warn( p_demux, "Could not find stream info: %m" );
     }
     vlc_avcodec_unlock();
 
@@ -521,7 +528,12 @@ void CloseDemux( vlc_object_t *p_this )
     FREENULL( p_sys->tk );
     free( p_sys->tk_pcr );
 
-    if( p_sys->ic ) av_close_input_stream( p_sys->ic );
+    if( p_sys->ic )
+#if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(17<<8)+0)
+        avformat_close_input( &p_sys->ic );
+#else
+        av_close_input_stream( p_sys->ic );
+#endif
 
     for( int i = 0; i < p_sys->i_attachments; i++ )
         free( p_sys->attachments[i] );



More information about the vlc-commits mailing list