[Mplayer-cvslog] CVS: main/libmpdemux tv.c,1.34,1.35

Alex Beregszaszi alex at mplayerhq.hu
Sat Oct 19 22:55:09 CEST 2002


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv28379

Modified Files:
	tv.c 
Log Message:
set position in channel list on startup. note: hope one day we will get cleaned the int->float->int sutff ;)

Index: tv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- tv.c	22 Sep 2002 02:33:26 -0000	1.34
+++ tv.c	19 Oct 2002 20:55:06 -0000	1.35
@@ -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);
@@ -513,6 +530,17 @@
 	    mp_msg(MSGT_TV, MSGL_WARN, "Unknown color option (%d) specified!\n", opt);
     }
     
+    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);
 }
 




More information about the MPlayer-cvslog mailing list