Re: [PATCH 14/18] media: allegro: handle dependency of bitrate and bitrate_peak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/17/20 4:13 PM, Michael Tretter wrote:
> The peak bitrate must not be smaller than the configured bitrate. Update
> the other control whenever one of the controls changes to reflect this
> dependency.
> 
> Signed-off-by: Michael Tretter <m.tretter@xxxxxxxxxxxxxx>
> ---
>  drivers/staging/media/allegro-dvt/allegro-core.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/staging/media/allegro-dvt/allegro-core.c b/drivers/staging/media/allegro-dvt/allegro-core.c
> index 8c26158eab93..cedb09ea649f 100644
> --- a/drivers/staging/media/allegro-dvt/allegro-core.c
> +++ b/drivers/staging/media/allegro-dvt/allegro-core.c
> @@ -2403,9 +2403,15 @@ static int allegro_s_ctrl(struct v4l2_ctrl *ctrl)
>  		break;
>  	case V4L2_CID_MPEG_VIDEO_BITRATE:
>  		channel->bitrate = ctrl->val;
> +		if (channel->bitrate > channel->bitrate_peak)
> +			__v4l2_ctrl_s_ctrl(channel->mpeg_video_bitrate_peak,
> +					   channel->bitrate);
>  		break;
>  	case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK:
>  		channel->bitrate_peak = ctrl->val;
> +		if (channel->bitrate_peak < channel->bitrate)
> +			__v4l2_ctrl_s_ctrl(channel->mpeg_video_bitrate,
> +					   channel->bitrate_peak);
>  		break;
>  	case V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE:
>  		channel->cpb_size = ctrl->val;
> 

In the case of controls that are depend on one another you use a
control cluster and implement try_ctrl. See e.g. drivers/media/usb/hdpvr/hdpvr-video.c
which does the same thing.

Documentation on control clusters is here:

https://hverkuil.home.xs4all.nl/spec/kapi/v4l2-controls.html#control-clusters

Regards,

	Hans



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux