Demux Directory API

dmx_register_demux()
dmx_unregister_demux()
dmx_get_demuxes()

The demux directory is a Linux kernel-wide facility for registering and accessing the MPEG-2 TS demuxes in the system. Run-time registering and unregistering of demux drivers is possible using this API.

All demux drivers in the directory implement the abstract interface dmx_demux_t.

dmx_register_demux()

DESCRIPTION

This function makes a demux driver interface available to the Linux kernel. It is usually called by the init_module() function of the kernel module that contains the demux driver. The caller of this function is responsible for allocating dynamic or static memory for the demux structure and for initializing its fields before calling this function. The memory allocated for the demux structure must not be freed before calling dmx_unregister_demux(),

SYNOPSIS

int dmx_register_demux ( dmx_demux_t ⋆demux )

PARAMETERS

dmx_demux_t* demux

Pointer to the demux structure.

RETURNS

0

The function was completed without errors.

-EEXIST

A demux with the same value of the id field already stored in the directory.

-ENOSPC

No space left in the directory.

dmx_unregister_demux()

DESCRIPTION

This function is called to indicate that the given demux interface is no longer available. The caller of this function is responsible for freeing the memory of the demux structure, if it was dynamically allocated before calling dmx_register_demux(). The cleanup_module() function of the kernel module that contains the demux driver should call this function. Note that this function fails if the demux is currently in use, i.e., release_demux() has not been called for the interface.

SYNOPSIS

int dmx_unregister_demux ( dmx_demux_t ⋆demux )

PARAMETERS

dmx_demux_t* demux

Pointer to the demux structure which is to be unregistered.

RETURNS

0

The function was completed without errors.

ENODEV

The specified demux is not registered in the demux directory.

EBUSY

The specified demux is currently in use.

dmx_get_demuxes()

DESCRIPTION

Provides the caller with the list of registered demux interfaces, using the standard list structure defined in the include file linux/list.h. The include file demux.h defines the macro DMX_DIR_ENTRY() for converting an element of the generic type struct list_head* to the type dmx_demux_t*. The caller must not free the memory of any of the elements obtained via this function call.

SYNOPSIS

struct list_head ⋆dmx_get_demuxes ()

PARAMETERS

none

 

RETURNS

struct list_head *

A list of demux interfaces, or NULL in the case of an empty list.