[vlc-commits] demux: ogg: use stable ids

Thomas Guillem git at videolan.org
Fri Feb 28 20:46:28 CET 2020


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Feb 18 11:26:27 2020 +0100| [bdd73ed3d68b5e7e9c8f0d36b2d78987943e5514] | committer: Thomas Guillem

demux: ogg: use stable ids

Use the track addition order as a track id when tracks are added from the open
callback. Tracks added midstream will keep using the automatic id.

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

 modules/demux/ogg.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index 397906034a..d50141e56d 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -135,7 +135,7 @@ static inline bool Ogg_HasQueuedBlocks( const logical_stream_t *p_stream )
     return ( p_stream->queue.p_blocks != NULL );
 }
 
-static void Ogg_CreateES( demux_t *p_demux );
+static void Ogg_CreateES( demux_t *p_demux, bool );
 static int Ogg_BeginningOfStream( demux_t *p_demux );
 static int Ogg_FindLogicalStreams( demux_t *p_demux );
 static void Ogg_EndOfStream( demux_t *p_demux );
@@ -252,7 +252,7 @@ static int Open( vlc_object_t * p_this )
     while ( !p_sys->b_preparsing_done && p_demux->pf_demux( p_demux ) > 0 )
     {}
     if ( p_sys->b_preparsing_done && p_demux->b_preparsing )
-        Ogg_CreateES( p_demux );
+        Ogg_CreateES( p_demux, true );
 
     return VLC_SUCCESS;
 }
@@ -435,7 +435,7 @@ static int Demux( demux_t * p_demux )
     }
 
     if ( p_sys->b_preparsing_done && !p_sys->b_es_created )
-        Ogg_CreateES( p_demux );
+        Ogg_CreateES( p_demux, false );
 
     /*
      * The first data page of a physical stream is stored in the relevant logical stream
@@ -2108,7 +2108,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
 /****************************************************************************
  * Ogg_CreateES: Creates all Elementary streams once headers are parsed
  ****************************************************************************/
-static void Ogg_CreateES( demux_t *p_demux )
+static void Ogg_CreateES( demux_t *p_demux, bool stable_id )
 {
     demux_sys_t *p_ogg = p_demux->p_sys;
     logical_stream_t *p_old_stream = p_ogg->p_old_stream;
@@ -2152,6 +2152,13 @@ static void Ogg_CreateES( demux_t *p_demux )
             }
             else
             {
+                if( stable_id )
+                {
+                    /* IDs are stable when ES tracks are created from the Open
+                     * function. Don't specify ids when tracks are added
+                     * midstream */
+                    p_stream->fmt.i_id = i_stream;
+                }
                 p_stream->p_es = es_out_Add( p_demux->out, &p_stream->fmt );
             }
         }



More information about the vlc-commits mailing list