aboutsummaryrefslogtreecommitdiff
path: root/video.c
diff options
context:
space:
mode:
Diffstat (limited to 'video.c')
-rw-r--r--video.c44
1 files changed, 42 insertions, 2 deletions
diff --git a/video.c b/video.c
index 8eafcc6..013fd30 100644
--- a/video.c
+++ b/video.c
@@ -88,7 +88,7 @@ int video_set_control(struct instance *i)
ret = ioctl(i->video.fd, VIDIOC_S_PARM, &parm);
if (ret)
err("set framerate (%s)", strerror(errno));
-
+#if 0
cntrl.id = V4L2_CID_MPEG_VIDEO_H264_PROFILE;
cntrl.value = V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE;
@@ -104,7 +104,7 @@ int video_set_control(struct instance *i)
ret = ioctl(i->video.fd, VIDIOC_S_CTRL, &cntrl);
if (ret)
err("set control - level (%s)", strerror(errno));
-
+#endif
cntrl.id = V4L2_CID_MPEG_VIDEO_BITRATE;
cntrl.value = 64000;
@@ -113,6 +113,46 @@ int video_set_control(struct instance *i)
if (ret)
err("set control - bitrate (%s)", strerror(errno));
+ cntrl.id = V4L2_CID_MPEG_VIDC_VIDEO_H264_VUI_TIMING_INFO;
+ cntrl.value = V4L2_MPEG_VIDC_VIDEO_H264_VUI_TIMING_INFO_ENABLED;
+
+ ret = ioctl(i->video.fd, VIDIOC_S_CTRL, &cntrl);
+ if (ret)
+ err("set control - vui timing info (%s)", strerror(errno));
+
+ {
+ struct v4l2_ext_controls ctrls;
+ struct v4l2_ext_control ctrl[32];
+ int c = 0;
+
+ memset (&ctrls, 0, sizeof(ctrls));
+ ctrls.controls = ctrl;
+ ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG;
+
+ ctrl[c].id = V4L2_CID_MPEG_VIDEO_H264_PROFILE;
+ ctrl[c].value = V4L2_MPEG_VIDEO_H264_PROFILE_HIGH;
+ c++;
+
+ ctrl[c].id = V4L2_CID_MPEG_VIDEO_H264_LEVEL;
+ ctrl[c].value = V4L2_MPEG_VIDEO_H264_LEVEL_3_0;
+ c++;
+
+ ctrl[c].id = V4L2_CID_MPEG_VIDC_VIDEO_NUM_B_FRAMES;
+ ctrl[c].value = 1;
+ c++;
+
+ ctrl[c].id = V4L2_CID_MPEG_VIDC_VIDEO_NUM_P_FRAMES;
+ ctrl[c].value = 2 * 30 - 1;
+ c++;
+
+ ctrls.count = c;
+
+ ret = ioctl(i->video.fd, VIDIOC_S_EXT_CTRLS, &ctrls);
+ if (ret)
+ err("set ext control - profile/level (%s)",
+ strerror(errno));
+ }
+
return 0;
}