media: vicodec: fix g_selection: either handle crop or compose
The logic of g_selection was wrong: encoders support crop, decoders support compose, but the code allowed both. 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
7243e5a06e
commit
fb56f4be05
|
@ -952,11 +952,25 @@ static int vidioc_g_selection(struct file *file, void *priv,
|
||||||
* encoder supports only cropping on the OUTPUT buffer
|
* encoder supports only cropping on the OUTPUT buffer
|
||||||
* decoder supports only composing on the CAPTURE buffer
|
* decoder supports only composing on the CAPTURE buffer
|
||||||
*/
|
*/
|
||||||
if ((ctx->is_enc && s->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) ||
|
if (ctx->is_enc && s->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
|
||||||
(!ctx->is_enc && s->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)) {
|
switch (s->target) {
|
||||||
|
case V4L2_SEL_TGT_CROP:
|
||||||
|
s->r.left = 0;
|
||||||
|
s->r.top = 0;
|
||||||
|
s->r.width = q_data->visible_width;
|
||||||
|
s->r.height = q_data->visible_height;
|
||||||
|
return 0;
|
||||||
|
case V4L2_SEL_TGT_CROP_DEFAULT:
|
||||||
|
case V4L2_SEL_TGT_CROP_BOUNDS:
|
||||||
|
s->r.left = 0;
|
||||||
|
s->r.top = 0;
|
||||||
|
s->r.width = q_data->coded_width;
|
||||||
|
s->r.height = q_data->coded_height;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} else if (!ctx->is_enc && s->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
|
||||||
switch (s->target) {
|
switch (s->target) {
|
||||||
case V4L2_SEL_TGT_COMPOSE:
|
case V4L2_SEL_TGT_COMPOSE:
|
||||||
case V4L2_SEL_TGT_CROP:
|
|
||||||
s->r.left = 0;
|
s->r.left = 0;
|
||||||
s->r.top = 0;
|
s->r.top = 0;
|
||||||
s->r.width = q_data->visible_width;
|
s->r.width = q_data->visible_width;
|
||||||
|
@ -964,8 +978,6 @@ static int vidioc_g_selection(struct file *file, void *priv,
|
||||||
return 0;
|
return 0;
|
||||||
case V4L2_SEL_TGT_COMPOSE_DEFAULT:
|
case V4L2_SEL_TGT_COMPOSE_DEFAULT:
|
||||||
case V4L2_SEL_TGT_COMPOSE_BOUNDS:
|
case V4L2_SEL_TGT_COMPOSE_BOUNDS:
|
||||||
case V4L2_SEL_TGT_CROP_DEFAULT:
|
|
||||||
case V4L2_SEL_TGT_CROP_BOUNDS:
|
|
||||||
s->r.left = 0;
|
s->r.left = 0;
|
||||||
s->r.top = 0;
|
s->r.top = 0;
|
||||||
s->r.width = q_data->coded_width;
|
s->r.width = q_data->coded_width;
|
||||||
|
|
Loading…
Reference in New Issue