Device interface

Name

Device interface -- 

Synopsis



typedef     vbi_capture_buffer;
vbi_capture* vbi_capture_v4l2_new           (char *dev_name,
                                             int buffers,
                                             unsigned int *services,
                                             int strict,
                                             char **errorstr,
                                             vbi_bool trace);
void        vbi_capture_delete              (vbi_capture *capture);
vbi_raw_decoder* vbi_capture_parameters     (vbi_capture *capture);
int         vbi_capture_pull_raw            (vbi_capture *capture,
                                             vbi_capture_buffer **buffer,
                                             struct timeval *timeout);
int         vbi_capture_pull_sliced         (vbi_capture *capture,
                                             vbi_capture_buffer **buffer,
                                             struct timeval *timeout);
int         vbi_capture_pull                (vbi_capture *capture,
                                             vbi_capture_buffer **raw_buffer,
                                             vbi_capture_buffer **sliced_buffer,
                                             struct timeval *timeout);
int         vbi_capture_read_raw            (vbi_capture *capture,
                                             void *data,
                                             double *timestamp,
                                             struct timeval *timeout);
int         vbi_capture_read_sliced         (vbi_capture *capture,
                                             vbi_sliced *data,
                                             int *lines,
                                             double *timestamp,
                                             struct timeval *timeout);
int         vbi_capture_read                (vbi_capture *capture,
                                             void *raw_data,
                                             vbi_sliced *sliced_data,
                                             int *lines,
                                             double *timestamp,
                                             struct timeval *timeout);

Description

Details

vbi_capture_buffer

typedef struct vbi_capture_buffer {
	void *			data;
	int			size;
	double			timestamp;
} vbi_capture_buffer;


vbi_capture_v4l2_new ()

vbi_capture* vbi_capture_v4l2_new           (char *dev_name,
                                             int buffers,
                                             unsigned int *services,
                                             int strict,
                                             char **errorstr,
                                             vbi_bool trace);

dev_name: Name of the device to open, usually one of /dev/vbi or /dev/vbi0 and up.
buffers: Number of device buffers for raw vbi data, when the driver supports streaming. Otherwise one bounce buffer is allocated for vbi_capture_pull().
services: This must point to a set of VBI_SLICED_ describing the data services to be decoded. On return the services actually decodable will be stored here. See #vbi_raw_decoder_add() for details. If you want to capture raw data only, set to VBI_SLICED_VBI_525, VBI_SLICED_VBI_625 or both.
strict: Will be passed to #vbi_raw_decoder_add().
errorstr: If not NULL this function stores a pointer to an error description here. You must free() this string when no longer needed.
trace: If TRUE print progress messages on stderr.
Returns : 


vbi_capture_delete ()

void        vbi_capture_delete              (vbi_capture *capture);

Free all resources associated with the capture context.

capture: Initialized vbi capture context, can be NULL.


vbi_capture_parameters ()

vbi_raw_decoder* vbi_capture_parameters     (vbi_capture *capture);

Describe the captured data. Raw vbi frames consist of vbi_raw_decoder.count[0] + vbi_raw_decoder.count[1] lines in vbi_raw_decoder.sampling_format, each vbi_raw_decoder.bytes_per_line. Sliced vbi arrays consist of at most vbi_raw_decoder.count[0] + vbi_raw_decoder.count[1] vbi_sliced structures.

capture: Initialized vbi capture context.
Returns : Pointer to a vbi_raw_decoder structure, read only.


vbi_capture_pull_raw ()

int         vbi_capture_pull_raw            (vbi_capture *capture,
                                             vbi_capture_buffer **buffer,
                                             struct timeval *timeout);

Read a raw vbi frame from the capture device, returning a pointer to the image. This data remains valid until the next vbi_capture_pull_raw() call and must be read only.

capture: Initialized vbi capture context.
buffer: Store pointer to a vbi_capture_buffer here.
timeout: Wait timeout, will be read only.
Returns : -1 on error, examine errno for details. The function also fails if vbi data is not available in raw format. 0 on timeout, 1 on success.


