mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 17:41:50 +00:00
media: v4l2-ctrl: Validate VP8 stateless decoder controls
Only one field needs to be validated: 'num_dct_parts'. This field is used to iterate over the user-provided array 'dct_part_sizes'. Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> [hverkuil-cisco@xs4all.nl: s -> (s) in zero_padding macro] Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
a57d6acaf3
commit
298c62d385
1 changed files with 21 additions and 0 deletions
|
@ -1633,10 +1633,15 @@ static void std_log(const struct v4l2_ctrl *ctrl)
|
||||||
})
|
})
|
||||||
|
|
||||||
/* Validate a new control */
|
/* Validate a new control */
|
||||||
|
|
||||||
|
#define zero_padding(s) \
|
||||||
|
memset(&(s).padding, 0, sizeof((s).padding))
|
||||||
|
|
||||||
static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
|
static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
|
||||||
union v4l2_ctrl_ptr ptr)
|
union v4l2_ctrl_ptr ptr)
|
||||||
{
|
{
|
||||||
struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params;
|
struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params;
|
||||||
|
struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header;
|
||||||
void *p = ptr.p + idx * ctrl->elem_size;
|
void *p = ptr.p + idx * ctrl->elem_size;
|
||||||
|
|
||||||
switch ((u32)ctrl->type) {
|
switch ((u32)ctrl->type) {
|
||||||
|
@ -1696,6 +1701,22 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case V4L2_CTRL_TYPE_VP8_FRAME_HEADER:
|
case V4L2_CTRL_TYPE_VP8_FRAME_HEADER:
|
||||||
|
p_vp8_frame_header = p;
|
||||||
|
|
||||||
|
switch (p_vp8_frame_header->num_dct_parts) {
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
case 4:
|
||||||
|
case 8:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
zero_padding(p_vp8_frame_header->segment_header);
|
||||||
|
zero_padding(p_vp8_frame_header->lf_header);
|
||||||
|
zero_padding(p_vp8_frame_header->quant_header);
|
||||||
|
zero_padding(p_vp8_frame_header->entropy_header);
|
||||||
|
zero_padding(p_vp8_frame_header->coder_state);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue