Linux Programming Guide - ADLINK Technology RTV Series User Manual

Multi-channel real-time video frame grabber series
Table of Contents

Advertisement

6.3 Linux Programming Guide

Introduction
Video4 Linux or V4L is intended to provide a standard video cap-
ture application programming interface on Linux. V4L is in its sec-
ond version. V4L2 driver include a compatibility mode for V4L1
application that is V4L application can mix the two modes of V4L1
and V4L2.
A complete documentation on V4L application programming can
be found at:
http:// www.linuxtv.org/downloads/video4linux/API/V4L2_API/
The document gives a very detailed description of all APIs. Famil-
iar with it will great help you in writing your video capturing applica-
tion.
A simple sample
In this chapter, we provide a simple sample as how to program
RTV cards.
Open device
The first step is to open a RTV device with open (). The first
parameter in it is device name which can be listed under directory
/dev with a prefix name 'video' and a number appending to it.
There will be same number of such files as how many devices
your system has.
static char dev_name[] = "/dev/video0";// Open
the first device
int open_device (void)
{
int fd;
fd = open (dev_name, O_RDWR | O_NONBLOCK,
if (-1 == fd) {
return fd;// Success
}
156
0);
fprintf (stderr, "Cannot open '%s':
%d, %s\n", dev_name, errno,
strerror (errno));
return -1;// Failed
}
Programming Guide

Advertisement

Table of Contents
loading

Table of Contents