Skip to content
Snippets Groups Projects
Commit a6bb42c3 authored by fryshorts's avatar fryshorts
Browse files

Display emulated formats as such in v4l2 plugin.

Formats that are emulated by v4l2 are marked by appending
"(Emulated)" to them.
parent 9a573bb4
No related branches found
No related tags found
No related merge requests found
...@@ -407,23 +407,30 @@ static void v4l2_format_list(int dev, obs_property_t prop) ...@@ -407,23 +407,30 @@ static void v4l2_format_list(int dev, obs_property_t prop)
struct v4l2_fmtdesc fmt; struct v4l2_fmtdesc fmt;
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
fmt.index = 0; fmt.index = 0;
struct dstr buffer;
dstr_init(&buffer);
obs_property_list_clear(prop); obs_property_list_clear(prop);
while (v4l2_ioctl(dev, VIDIOC_ENUM_FMT, &fmt) == 0) { while (v4l2_ioctl(dev, VIDIOC_ENUM_FMT, &fmt) == 0) {
dstr_copy(&buffer, (char *) fmt.description);
if (fmt.flags & V4L2_FMT_FLAG_EMULATED)
dstr_cat(&buffer, " (Emulated)");
if (v4l2_to_obs_video_format(fmt.pixelformat) if (v4l2_to_obs_video_format(fmt.pixelformat)
!= VIDEO_FORMAT_NONE) { != VIDEO_FORMAT_NONE) {
obs_property_list_add_int(prop, obs_property_list_add_int(prop, buffer.array,
(char *) fmt.description,
fmt.pixelformat); fmt.pixelformat);
blog(LOG_INFO, "Pixelformat: %s (available)", blog(LOG_INFO, "Pixelformat: %s (available)",
(char *) fmt.description); buffer.array);
} else { } else {
blog(LOG_INFO, "Pixelformat: %s (unavailable)", blog(LOG_INFO, "Pixelformat: %s (unavailable)",
(char *) fmt.description); buffer.array);
} }
fmt.index++; fmt.index++;
} }
dstr_free(&buffer);
} }
/* /*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment