[Mplayer-cvslog] CVS: main/libmpdemux tv.c,1.12,1.13 tv.h,1.8,1.9 tvi_v4l.c,1.10,1.11

Alex Beregszaszi alex at mplayer.dev.hu
Fri Nov 16 23:59:09 CET 2001


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

Modified Files:
	tv.c tv.h tvi_v4l.c 
Log Message:
added support for setting color values

Index: tv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- tv.c	16 Nov 2001 21:53:07 -0000	1.12
+++ tv.c	16 Nov 2001 22:59:07 -0000	1.13
@@ -284,4 +284,86 @@
 {
     return(tvh->functions->uninit(tvh->priv));
 }
+
+/* utilities for mplayer (not mencoder!!) */
+int tv_set_color_options(tvi_handle_t *tvh, int opt, int value)
+{
+    tvi_functions_t *funcs = tvh->functions;
+
+    switch(opt)
+    {
+	case TV_COLOR_BRIGHTNESS:
+	    if (value == 50)
+		value = 32768;
+	    if (value > 50)
+	    {
+		value *= 100;
+		value += 32768;
+	    }
+	    if (value < 50)
+	    {
+		int i;
+		value *= 100;
+		i = value;
+		value = 32768 - i;
+	    }
+	    funcs->control(tvh->priv, TVI_CONTROL_VID_SET_BRIGHTNESS, &value);
+	    break;
+	case TV_COLOR_HUE:
+	    if (value == 50)
+		value = 32768;
+	    if (value > 50)
+	    {
+		value *= 100;
+		value += 32768;
+	    }
+	    if (value < 50)
+	    {
+		int i;
+		value *= 100;
+		i = value;
+		value = 32768 - i;
+	    }
+	    funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HUE, &value);
+	    break;
+	case TV_COLOR_SATURATION:
+	    if (value == 50)
+		value = 32512;
+	    if (value > 50)
+	    {
+		value *= 100;
+		value += 32512;
+	    }
+	    if (value < 50)
+	    {
+		int i;
+		value *= 100;
+		i = value;
+		value = 32512 - i;
+	    }
+	    funcs->control(tvh->priv, TVI_CONTROL_VID_SET_SATURATION, &value);
+	    break;
+	case TV_COLOR_CONTRAST:
+	    if (value == 50)
+		value = 27648;
+	    if (value > 50)
+	    {
+		value *= 100;
+		value += 27648;
+	    }
+	    if (value < 50)
+	    {
+		int i;
+		value *= 100;
+		i = value;
+		value = 27648 - i;
+	    }
+	    funcs->control(tvh->priv, TVI_CONTROL_VID_SET_CONTRAST, &value);
+	    break;
+	default:
+	    mp_msg(MSGT_TV, MSGL_WARN, "Unknown color option (%d) specified!\n", opt);
+    }
+    
+    return(1);
+}
 #endif /* USE_TV */

Index: tv.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- tv.h	16 Nov 2001 21:30:10 -0000	1.8
+++ tv.h	16 Nov 2001 22:59:07 -0000	1.9
@@ -78,6 +78,16 @@
 #define TVI_CONTROL_VID_GET_HEIGHT	0x112
 #define TVI_CONTROL_VID_CHK_HEIGHT	0x113
 #define TVI_CONTROL_VID_SET_HEIGHT	0x114
+#define TVI_CONTROL_VID_GET_BRIGHTNESS	0x115
+#define TVI_CONTROL_VID_SET_BRIGHTNESS	0x116
+#define TVI_CONTROL_VID_GET_HUE		0x117
+#define TVI_CONTROL_VID_SET_HUE		0x118
+#define TVI_CONTROL_VID_GET_SATURATION	0x119
+#define TVI_CONTROL_VID_SET_SATURATION	0x11a
+#define TVI_CONTROL_VID_GET_CONTRAST	0x11b
+#define TVI_CONTROL_VID_SET_CONTRAST	0x11c
+#define TVI_CONTROL_VID_GET_PICTURE	0x11d
+#define TVI_CONTROL_VID_SET_PICTURE	0x11e
 
 /* TUNER controls */
 #define TVI_CONTROL_TUN_GET_FREQ	0x201
@@ -100,5 +110,11 @@
 extern tvi_handle_t *tv_begin(void);
 extern int tv_init(tvi_handle_t *tvh);
 extern int tv_uninit(tvi_handle_t *tvh);
+
+
+#define TV_COLOR_BRIGHTNESS	1
+#define TV_COLOR_HUE		2
+#define TV_COLOR_SATURATION	3
+#define TV_COLOR_CONTRAST	4
 
 #endif /* USE_TV */

Index: tvi_v4l.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tvi_v4l.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- tvi_v4l.c	16 Nov 2001 21:30:10 -0000	1.10
+++ tvi_v4l.c	16 Nov 2001 22:59:07 -0000	1.11
@@ -552,6 +552,36 @@
 	case TVI_CONTROL_VID_SET_HEIGHT:
 	    priv->height = (int)*(void **)arg;
 	    return(TVI_CONTROL_TRUE);
+	case TVI_CONTROL_VID_GET_PICTURE:
+	    if (ioctl(priv->fd, VIDIOCGPICT, &priv->picture) == -1)
+	    {
+		mp_msg(MSGT_TV, MSGL_ERR, "ioctl get picture failed: %s\n", strerror(errno));
+		return(TVI_CONTROL_FALSE);
+	    }
+	    return(TVI_CONTROL_TRUE);
+	case TVI_CONTROL_VID_SET_PICTURE:
+	    if (ioctl(priv->fd, VIDIOCSPICT, &priv->picture) == -1)
+	    {
+		mp_msg(MSGT_TV, MSGL_ERR, "ioctl get picture failed: %s\n", strerror(errno));
+		return(TVI_CONTROL_FALSE);
+	    }
+	    return(TVI_CONTROL_TRUE);
+	case TVI_CONTROL_VID_SET_BRIGHTNESS:
+	    priv->picture.brightness = (int)*(void **)arg;
+	    control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
+	    return(TVI_CONTROL_TRUE);
+	case TVI_CONTROL_VID_SET_HUE:
+	    priv->picture.hue = (int)*(void **)arg;
+	    control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
+	    return(TVI_CONTROL_TRUE);
+	case TVI_CONTROL_VID_SET_SATURATION:
+	    priv->picture.colour = (int)*(void **)arg;
+	    control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
+	    return(TVI_CONTROL_TRUE);
+	case TVI_CONTROL_VID_SET_CONTRAST:
+	    priv->picture.contrast = (int)*(void **)arg;
+	    control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
+	    return(TVI_CONTROL_TRUE);
 
 	/* ========== TUNER controls =========== */
 	case TVI_CONTROL_TUN_GET_FREQ:




More information about the MPlayer-cvslog mailing list