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

Rafaël Carré git at videolan.org
Sun Mar 4 22:42:02 CET 2012


vlc/vlc-2.0 | branch: master | Rafaël Carré <funman at videolan.org> | Sat Mar  3 00:03:04 2012 +0900| [f084d987fe8eadcf38440c84c2319290b94b6a46] | committer: Rafaël Carré

avformat demux: use new input APIs

print avformat_find_stream_info errors
(cherry picked from commit 49944dcb5ac7ecc39da86bdb300bd7be8c9d2e47)

Signed-off-by: KO Myung-Hun <komh at chollian.net>
Signed-off-by: Rafaël Carré <funman at videolan.org>

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

 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 6c492c8..dff8a08 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 );
@@ -250,9 +251,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();
 
@@ -529,7 +536,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