summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-11-16 22:59:07 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-11-16 22:59:07 +0000
commitc451b1fe262fe39515f14ce82f2a590004e96d34 (patch)
treed58328865d1561891e51749c705e1ebd816c6674 /libmpdemux
parent1e50777fb8e235375783868c223b466ca9e39e1b (diff)
downloadmpv-c451b1fe262fe39515f14ce82f2a590004e96d34.tar.bz2
mpv-c451b1fe262fe39515f14ce82f2a590004e96d34.tar.xz
added support for setting color values
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2938 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/tv.c82
-rw-r--r--libmpdemux/tv.h16
-rw-r--r--libmpdemux/tvi_v4l.c30
3 files changed, 128 insertions, 0 deletions
diff --git a/libmpdemux/tv.c b/libmpdemux/tv.c
index 9c93624e38..685b70e01a 100644
--- a/libmpdemux/tv.c
+++ b/libmpdemux/tv.c
@@ -284,4 +284,86 @@ int tv_uninit(tvi_handle_t *tvh)
{
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 */
diff --git a/libmpdemux/tv.h b/libmpdemux/tv.h
index f87fca9390..972a790f33 100644
--- a/libmpdemux/tv.h
+++ b/libmpdemux/tv.h
@@ -78,6 +78,16 @@ typedef struct tvi_handle_s {
#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
@@ -101,4 +111,10 @@ 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 */
diff --git a/libmpdemux/tvi_v4l.c b/libmpdemux/tvi_v4l.c
index 05a950ec38..0e6491a1a7 100644
--- a/libmpdemux/tvi_v4l.c
+++ b/libmpdemux/tvi_v4l.c
@@ -552,6 +552,36 @@ static int control(priv_t *priv, int cmd, void *arg)
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: