[vlc-devel] commit: Changed "teletext-es" to be a list of teletext spu id. ( Laurent Aimar )
git version control
git at videolan.org
Fri Feb 13 23:07:51 CET 2009
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri Feb 13 20:41:51 2009 +0100| [d4e9d57d43bf2d369b7cc75178f84ecdb9b5499e] | committer: Laurent Aimar
Changed "teletext-es" to be a list of teletext spu id.
This change is needed to fix teletext support.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d4e9d57d43bf2d369b7cc75178f84ecdb9b5499e
---
include/vlc_input.h | 3 ++-
src/input/es_out.c | 28 +++++++++++++++-------------
src/input/event.c | 29 ++++++++++++++++-------------
src/input/event.h | 5 ++++-
4 files changed, 37 insertions(+), 28 deletions(-)
diff --git a/include/vlc_input.h b/include/vlc_input.h
index 55173d3..650bb7b 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -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])
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 133f294..479f34e 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -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 );
}
/**
diff --git a/src/input/event.c b/src/input/event.c
index 0718dac..9224478 100644
--- a/src/input/event.c
+++ b/src/input/event.c
@@ -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 )
diff --git a/src/input/event.h b/src/input/event.h
index 5192390..2b68ff1 100644
--- a/src/input/event.h
+++ b/src/input/event.h
@@ -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
More information about the vlc-devel
mailing list