diff options
author | Michael Tretter <m.tretter@pengutronix.de> | 2020-03-16 18:26:33 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-03-20 11:25:11 +0300 |
commit | d71f12225d4635000e9491af65b600f05512de60 (patch) | |
tree | ea8998d442721eb19e00c8a90f1eac23189ae50c /drivers/staging/media/allegro-dvt | |
parent | 80c8449fc71c807e488709ffb5fb0e3182c95c52 (diff) | |
download | linux-d71f12225d4635000e9491af65b600f05512de60.tar.xz |
media: allegro: read bitrate mode directly from control
There is no need to copy the bitrate mode to a field in the channel and
the value can be read directly from the control.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/staging/media/allegro-dvt')
-rw-r--r-- | drivers/staging/media/allegro-dvt/allegro-core.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/staging/media/allegro-dvt/allegro-core.c b/drivers/staging/media/allegro-dvt/allegro-core.c index ffcfedff729b..0e2e862e55a8 100644 --- a/drivers/staging/media/allegro-dvt/allegro-core.c +++ b/drivers/staging/media/allegro-dvt/allegro-core.c @@ -197,7 +197,6 @@ struct allegro_channel { unsigned int sizeimage_encoded; unsigned int csequence; - enum v4l2_mpeg_video_bitrate_mode bitrate_mode; bool frame_rc_enable; unsigned int bitrate; unsigned int bitrate_peak; @@ -1119,6 +1118,7 @@ static int allegro_mcu_send_create_channel(struct allegro_dev *dev, int i_frame_qp = v4l2_ctrl_g_ctrl(channel->mpeg_video_h264_i_frame_qp); int p_frame_qp = v4l2_ctrl_g_ctrl(channel->mpeg_video_h264_p_frame_qp); int b_frame_qp = v4l2_ctrl_g_ctrl(channel->mpeg_video_h264_b_frame_qp); + int bitrate_mode = v4l2_ctrl_g_ctrl(channel->mpeg_video_bitrate_mode); memset(&msg, 0, sizeof(msg)); @@ -1156,7 +1156,7 @@ static int allegro_mcu_send_create_channel(struct allegro_dev *dev, if (channel->frame_rc_enable) msg.rate_control_mode = - v4l2_bitrate_mode_to_mcu_mode(channel->bitrate_mode); + v4l2_bitrate_mode_to_mcu_mode(bitrate_mode); else msg.rate_control_mode = 0; @@ -2224,7 +2224,6 @@ static void allegro_set_default_params(struct allegro_channel *channel) channel->sizeimage_encoded = estimate_stream_size(channel->width, channel->height); - channel->bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_CBR; channel->bitrate = maximum_bitrate(channel->level); channel->bitrate_peak = maximum_bitrate(channel->level); channel->cpb_size = maximum_cpb_size(channel->level); @@ -2422,9 +2421,6 @@ static int allegro_s_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE: channel->frame_rc_enable = ctrl->val; break; - case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: - channel->bitrate_mode = ctrl->val; - break; case V4L2_CID_MPEG_VIDEO_BITRATE: channel->bitrate = ctrl->val; break; @@ -2520,7 +2516,7 @@ static int allegro_open(struct file *file) &allegro_ctrl_ops, V4L2_CID_MPEG_VIDEO_BITRATE_MODE, V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, 0, - channel->bitrate_mode); + V4L2_MPEG_VIDEO_BITRATE_MODE_CBR); channel->mpeg_video_bitrate = v4l2_ctrl_new_std(handler, &allegro_ctrl_ops, V4L2_CID_MPEG_VIDEO_BITRATE, |