Skip to content
Snippets Groups Projects
Commit 15fc3fee authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot
Browse files

libv4lplugins: Report H264 Main profile only is supported

RK3399 supports H264 Base, Main and High profiles. However,
libv4lplugins support Main profile only. So, in the plugin layer,
it needs to interrupt the IOCTL and report H264 Main profile only
is supported.

BUG=b:145095115
TEST=android.media.cts.MediaRecorderTest#testProfileAvcBaselineLevel1

Change-Id: I6b050c99474a97c535b38ba6896c147728a3be25
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/libv4lplugins/+/1958319


Tested-by: default avatarHirokazu Honda <hiroh@chromium.org>
Auto-Submit: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarChih-Yu Huang <akahuang@chromium.org>
Reviewed-by: default avatarAlexandre Courbot <acourbot@chromium.org>
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
parent 0d925387
No related branches found
No related tags found
No related merge requests found
......@@ -162,6 +162,10 @@ static int ioctl_reqbufs_locked(struct encoder_context *ctx, int fd,
struct v4l2_requestbuffers *reqbufs);
static int ioctl_encoder_cmd_locked(struct encoder_context *ctx, int fd,
struct v4l2_encoder_cmd *argp);
static int ioctl_querymenu_locked(struct encoder_context *ctx, int fd,
struct v4l2_querymenu *argp);
static int ioctl_queryctrl_locked(struct encoder_context *ctx, int fd,
struct v4l2_queryctrl *argp);
/* Helper functions to manipulate the pending buffer queue. */
......@@ -313,6 +317,14 @@ static int plugin_ioctl(void *dev_ops_priv, int fd,
ret = ioctl_encoder_cmd_locked(ctx, fd, arg);
break;
case VIDIOC_QUERYCTRL:
ret = ioctl_queryctrl_locked(ctx, fd, arg);
break;
case VIDIOC_QUERYMENU:
ret = ioctl_querymenu_locked(ctx, fd, arg);
break;
default:
ret = SYS_IOCTL(fd, cmd, arg);
break;
......@@ -633,6 +645,43 @@ static int ioctl_encoder_cmd_locked(struct encoder_context *ctx, int fd,
return SYS_IOCTL(fd, VIDIOC_ENCODER_CMD, argp);
}
static int ioctl_querymenu_locked(struct encoder_context *ctx, int fd,
struct v4l2_querymenu *argp)
{
if (argp->id == V4L2_CID_MPEG_VIDEO_H264_PROFILE) {
/*
* Return invalid unless the queried h264 profile is Main. The
* hardware supports H264 Base, Main, High profile, but this
* plugin supports Main profile only because Main profile is
* hard-coded in h264e_init_sps().
*/
if (argp->index == V4L2_MPEG_VIDEO_H264_PROFILE_MAIN)
return 0;
return -EINVAL;
}
return SYS_IOCTL(fd, VIDIOC_QUERYMENU, argp);
}
static int ioctl_queryctrl_locked(struct encoder_context *ctx, int fd,
struct v4l2_queryctrl *argp)
{
if (argp->id == V4L2_CID_MPEG_VIDEO_H264_PROFILE) {
/*
* Filter out other H264 profiles than Main profile. The
* hardware supports H264 Base, Main, High profile, but this
* plugin supports Main profile only because Main profile is
* hard-coded in h264e_init_sps().
*/
argp->type = V4L2_CTRL_TYPE_MENU;
argp->minimum = argp->maximum = argp->default_value =
V4L2_MPEG_VIDEO_H264_PROFILE_MAIN;
argp->step = 1;
return 0;
}
return SYS_IOCTL(fd, VIDIOC_QUERYMENU, argp);
}
bool is_rockchip_encoder(int fd) {
struct v4l2_capability cap;
memset(&cap, 0, sizeof(cap));
......@@ -863,6 +912,10 @@ static const char* v4l_cmd2str(unsigned long int cmd)
return "VIDIOC_QUERYBUF";
case VIDIOC_ENCODER_CMD:
return "VIDIOC_ENCODER_CMD";
case VIDIOC_QUERYMENU:
return "VIDIOC_QUERYMENU";
case VIDIOC_QUERYCTRL:
return "VIDIOC_QUERYCTRL";
default:
return "UNKNOWN";
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment