Browse Source

linux-v4l2: Fix device enumeration on FreeBSD

Add platform specific code to enumerate v4l2 devices on FreeBSD.
Kris Moore 10 years ago
parent
commit
cef95722f9
1 changed files with 9 additions and 0 deletions
  1. 9 0
      plugins/linux-v4l2/v4l2-input.c

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

@@ -269,7 +269,11 @@ static void v4l2_device_list(obs_property_t *prop, obs_data_t *settings)
 	size_t cur_device_index;
 	const char *cur_device_name;
 
+#ifdef __FreeBSD__
+	dirp = opendir("/dev");
+#else
 	dirp = opendir("/sys/class/video4linux");
+#endif
 	if (!dirp)
 		return;
 
@@ -285,6 +289,11 @@ static void v4l2_device_list(obs_property_t *prop, obs_data_t *settings)
 		uint32_t caps;
 		struct v4l2_capability video_cap;
 
+#ifdef __FreeBSD__
+		if (strstr(dp->d_name, "video") == NULL)
+			continue;
+#endif
+
 		if (dp->d_type == DT_DIR)
 			continue;