Commit d4e9d57d authored by Laurent Aimar's avatar Laurent Aimar

Changed "teletext-es" to be a list of teletext spu id.

This change is needed to fix teletext support.
parent 1a082467
......@@ -298,7 +298,8 @@ struct input_thread_t
* - "can-rate"
* - "can-rewind"
* - "can-record" (if a stream can be recorded while playing)
* - "teletext-es" to get the index of spu track that is teletext -1 if no teletext)
* - "teletext-es" (list of id from the spu tracks (spu-es) that are teletext, the
* variable value being the one currently selected, -1 if no teletext)
* - "signal-quality"
* - "signal-strength"
* - "cache" (level of data cached [0 .. 1])
......
......@@ -205,7 +205,10 @@ static inline int EsOutGetClosedCaptionsChannel( vlc_fourcc_t fcc )
}
return -1;
}
static inline bool EsFmtIsTeletext( const es_format_t *p_fmt )
{
return p_fmt->i_cat == SPU_ES && p_fmt->i_codec == VLC_FOURCC( 't', 'e', 'l', 'x' );
}
/*****************************************************************************
* input_EsOutNew:
......@@ -853,19 +856,18 @@ static mtime_t EsOutGetBuffering( es_out_t *out )
return i_delay;
}
static void EsOutESVarUpdateGeneric( es_out_t *out, int i_id, es_format_t *fmt, const char *psz_language,
static void EsOutESVarUpdateGeneric( es_out_t *out, int i_id,
const es_format_t *fmt, const char *psz_language,
bool b_delete )
{
es_out_sys_t *p_sys = out->p_sys;
input_thread_t *p_input = p_sys->p_input;
const bool b_teletext = fmt->i_cat == SPU_ES && fmt->i_codec == VLC_FOURCC( 't', 'e', 'l', 'x' );
vlc_value_t val, text;
if( b_delete )
{
/* TODO it should probably be a list */
if( b_teletext )
input_SendEventTeletext( p_sys->p_input, -1 );
if( EsFmtIsTeletext( fmt ) )
input_SendEventTeletextDel( p_sys->p_input, i_id );
input_SendEventEsDel( p_input, fmt->i_cat, i_id );
return;
......@@ -918,15 +920,10 @@ static void EsOutESVarUpdateGeneric( es_out_t *out, int i_id, es_format_t *fmt,
}
input_SendEventEsAdd( p_input, fmt->i_cat, i_id, text.psz_string );
if( EsFmtIsTeletext( fmt ) )
input_SendEventTeletextAdd( p_sys->p_input, i_id, NULL );
free( text.psz_string );
if( b_teletext )
{
/* TODO it should probably be a list */
if( var_GetInteger( p_sys->p_input, "teletext-es" ) < 0 )
input_SendEventTeletext( p_sys->p_input, i_id );
}
}
static void EsOutESVarUpdate( es_out_t *out, es_out_id_t *es,
......@@ -979,6 +976,7 @@ static void EsOutProgramSelect( es_out_t *out, es_out_pgrm_t *p_pgrm )
input_SendEventEsDel( p_input, AUDIO_ES, -1 );
input_SendEventEsDel( p_input, VIDEO_ES, -1 );
input_SendEventEsDel( p_input, SPU_ES, -1 );
input_SendEventTeletextDel( p_input, -1 );
/* TODO event */
var_SetInteger( p_input, "teletext-es", -1 );
......@@ -1577,6 +1575,8 @@ static void EsSelect( es_out_t *out, es_out_id_t *es )
/* Mark it as selected */
input_SendEventEsSelect( p_input, es->fmt.i_cat, es->i_id );
if( EsFmtIsTeletext( &es->fmt ) )
input_SendEventTeletextSelect( p_input, es->i_id );
}
static void EsUnselect( es_out_t *out, es_out_id_t *es, bool b_update )
......@@ -1629,6 +1629,8 @@ static void EsUnselect( es_out_t *out, es_out_id_t *es, bool b_update )
/* Mark it as unselected */
input_SendEventEsSelect( p_input, es->fmt.i_cat, -1 );
if( EsFmtIsTeletext( &es->fmt ) )
input_SendEventTeletextSelect( p_input, -1 );
}
/**
......
......@@ -245,17 +245,17 @@ static const char *GetEsVarName( int i_cat )
return "spu-es";
}
}
void input_SendEventEsDel( input_thread_t *p_input, int i_cat, int i_id )
{
if( i_cat != UNKNOWN_ES )
VarListDel( p_input, GetEsVarName( i_cat ), INPUT_EVENT_ES, i_id );
}
void input_SendEventEsAdd( input_thread_t *p_input, int i_cat, int i_id, const char *psz_text )
{
if( i_cat != UNKNOWN_ES )
VarListAdd( p_input, GetEsVarName( i_cat ), INPUT_EVENT_ES,
i_id, psz_text );
}
void input_SendEventEsDel( input_thread_t *p_input, int i_cat, int i_id )
{
if( i_cat != UNKNOWN_ES )
VarListDel( p_input, GetEsVarName( i_cat ), INPUT_EVENT_ES, i_id );
}
/* i_id == -1 will unselect */
void input_SendEventEsSelect( input_thread_t *p_input, int i_cat, int i_id )
{
......@@ -263,15 +263,18 @@ void input_SendEventEsSelect( input_thread_t *p_input, int i_cat, int i_id )
VarListSelect( p_input, GetEsVarName( i_cat ), INPUT_EVENT_ES, i_id );
}
void input_SendEventTeletext( input_thread_t *p_input, int i_id )
void input_SendEventTeletextAdd( input_thread_t *p_input,
int i_teletext, const char *psz_text )
{
vlc_value_t val;
val.i_int = i_id;
var_Change( p_input, "teletext-es", VLC_VAR_SETVALUE, &val, NULL );
Trigger( p_input, INPUT_EVENT_TELETEXT );
VarListAdd( p_input, "teletext-es", INPUT_EVENT_TELETEXT, i_teletext, psz_text );
}
void input_SendEventTeletextDel( input_thread_t *p_input, int i_teletext )
{
VarListDel( p_input, "teletext-es", INPUT_EVENT_TELETEXT, i_teletext );
}
void input_SendEventTeletextSelect( input_thread_t *p_input, int i_teletext )
{
VarListSelect( p_input, "teletext-es", INPUT_EVENT_TELETEXT, i_teletext );
}
void input_SendEventVout( input_thread_t *p_input )
......
......@@ -63,7 +63,10 @@ void input_SendEventEsDel( input_thread_t *p_input, int i_cat, int i_id );
void input_SendEventEsAdd( input_thread_t *p_input, int i_cat, int i_id, const char *psz_text );
void input_SendEventEsSelect( input_thread_t *p_input, int i_cat, int i_id ); /* i_id == -1 will unselect */
void input_SendEventTeletext( input_thread_t *p_input, int i_id );
void input_SendEventTeletextAdd( input_thread_t *p_input,
int i_teletext, const char *psz_text );
void input_SendEventTeletextDel( input_thread_t *p_input, int i_teletext );
void input_SendEventTeletextSelect( input_thread_t *p_input, int i_teletext );
/*****************************************************************************
* Event for decoder.c
......
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