[vlc-commits] demux: ts: delete/and recreate es on format change

Francois Cartegnie git at videolan.org
Tue Apr 7 23:33:16 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Apr  7 23:31:42 2015 +0200| [50accb82e6e8b10a3f3493091dfcd832405ba234] | committer: Francois Cartegnie

demux: ts: delete/and recreate es on format change

refs #14257

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

 modules/demux/ts.c |   31 +++++--------------------------
 1 file changed, 5 insertions(+), 26 deletions(-)

diff --git a/modules/demux/ts.c b/modules/demux/ts.c
index efb0fd8..d474680 100644
--- a/modules/demux/ts.c
+++ b/modules/demux/ts.c
@@ -5446,34 +5446,13 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt )
                                  p_pes->es.fmt.psz_language ) ) ) )
                 {
                     /* Differs, swap then */
-                    ts_pes_t *e = pespid->u.p_pes;
+                    ts_pes_t *old = pespid->u.p_pes;
                     pespid->u.p_pes = p_pes;
-                    p_pes = e;
-
-                    /* p_pes still tmp, but now contains old config */
-                    pespid->u.p_pes->es.id = p_pes->es.id;
-                    if( pespid->u.p_pes->es.id )
-                    {
-                        p_pes->es.id = NULL;
-                        es_out_Control( p_demux->out, ES_OUT_SET_ES_FMT,
-                                        pespid->u.p_pes->es.id, &pespid->u.p_pes->es.fmt );
-                    }
-
-                    for( int i=0; i<pespid->u.p_pes->extra_es.i_size &&
-                                  i<p_pes->extra_es.i_size; i++ )
-                    {
-                        pespid->u.p_pes->extra_es.p_elems[i]->id = p_pes->extra_es.p_elems[i]->id;
-                        if( pespid->u.p_pes->extra_es.p_elems[i]->id )
-                        {
-                            es_out_Control( p_demux->out, ES_OUT_SET_ES_FMT,
-                                            pespid->u.p_pes->extra_es.p_elems[i]->id,
-                                            &pespid->u.p_pes->extra_es.p_elems[i]->fmt );
-                            p_pes->extra_es.p_elems[i]->id = NULL;
-                        }
-                    }
+                    AddAndCreateES( p_demux, pespid, false );
+                    ts_pes_Del( p_demux, old );
                 }
-
-                ts_pes_Del( p_demux, p_pes ); // delete temp
+                else
+                    ts_pes_Del( p_demux, p_pes ); // delete temp, stay with current es/es_id
             }
             else
             {



More information about the vlc-commits mailing list