[vlc-devel] [PATCH 1/3] input: pass full fmt to es add event
Thomas Guillem
thomas at gllm.fr
Thu Aug 16 16:01:24 CEST 2018
---
include/vlc_input.h | 18 +++++++++++++++---
src/input/es_out.c | 2 +-
src/input/event.c | 28 ++++++++++++++++------------
src/input/event.h | 3 ++-
src/input/var.c | 14 +++++++-------
5 files changed, 41 insertions(+), 24 deletions(-)
diff --git a/include/vlc_input.h b/include/vlc_input.h
index 1e47b96772..4a12cbf1ea 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -443,9 +443,21 @@ struct vlc_input_event
VLC_INPUT_ES_DELETED,
VLC_INPUT_ES_SELECTED,
} action;
- enum es_format_category_e cat;
- int id; /**< id == -1 will unselect */
- const char *title;
+ union
+ {
+ struct {
+ const char *title;
+ const es_format_t *fmt;
+ } added;
+ struct {
+ enum es_format_category_e cat;
+ int id;
+ } deleted;
+ struct {
+ enum es_format_category_e cat;
+ int id; /**< id == -1 will unselect */
+ } selected;
+ };
} es;
/* INPUT_EVENT_TELETEXT */
struct {
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 000cad3f97..bd0625239a 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -972,7 +972,7 @@ static void EsOutESVarUpdateGeneric( es_out_t *out, int i_id,
}
}
- input_SendEventEsAdd( p_input, fmt->i_cat, i_id, text.psz_string );
+ input_SendEventEsAdd( p_input, text.psz_string, fmt );
if( EsFmtIsTeletext( fmt ) )
{
char psz_page[3+1];
diff --git a/src/input/event.c b/src/input/event.c
index d4da9ce1ab..38ea5e2f65 100644
--- a/src/input/event.c
+++ b/src/input/event.c
@@ -218,21 +218,21 @@ void input_SendEventProgramScrambled( input_thread_t *p_input, int i_group, bool
});
}
-void input_SendEventEsAdd( input_thread_t *p_input,
- enum es_format_category_e i_cat, int i_id,
- const char *psz_text )
+void input_SendEventEsAdd( input_thread_t *p_input, const char *psz_title,
+ const es_format_t *p_fmt )
{
input_thread_private_t *priv = input_priv(p_input);
- priv->i_last_es_cat = i_cat;
- priv->i_last_es_id = i_id;
+ priv->i_last_es_cat = p_fmt->i_cat;
+ priv->i_last_es_id = p_fmt->i_id;
input_SendEvent( p_input, &(struct vlc_input_event) {
.type = INPUT_EVENT_ES,
.es = {
.action = VLC_INPUT_ES_ADDED,
- .cat = i_cat,
- .id = i_id,
- .title = psz_text
+ .added = {
+ .title = psz_title,
+ .fmt = p_fmt,
+ }
}
});
}
@@ -243,8 +243,10 @@ void input_SendEventEsDel( input_thread_t *p_input,
.type = INPUT_EVENT_ES,
.es = {
.action = VLC_INPUT_ES_DELETED,
- .cat = i_cat,
- .id = i_id,
+ .deleted = {
+ .cat = i_cat,
+ .id = i_id,
+ },
}
});
}
@@ -255,8 +257,10 @@ void input_SendEventEsSelect( input_thread_t *p_input,
.type = INPUT_EVENT_ES,
.es = {
.action = VLC_INPUT_ES_SELECTED,
- .cat = i_cat,
- .id = i_id,
+ .selected = {
+ .cat = i_cat,
+ .id = i_id,
+ }
}
});
}
diff --git a/src/input/event.h b/src/input/event.h
index 4c9792d228..5ede17fd73 100644
--- a/src/input/event.h
+++ b/src/input/event.h
@@ -59,7 +59,8 @@ void input_SendEventProgramSelect( input_thread_t *p_input, int i_program );
void input_SendEventProgramScrambled( input_thread_t *p_input, int i_group, bool b_scrambled );
void input_SendEventEsDel( input_thread_t *p_input, enum es_format_category_e i_cat, int i_id );
-void input_SendEventEsAdd( input_thread_t *p_input, enum es_format_category_e i_cat, int i_id, const char *psz_text );
+void input_SendEventEsAdd( input_thread_t *p_input, const char *psz_title,
+ const es_format_t *fmt );
void input_SendEventEsSelect( input_thread_t *p_input, enum es_format_category_e i_cat, int i_id ); /* i_id == -1 will unselect */
void input_SendEventTeletextAdd( input_thread_t *p_input,
diff --git a/src/input/var.c b/src/input/var.c
index 02a5770e5d..4cbc9a3ec6 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -324,7 +324,7 @@ void input_LegacyEvents( input_thread_t *p_input, void *user_data,
{
case VLC_INPUT_ES_ADDED:
{
- const char *varname = GetEsVarName( event->es.cat );
+ const char *varname = GetEsVarName( event->es.added.fmt->i_cat );
if( varname )
{
size_t count;
@@ -334,23 +334,23 @@ void input_LegacyEvents( input_thread_t *p_input, void *user_data,
/* First one, we need to add the "Disable" choice */
VarListAdd( p_input, varname, -1, _("Disable") );
}
- VarListAdd( p_input, varname, event->es.id,
- event->es.title );
+ VarListAdd( p_input, varname, event->es.added.fmt->i_id,
+ event->es.added.title );
}
break;
}
case VLC_INPUT_ES_DELETED:
{
- const char *varname = GetEsVarName( event->es.cat );
+ const char *varname = GetEsVarName( event->es.deleted.cat );
if( varname )
- VarListDel( p_input, varname, event->es.id );
+ VarListDel( p_input, varname, event->es.deleted.id );
break;
}
case VLC_INPUT_ES_SELECTED:
{
- const char *varname = GetEsVarName( event->es.cat );
+ const char *varname = GetEsVarName( event->es.selected.cat );
if( varname )
- VarListSelect( p_input, varname, event->es.id );
+ VarListSelect( p_input, varname, event->es.selected.id );
break;
}
}
--
2.18.0
More information about the vlc-devel
mailing list