diff --git a/modules/demux/ts.c b/modules/demux/ts.c index efb0fd86e14f23481d32f49b853df240cda164e4..d474680511b24fe4972cc23a700077d4b13972bd 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 {