diff options
-rw-r--r-- | DOCS/tech/slave.txt | 3 | ||||
-rw-r--r-- | input/input.c | 1 | ||||
-rw-r--r-- | input/input.h | 1 | ||||
-rw-r--r-- | mplayer.c | 5 | ||||
-rw-r--r-- | stream/stream_radio.c | 21 | ||||
-rw-r--r-- | stream/stream_radio.h | 1 |
6 files changed, 32 insertions, 0 deletions
diff --git a/DOCS/tech/slave.txt b/DOCS/tech/slave.txt index 29d52a2522..feacc4f51b 100644 --- a/DOCS/tech/slave.txt +++ b/DOCS/tech/slave.txt @@ -222,6 +222,9 @@ radio_step_channel <-1|1> Step forwards (1) or backwards (-1) in channel list. Works only when the 'channels' radio parameter was set. +radio_step_freq <value> + Tune frequency by the <value> (positive - up, negative - down). + seek <value> [type] Seek to some place in the movie. 0 is a relative seek of +/- <value> seconds (default). diff --git a/input/input.c b/input/input.c index 73f9034821..e37015cd9f 100644 --- a/input/input.c +++ b/input/input.c @@ -51,6 +51,7 @@ static mp_cmd_t mp_cmds[] = { { MP_CMD_RADIO_STEP_CHANNEL, "radio_step_channel", 1, { { MP_CMD_ARG_INT ,{0}}, {-1,{0}} }}, { MP_CMD_RADIO_SET_CHANNEL, "radio_set_channel", 1, { { MP_CMD_ARG_STRING, {0}}, {-1,{0}} }}, { MP_CMD_RADIO_SET_FREQ, "radio_set_freq", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } }, + { MP_CMD_RADIO_STEP_FREQ, "radio_step_freq", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } }, #endif { MP_CMD_SEEK, "seek", 1, { {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } }, { MP_CMD_EDL_MARK, "edl_mark", 0, { {-1,{0}} } }, diff --git a/input/input.h b/input/input.h index 73e349f500..6a5565dd25 100644 --- a/input/input.h +++ b/input/input.h @@ -91,6 +91,7 @@ #define MP_CMD_RADIO_SET_FREQ 89 #define MP_CMD_SET_MOUSE_POS 90 #define MP_CMD_STEP_PROPERTY 91 +#define MP_CMD_RADIO_STEP_FREQ 92 #define MP_CMD_GUI_EVENTS 5000 #define MP_CMD_GUI_LOADFILE 5001 @@ -5025,6 +5025,11 @@ if(step_sec>0) { if (demuxer->stream->type== STREAMTYPE_RADIO) radio_set_freq(demuxer->stream, cmd->args[0].v.f); } break; + case MP_CMD_RADIO_STEP_FREQ : + if (demuxer->stream->type == STREAMTYPE_RADIO){ + radio_step_freq(demuxer->stream, cmd->args[0].v.f); + } + break; #endif #ifdef USE_TV case MP_CMD_TV_SET_FREQ : { diff --git a/stream/stream_radio.c b/stream/stream_radio.c index bb19aa4fd7..2db3680d0f 100644 --- a/stream/stream_radio.c +++ b/stream/stream_radio.c @@ -981,6 +981,27 @@ int radio_set_freq(struct stream_st *stream, float frequency){ } /***************************************************************** + * \brief tune current frequency by step_interval value + * \parameter step_interval increment value + * \return 1 if success,0 - otherwise + * + */ +int radio_step_freq(struct stream_st *stream, float step_interval){ + float frequency; + radio_priv_t* priv=(radio_priv_t*)stream->priv; + + if (get_frequency(priv,&frequency)!=STREAM_OK) + return 0; + + frequency+=step_interval; + if (frequency>priv->rangehigh) + frequency=priv->rangehigh; + if (frequency<priv->rangelow) + frequency=priv->rangelow; + + return radio_set_freq(stream,frequency); +} +/***************************************************************** * \brief step channel up or down * \parameter direction RADIO_CHANNEL_LOWER - go to prev channel,RADIO_CHANNEL_HIGHER - to next * \return 1 if success,0 - otherwise diff --git a/stream/stream_radio.h b/stream/stream_radio.h index 3baca729a0..2d5ffb2cc4 100644 --- a/stream/stream_radio.h +++ b/stream/stream_radio.h @@ -22,6 +22,7 @@ int radio_get_freq(struct stream_st *stream, float* freq); char* radio_get_channel_name(struct stream_st *stream); int radio_set_channel(struct stream_st *stream, char *channel); int radio_step_channel(struct stream_st *stream, int direction); +int radio_step_freq(struct stream_st *stream, float step_interval); #endif |