diff options
Diffstat (limited to 'stream')
-rw-r--r-- | stream/stream_tv.c | 1 | ||||
-rw-r--r-- | stream/tv.c | 4 | ||||
-rw-r--r-- | stream/tv.h | 3 | ||||
-rw-r--r-- | stream/tvi_v4l2.c | 35 |
4 files changed, 42 insertions, 1 deletions
diff --git a/stream/stream_tv.c b/stream/stream_tv.c index 4b3af7be7c..95ba0b97a7 100644 --- a/stream/stream_tv.c +++ b/stream/stream_tv.c @@ -72,6 +72,7 @@ tv_param_t stream_tv_defaults = { 0, //contrast 0, //hue 0, //saturation + -1, //gain NULL, //tdevice 0, //tformat 100, //tpage diff --git a/stream/tv.c b/stream/tv.c index be06149b1e..3315905930 100644 --- a/stream/tv.c +++ b/stream/tv.c @@ -759,6 +759,10 @@ no_audio: tv_set_color_options(tvh, TV_COLOR_SATURATION, tvh->tv_param->saturation); tv_set_color_options(tvh, TV_COLOR_CONTRAST, tvh->tv_param->contrast); + if(tvh->tv_param->gain!=-1) + if(funcs->control(tvh->priv,TVI_CONTROL_VID_SET_GAIN,&tvh->tv_param->gain)!=TVI_CONTROL_TRUE) + mp_msg(MSGT_TV,MSGL_WARN,"Unable to set gain control!\n"); + funcs->control(tvh->priv,TV_VBI_CONTROL_RESET,tvh->tv_param); return demuxer; diff --git a/stream/tv.h b/stream/tv.h index 5e67ef96f6..ff04a901d3 100644 --- a/stream/tv.h +++ b/stream/tv.h @@ -47,6 +47,7 @@ typedef struct tv_param_s { int contrast; int hue; int saturation; + int gain; char *tdevice; ///< teletext device int tformat; ///< teletext display format int tpage; ///< start teletext page @@ -151,6 +152,8 @@ typedef struct { #define TVI_CONTROL_VID_SET_CONTRAST 0x11c #define TVI_CONTROL_VID_GET_PICTURE 0x11d #define TVI_CONTROL_VID_SET_PICTURE 0x11e +#define TVI_CONTROL_VID_SET_GAIN 0x11f +#define TVI_CONTROL_VID_GET_GAIN 0x120 /* TUNER controls */ #define TVI_CONTROL_TUN_GET_FREQ 0x201 diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c index d0d58cbd38..e049d940dd 100644 --- a/stream/tvi_v4l2.c +++ b/stream/tvi_v4l2.c @@ -478,7 +478,6 @@ static int set_mute(priv_t *priv, int value) */ static int set_control(priv_t *priv, struct v4l2_control *control, int val_signed) { struct v4l2_queryctrl qctrl; - qctrl.id = control->id; if (ioctl(priv->video_fd, VIDIOC_QUERYCTRL, &qctrl) < 0) { mp_msg(MSGT_TV, MSGL_ERR, "%s: ioctl query control failed: %s\n", @@ -806,6 +805,40 @@ static int control(priv_t *priv, int cmd, void *arg) control.id = V4L2_CID_SATURATION; control.value = *(int *)arg; return set_control(priv, &control, 1); + case TVI_CONTROL_VID_GET_GAIN: + { + + control.id = V4L2_CID_AUTOGAIN; + if(get_control(priv,&control,0)!=TVI_CONTROL_TRUE) + return TVI_CONTROL_FALSE; + + if(control.value){ //Auto Gain control is enabled + *(int*)arg=0; + return TVI_CONTROL_TRUE; + } + + //Manual Gain control + control.id = V4L2_CID_GAIN; + if(get_control(priv,&control,0)!=TVI_CONTROL_TRUE) + return TVI_CONTROL_FALSE; + + *(int*)arg=control.value?control.value:1; + + return TVI_CONTROL_TRUE; + } + case TVI_CONTROL_VID_SET_GAIN: + { + //value==0 means automatic gain control + int value=*(int*)arg; + + if (value < 0 || value>100) + return TVI_CONTROL_FALSE; + + control.id=value?V4L2_CID_GAIN:V4L2_CID_AUTOGAIN; + control.value=value?value:1; + + return set_control(priv,&control,0); + } case TVI_CONTROL_VID_GET_CONTRAST: control.id = V4L2_CID_CONTRAST; if (get_control(priv, &control, 1) == TVI_CONTROL_TRUE) { |