libv4l1.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. # (C) 2008 Hans de Goede <hdegoede@redhat.com>
  3. # This program is free software; you can redistribute it and/or modify
  4. # it under the terms of the GNU Lesser General Public License as published by
  5. # the Free Software Foundation; either version 2.1 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU Lesser General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU Lesser General Public License
  14. # along with this program; if not, write to the Free Software
  15. # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
  16. */
  17. #ifndef __LIBV4L1_H
  18. #define __LIBV4L1_H
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif /* __cplusplus */
  22. #include <stdio.h>
  23. #include <stdint.h>
  24. #include <unistd.h>
  25. #include <libv4l1-videodev.h>
  26. #if HAVE_VISIBILITY
  27. #define LIBV4L_PUBLIC __attribute__ ((visibility("default")))
  28. #else
  29. #define LIBV4L_PUBLIC
  30. #endif
  31. /* Point this to a FILE opened for writing when you want to log error and
  32. status messages to a file, when NULL errors will get send to stderr */
  33. LIBV4L_PUBLIC extern FILE *v4l1_log_file;
  34. /* Just like your regular open/close/etc, except that when opening a v4l2
  35. capture only device, full v4l1 emulation is done including emulating the
  36. often not implemented in v4l2 drivers CGMBUF ioctl and v4l1 style mmap call
  37. in userspace.
  38. Format conversion is done if necessary when capturing. That is if you
  39. (try to) set a capture format which is not supported by the cam, but is
  40. supported by libv4lconvert then SPICT will succeed and on SYNC / read the
  41. data will be converted for you and returned in the request format.
  42. Note that currently libv4l1 depends on the kernel v4l1 compatibility layer
  43. for: 1) Devices which are not capture only, 2) Emulation of many basic
  44. v4l1 ioctl's which require no driver specific handling.
  45. Note that no functionality is added to v4l1 devices, so if for example an
  46. obscure v4l1 device is opened which only supports some weird capture format
  47. then libv4l1 will not be of any help (in this case it would be best to get
  48. the driver converted to v4l2, as v4l2 has been designed to include weird
  49. capture formats, like hw specific bayer compression methods).
  50. */
  51. LIBV4L_PUBLIC int v4l1_open(const char *file, int oflag, ...);
  52. LIBV4L_PUBLIC int v4l1_close(int fd);
  53. LIBV4L_PUBLIC int v4l1_dup(int fd);
  54. LIBV4L_PUBLIC int v4l1_ioctl(int fd, unsigned long int request, ...);
  55. LIBV4L_PUBLIC ssize_t v4l1_read(int fd, void *buffer, size_t n);
  56. LIBV4L_PUBLIC void *v4l1_mmap(void *start, size_t length, int prot, int flags,
  57. int fd, int64_t offset);
  58. LIBV4L_PUBLIC int v4l1_munmap(void *_start, size_t length);
  59. #ifdef __cplusplus
  60. }
  61. #endif /* __cplusplus */
  62. #endif