diff options
-rw-r--r-- | drivers/media/video/saa7164/saa7164-api.c | 2 | ||||
-rw-r--r-- | drivers/media/video/saa7164/saa7164-encoder.c | 17 | ||||
-rw-r--r-- | drivers/media/video/saa7164/saa7164.h | 1 |
3 files changed, 19 insertions, 1 deletions
diff --git a/drivers/media/video/saa7164/saa7164-api.c b/drivers/media/video/saa7164/saa7164-api.c index 34ac6483c735..54568cfe933d 100644 --- a/drivers/media/video/saa7164/saa7164-api.c +++ b/drivers/media/video/saa7164/saa7164-api.c @@ -64,7 +64,7 @@ int saa7164_api_set_encoder(struct saa7164_port *port) else vb.ucVideoBitRateMode = EU_VIDEO_BIT_RATE_MODE_VARIABLE_PEAK; vb.dwVideoBitRate = port->encoder_params.bitrate; - vb.dwVideoBitRatePeak = vb.dwVideoBitRate; + vb.dwVideoBitRatePeak = port->encoder_params.bitrate_peak; ret = saa7164_cmd_send(port->dev, port->hwcfg.sourceid, SET_CUR, EU_VIDEO_BIT_RATE_CONTROL, sizeof(tmComResEncVideoBitRate_t), &vb); if (ret != SAA_OK) diff --git a/drivers/media/video/saa7164/saa7164-encoder.c b/drivers/media/video/saa7164/saa7164-encoder.c index 5cab46654157..c1265b821b2b 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_BITRATE_PEAK, V4L2_CID_MPEG_VIDEO_B_FRAMES, 0 }; @@ -387,6 +388,9 @@ static int saa7164_get_ctrl(struct saa7164_port *port, case V4L2_CID_MPEG_VIDEO_B_FRAMES: ctrl->value = params->refdist; break; + case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: + ctrl->value = params->bitrate_peak; + break; default: return -EINVAL; } @@ -456,6 +460,11 @@ static int saa7164_try_ctrl(struct v4l2_ext_control *ctrl, int ac3) (ctrl->value <= 3)) ret = 0; break; + case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: + if ((ctrl->value >= ENCODER_MIN_BITRATE) && + (ctrl->value <= ENCODER_MAX_BITRATE)) + ret = 0; + break; default: ret = -EINVAL; } @@ -521,6 +530,9 @@ static int saa7164_set_ctrl(struct saa7164_port *port, case V4L2_CID_MPEG_VIDEO_B_FRAMES: params->refdist = ctrl->value; break; + case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: + params->bitrate_peak = ctrl->value; + break; default: return -EINVAL; } @@ -698,6 +710,10 @@ static int fill_queryctrl(struct saa7164_encoder_params *params, case V4L2_CID_MPEG_VIDEO_B_FRAMES: return v4l2_ctrl_query_fill(c, 1, 3, 1, 1); + case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: + return v4l2_ctrl_query_fill(c, + ENCODER_MIN_BITRATE, ENCODER_MAX_BITRATE, + 100000, ENCODER_DEF_BITRATE); default: return -EINVAL; } @@ -1318,6 +1334,7 @@ int saa7164_encoder_register(struct saa7164_port *port) port->ctl_saturation = 62; port->ctl_sharpness = 8; port->encoder_params.bitrate = ENCODER_DEF_BITRATE; + port->encoder_params.bitrate_peak = ENCODER_DEF_BITRATE; port->encoder_params.bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR; port->encoder_params.stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS; port->encoder_params.ctl_mute = 0; diff --git a/drivers/media/video/saa7164/saa7164.h b/drivers/media/video/saa7164/saa7164.h index 1d9c4e358e72..dade968af0cd 100644 --- a/drivers/media/video/saa7164/saa7164.h +++ b/drivers/media/video/saa7164/saa7164.h @@ -255,6 +255,7 @@ struct saa7164_encoder_params { u32 width; u32 is_50hz; u32 bitrate; /* bps */ + u32 bitrate_peak; /* bps */ u32 bitrate_mode; u32 stream_type; /* V4L2_MPEG_STREAM_TYPE_MPEG2_TS */ |