From bfddb0aa03a57024070b78c2bb5c4a78d8391f9d Mon Sep 17 00:00:00 2001 From: henry Date: Thu, 19 Dec 2002 10:09:43 +0000 Subject: add a TV_SET_CNANNEL command git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8495 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/tv.c | 21 +++++++++++++++++++++ libmpdemux/tv.h | 2 ++ 2 files changed, 23 insertions(+) (limited to 'libmpdemux') diff --git a/libmpdemux/tv.c b/libmpdemux/tv.c index 5d32e4cfb9..6a90f31ac5 100644 --- a/libmpdemux/tv.c +++ b/libmpdemux/tv.c @@ -554,6 +554,27 @@ int tv_step_channel(tvi_handle_t *tvh, int direction) 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 --git a/libmpdemux/tv.h b/libmpdemux/tv.h index 6afaf20a9a..4f2cb9e41c 100644 --- a/libmpdemux/tv.h +++ b/libmpdemux/tv.h @@ -148,6 +148,8 @@ int tv_step_channel(tvi_handle_t *tvh, int direction); #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); -- cgit v1.2.3