Browse Source

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.
fryshorts 11 years ago
parent
commit
0132453d23
1 changed files with 4 additions and 0 deletions
  1. 4 0
      plugins/linux-v4l2/v4l2-input.c

+ 4 - 0
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);