[vlc-commits] avformat: always insert a track in the table (fixes #11931)

Rémi Denis-Courmont git at videolan.org
Fri Oct 3 19:05:50 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Oct  2 21:34:46 2014 +0300| [6e800f09423c6e9dc28d2fef9296ae4b25bddb26] | committer: Rémi Denis-Courmont

avformat: always insert a track in the table (fixes #11931)

This seems necessary to maintain the mapping of libav's packet stream
index to the VLC plugin's tracks table offset.

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

 modules/demux/avformat/demux.c |   25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index da7d4c1..826b78e 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -328,26 +328,24 @@ int OpenDemux( vlc_object_t *p_this )
     {
         AVStream *s = p_sys->ic->streams[i];
         AVCodecContext *cc = s->codec;
-
-        es_out_id_t  *es;
+        es_out_id_t  *es = NULL;
         es_format_t  fmt;
         vlc_fourcc_t fcc;
         const char *psz_type = "unknown";
 
-        if( cc->codec_id == AV_CODEC_ID_NONE )
-        {
-            p_sys->i_tk++;
-            continue;
-        }
-
         if( !GetVlcFourcc( cc->codec_id, NULL, &fcc, NULL ) )
             fcc = VLC_FOURCC( 'u', 'n', 'd', 'f' );
 
 #if LIBAVFORMAT_VERSION_INT >= ((54<<16)+(2<<8)+0)
         /* Do not use the cover art as a stream */
         if( s->disposition == AV_DISPOSITION_ATTACHED_PIC )
-            continue;
+            fcc = 0;
 #endif
+        if( fcc == 0 )
+        {
+            TAB_APPEND( p_sys->i_tk, p_sys->tk, NULL );
+            continue;
+        }
 
         switch( cc->codec_type )
         {
@@ -595,8 +593,8 @@ int OpenDemux( vlc_object_t *p_this )
 
             msg_Dbg( p_demux, "adding es: %s codec = %4.4s (%d)",
                      psz_type, (char*)&fcc, cc->codec_id  );
-            TAB_APPEND( p_sys->i_tk, p_sys->tk, es );
         }
+        TAB_APPEND( p_sys->i_tk, p_sys->tk, es );
     }
     p_sys->tk_pcr = xcalloc( p_sys->i_tk, sizeof(*p_sys->tk_pcr) );
 
@@ -647,7 +645,7 @@ void CloseDemux( vlc_object_t *p_this )
     demux_t     *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys = p_demux->p_sys;
 
-    FREENULL( p_sys->tk );
+    free( p_sys->tk );
     free( p_sys->tk_pcr );
 
     if( p_sys->ic )
@@ -792,7 +790,10 @@ static int Demux( demux_t *p_demux )
         UpdateSeekPoint( p_demux, p_sys->i_pcr );
     }
 
-    es_out_Send( p_demux->out, p_sys->tk[pkt.stream_index], p_frame );
+    if( p_sys->tk[pkt.stream_index] != NULL )
+        es_out_Send( p_demux->out, p_sys->tk[pkt.stream_index], p_frame );
+    else
+        block_Release( p_frame );
 
     av_free_packet( &pkt );
     return 1;



More information about the vlc-commits mailing list