Browse Source

linux-v4l2: Use dv timing property in source

Use the dv timing selected in the source properties to configure the
device instead of resolution/framerate.
fryshorts 10 years ago
parent
commit
1c0df043fa
1 changed files with 11 additions and 0 deletions
  1. 11 0
      plugins/linux-v4l2/v4l2-input.c

+ 11 - 0
plugins/linux-v4l2/v4l2-input.c

@@ -57,6 +57,7 @@ struct v4l2_data {
 	int input;
 	int pixfmt;
 	int standard;
+	int dv_timing;
 	int resolution;
 	int framerate;
 	bool sys_timing;
@@ -825,6 +826,15 @@ static void v4l2_init(struct v4l2_data *data)
 		data->resolution = -1;
 		data->framerate  = -1;
 	}
+	/* set dv timing if supported */
+	if (input_caps & V4L2_IN_CAP_DV_TIMINGS) {
+		if (v4l2_set_dv_timing(data->dev, &data->dv_timing) < 0) {
+			blog(LOG_ERROR, "Unable to set dv timing");
+			goto fail;
+		}
+		data->resolution = -1;
+		data->framerate  = -1;
+	}
 
 	/* set pixel format and resolution */
 	if (v4l2_set_format(data->dev, &data->resolution, &data->pixfmt,
@@ -887,6 +897,7 @@ static void v4l2_update(void *vptr, obs_data_t *settings)
 	data->input      = obs_data_get_int(settings, "input");
 	data->pixfmt     = obs_data_get_int(settings, "pixelformat");
 	data->standard   = obs_data_get_int(settings, "standard");
+	data->dv_timing  = obs_data_get_int(settings, "dv_timing");
 	data->resolution = obs_data_get_int(settings, "resolution");
 	data->framerate  = obs_data_get_int(settings, "framerate");
 	data->sys_timing = obs_data_get_bool(settings, "system_timing");