vbi_capture_pull_sliced ()

int         vbi_capture_pull_sliced         (vbi_capture *capture,
                                             vbi_capture_buffer **buffer,
                                             struct timeval *timeout);

Read a sliced vbi frame, that is an array of vbi_sliced, from the capture device, returning a pointer to the array buffer->data. Note buffer->size is lines decoded, which can be zero, times the size of vbi_sliced. This data remains valid until the next vbi_capture_pull_sliced() call and must be read only.

capture: Initialized vbi capture context.
buffer: Store pointer to a vbi_capture_buffer here.
timeout: Wait timeout, will be read only.
Returns : -1 on error, examine errno for details. 0 on timeout, 1 on success.


vbi_capture_pull ()

int         vbi_capture_pull                (vbi_capture *capture,
                                             vbi_capture_buffer **raw_buffer,
                                             vbi_capture_buffer **sliced_buffer,
                                             struct timeval *timeout);

Read a raw vbi frame from the capture device, decode to sliced data and also read the sliced vbi frame, that is an array of vbi_sliced, from the capture device, returning pointers to the image raw_buffer->data and array sliced_buffer->data. Note sliced_buffer->size is lines decoded, which can be zero, times the size of vbi_sliced. This data remains valid until the next vbi_capture_pull_raw() call and must be read only.

capture: Initialized vbi capture context.
raw_buffer: Store pointer to a vbi_capture_buffer here.
sliced_buffer: Store pointer to a vbi_capture_buffer here.
timeout: Wait timeout, will be read only.
Returns : -1 on error, examine errno for details. The function also fails if vbi data is not available in raw format. 0 on timeout, 1 on success.


vbi_capture_read_raw ()

int         vbi_capture_read_raw            (vbi_capture *capture,
                                             void *data,
                                             double *timestamp,
                                             struct timeval *timeout);

Read a raw vbi frame from the capture device.

capture: Initialized vbi capture context.
data: Store the raw vbi data here. Use vbi_capture_parameters() to determine the buffer size.
timestamp: On success the capture instant in seconds and fractions since 1970-01-01 00:00 will be stored here.
timeout: Wait timeout, will be read only.
Returns :-1 on error, examine errno for details. The function also fails if vbi data is not available in raw format. 0 on timeout, 1 on success.


vbi_capture_read_sliced ()

int         vbi_capture_read_sliced         (vbi_capture *capture,
                                             vbi_sliced *data,
                                             int *lines,
                                             double *timestamp,
                                             struct timeval *timeout);

Read a sliced vbi frame, that is an array of vbi_sliced, from the capture device.

capture: Initialized vbi capture context.
data: Store the sliced vbi data here. Use vbi_capture_parameters() to determine the buffer size.
lines: Store number of vbi lines decoded and stored in data, which can be zero, here.
timestamp: On success the capture instant in seconds and fractions since 1970-01-01 00:00 will be stored here.
timeout: Wait timeout, will be read only.
Returns : -1 on error, examine errno for details. 0 on timeout, 1 on success.


vbi_capture_read ()

int         vbi_capture_read                (vbi_capture *capture,
                                             void *raw_data,
                                             vbi_sliced *sliced_data,
                                             int *lines,
                                             double *timestamp,
                                             struct timeval *timeout);

Read a raw vbi frame from the capture device, decode to sliced data and also read the sliced vbi frame, that is an array of vbi_sliced, from the capture device.

capture: Initialized vbi capture context.
raw_data: Store the raw vbi data here. Use vbi_capture_parameters() to determine the buffer size.
sliced_data: Store the sliced vbi data here. Use vbi_capture_parameters() to determine the buffer size.
lines: Store number of vbi lines decoded and stored in data, which can be zero, here.
timestamp: On success the capture instant in seconds and fractions since 1970-01-01 00:00 will be stored here.
timeout: Wait timeout, will be read only.
Returns :-1 on error, examine errno for details. The function also fails if vbi data is not available in raw format. 0 on timeout, 1 on success.