[vlc-devel] [RFC PATCH 2/3] input: handle vbi controls and events
Thomas Guillem
thomas at gllm.fr
Tue Oct 16 16:35:28 CEST 2018
This will be used by the future player to select VBI page or transparency and
get notified when they change. These new controls need the vlc_es_id_t of the
teletext track, that will be known by the player. This will replace the hackish
function: input_GetEsObjects() that is only used by QT in order to control
teletext.
---
src/input/es_out.c | 37 ++++++++++++++++++++++++++++++++++++
src/input/es_out.h | 6 ++++++
src/input/es_out_timeshift.c | 2 ++
src/input/event.h | 17 +++++++++++++++++
src/input/input.c | 9 +++++++++
src/input/input_internal.h | 11 +++++++++++
6 files changed, 82 insertions(+)
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 7e1480fad4..98f71b3ec0 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -1852,6 +1852,18 @@ static void EsOutSelectEs( es_out_t *out, es_out_id_t *es )
/* Mark it as selected */
EsOutSendEsEvent(out, es, VLC_INPUT_ES_SELECTED);
+
+ /* Special case of the zvbi decoder for teletext: send the initial selected
+ * page and transparency */
+ if( !es->p_master && es->fmt.i_cat == SPU_ES
+ && es->fmt.i_codec == VLC_CODEC_TELETEXT
+ && var_Type( es->p_dec, "vbi-page" ) == VLC_VAR_INTEGER )
+ {
+ input_SendEventVbiPage( p_input,
+ var_GetInteger( es->p_dec, "vbi-page" ) );
+ input_SendEventVbiTransparency( p_input,
+ var_GetBool( es->p_dec, "vbi-opaque" ) );
+ }
}
static void EsDeleteCCChannels( es_out_t *out, es_out_id_t *parent )
@@ -3041,7 +3053,32 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
return input_DecoderSetSpuHighlight( p_es->p_dec, spu_hl );
return VLC_EGENERIC;
}
+ case ES_OUT_SET_VBI_PAGE:
+ case ES_OUT_SET_VBI_TRANSPARENCY:
+ {
+ es_out_id_t *es = va_arg( args, es_out_id_t * );
+ assert(es);
+ if( !es->p_dec || es->fmt.i_cat != SPU_ES
+ || es->fmt.i_codec != VLC_CODEC_TELETEXT )
+ return VLC_EGENERIC;
+ int ret;
+ if( i_query == ES_OUT_SET_VBI_PAGE )
+ {
+ unsigned page = va_arg( args, unsigned );
+ ret = var_SetInteger( es->p_dec, "vbi-page", page );
+ if( ret == VLC_SUCCESS )
+ input_SendEventVbiPage( p_sys->p_input, page );
+ }
+ else
+ {
+ bool opaque = va_arg( args, int );
+ ret = var_SetBool( es->p_dec, "vbi-opaque", opaque );
+ if( ret == VLC_SUCCESS )
+ input_SendEventVbiTransparency( p_sys->p_input, opaque );
+ }
+ return ret;
+ }
default:
msg_Err( p_sys->p_input, "unknown query 0x%x in %s", i_query,
__func__ );
diff --git a/src/input/es_out.h b/src/input/es_out.h
index 2976021ea1..f94a7cc516 100644
--- a/src/input/es_out.h
+++ b/src/input/es_out.h
@@ -85,6 +85,12 @@ enum es_out_query_private_e
/* Set End Of Stream */
ES_OUT_SET_EOS, /* res=cannot fail */
+
+ /* Set a VBI/Teletext page */
+ ES_OUT_SET_VBI_PAGE, /* arg1=unsigned res=can fail */
+
+ /* Set VBI/Teletext menu transparent */
+ ES_OUT_SET_VBI_TRANSPARENCY /* arg1=bool res=can fail */
};
static inline void es_out_SetMode( es_out_t *p_out, int i_mode )
diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index b7440da467..d051243fbf 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -747,6 +747,8 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
case ES_OUT_START_ALL_ES:
case ES_OUT_SET_DELAY:
case ES_OUT_SET_RECORD_STATE:
+ case ES_OUT_SET_VBI_PAGE:
+ case ES_OUT_SET_VBI_TRANSPARENCY:
default:
vlc_assert_unreachable();
return VLC_EGENERIC;
diff --git a/src/input/event.h b/src/input/event.h
index 99cc8f3faf..211be0bdcc 100644
--- a/src/input/event.h
+++ b/src/input/event.h
@@ -262,6 +262,23 @@ static inline void input_SendEventParsing(input_thread_t *p_input,
});
}
+static inline void input_SendEventVbiPage(input_thread_t *p_input, unsigned page)
+{
+ input_SendEvent(p_input, &(struct vlc_input_event) {
+ .type = INPUT_EVENT_VBI_PAGE,
+ .vbi_page = page,
+ });
+}
+
+static inline void input_SendEventVbiTransparency(input_thread_t *p_input,
+ bool transparent)
+{
+ input_SendEvent(p_input, &(struct vlc_input_event) {
+ .type = INPUT_EVENT_VBI_TRANSPARENCY,
+ .vbi_transparent = transparent,
+ });
+}
+
/*****************************************************************************
* Event for resource.c
*****************************************************************************/
diff --git a/src/input/input.c b/src/input/input.c
index eca27ad78d..a21111ff32 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2329,6 +2329,15 @@ static bool Control( input_thread_t *p_input,
#endif
break;
}
+ case INPUT_CONTROL_SET_VBI_PAGE:
+ es_out_Control( priv->p_es_out_display, ES_OUT_SET_VBI_PAGE,
+ param.vbi_page.id, param.vbi_page.page );
+ break;
+ case INPUT_CONTROL_SET_VBI_TRANSPARENCY:
+ es_out_Control( priv->p_es_out_display, ES_OUT_SET_VBI_TRANSPARENCY,
+ param.vbi_transparency.id,
+ param.vbi_transparency.enabled );
+ break;
case INPUT_CONTROL_NAV_ACTIVATE:
case INPUT_CONTROL_NAV_UP:
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 421b89e37c..d1eaa2911e 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -95,6 +95,14 @@ typedef union
bool b_absolute;
vlc_tick_t i_val;
} delay;
+ struct {
+ vlc_es_id_t *id;
+ unsigned page;
+ } vbi_page;
+ struct {
+ vlc_es_id_t *id;
+ bool enabled;
+ } vbi_transparency;
} input_control_param_t;
typedef struct
@@ -252,6 +260,9 @@ enum input_control_e
INPUT_CONTROL_SET_FRAME_NEXT,
INPUT_CONTROL_SET_RENDERER,
+
+ INPUT_CONTROL_SET_VBI_PAGE,
+ INPUT_CONTROL_SET_VBI_TRANSPARENCY,
};
/* Internal helpers */
--
2.19.1
More information about the vlc-devel
mailing list