From 0132453d235a7eb51ab7f183d8c789f31fa0674b Mon Sep 17 00:00:00 2001 From: fryshorts Date: Tue, 16 Sep 2014 21:45:23 +0200 Subject: [PATCH] Add video format check in v4l2 input. This adds a check whether the video format from the device is compatible with obs. This could either happen if the "Leave unchanged" option is selected for the video format, or if the driver simply overwrites the requested video format. --- plugins/linux-v4l2/v4l2-input.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/linux-v4l2/v4l2-input.c b/plugins/linux-v4l2/v4l2-input.c index a80f8d974..d46b62b3f 100644 --- a/plugins/linux-v4l2/v4l2-input.c +++ b/plugins/linux-v4l2/v4l2-input.c @@ -602,6 +602,10 @@ static void v4l2_init(struct v4l2_data *data) blog(LOG_ERROR, "Unable to set format"); goto fail; } + if (v4l2_to_obs_video_format(data->pixfmt) == VIDEO_FORMAT_NONE) { + blog(LOG_ERROR, "Selected video format not supported"); + goto fail; + } v4l2_unpack_tuple(&data->width, &data->height, data->resolution); blog(LOG_INFO, "Resolution: %dx%d", data->width, data->height); blog(LOG_INFO, "Pixelformat: %d", data->pixfmt);