Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

capture.h File Reference

Capture client interface. More...

#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/videodev.h>
#include "frame.h"

Go to the source code of this file.

Data Structures

struct  FRAMEGRABBER
 An opaque framegrabber handle. More...


Defines

#define FG_DEFAULT_DEVICE   "/dev/video" /** Default video input */
#define FG_DEFAULT_WIDTH   640
#define FG_DEFAULT_HEIGHT   480
#define FG_PERCENT(n)   ((n)*65535/100)
#define FG_50PC   FG_PERCENT(50)
#define FG_SOURCE_TV   0
#define FG_SOURCE_COMPOSITE   1
#define FG_SOURCE_SVIDEO   2

Functions

FRAMEGRABBERfg_open (const char *dev)
void fg_close (FRAMEGRABBER *fg)
FRAMEfg_grab (FRAMEGRABBER *fg)
FRAMEfg_grab_frame (FRAMEGRABBER *fg, FRAME *fr)
int fg_set_source (FRAMEGRABBER *fg, int src)
int fg_set_source_norm (FRAMEGRABBER *fg, int norm)
int fg_get_source_count (FRAMEGRABBER *fg)
char * fg_get_source_name (FRAMEGRABBER *fg, int src)
int fg_set_channel (FRAMEGRABBER *fg, float freq)
float fg_get_channel (FRAMEGRABBER *fg)
int fg_set_format (FRAMEGRABBER *fg, int fmt)
int fg_set_capture_window (FRAMEGRABBER *fg, int x, int y, int width, int height)
int fg_set_brightness (FRAMEGRABBER *fg, int br)
int fg_set_hue (FRAMEGRABBER *fg, int hu)
int fg_set_colour (FRAMEGRABBER *fg, int co)
int fg_set_color (FRAMEGRABBER *fg, int co)
int fg_set_contrast (FRAMEGRABBER *fg, int ct)
int fg_set_whiteness (FRAMEGRABBER *fg, int wh)
FRAMEfg_new_compatible_frame (FRAMEGRABBER *fg)
void fg_dump_info (FRAMEGRABBER *fg)


Detailed Description

Capture client interface.

libfg - Frame Grabber interface for Linux

Provides a high-level C interface for controlling frame grabber and TV tuner cards. Uses the Video 4 Linux API (currently v1) and thus supports any V4L supported device.

Author:
Gavin Baker <gavinb@antonym.org>
Version:
Revision
1.9
Homepage: http://www.antonym.org/libfg

Function Documentation

void fg_close FRAMEGRABBER fg  ) 
 

Closes an open framegrabber device, and releases all memory allocated with it.

Parameters:
fg The framegrabber handle to close.

void fg_dump_info FRAMEGRABBER fg  ) 
 

Dumps to the console on stdout all the status information available for the framegrabber.

Parameters:
fg Framegrabber handle

float fg_get_channel FRAMEGRABBER fg  ) 
 

Queries the current frequency of the TV tuner.

Parameters:
fg Framegrabber handle
Returns:
The frequency in MHz

int fg_get_source_count FRAMEGRABBER fg  ) 
 

Returns the number of input sources available.

Parameters:
fg Framegrabber handle
Returns:
>0 Sources (can be used in fg_set_source)

char* fg_get_source_name FRAMEGRABBER fg,
int  src
 

Returns a user-friendly name corresponding to the supplied channel number.

Parameters:
fg Framegrabber handle
src Source id (eg. FG_SOURCE_TV)
Returns:
Name, like "Television"

FRAME* fg_grab FRAMEGRABBER fg  ) 
 

Reads a frame from the capture device, allocating a new FRAME instance and returning it. The frame will be allocated the maximum size window /// in the default picture format. Note that this is a blocking read, /// and thus will wait until the next frame is ready. The caller is /// responsible for doing a frame_release() when done with the frame (to /// free memory).

Parameters:
fg The framegrabber handle from which to capture
Returns:
The most recently captured frame, or NULL on error
Note:
This function blocks!

