diff options
author | Steven Toth <stoth@kernellabs.com> | 2010-07-31 13:59:38 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-21 05:54:46 -0400 |
commit | 968b11b20143036098a7013817a15615a54383d3 (patch) | |
tree | 8b0f946481d9ceeb2a8bee47aae5b6d8355c687b /drivers/media/video/saa7164/saa7164-encoder.c | |
parent | 3ed43cf96aa9fc565d74855649d8cee0def67f38 (diff) |
[media] saa7164: implement encoder peak bitrate feature
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7164/saa7164-encoder.c')
-rw-r--r-- | drivers/media/video/saa7164/saa7164-encoder.c | 17 |
1 files changed, 17 insertions, 0 deletions
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[] = { | |||
47 | V4L2_CID_MPEG_AUDIO_MUTE, | 47 | V4L2_CID_MPEG_AUDIO_MUTE, |
48 | V4L2_CID_MPEG_VIDEO_BITRATE_MODE, | 48 | V4L2_CID_MPEG_VIDEO_BITRATE_MODE, |
49 | V4L2_CID_MPEG_VIDEO_BITRATE, | 49 | V4L2_CID_MPEG_VIDEO_BITRATE, |
50 | V4L2_CID_MPEG_VIDEO_BITRATE_PEAK, | ||
50 | V4L2_CID_MPEG_VIDEO_B_FRAMES, | 51 | V4L2_CID_MPEG_VIDEO_B_FRAMES, |
51 | 0 | 52 | 0 |
52 | }; | 53 | }; |
@@ -387,6 +388,9 @@ static int saa7164_get_ctrl(struct saa7164_port *port, | |||
387 | case V4L2_CID_MPEG_VIDEO_B_FRAMES: | 388 | case V4L2_CID_MPEG_VIDEO_B_FRAMES: |
388 | ctrl->value = params->refdist; | 389 | ctrl->value = params->refdist; |
389 | break; | 390 | break; |
391 | case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: | ||
392 | ctrl->value = params->bitrate_peak; | ||
393 | break; | ||
390 | default: | 394 | default: |
391 | return -EINVAL; | 395 | return -EINVAL; |
392 | } | 396 | } |
@@ -456,6 +460,11 @@ static int saa7164_try_ctrl(struct v4l2_ext_control *ctrl, int ac3) | |||
456 | (ctrl->value <= 3)) | 460 | (ctrl->value <= 3)) |
457 | ret = 0; | 461 | ret = 0; |
458 | break; | 462 | break; |
463 | case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: | ||
464 | if ((ctrl->value >= ENCODER_MIN_BITRATE) && | ||
465 | (ctrl->value <= ENCODER_MAX_BITRATE)) | ||
466 | ret = 0; | ||
467 | break; | ||
459 | default: | 468 | default: |
460 | ret = -EINVAL; | 469 | ret = -EINVAL; |
461 | } | 470 | } |
@@ -521,6 +530,9 @@ static int saa7164_set_ctrl(struct saa7164_port *port, | |||
521 | case V4L2_CID_MPEG_VIDEO_B_FRAMES: | 530 | case V4L2_CID_MPEG_VIDEO_B_FRAMES: |
522 | params->refdist = ctrl->value; | 531 | params->refdist = ctrl->value; |
523 | break; | 532 | break; |
533 | case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: | ||
534 | params->bitrate_peak = ctrl->value; | ||
535 | break; | ||
524 | default: | 536 | default: |
525 | return -EINVAL; | 537 | return -EINVAL; |
526 | } | 538 | } |
@@ -698,6 +710,10 @@ static int fill_queryctrl(struct saa7164_encoder_params *params, | |||
698 | case V4L2_CID_MPEG_VIDEO_B_FRAMES: | 710 | case V4L2_CID_MPEG_VIDEO_B_FRAMES: |
699 | return v4l2_ctrl_query_fill(c, | 711 | return v4l2_ctrl_query_fill(c, |
700 | 1, 3, 1, 1); | 712 | 1, 3, 1, 1); |
713 | case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: | ||
714 | return v4l2_ctrl_query_fill(c, | ||
715 | ENCODER_MIN_BITRATE, ENCODER_MAX_BITRATE, | ||
716 | 100000, ENCODER_DEF_BITRATE); | ||
701 | default: | 717 | default: |
702 | return -EINVAL; | 718 | return -EINVAL; |
703 | } | 719 | } |
@@ -1318,6 +1334,7 @@ int saa7164_encoder_register(struct saa7164_port *port) | |||
1318 | port->ctl_saturation = 62; | 1334 | port->ctl_saturation = 62; |
1319 | port->ctl_sharpness = 8; | 1335 | port->ctl_sharpness = 8; |
1320 | port->encoder_params.bitrate = ENCODER_DEF_BITRATE; | 1336 | port->encoder_params.bitrate = ENCODER_DEF_BITRATE; |
1337 | port->encoder_params.bitrate_peak = ENCODER_DEF_BITRATE; | ||
1321 | port->encoder_params.bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR; | 1338 | port->encoder_params.bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR; |
1322 | port->encoder_params.stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS; | 1339 | port->encoder_params.stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS; |
1323 | port->encoder_params.ctl_mute = 0; | 1340 | port->encoder_params.ctl_mute = 0; |