aboutsummaryrefslogtreecommitdiff
path: root/video.c
diff options
context:
space:
mode:
Diffstat (limited to 'video.c')
-rw-r--r--video.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/video.c b/video.c
index e655a38..a5e1a95 100644
--- a/video.c
+++ b/video.c
@@ -226,7 +226,6 @@ int video_set_control(struct instance *i)
if (i->num_bframes && i->num_bframes < 4) {
memset(&cntrl, 0, sizeof(cntrl));
cntrl.id = V4L2_CID_MPEG_VIDEO_B_FRAMES;
-// cntrl.value = 1;
cntrl.value = i->num_bframes;
info("setting num b frames: %u", cntrl.value);
ret = ioctl(i->video.fd, VIDIOC_S_CTRL, &cntrl);
@@ -236,6 +235,29 @@ int video_set_control(struct instance *i)
}
}
+ if (i->codec == V4L2_PIX_FMT_HEVC) {
+ if (i->num_bframes && i->num_bframes < 4) {
+ memset(&cntrl, 0, sizeof(cntrl));
+ cntrl.id = V4L2_CID_MPEG_VIDEO_B_FRAMES;
+ cntrl.value = i->num_bframes;
+ info("setting num b frames: %u", cntrl.value);
+ ret = ioctl(i->video.fd, VIDIOC_S_CTRL, &cntrl);
+ if (ret)
+ err("set control - num b frames (%s)",
+ strerror(errno));
+ }
+ }
+
+ if (i->codec == V4L2_PIX_FMT_VP8) {
+ memset(&cntrl, 0, sizeof(cntrl));
+ cntrl.id = V4L2_CID_MPEG_VIDEO_VPX_PROFILE;
+ cntrl.value = 2;
+ info("setting VP8 profile: %u", cntrl.value);
+ ret = ioctl(i->video.fd, VIDIOC_S_CTRL, &cntrl);
+ if (ret)
+ err("set control - profile (%s)", strerror(errno));
+ }
+
#if 0
struct v4l2_ext_controls ctrls;
struct v4l2_ext_control ctrl[32];
@@ -435,7 +457,8 @@ int video_dequeue_output(struct instance *i, unsigned int *n)
}
int video_dequeue_capture(struct instance *i, unsigned int *n,
- unsigned int *finished, unsigned int *bytesused)
+ unsigned int *finished, unsigned int *bytesused,
+ unsigned int *data_offset, unsigned int *buf_flags)
{
struct v4l2_buffer buf;
struct v4l2_plane planes[CAP_PLANES];
@@ -456,6 +479,10 @@ int video_dequeue_capture(struct instance *i, unsigned int *n,
*bytesused = buf.m.planes[0].bytesused;
*n = buf.index;
+ *data_offset = buf.m.planes[0].data_offset;
+
+ if (buf_flags)
+ *buf_flags = buf.flags;
return 0;
}