diff options
author | alex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-10-19 20:55:06 +0000 |
---|---|---|
committer | alex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-10-19 20:55:06 +0000 |
commit | 108e2a21303b1c3b1a6b31bfb78cd454542bbce8 (patch) | |
tree | a8d4e9b1aaf943ca45a7b928c9d1a35e2bdde325 /libmpdemux | |
parent | 8f12b9b42b9542882ca829957f2066c08f78dd27 (diff) |
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7807 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/tv.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/libmpdemux/tv.c b/libmpdemux/tv.c index 3e9dd83dbd..4a54a02c9f 100644 --- a/libmpdemux/tv.c +++ b/libmpdemux/tv.c @@ -244,6 +244,25 @@ static int open_tv(tvi_handle_t *tvh) } } } + + /* grep frequency in chanlist */ + { + unsigned long i2; + int freq; + + tv_get_freq(tvh, &i2); + + freq = (int) (((float)(i2/16))*1000)+250; + + for (i = 0; i < chanlists[tvh->chanlist].count; i++) + { + if (tvh->chanlist_s[i].freq == freq) + { + tvh->channel = i+1; + break; + } + } + } done: /* also start device! */ @@ -388,13 +407,11 @@ no_audio: return 1; } -#if defined(USE_TV) && defined(HAVE_TV_V4L) int demux_close_tv(demuxer_t *demuxer) { tvi_handle_t *tvh=(tvi_handle_t*)(demuxer->priv); return(tvh->functions->uninit(tvh->priv)); } -#endif /* ================== STREAM_TV ===================== */ tvi_handle_t *tvi_init_dummy(char *device); @@ -516,6 +533,17 @@ int tv_set_color_options(tvi_handle_t *tvh, int opt, int value) return(1); } +int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq) +{ + if (tvh->functions->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) == TVI_CONTROL_TRUE) + { + tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, freq); + mp_msg(MSGT_TV, MSGL_V, "Current frequency: %lu (%.3f)\n", + *freq, (float)*freq/16); + } + return(1); +} + int tv_set_freq(tvi_handle_t *tvh, unsigned long freq) { if (tvh->functions->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) == TVI_CONTROL_TRUE) |