From 94674443a39349c459274668301f2d52a3f95820 Mon Sep 17 00:00:00 2001 From: voroshil Date: Sat, 17 Mar 2007 11:51:17 +0000 Subject: New slave command: tv_step_freq Command sets the TV frequency relative to current value git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22685 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/tech/slave.txt | 3 +++ command.c | 6 ++++++ input/input.c | 1 + input/input.h | 1 + stream/tv.c | 15 +++++++++++++++ stream/tv.h | 1 + 6 files changed, 27 insertions(+) diff --git a/DOCS/tech/slave.txt b/DOCS/tech/slave.txt index a9e31fda84..1ca4e40838 100644 --- a/DOCS/tech/slave.txt +++ b/DOCS/tech/slave.txt @@ -330,6 +330,9 @@ tv_last_channel tv_set_freq Set the TV tuner frequency. +tv_step_freq + Set the TV tuner frequency relative to current value. + tv_set_norm Set the TV tuner norm (PAL, SECAM, NTSC, ...). diff --git a/command.c b/command.c index a89ae1a27e..5f60d9e94b 100644 --- a/command.c +++ b/command.c @@ -1941,6 +1941,12 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd) cmd->args[0].v.f * 16.0); break; + case MP_CMD_TV_STEP_FREQ: + if (mpctx->file_format == DEMUXER_TYPE_TV) + tv_step_freq((tvi_handle_t *) (mpctx->demuxer->priv), + cmd->args[0].v.f * 16.0); + break; + case MP_CMD_TV_SET_NORM: if (mpctx->file_format == DEMUXER_TYPE_TV) tv_set_norm((tvi_handle_t *) (mpctx->demuxer->priv), diff --git a/input/input.c b/input/input.c index 2cb65ed07f..1adff16b82 100644 --- a/input/input.c +++ b/input/input.c @@ -112,6 +112,7 @@ static mp_cmd_t mp_cmds[] = { { MP_CMD_TV_SET_CHANNEL, "tv_set_channel", 1, { { MP_CMD_ARG_STRING, {0}}, {-1,{0}} }}, { MP_CMD_TV_LAST_CHANNEL, "tv_last_channel", 0, { {-1,{0}} } }, { MP_CMD_TV_SET_FREQ, "tv_set_freq", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } }, + { MP_CMD_TV_STEP_FREQ, "tv_step_freq", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } }, { MP_CMD_TV_SET_NORM, "tv_set_norm", 1, { {MP_CMD_ARG_STRING,{0}}, {-1,{0}} } }, { MP_CMD_TV_SET_BRIGHTNESS, "tv_set_brightness", 1, { { MP_CMD_ARG_INT ,{0}}, { MP_CMD_ARG_INT,{1} }, {-1,{0}} }}, { MP_CMD_TV_SET_CONTRAST, "tv_set_contrast", 1, { { MP_CMD_ARG_INT ,{0}}, { MP_CMD_ARG_INT,{1} }, {-1,{0}} }}, diff --git a/input/input.h b/input/input.h index 86706e6be4..b2096a7a6b 100644 --- a/input/input.h +++ b/input/input.h @@ -92,6 +92,7 @@ #define MP_CMD_SET_MOUSE_POS 90 #define MP_CMD_STEP_PROPERTY 91 #define MP_CMD_RADIO_STEP_FREQ 92 +#define MP_CMD_TV_STEP_FREQ 93 #define MP_CMD_GUI_EVENTS 5000 #define MP_CMD_GUI_LOADFILE 5001 diff --git a/stream/tv.c b/stream/tv.c index b3bcc37923..8fe173c3bb 100644 --- a/stream/tv.c +++ b/stream/tv.c @@ -781,6 +781,21 @@ int tv_set_freq(tvi_handle_t *tvh, unsigned long freq) return(1); } +/***************************************************************** + * \brief tune current frequency by step_interval value + * \parameter step_interval increment value in 1/16 MHz + * \note frequency is rounded to 1/16 MHz value + * \return 1 + * + */ +int tv_step_freq(tvi_handle_t* tvh, float step_interval){ + unsigned long frequency; + + tv_get_freq(tvh,&frequency); + frequency+=step_interval; + return tv_set_freq(tvh,frequency); +} + int tv_step_channel_real(tvi_handle_t *tvh, int direction) { struct CHANLIST cl; diff --git a/stream/tv.h b/stream/tv.h index 509dfcf9d6..59deda41eb 100644 --- a/stream/tv.h +++ b/stream/tv.h @@ -184,6 +184,7 @@ int tv_step_chanlist(tvi_handle_t *tvh); int tv_set_freq(tvi_handle_t *tvh, unsigned long freq); int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq); +int tv_step_freq(tvi_handle_t *tvh, float step_interval); int tv_set_norm(tvi_handle_t *tvh, char* norm); -- cgit v1.2.3