Skip to content

Instantly share code, notes, and snippets.

@codebrainz
Created December 24, 2011 08:54
Show Gist options
  • Select an option

  • Save codebrainz/1516940 to your computer and use it in GitHub Desktop.

Select an option

Save codebrainz/1516940 to your computer and use it in GitHub Desktop.
libv4l2 Vala Bindings
/*
* Bindings for libv4l2 user-space library
* See: http://linuxtv.org/downloads/v4l-dvb-apis/libv4l.html
*/
using Posix; /* For mode_t */
[CCode (lower_case_cprefix="v4l2_", cprefix="v4l2_", cheader_filename="libv4l2.h")]
namespace LibV4l2
{
/* Replacements for standard Posix functions */
public int open (string path, int oflag, mode_t mode=0);
public int close (int fd);
public int dup (int fd);
public int ioctl (int fildes, int request, ...);
public ssize_t read (int fd, void* buf, size_t count);
public void mmap(void *start, size_t length, int prot, int flags, int fd, int64 offset);
public int munmap(void *_start, size_t length);
/* LibV4l2-specific stuff */
public int fd_open (int fd, int flags);
public int set_control (int fd, int cid, int val);
public int get_control (int fd, int cid);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment