On 29/12/2011 11:29 AM, Luca Barbato wrote:
Check capabilities directly in the function, further simplify the code.
---
  libavdevice/v4l2.c |   70 +++++++++++++++++++++++++--------------------------
  1 files changed, 34 insertions(+), 36 deletions(-)

[...]

     if (res < 0) {
+        err = errno;
         av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n",
-                 strerror(errno));
-        close(fd);
+           strerror(err));

Nit: This doesn't look indented right.

-    *capabilities = cap.capabilities;
+    if (!(cap.capabilities & V4L2_CAP_STREAMING)) {
+        av_log(ctx, AV_LOG_ERROR,
+               "The device does not support the streaming I/O method.\n");
+        err = AVERROR(ENOSYS);
+    }

Shouldn't error be set to ENOSYS, not AVERROR(ENOSYS), and shouldnt
this have a goto fail; ?

+    if ((res = mmap_init(s1)) ||
+        (res = mmap_start(s1)) < 0) {
         close(s->fd);
         goto out;
     }

I am not exactly sure how this works at a glace... as in
what res will end up as.

- Derek
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to