summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7164
diff options
context:
space:
mode:
authorSteven Toth <stoth@kernellabs.com>2010-07-31 14:58:35 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-21 07:54:45 -0200
commit3ed43cf96aa9fc565d74855649d8cee0def67f38 (patch)
tree52d4a9d03c1ef4456574e373eab56ce3d74e646b /drivers/media/video/saa7164
parent2600d71cc535907e5d95cd31751c587afc370065 (diff)
downloadtalos-obmc-linux-3ed43cf96aa9fc565d74855649d8cee0def67f38.tar.gz
talos-obmc-linux-3ed43cf96aa9fc565d74855649d8cee0def67f38.zip
[media] saa7164: allow the IBP reference distance to be configurable
Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7164')
-rw-r--r--drivers/media/video/saa7164/saa7164-api.c2
-rw-r--r--drivers/media/video/saa7164/saa7164-encoder.c16
-rw-r--r--drivers/media/video/saa7164/saa7164.h1
3 files changed, 18 insertions, 1 deletions
diff --git a/drivers/media/video/saa7164/saa7164-api.c b/drivers/media/video/saa7164/saa7164-api.c
index fec5138737e0..34ac6483c735 100644
--- a/drivers/media/video/saa7164/saa7164-api.c
+++ b/drivers/media/video/saa7164/saa7164-api.c
@@ -32,7 +32,7 @@ int saa7164_api_set_gop_size(struct saa7164_port *port)
dprintk(DBGLVL_ENC, "%s()\n", __func__);
- gs.ucRefFrameDist = SAA7164_ENCODER_DEFAULT_GOP_DIST;
+ gs.ucRefFrameDist = port->encoder_params.refdist;
gs.ucGOPSize = SAA7164_ENCODER_DEFAULT_GOP_SIZE;
ret = saa7164_cmd_send(port->dev, port->hwcfg.sourceid, SET_CUR,
EU_VIDEO_GOP_STRUCTURE_CONTROL,
diff --git a/drivers/media/video/saa7164/saa7164-encoder.c b/drivers/media/video/saa7164/saa7164-encoder.c
index d7d2fe009ff9..5cab46654157 100644
--- a/drivers/media/video/saa7164/saa7164-encoder.c
+++ b/drivers/media/video/saa7164/saa7164-encoder.c
@@ -47,6 +47,7 @@ static const u32 saa7164_v4l2_ctrls[] = {
V4L2_CID_MPEG_AUDIO_MUTE,
V4L2_CID_MPEG_VIDEO_BITRATE_MODE,
V4L2_CID_MPEG_VIDEO_BITRATE,
+ V4L2_CID_MPEG_VIDEO_B_FRAMES,
0
};
@@ -383,6 +384,9 @@ static int saa7164_get_ctrl(struct saa7164_port *port,
case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
ctrl->value = params->bitrate_mode;
break;
+ case V4L2_CID_MPEG_VIDEO_B_FRAMES:
+ ctrl->value = params->refdist;
+ break;
default:
return -EINVAL;
}
@@ -447,6 +451,11 @@ static int saa7164_try_ctrl(struct v4l2_ext_control *ctrl, int ac3)
(ctrl->value == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR))
ret = 0;
break;
+ case V4L2_CID_MPEG_VIDEO_B_FRAMES:
+ if ((ctrl->value >= 1) &&
+ (ctrl->value <= 3))
+ ret = 0;
+ break;
default:
ret = -EINVAL;
}
@@ -509,6 +518,9 @@ static int saa7164_set_ctrl(struct saa7164_port *port,
case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
params->bitrate_mode = ctrl->value;
break;
+ case V4L2_CID_MPEG_VIDEO_B_FRAMES:
+ params->refdist = ctrl->value;
+ break;
default:
return -EINVAL;
}
@@ -683,6 +695,9 @@ static int fill_queryctrl(struct saa7164_encoder_params *params,
return v4l2_ctrl_query_fill(c,
V4L2_MPEG_VIDEO_BITRATE_MODE_VBR, V4L2_MPEG_VIDEO_BITRATE_MODE_CBR,
1, V4L2_MPEG_VIDEO_BITRATE_MODE_VBR);
+ case V4L2_CID_MPEG_VIDEO_B_FRAMES:
+ return v4l2_ctrl_query_fill(c,
+ 1, 3, 1, 1);
default:
return -EINVAL;
}
@@ -1307,6 +1322,7 @@ int saa7164_encoder_register(struct saa7164_port *port)
port->encoder_params.stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS;
port->encoder_params.ctl_mute = 0;
port->encoder_params.ctl_aspect = V4L2_MPEG_VIDEO_ASPECT_4x3;
+ port->encoder_params.refdist = 1;
if (port->encodernorm.id & V4L2_STD_525_60)
port->height = 480;
diff --git a/drivers/media/video/saa7164/saa7164.h b/drivers/media/video/saa7164/saa7164.h
index 712f762d9f73..1d9c4e358e72 100644
--- a/drivers/media/video/saa7164/saa7164.h
+++ b/drivers/media/video/saa7164/saa7164.h
@@ -261,6 +261,7 @@ struct saa7164_encoder_params {
u32 audio_sampling_freq;
u32 ctl_mute;
u32 ctl_aspect;
+ u32 refdist;
};
struct saa7164_port;
OpenPOWER on IntegriCloud