On 08/25/2017 05:35 PM, wm4 wrote:
+
+    dirp = opendir("/dev");
+    if (!dirp)
+        return AVERROR(errno);
+
+    for (entry = readdir(dirp); entry; entry = readdir(dirp)) {
+
+        if (strncmp(entry->d_name, "video", 5))
+            continue;
+
+        snprintf(node, sizeof(node), "/dev/%s", entry->d_name);
+
+        av_log(log_ctx, AV_LOG_DEBUG, "probing device %s\n", node);
+
+        s->devname = node;
+        ret = probe_v4l2_driver(s, log_ctx);
+        if (!ret)
+                break;
+    }
This doesn't really look like a good idea. Even somehow trying to
enumerate stuff in/sys/class/  sounds better. Just because device
filename starts with "video" it doesn't need to be relevant, and poking
random ioctl()s at arbitrary devices doesn't sound very reliable.


yes it might seem that way but this is pretty much the standard way of opening v4l2 devices (I am not reimplementing the API to my understanding). for an example already present in ffmpeg check libavdevice/v4l2.c v4l2_get_device_list.


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to