コード例 #1
0
ファイル: v4l2-input.c プロジェクト: Bl00drav3n/obs-studio
static void *v4l2_create(obs_data_t *settings, obs_source_t *source)
{
	struct v4l2_data *data = bzalloc(sizeof(struct v4l2_data));
	data->dev = -1;
	data->source = source;

	/* Bitch about build problems ... */
#ifndef V4L2_CAP_DEVICE_CAPS
	blog(LOG_WARNING, "Plugin built without device caps support!");
#endif
#if !defined(VIDIOC_ENUM_DV_TIMINGS) || !defined(V4L2_IN_CAP_DV_TIMINGS)
	blog(LOG_WARNING, "Plugin built without dv-timing support!");
#endif

	v4l2_update(data, settings);

#if HAVE_UDEV
	v4l2_init_udev();
	signal_handler_t *sh = v4l2_get_udev_signalhandler();

	signal_handler_connect(sh, "device_added", &device_added, data);
	signal_handler_connect(sh, "device_removed", &device_removed, data);
#endif

	return data;
}
コード例 #2
0
ファイル: v4l2-input.c プロジェクト: Socapex/obs-studio
static void *v4l2_create(obs_data_t *settings, obs_source_t *source)
{
	struct v4l2_data *data = bzalloc(sizeof(struct v4l2_data));
	data->dev = -1;
	data->source = source;

	v4l2_update(data, settings);

#if HAVE_UDEV
	data->udev = v4l2_init_udev();
	v4l2_set_device_added_callback(data->udev, &device_added, data);
	v4l2_set_device_removed_callback(data->udev, &device_removed, data);
#endif

	return data;
}