Skip to content
Snippets Groups Projects
Commit 0abf0f57 authored by fryshorts's avatar fryshorts
Browse files

Do not explicitly set a default device in v4l2 input.

This was added at a time where the source properties dialog did not
pop up automatically on source creation. Now when the properties are
displayed the first device in the select input will be selected by
default if there was none already specified by the source settings.

This will make the code cleaner and also save one redundant round of
device enumeration.
parent 841f02be
No related branches found
No related tags found
No related merge requests found
......@@ -231,10 +231,11 @@ static void v4l2_defaults(obs_data_t settings)
*/
static void v4l2_device_list(obs_property_t prop, obs_data_t settings)
{
UNUSED_PARAMETER(settings);
DIR *dirp;
struct dirent *dp;
struct dstr device;
bool first = true;
dirp = opendir("/sys/class/video4linux");
if (!dirp)
......@@ -280,13 +281,6 @@ static void v4l2_device_list(obs_property_t prop, obs_data_t settings)
obs_property_list_add_string(prop, (char *) video_cap.card,
device.array);
if (first) {
obs_data_set_string(settings, "device_id",
device.array);
first = false;
}
blog(LOG_INFO, "Found device '%s' at %s", video_cap.card,
device.array);
......@@ -679,11 +673,6 @@ static void v4l2_update(void *vptr, obs_data_t settings)
const char *new_device;
new_device = obs_data_get_string(settings, "device_id");
if (strlen(new_device) == 0) {
v4l2_device_list(NULL, settings);
new_device = obs_data_get_string(settings, "device_id");
}
if (!data->set_device || strcmp(data->set_device, new_device) != 0) {
if (data->set_device)
bfree(data->set_device);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment