Browse Source

input: handle vbi controls and events

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.
pull/77/head
Thomas Guillem 8 years ago
parent
commit
0f90207fee
  1. 8
      include/vlc_input.h
  2. 37
      src/input/es_out.c
  3. 6
      src/input/es_out.h
  4. 2
      src/input/es_out_timeshift.c
  5. 17
      src/input/event.h
  6. 9
      src/input/input.c
  7. 11
      src/input/input_internal.h

8
include/vlc_input.h

@ -388,6 +388,10 @@ typedef enum input_event_type_e
/* (pre-)parsing events */
INPUT_EVENT_SUBITEMS,
/* vbi_page has changed */
INPUT_EVENT_VBI_PAGE,
/* vbi_transparent has changed */
INPUT_EVENT_VBI_TRANSPARENCY,
} input_event_type_e;
#define VLC_INPUT_CAPABILITIES_SEEKABLE (1<<0)
@ -515,6 +519,10 @@ struct vlc_input_event
struct vlc_input_event_vout vout;
/* INPUT_EVENT_SUBITEMS */
input_item_node_t *subitems;
/* INPUT_EVENT_VBI_PAGE */
unsigned vbi_page;
/* INPUT_EVENT_VBI_TRANSPARENCY */
bool vbi_transparent;
};
};

37
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__ );

6
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 )

2
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;

17
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
*****************************************************************************/

9
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:

11
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 */

Loading…
Cancel
Save