diff options
author | voroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-07-29 17:55:28 +0000 |
---|---|---|
committer | voroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-07-29 17:55:28 +0000 |
commit | 4f0d56b9ae993ab39db45eeac978a9a5e632add3 (patch) | |
tree | 38fd3387cf903eeb37ce33d78e95bac9835a812a /command.c | |
parent | dd5778726ee97081d6e341cc894a9d459a66ac1e (diff) | |
download | mpv-4f0d56b9ae993ab39db45eeac978a9a5e632add3.tar.bz2 mpv-4f0d56b9ae993ab39db45eeac978a9a5e632add3.tar.xz |
Teletext support.
Part 2/5: options/slaves/configure/definitions/etc
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23920 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'command.c')
-rw-r--r-- | command.c | 105 |
1 files changed, 105 insertions, 0 deletions
@@ -1510,6 +1510,89 @@ static int mp_property_tv_color(m_option_t * prop, int action, void *arg, #endif +#ifdef HAVE_TV_TELETEXT +static int mp_property_teletext_common(m_option_t * prop, int action, void *arg, + MPContext * mpctx) +{ + int val,result; + int base_ioctl=(int)prop->priv; + /* + for teletext's GET,SET,STEP ioctls this is not 0 + SET is GET+1 + STEP is GET+2 + */ + tvi_handle_t *tvh = mpctx->demuxer->priv; + if (mpctx->demuxer->type != DEMUXER_TYPE_TV || !tvh) + return M_PROPERTY_UNAVAILABLE; + if(!base_ioctl) + return M_PROPERTY_ERROR; + + switch (action) { + case M_PROPERTY_GET: + if (!arg) + return M_PROPERTY_ERROR; + result=tvh->functions->control(tvh->priv, base_ioctl, arg); + break; + case M_PROPERTY_SET: + if (!arg) + return M_PROPERTY_ERROR; + M_PROPERTY_CLAMP(prop, *(int *) arg); + result=tvh->functions->control(tvh->priv, base_ioctl+1, arg); + break; + case M_PROPERTY_STEP_UP: + case M_PROPERTY_STEP_DOWN: + result=tvh->functions->control(tvh->priv, base_ioctl, &val); + val += (arg ? *(int *) arg : 1) * (action == M_PROPERTY_STEP_DOWN ? -1 : 1); + result=tvh->functions->control(tvh->priv, base_ioctl+1, &val); + break; + default: + return M_PROPERTY_NOT_IMPLEMENTED; + } + + return (result==TVI_CONTROL_TRUE?M_PROPERTY_OK:M_PROPERTY_ERROR); +} + +static int mp_property_teletext_mode(m_option_t * prop, int action, void *arg, + MPContext * mpctx) +{ + tvi_handle_t *tvh = mpctx->demuxer->priv; + int result; + int val; + + //with tvh==NULL will fail too + result=mp_property_teletext_common(prop,action,arg,mpctx); + if(result!=M_PROPERTY_OK) + return result; + + if(tvh->functions->control(tvh->priv, prop->priv, &val)==TVI_CONTROL_TRUE && val) + mp_input_set_section("teletext"); + else + mp_input_set_section("tv"); + return M_PROPERTY_OK; +} + +static int mp_property_teletext_page(m_option_t * prop, int action, void *arg, + MPContext * mpctx) +{ + tvi_handle_t *tvh = mpctx->demuxer->priv; + int result; + int val; + switch(action){ + case M_PROPERTY_STEP_UP: + case M_PROPERTY_STEP_DOWN: + //This should be handled separately + val = (arg ? *(int *) arg : 1) * (action == M_PROPERTY_STEP_DOWN ? -1 : 1); + result=tvh->functions->control(tvh->priv, TV_VBI_CONTROL_STEP_PAGE, &val); + break; + default: + result=mp_property_teletext_common(prop,action,arg,mpctx); + } + return result; +} + + +#endif /* HAVE_TV_TELETEXT */ + ///@} /// All properties available in MPlayer. @@ -1643,6 +1726,19 @@ static m_option_t mp_properties[] = { M_OPT_RANGE, -100, 100, (void *) TV_COLOR_HUE }, #endif +#ifdef HAVE_TV_TELETEXT + { "teletext_page", mp_property_teletext_page, CONF_TYPE_INT, + M_OPT_RANGE, 100, 899, (void*)TV_VBI_CONTROL_GET_PAGE }, + { "teletext_subpage", mp_property_teletext_common, CONF_TYPE_INT, + M_OPT_RANGE, 0, 64, (void*)TV_VBI_CONTROL_GET_SUBPAGE }, + { "teletext_mode", mp_property_teletext_mode, CONF_TYPE_FLAG, + M_OPT_RANGE, 0, 1, (void*)TV_VBI_CONTROL_GET_MODE }, + { "teletext_format", mp_property_teletext_common, CONF_TYPE_INT, + M_OPT_RANGE, 0, 3, (void*)TV_VBI_CONTROL_GET_FORMAT }, + { "teletext_half_page", mp_property_teletext_common, CONF_TYPE_INT, + M_OPT_RANGE, 0, 2, (void*)TV_VBI_CONTROL_GET_HALF_PAGE }, +#endif + { NULL, NULL, NULL, 0, 0, 0, NULL } }; @@ -2342,6 +2438,15 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd) if (mpctx->file_format == DEMUXER_TYPE_TV) tv_step_chanlist((tvi_handle_t *) (mpctx->demuxer->priv)); break; +#ifdef HAVE_TV_TELETEXT + case MP_CMD_TV_TELETEXT_ADD_DEC: + { + tvi_handle_t* tvh=(tvi_handle_t *)(mpctx->demuxer->priv); + if (mpctx->file_format == DEMUXER_TYPE_TV) + tvh->functions->control(tvh->priv,TV_VBI_CONTROL_ADD_DEC,&(cmd->args[0].v.s)); + break; + } +#endif /* HAVE_TV_TELETEXT */ #endif /* USE_TV */ case MP_CMD_SUB_LOAD: |