Data Structures | |
struct | vbi_channel_profile |
Proxy scheduler configuration for background channel switching. More... | |
Defines | |
#define | VBIPROXY_VERSION 0x00000100 |
Proxy protocol version: major, minor and patchlevel. | |
Typedefs | |
typedef vbi_proxy_client | vbi_proxy_client |
Proxy client context. | |
typedef void | VBI_PROXY_CLIENT_CALLBACK (void *p_client_data, VBI_PROXY_EV_TYPE ev_mask) |
Function prototype for proxy client callback. | |
Enumerations | |
enum | VBI_PROXY_EV_TYPE { VBI_PROXY_EV_CHN_GRANTED = 1<<0, VBI_PROXY_EV_CHN_CHANGED = 1<<1, VBI_PROXY_EV_NORM_CHANGED = 1<<2, VBI_PROXY_EV_CHN_RECLAIMED = 1<<3, VBI_PROXY_EV_NONE = 0 } |
Bits in event mask parameter to proxy client callback function. More... | |
enum | VBI_PROXY_SUSPEND { VBI_PROXY_SUSPEND_START, VBI_PROXY_SUSPEND_STOP } |
Modes for channel suspend requests. More... | |
enum | VBI_CHN_PRIO { VBI_CHN_PRIO_BACKGROUND = 1, VBI_CHN_PRIO_INTERACTIVE = 2, VBI_CHN_PRIO_DEFAULT = VBI_CHN_PRIO_INTERACTIVE, VBI_CHN_PRIO_RECORD = 3 } |
Priority levels for channel switching (equivalent to enum v4l2_priority). More... | |
enum | VBI_CHN_SUBPRIO { VBI_CHN_SUBPRIO_MINIMAL = 0x00, VBI_CHN_SUBPRIO_CHECK = 0x10, VBI_CHN_SUBPRIO_UPDATE = 0x20, VBI_CHN_SUBPRIO_INITIAL = 0x30, VBI_CHN_SUBPRIO_VPS_PDC = 0x40 } |
Sub-priorities for channel scheduling at "background" priority. More... | |
enum | VBI_PROXY_DAEMON_FLAGS { VBI_PROXY_DAEMON_NO_TIMEOUTS = 1<<0 } |
General flags sent from clients to daemon during connect. More... | |
enum | VBI_PROXY_CLIENT_FLAGS { VBI_PROXY_CLIENT_NO_TIMEOUTS = 1<<0, VBI_PROXY_CLIENT_NO_STATUS_IND = 1<<1 } |
General flags sent from daemon to clients during connect. More... | |
enum | VBI_PROXY_CHN_FLAGS { VBI_PROXY_CHN_RELEASE = 1<<0, VBI_PROXY_CHN_TOKEN = 1<<1, VBI_PROXY_CHN_FLUSH = 1<<2, VBI_PROXY_CHN_NORM = 1<<3, VBI_PROXY_CHN_FAIL = 1<<4, VBI_PROXY_CHN_NONE = 0 } |
Channel notification flags. More... | |
enum | VBI_DRIVER_API_REV { VBI_API_UNKNOWN, VBI_API_V4L1, VBI_API_V4L2, VBI_API_BKTR } |
Identification of the VBI device driver type. | |
Functions | |
vbi_proxy_client * | vbi_proxy_client_create (const char *dev_name, const char *p_client_name, VBI_PROXY_CLIENT_FLAGS client_flags, char **pp_errorstr, int trace_level) |
void | vbi_proxy_client_destroy (vbi_proxy_client *vpc) |
vbi_capture * | vbi_proxy_client_get_capture_if (vbi_proxy_client *vpc) |
Returns capture interface for an initialized proxy client. | |
VBI_PROXY_CLIENT_CALLBACK * | vbi_proxy_client_set_callback (vbi_proxy_client *vpc, VBI_PROXY_CLIENT_CALLBACK *p_callback, void *p_data) |
Installs callback function for asynchronous events. | |
VBI_DRIVER_API_REV | vbi_proxy_client_get_driver_api (vbi_proxy_client *vpc) |
Returns the driver type behind the actual capture device. | |
int | vbi_proxy_client_channel_request (vbi_proxy_client *vpc, VBI_CHN_PRIO chn_prio, vbi_channel_profile *chn_profile) |
int | vbi_proxy_client_channel_notify (vbi_proxy_client *vpc, VBI_PROXY_CHN_FLAGS notify_flags, unsigned int scanning) |
int | vbi_proxy_client_channel_suspend (vbi_proxy_client *vpc, VBI_PROXY_SUSPEND cmd) |
int | vbi_proxy_client_device_ioctl (vbi_proxy_client *vpc, int request, void *p_arg) |
Wrapper for ioctl requests on the VBI device. | |
int | vbi_proxy_client_get_channel_desc (vbi_proxy_client *vpc, unsigned int *p_scanning, vbi_bool *p_granted) |
vbi_bool | vbi_proxy_client_has_channel_control (vbi_proxy_client *vpc) |
Query if the client is currently allowed to switch channels. |
Using the VBI proxy daemon instead of capturing directly from a VBI device allows multiple clients to capture concurrently, e.g. to decode multiple data services.
typedef struct vbi_proxy_client vbi_proxy_client |
Proxy client context.
A reference to this anonymous structure is returned by vbi_proxy_client_create and must be passed to the device capture interface and/or all subsequent calls to proxy client interface functions. The contents of this structure are private and must not be accessed or changed by the caller.
typedef void VBI_PROXY_CLIENT_CALLBACK(void *p_client_data, VBI_PROXY_EV_TYPE ev_mask) |
Function prototype for proxy client callback.
The first parameter is the value which the client passed when installing the callback; it's just passed through to the callback unmodified. The second parameter contains one or more bits to describe which events occured wince the last call.
enum VBI_PROXY_EV_TYPE |
Bits in event mask parameter to proxy client callback function.
enum VBI_PROXY_SUSPEND |
Modes for channel suspend requests.
enum VBI_CHN_PRIO |
Priority levels for channel switching (equivalent to enum v4l2_priority).
These priorities are used to cooperativly resolve conflicts between channel requests of multiple capture applications. While a capture application with a higher priority has opened a device, channel change requests of applications with lower priority will fail with error "EBUSY".
enum VBI_CHN_SUBPRIO |
Sub-priorities for channel scheduling at "background" priority.
This enum describes recommended sub-priority levels for channel profiles. They're intended for channel switching through a VBI proxy at background priority level. The daemon uses this priority to decide which request to grant first if there are multiple outstanding requests. To the daemon these are just numbers (highest wins) but for successful cooperation clients need to use agree on values for similar tasks. Hence the following values are recommended:
General flags sent from daemon to clients during connect.
enum VBI_PROXY_CHN_FLAGS |
Channel notification flags.
vbi_proxy_client* vbi_proxy_client_create | ( | const char * | p_dev_name, | |
const char * | p_client_name, | |||
VBI_PROXY_CLIENT_FLAGS | client_flags, | |||
char ** | pp_errorstr, | |||
int | trace_level | |||
) |
p_dev_name | Name of the device to open, usually one of /dev/vbi or /dev/vbi0 and up. Note: should be the same path as used by the proxy daemon, else the client may not be able to connect. | |
p_client_name | Name of the client application, typically identical to argv[0] (without the path though) Can be used by the proxy daemon to fine-tune scheduling or to present the user with a list of currently connected applications. | |
client_flags | Can contain one or more members of VBI_PROXY_CLIENT_FLAGS | |
pp_errorstr | If not NULL this function stores a pointer to an error description here. You must free() this string when no longer needed. | |
trace_level | Enable debug output to stderr if non-zero. Larger values produce more output. |
NULL
on failurevoid vbi_proxy_client_destroy | ( | vbi_proxy_client * | vpc | ) |
vpc | Pointer to initialized proxy client context |
vbi_capture* vbi_proxy_client_get_capture_if | ( | vbi_proxy_client * | vpc | ) |
Returns capture interface for an initialized proxy client.
vpc | Pointer to initialized and active proxy client context |
NULL
upon error (i.e. if the client is not connected to the daemon)VBI_PROXY_CLIENT_CALLBACK* vbi_proxy_client_set_callback | ( | vbi_proxy_client * | vpc, | |
VBI_PROXY_CLIENT_CALLBACK * | p_callback, | |||
void * | p_data | |||
) |
Installs callback function for asynchronous events.
vpc | Pointer to initialized proxy client context | |
p_callback | Pointer to callback function | |
p_data | Void pointer which will be passed through to the callback function unmodified. |
Note for channel requests the callback to grant channel control may be invoked before the request function returns. Note you can call any interface function from inside the callback, including the destroy operator.
NULL
if none.VBI_DRIVER_API_REV vbi_proxy_client_get_driver_api | ( | vbi_proxy_client * | vpc | ) |
Returns the driver type behind the actual capture device.
vpc | Pointer to initialized proxy client context |
The function will fail if the client is currently not connected to the daemon, i.e. VPI capture has to be started first.
int vbi_proxy_client_channel_request | ( | vbi_proxy_client * | vpc, | |
VBI_CHN_PRIO | chn_prio, | |||
vbi_channel_profile * | p_chn_profile | |||
) |
vpc | Pointer to initialized proxy client context | |
chn_prio | Channel change priority level. If there are other clients with higher priority the client will be refused any channel changes. | |
p_chn_profile | Channel profile for scheduling at background priority level. |
Scheduling differs at the 3 priority levels. For an explanation of priorities see enum VBI_CHN_PRIO. At background level channel changes are coordinated by introduction of a virtual token: only the one client which holds the token is allowed to switch channels. The daemon will wait for the token to be returned before it's granted to another client. This way conflicting channel changes are avoided.
At the upper level the latest request always wins. To avoid interference the application still might wait until it gets indicated that the token has been returned to the daemon.
The token may be granted right away or at a later time, e.g. when it has to be reclaimed from another client first, or if there are other clients with higher priority. If a callback has been registered, it will be invoked when the token arrives; otherwise vbi_proxy_client_has_channel_control() can be used to poll for it.
Note: to set the priority level to "background" only without requesting a channel, set the is_valid member in the profile to FALSE
.
errno
for details.int vbi_proxy_client_channel_notify | ( | vbi_proxy_client * | vpc, | |
VBI_PROXY_CHN_FLAGS | notify_flags, | |||
unsigned int | scanning | |||
) |
vpc | Pointer to initialized proxy client context | |
notify_flags | Combination of event notification bits | |
scanning | New norm, if norm event bit is set |
errno
for details.int vbi_proxy_client_channel_suspend | ( | vbi_proxy_client * | vpc, | |
VBI_PROXY_SUSPEND | cmd | |||
) |
vpc | Pointer to initialized proxy client context | |
cmd | Control command |
errno
for details.int vbi_proxy_client_device_ioctl | ( | vbi_proxy_client * | vpc, | |
int | request, | |||
void * | p_arg | |||
) |
Wrapper for ioctl requests on the VBI device.
vpc | Pointer to initialized proxy client context | |
request | Ioctl request code to be passed to driver | |
p_arg | Ioctl argument to be passed to driver |
EBUSY
if the client doesn't have permission to control the channel.int vbi_proxy_client_get_channel_desc | ( | vbi_proxy_client * | vpc, | |
unsigned int * | p_scanning, | |||
vbi_bool * | p_granted | |||
) |
vpc | Pointer to initialized proxy client context | |
p_scanning | Returns new scanning after channel change | |
p_granted | ReturnsTRUE if client is currently allowed to switch channels |
vbi_bool vbi_proxy_client_has_channel_control | ( | vbi_proxy_client * | vpc | ) |
Query if the client is currently allowed to switch channels.
vpc | Pointer to initialized proxy client context |
TRUE
if client is currently allowed to switch channels.