提交 bf27d4c1 编写于 作者: F fryshorts

linux-v4l2: Add function to list dv timings

Add a helper function to enumerate dv timings supported by the
selected input and add them to a property.
上级 0a6cf208
......@@ -399,6 +399,43 @@ static void v4l2_standard_list(int dev, obs_property_t *prop)
}
}
/*
* List dv timings for the device
*/
static void v4l2_dv_timing_list(int dev, obs_property_t *prop)
{
struct v4l2_dv_timings dvt;
struct dstr buf;
int index = 0;
dstr_init(&buf);
obs_property_list_clear(prop);
obs_property_list_add_int(prop, obs_module_text("LeaveUnchanged"), -1);
while (v4l2_enum_dv_timing(dev, &dvt, index) == 0) {
/* i do not pretend to understand, this is from qv4l2 ... */
double h = (double) dvt.bt.height + dvt.bt.vfrontporch +
dvt.bt.vsync + dvt.bt.vbackporch +
dvt.bt.il_vfrontporch + dvt.bt.il_vsync +
dvt.bt.il_vbackporch;
double w = (double) dvt.bt.width + dvt.bt.hfrontporch +
dvt.bt.hsync + dvt.bt.hbackporch;
double i = (dvt.bt.interlaced) ? 2.0f : 1.0f;
double rate = (double) dvt.bt.pixelclock / (w * (h / i));
dstr_printf(&buf, "%ux%u%c %.2f",
dvt.bt.width, dvt.bt.height,
(dvt.bt.interlaced) ? 'i' : 'p', rate);
obs_property_list_add_int(prop, buf.array, index);
index++;
}
dstr_free(&buf);
}
/*
* List resolutions for device and format
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册