# HG changeset patch # User alex # Date 1035060906 0 # Node ID 6a6f6b8b2ac77b40d8fc19cbc816689925faa9a6 # Parent f71bc57c4da9cae14a6ca7e7a1a7fa51a7e309f1 set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;) diff -r f71bc57c4da9 -r 6a6f6b8b2ac7 libmpdemux/tv.c --- a/libmpdemux/tv.c Sat Oct 19 20:26:04 2002 +0000 +++ b/libmpdemux/tv.c Sat Oct 19 20:55:06 2002 +0000 @@ -244,6 +244,25 @@ } } } + + /* 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 @@ 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 @@ 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)