diff libmpdemux/tv.c @ 8494:47cf94058137

add a TV_SET_CNANNEL command
author henry
date Thu, 19 Dec 2002 10:09:43 +0000
parents e93ac55da5ae
children 14ab71b47a58
line wrap: on
line diff
--- 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);