aboutsummaryrefslogtreecommitdiff
path: root/video.c
diff options
context:
space:
mode:
Diffstat (limited to 'video.c')
-rw-r--r--video.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/video.c b/video.c
index 12e79fa..3440390 100644
--- a/video.c
+++ b/video.c
@@ -61,8 +61,7 @@ int video_open(struct instance *i, char *name)
info("caps (%s): driver=\"%s\" bus_info=\"%s\" card=\"%s\" fd=0x%x",
name, cap.driver, cap.bus_info, cap.card, i->video.fd);
- if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE) ||
- !(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE) ||
+ if (!(cap.capabilities & V4L2_CAP_VIDEO_M2M_MPLANE) ||
!(cap.capabilities & V4L2_CAP_STREAMING)) {
err("Insufficient capabilities for video device (is %s correct?)",
name);
@@ -83,7 +82,7 @@ int video_set_control(struct instance *i)
struct v4l2_control cntrl;
int ret;
- parm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+ parm.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
parm.parm.output.timeperframe.numerator = 1;
parm.parm.output.timeperframe.denominator = 30;
@@ -93,7 +92,7 @@ int video_set_control(struct instance *i)
err("set framerate (%s)", strerror(errno));
cntrl.id = V4L2_CID_MPEG_VIDEO_BITRATE;
- cntrl.value = 5 * 1024 * 1024;
+ cntrl.value = 10 * 1024 * 1024;
info("setting bitrate: %u", cntrl.value);
ret = ioctl(i->video.fd, VIDIOC_S_CTRL, &cntrl);
@@ -124,12 +123,25 @@ int video_set_control(struct instance *i)
ctrl[c].value = V4L2_MPEG_VIDEO_H264_LEVEL_5_0;
c++;
- ctrl[c].id = V4L2_CID_MPEG_VIDC_VIDEO_NUM_B_FRAMES;
+// ctrl[c].id = V4L2_CID_MPEG_VIDEO_BITRATE_MODE;
+// ctrl[c].value = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR;
+// c++;
+
+ ctrl[c].id = V4L2_CID_MPEG_VIDEO_GOP_SIZE;
ctrl[c].value = 1;
c++;
+ /* intra_period = pframes + bframes + 1
+ * bframes/pframes must be integer
+ *
+ */
+
+ ctrl[c].id = V4L2_CID_MPEG_VIDEO_B_FRAMES;
+ ctrl[c].value = 0;
+ c++;
+
ctrl[c].id = V4L2_CID_MPEG_VIDC_VIDEO_NUM_P_FRAMES;
- ctrl[c].value = 2 * 30 - 1;
+ ctrl[c].value = 29;//2 * 15 - 1;
c++;
ctrls.count = c;