FRAME* fg_grab_frame FRAMEGRABBER fg,
FRAME fr
 

Reads a frame from the capture device, using the existing frame storage as passed in. Returns the same instance, with the contents of /// the last frame. Note that this is a *blocking* read, and thus will /// wait until the next frame is ready.

Parameters:
fg The open framegrabber
fr An existing frame
Returns:
The most recently captured frame, or NULL on error
Note:
This function blocks! The size must be correct!

FRAME* fg_new_compatible_frame FRAMEGRABBER fg  ) 
 

Returns a newly allocated frame that is compatible with the current frame grabber settings; that is, the window width and height, and the capture format. This frame must be deleted by the caller with frame_release().

Returns:
A new frame

FRAMEGRABBER* fg_open const char *  dev  ) 
 

Opens and initialises the frame grabber device with some reasonable default values, and queries for all capabilities.

Parameters:
dev Device name to open, eg. "/dev/video2" or NULL for "/dev/video".
Returns:
The open framegrabber handle, or NULL in the case of an error.

int fg_set_brightness FRAMEGRABBER fg,
int  br
 

Sets the picture brightness to the specified value.

Parameters:
fg Framegrabber handle
br Brightness (in percent)
Returns:
0 Success -1 Failure

int fg_set_capture_window FRAMEGRABBER fg,
int  x,
int  y,
int  width,
int  height
 

Specifies a sub-window of the input source to capture. The parameters specify the capture window that is smaller than or equal to the maximum supported window size.

Parameters:
fg Framegrabber handle
x 
y 
width 
height 
Returns:
0 Success -1 Failure

int fg_set_channel FRAMEGRABBER fg,
float  freq
 

Sets the TV tuner to the specified frequency.

Parameters:
fg Framegrabber handle
freq Tuner frequency, in MHz
Returns:
0 Success, tuned in -1 Failure

int fg_set_color FRAMEGRABBER fg,
int  co
 

Sets the picture color balance for Americans to the specified value.

Parameters:
fg Framegrabber handle
co Color balance (in percent)
Returns:
0 Success -1 Failure

int fg_set_colour FRAMEGRABBER fg,
int  co
 

Sets the picture colour balance for Queen's English speakers to the specified value.

Parameters:
fg Framegrabber handle
co Colour balance (in percent)
Returns:
0 Success -1 Failure

int fg_set_contrast FRAMEGRABBER fg,
int  ct
 

Sets the picture contrast to the specified value.

Parameters:
fg Framegrabber handle
ct Contrast (in percent)
Returns:
0 Success -1 Failure

int fg_set_format FRAMEGRABBER fg,
int  fmt
 

Specifies the capture format to use. Must be one of the VIDEO_PALETTE_* flags.

Parameters:
fg Framegrabber handle
fmt pixel format
Note:
Currently only RGB32 and RGB24 are properly supported.
Returns:
0 Success

int fg_set_hue FRAMEGRABBER fg,
int  hu
 

Sets the picture hue control to the specified value.

Parameters:
fg Framegrabber handle
hu Hue (in percent)
Returns:
0 Success -1 Failure

int fg_set_source FRAMEGRABBER fg,
int  src
 

Specifies the number of the video source to be used for the input signal. For example, tuner, composite or S/Video signal.

Parameters:
fg Framegrabber handle
src Source id (eg. FG_SOURCE_SVIDEO)
Returns: 0 on success, -1 on failure

int fg_set_source_norm FRAMEGRABBER fg,
int  norm
 

Specifies the video signal norm (eg. PAL, NTSC, SECAM) for the current input source.

Parameters:
fg Framegrabber handle
norm Signal norm (eg. VIDEO_MODE_PAL)
Returns:
0 On success -1 Failure

int fg_set_whiteness FRAMEGRABBER fg,
int  wh
 

Sets the picture white balance to the specified value.

Parameters:
fg Framegrabber handle
wh Whiteness (in percent)
Returns:
0 Success -1 Failure


Generated on Thu Nov 20 01:38:22 2003 for libfg by doxygen 1.3.4