[Mplayer-cvslog] CVS: main/libmpdemux tv.c,1.58,1.59 tv.h,1.23,1.24

Gabucino gabucino at mplayerhq.hu
Mon Aug 4 11:13:14 CEST 2003


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

Modified Files:
	tv.c tv.h 
Log Message:
I'd like to change tv tuner frequency in the slave mode. So this patch
helps me.

Patch by Kir Kostuchenko <kir at users.sourceforge.net>


Index: tv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- tv.c	3 Jul 2003 20:16:09 -0000	1.58
+++ tv.c	4 Aug 2003 09:13:10 -0000	1.59
@@ -118,9 +118,27 @@
     return 1;
 }
 
- /* forward declarations */
-int tv_set_freq(tvi_handle_t *tvh, unsigned long freq);
-int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq);
+static int norm_from_string(char* norm)
+{
+    if (!strcasecmp(norm, "pal"))
+	return TV_NORM_PAL;
+    else if (!strcasecmp(norm, "ntsc"))
+	return TV_NORM_NTSC;
+    else if (!strcasecmp(norm, "secam"))
+	return TV_NORM_SECAM;
+    else if (!strcasecmp(norm, "palnc"))
+	return TV_NORM_PALNC;
+    else if (!strcasecmp(norm, "palm"))
+	return TV_NORM_PALM;
+    else if (!strcasecmp(norm, "paln"))
+	return TV_NORM_PALN;
+    else if (!strcasecmp(norm, "ntscjp"))
+	return TV_NORM_NTSCJP;
+    else {
+	mp_msg(MSGT_TV, MSGL_V, "tv.c : norm_from_string(%s): Bogus norm parameter, setting PAL.\n", norm);
+	return TV_NORM_PAL;
+    }
+}
 
 static int open_tv(tvi_handle_t *tvh)
 {
@@ -162,24 +180,7 @@
     funcs->control(tvh->priv, TVI_CONTROL_SPC_SET_INPUT, &tv_param_input);
 
     /* select video norm */
-    if (!strcasecmp(tv_param_norm, "pal"))
-	tvh->norm = TV_NORM_PAL;
-    else if (!strcasecmp(tv_param_norm, "ntsc"))
-	tvh->norm = TV_NORM_NTSC;
-    else if (!strcasecmp(tv_param_norm, "secam"))
-	tvh->norm = TV_NORM_SECAM;
-    else if (!strcasecmp(tv_param_norm, "palnc"))
-	tvh->norm = TV_NORM_PALNC;
-    else if (!strcasecmp(tv_param_norm, "palm"))
-	tvh->norm = TV_NORM_PALM;
-    else if (!strcasecmp(tv_param_norm, "paln"))
-	tvh->norm = TV_NORM_PALN;
-    else if (!strcasecmp(tv_param_norm, "ntscjp"))
-	tvh->norm = TV_NORM_NTSCJP;
-    else {
-	mp_msg(MSGT_TV, MSGL_V, "Bogus norm parameter, setting PAL.\n");
-	tvh->norm = TV_NORM_PAL;
-    }
+    tvh->norm = norm_from_string(tv_param_norm);
 
     mp_msg(MSGT_TV, MSGL_V, "Selected norm: %s\n", tv_param_norm);
     if (funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) {
@@ -804,4 +805,17 @@
 {
     return(1);
 }
+
+int tv_set_norm(tvi_handle_t *tvh, char* norm)
+{
+    tvh->norm = norm_from_string(norm);
+
+    mp_msg(MSGT_TV, MSGL_V, "Selected norm: %s\n", tv_param_norm);
+    if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) {
+	mp_msg(MSGT_TV, MSGL_ERR, "Error: cannot set norm!\n");
+	return 0;
+    }
+    return(1);
+}
+
 #endif /* USE_TV */

Index: tv.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- tv.h	23 Mar 2003 15:05:14 -0000	1.23
+++ tv.h	4 Aug 2003 09:13:10 -0000	1.24
@@ -177,6 +177,11 @@
 int tv_step_norm(tvi_handle_t *tvh);
 int tv_step_chanlist(tvi_handle_t *tvh);
 
+int tv_set_freq(tvi_handle_t *tvh, unsigned long freq);
+int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq);
+
+int tv_set_norm(tvi_handle_t *tvh, char* norm);
+
 #define TV_NORM_PAL		1
 #define TV_NORM_NTSC		2
 #define TV_NORM_SECAM		3



More information about the MPlayer-cvslog mailing list