Fix support for keyframes
This commit is contained in:
parent
885ec79f5b
commit
b21ddd2519
@ -125,6 +125,7 @@ int camera_set_params(camera_t *camera)
|
|||||||
|
|
||||||
device_set_option_string(camera->codec_h264, "video_bitrate_mode", "0");
|
device_set_option_string(camera->codec_h264, "video_bitrate_mode", "0");
|
||||||
device_set_option_string(camera->codec_h264, "video_bitrate", "5000000");
|
device_set_option_string(camera->codec_h264, "video_bitrate", "5000000");
|
||||||
|
device_set_option_string(camera->codec_h264, "repeat_sequence_header", "1");
|
||||||
device_set_option_string(camera->codec_h264, "h264_i_frame_period", "30");
|
device_set_option_string(camera->codec_h264, "h264_i_frame_period", "30");
|
||||||
device_set_option_string(camera->codec_h264, "h264_level", "11");
|
device_set_option_string(camera->codec_h264, "h264_level", "11");
|
||||||
device_set_option_string(camera->codec_h264, "h264_profile", "4");
|
device_set_option_string(camera->codec_h264, "h264_profile", "4");
|
||||||
|
@ -13,6 +13,8 @@ int v4l2_device_open(device_t *dev)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
E_LOG_INFO(dev, "Device path=%s fd=%d opened", dev->path, dev->v4l2.dev_fd);
|
||||||
|
|
||||||
E_LOG_DEBUG(dev, "Querying device capabilities ...");
|
E_LOG_DEBUG(dev, "Querying device capabilities ...");
|
||||||
struct v4l2_capability v4l2_cap;
|
struct v4l2_capability v4l2_cap;
|
||||||
E_XIOCTL(dev, dev->v4l2.dev_fd, VIDIOC_QUERYCAP, &v4l2_cap, "Can't query device capabilities");
|
E_XIOCTL(dev, dev->v4l2.dev_fd, VIDIOC_QUERYCAP, &v4l2_cap, "Can't query device capabilities");
|
||||||
@ -23,8 +25,6 @@ int v4l2_device_open(device_t *dev)
|
|||||||
|
|
||||||
strcpy(dev->bus_info, v4l2_cap.bus_info);
|
strcpy(dev->bus_info, v4l2_cap.bus_info);
|
||||||
dev->v4l2.subdev_fd = v4l2_device_open_v4l2_subdev(dev, 0);
|
dev->v4l2.subdev_fd = v4l2_device_open_v4l2_subdev(dev, 0);
|
||||||
E_LOG_INFO(dev, "Device path=%s fd=%d opened", dev->path, dev->v4l2.dev_fd);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -67,8 +67,9 @@ int v4l2_device_open_v4l2_subdev(device_t *dev, int subdev)
|
|||||||
};
|
};
|
||||||
|
|
||||||
int rc = ioctl(media_fd, MEDIA_IOC_ENUM_ENTITIES, &entity);
|
int rc = ioctl(media_fd, MEDIA_IOC_ENUM_ENTITIES, &entity);
|
||||||
if (rc < 0 && errno == EINVAL)
|
if (rc < 0 && errno == EINVAL) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
@ -79,26 +80,27 @@ int v4l2_device_open_v4l2_subdev(device_t *dev, int subdev)
|
|||||||
sprintf(path, "/sys/dev/char/%d:%d", entity.dev.major, entity.dev.minor);
|
sprintf(path, "/sys/dev/char/%d:%d", entity.dev.major, entity.dev.minor);
|
||||||
|
|
||||||
char link[256];
|
char link[256];
|
||||||
if (readlink(path, link, sizeof(link)) < 0) {
|
if ((rc = readlink(path, link, sizeof(link)-1)) < 0) {
|
||||||
E_LOG_ERROR(dev, "Cannot readlink '%s'", path);
|
E_LOG_ERROR(dev, "Cannot readlink '%s'", path);
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
|
link[rc] = 0;
|
||||||
|
|
||||||
char * last = strrchr(link, '/');
|
char *last = strrchr(link, '/');
|
||||||
if (!last) {
|
if (!last) {
|
||||||
E_LOG_ERROR(dev, "Link '%s' for '%s' does not end with '/'", link, path);
|
E_LOG_ERROR(dev, "Link '%s' for '%s' does not end with '/'", link, path);
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strstr(last, "/v4l-subdev") != last) {
|
if (strstr(last, "/v4l-subdev") != last) {
|
||||||
goto error;
|
E_LOG_ERROR(dev, "Link '%s' does not contain '/v4l-subdev'", link, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(path, "/dev%s", last);
|
sprintf(path, "/dev%s", last);
|
||||||
ret = open(path, O_RDWR);
|
ret = open(path, O_RDWR);
|
||||||
if (ret >= 0) {
|
if (ret < 0) {
|
||||||
E_LOG_INFO(dev, "Opened '%s' (fd=%d)", path, ret);
|
E_LOG_ERROR(dev, "Cannot open '%s' (ret=%d)", path, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
E_LOG_INFO(dev, "Opened '%s' (fd=%d)", path, ret);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user