# HG changeset patch # User henry # Date 1040292583 0 # Node ID 47cf9405813701d2f285274ce8ae6ecb9c7116c2 # Parent dc038bbb36a38f56a89e7b7fd9b0f1e3f91a6288 add a TV_SET_CNANNEL command diff -r dc038bbb36a3 -r 47cf94058137 input/input.c --- a/input/input.c Wed Dec 18 23:49:01 2002 +0000 +++ b/input/input.c Thu Dec 19 10:09:43 2002 +0000 @@ -74,6 +74,7 @@ { MP_CMD_TV_STEP_CHANNEL, "tv_step_channel", 1, { { MP_CMD_ARG_INT ,{0}}, {-1,{0}} }}, { MP_CMD_TV_STEP_NORM, "tv_step_norm",0, { {-1,{0}} } }, { MP_CMD_TV_STEP_CHANNEL_LIST, "tv_step_chanlist", 0, { {-1,{0}} } }, + { MP_CMD_TV_SET_CHANNEL, "tv_set_channel", 1, { { MP_CMD_ARG_STRING, {0}}, {-1,{0}} }}, #endif { MP_CMD_VO_FULLSCREEN, "vo_fullscreen", 0, { {-1,{0}} } }, { MP_CMD_SCREENSHOT, "screenshot", 0, { {-1,{0}} } }, diff -r dc038bbb36a3 -r 47cf94058137 input/input.h --- a/input/input.h Wed Dec 18 23:49:01 2002 +0000 +++ b/input/input.h Thu Dec 19 10:09:43 2002 +0000 @@ -19,6 +19,7 @@ #define MP_CMD_TV_STEP_CHANNEL 17 #define MP_CMD_TV_STEP_NORM 18 #define MP_CMD_TV_STEP_CHANNEL_LIST 19 +#define MP_CMD_TV_SET_CHANNEL 37 #define MP_CMD_VO_FULLSCREEN 20 #define MP_CMD_SUB_POS 21 #define MP_CMD_DVDNAV 22 diff -r dc038bbb36a3 -r 47cf94058137 libmpdemux/tv.c --- a/libmpdemux/tv.c Wed Dec 18 23:49:01 2002 +0000 +++ b/libmpdemux/tv.c Thu Dec 19 10:09:43 2002 +0000 @@ -554,6 +554,27 @@ return(1); } +int tv_set_channel(tvi_handle_t *tvh, char *channel) +{ + int i; + struct CHANLIST cl; + + for (i = 0; i < chanlists[tvh->chanlist].count; i++) + { + cl = tvh->chanlist_s[i]; +// printf("count%d: name: %s, freq: %d\n", +// i, cl.name, cl.freq); + if (!strcasecmp(cl.name, channel)) + { + tvh->channel = i; + mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n", + cl.name, (float)cl.freq/1000); + tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16)); + break; + } + } +} + int tv_step_norm(tvi_handle_t *tvh) { return(1); diff -r dc038bbb36a3 -r 47cf94058137 libmpdemux/tv.h --- a/libmpdemux/tv.h Wed Dec 18 23:49:01 2002 +0000 +++ b/libmpdemux/tv.h Thu Dec 19 10:09:43 2002 +0000 @@ -148,6 +148,8 @@ #define TV_CHANNEL_LOWER 1 #define TV_CHANNEL_HIGHER 2 +int tv_set_channel(tvi_handle_t *tvh, char *channel); + int tv_step_norm(tvi_handle_t *tvh); int tv_step_chanlist(tvi_handle_t *tvh); diff -r dc038bbb36a3 -r 47cf94058137 mplayer.c --- a/mplayer.c Wed Dec 18 23:49:01 2002 +0000 +++ b/mplayer.c Thu Dec 19 10:09:43 2002 +0000 @@ -2288,6 +2288,10 @@ tv_step_channel((tvi_handle_t*)(demuxer->priv), TV_CHANNEL_LOWER); } } break; + case MP_CMD_TV_SET_CHANNEL : { + if (tv_param_on == 1) + tv_set_channel((tvi_handle_t*)(demuxer->priv), cmd->args[0].v.s); + } break; case MP_CMD_TV_STEP_NORM : { if (tv_param_on == 1) tv_step_norm((tvi_handle_t*)(demuxer->priv));