Commit 964b5422 authored by François Cartegnie's avatar François Cartegnie 🤞

demux: ps: split seen / configured states

b_seen was misused for both stream presence
and after configuration
parent 2e485524
......@@ -534,7 +534,7 @@ static void Close( vlc_object_t *p_this )
for( int i = 0; i < PS_TK_COUNT; i++ )
{
ps_track_t *tk = &p_sys->tk[i];
if( tk->b_seen )
if( tk->b_configured )
{
es_format_Clean( &tk->fmt );
if( tk->es ) es_out_Del( p_demux->out, tk->es );
......@@ -942,12 +942,12 @@ static int Demux( demux_t *p_demux )
for( int i = 0; i < PS_TK_COUNT; i++ )
{
ps_track_t *tk = &p_sys->tk[i];
if( tk->b_seen )
if( tk->b_configured )
{
es_format_Clean( &tk->fmt );
if( tk->es ) es_out_Del( p_demux->out, tk->es );
}
tk->b_seen = false;
tk->b_configured = false;
}
uint32_t i_width, i_height;
......@@ -1316,7 +1316,7 @@ static void ESSubtitleUpdate( demux_t *p_demux )
for( i_spu = 0; i_spu <= 0x1F; i_spu++ )
{
ps_track_t *tk = &p_sys->tk[PS_ID_TO_TK(0xbd20 + i_spu)];
if( tk->b_seen )
if( tk->b_configured )
{
es_out_Control( p_demux->out, ES_OUT_SET_ES_STATE, tk->es,
(bool)false );
......@@ -1382,11 +1382,11 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *p, int len )
{
ps_track_t *tk = &p_sys->tk[PS_ID_TO_TK(i_id)];
if( !tk->b_seen )
if( !tk->b_configured )
{
ESNew( p_demux, i_id );
}
if( tk->b_seen && tk->es &&
if( tk->b_configured && tk->es &&
!ps_pkt_parse_pes( VLC_OBJECT(p_demux), p_pkt, tk->i_skip ) )
{
es_out_Send( p_demux->out, tk->es, p_pkt );
......@@ -1436,7 +1436,7 @@ static void ESNew( demux_t *p_demux, int i_id )
ps_track_t *tk = &p_sys->tk[PS_ID_TO_TK(i_id)];
bool b_select = false;
if( tk->b_seen ) return;
if( tk->b_configured ) return;
if( ps_track_fill( tk, 0, i_id, NULL ) )
{
......@@ -1518,7 +1518,7 @@ static void ESNew( demux_t *p_demux, int i_id )
{
es_out_Control( p_demux->out, ES_OUT_SET_ES, tk->es );
}
tk->b_seen = true;
tk->b_configured = true;
if( tk->fmt.i_cat == VIDEO_ES ) ButtonUpdate( p_demux, false );
}
......
......@@ -257,7 +257,7 @@ static void Close( vlc_object_t *p_this )
for( int i = 0; i < PS_TK_COUNT; i++ )
{
ps_track_t *tk = &p_sys->tk[i];
if( tk->b_seen )
if( tk->b_configured )
{
es_format_Clean( &tk->fmt );
if( tk->es ) es_out_Del( p_demux->out, tk->es );
......@@ -609,11 +609,11 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *p, int len )
{
ps_track_t *tk = &p_sys->tk[PS_ID_TO_TK(i_id)];
if( !tk->b_seen )
if( !tk->b_configured )
{
ESNew( p_demux, i_id, 0 );
}
if( tk->b_seen && tk->es &&
if( tk->b_configured && tk->es &&
!ps_pkt_parse_pes( VLC_OBJECT(p_demux), p_pkt, tk->i_skip ) )
{
es_out_Send( p_demux->out, tk->es, p_pkt );
......@@ -647,7 +647,7 @@ static void ESNew( demux_t *p_demux, int i_id, int i_lang )
ps_track_t *tk = &p_sys->tk[PS_ID_TO_TK(i_id)];
char psz_language[3];
if( tk->b_seen ) return;
if( tk->b_configured ) return;
if( ps_track_fill( tk, 0, i_id, NULL ) )
{
......@@ -704,7 +704,7 @@ static void ESNew( demux_t *p_demux, int i_id, int i_lang )
}
tk->es = es_out_Add( p_demux->out, &tk->fmt );
tk->b_seen = true;
tk->b_configured = true;
}
/*****************************************************************************
......@@ -841,12 +841,12 @@ static int DvdReadSetArea( demux_t *p_demux, int i_title, int i_chapter,
for( int i = 0; i < PS_TK_COUNT; i++ )
{
ps_track_t *tk = &p_sys->tk[i];
if( tk->b_seen )
if( tk->b_configured )
{
es_format_Clean( &tk->fmt );
if( tk->es ) es_out_Del( p_demux->out, tk->es );
}
tk->b_seen = false;
tk->b_configured = false;
}
if( p_demux->info.i_title != i_title )
......
......@@ -256,7 +256,7 @@ static void Close( vlc_object_t *p_this )
for( i = 0; i < PS_TK_COUNT; i++ )
{
ps_track_t *tk = &p_sys->tk[i];
if( tk->b_seen )
if( tk->b_configured )
{
es_format_Clean( &tk->fmt );
if( tk->es ) es_out_Del( p_demux->out, tk->es );
......@@ -383,7 +383,7 @@ static void NotifyDiscontinuity( ps_track_t *p_tk, es_out_t *out )
for( size_t i = 0; i < PS_TK_COUNT; i++ )
{
ps_track_t *tk = &p_tk[i];
if( tk->b_seen && tk->es &&
if( tk->b_configured && tk->es &&
es_out_Control( out, ES_OUT_GET_ES_STATE, tk->es, &b_selected ) == VLC_SUCCESS
&& b_selected )
{
......@@ -472,6 +472,7 @@ static int Demux( demux_t *p_demux )
if( tk->b_seen && !tk->es && tk->fmt.i_cat != UNKNOWN_ES )
{
tk->es = es_out_Add( p_demux->out, &tk->fmt );
tk->b_configured = true;
}
}
}
......@@ -514,7 +515,7 @@ static int Demux( demux_t *p_demux )
bool b_new = false;
ps_track_t *tk = &p_sys->tk[PS_ID_TO_TK(i_id)];
if( !tk->b_seen )
if( !tk->b_configured )
{
if( !ps_track_fill( tk, &p_sys->psm, i_id, p_pkt ) )
{
......@@ -537,7 +538,7 @@ static int Demux( demux_t *p_demux )
tk->es = es_out_Add( p_demux->out, &tk->fmt );
b_new = true;
tk->b_seen = true;
tk->b_configured = true;
}
else
{
......@@ -569,7 +570,7 @@ static int Demux( demux_t *p_demux )
es_out_Control( p_demux->out, ES_OUT_SET_PCR, VLC_TS_0 + p_sys->i_pack_scr );
}
if( tk->b_seen && tk->es &&
if( tk->b_configured && tk->es &&
!ps_pkt_parse_pes( VLC_OBJECT(p_demux), p_pkt, tk->i_skip ) )
{
if( tk->fmt.i_cat == AUDIO_ES || tk->fmt.i_cat == VIDEO_ES )
......
......@@ -61,7 +61,8 @@ static inline const uint8_t *ps_id_to_lang( const ps_psm_t *, int );
typedef struct
{
bool b_seen;
bool b_configured;
bool b_seen;
int i_skip;
int i_id;
int i_next_block_flags;
......@@ -78,6 +79,7 @@ static inline void ps_track_init( ps_track_t tk[PS_TK_COUNT] )
int i;
for( i = 0; i < PS_TK_COUNT; i++ )
{
tk[i].b_configured = false;
tk[i].b_seen = false;
tk[i].i_skip = 0;
tk[i].i_id = 0;
......@@ -476,10 +478,10 @@ static inline int ps_pkt_parse_system( block_t *p_pkt, ps_psm_t *p_psm,
continue;
int i_tk = PS_ID_TO_TK( i_id );
if( !tk[i_tk].b_seen &&
if( !tk[i_tk].b_configured &&
!ps_track_fill( &tk[i_tk], p_psm, i_id, NULL ) )
{
tk[i_tk].b_seen = true;
tk[i_tk].b_configured = true;
}
}
return VLC_SUCCESS;
......@@ -687,7 +689,7 @@ static inline int ps_psm_fill( ps_psm_t *p_psm, block_t *p_pkt,
{
ps_track_t tk_tmp;
if( !tk[i].b_seen || !tk[i].es ) continue;
if( !tk[i].b_configured || !tk[i].es ) continue;
if( ps_track_fill( &tk_tmp, p_psm, tk[i].i_id, p_pkt ) != VLC_SUCCESS )
continue;
......@@ -701,7 +703,7 @@ static inline int ps_psm_fill( ps_psm_t *p_psm, block_t *p_pkt,
es_out_Del( out, tk[i].es );
es_format_Clean( &tk[i].fmt );
tk_tmp.b_seen = true;
tk_tmp.b_configured = true;
tk[i] = tk_tmp;
tk[i].es = es_out_Add( out, &tk[i].fmt );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment