convergence.de
 cryptolabs.org
 directfb.org
 linuxtv.org
 
 linuxtv
 projects
 developer
   DVB
    API
   DVD
   Mbone
   CVS
 download
 contact
 

DVB Audio API

The DVB audio device controls the MPEG2 audio decoder of the DVB hardware. It can be accessed through /dev/ost/audio.

The function calls defined in the include file audio.h are described in detail below:

Audio API IO control calls


int open(const char *deviceName, int flags);

    DESCRIPTION
    
	This system call opens a named audio device (e.g. /dev/ost/audio) for subsequent
        use. When an open() call has succeeded, the device will be ready for use.
        The significance of blocking or non-blocking mode is described in the 
	documentation for functions where there is a difference. It does not affect 
	the semantics of the open() call itself. A device opened in blocking mode can
	later be put into non-blocking mode (and vice versa) using the F_SETFL command
	of the fcntl system call.  This is a standard system call, documented in the 
	Linux manual page for fcntl.
        Only one user can open the Audio  Device in O_RDWR mode. All other attempts to
        open the device in this mode will fail, and an errorcode will be returned.
        If the Audio Device is opened in O_RDONLY mode, the only ioctl call that can 
	be used is AUDIO_GET_STATUS. All other call will return with an error code.


    PARAMETERS

	const char *deviceName		Name of specific audio device.

	int flags           		A bit-wise OR of the following flags:
                                        
					O_RDONLY read-only access

                                        O_RDWR read/write access

                                        O_NONBLOCK open in non-blocking mode
                                                   (blocking mode is the default)

    RETURNS

	ENODEV                          Device driver not loaded/available.

	EINTERNAL			Internal error

        EBUSY                           Device or resource busy.

        EINVAL                          Invalid argument.




int close(int fd);

    DESCRIPTION
	
	This system call closes a previously opened audio device

    PARAMETERS
	
	int fd			File descriptor returned by a previous call to open().

    RETURNS

	EBADF			fd is not a valid open file descriptor




size_t write(int fd, const void *buf, size_t count);

    DESCRIPTION

	This system call can only be used if AUDIO_SOURCE_MEMORY is selected in the 
	ioctl call AUDIO_SELECT_SOURCE. The data provided shall be in PES format.
        If O_NONBLOCK is not specified the function will block until buffer space is
	available. The amount of data to be transferred is implied by count.

    PARAMETERS

	int fd			File descriptor returned by a previous call to open().

	void *buf		Pointer to the buffer containing the PES data.

	size_t count		Size of buf.

    RETURNS

	EPERM			Mode VIDEO_SOURCE_INTERNAL not selected.

	ENOMEM			Attempted to write more data than the internal
                                buffer can hold.

	EBADF			fd is not a valid open file descriptor




int ioctl(int fd, int request = AUDIO_STOP);

    DESCRIPTION

	This ioctl call asks the Audio Device to stop playing the current stream.


    PARAMETERS

	int fd			File descriptor returned by a previous call to open().

	int request             Equals AUDIO_STOP for this command.

    RETURNS

	EBADF                   fd is not a valid open file descriptor

	EINTERNAL		Internal error




int ioctl(int fd, int request = AUDIO_PLAY);

    DESCRIPTION

	This ioctl call asks the Audio Device to start playing an audio stream from the
        selected source.

    PARAMETERS

	int fd			File descriptor returned by a previous call to open().

	int request		Equals AUDIO_PLAY for this command.

    RETURNS
	
        EBADF			fd is not a valid open file descriptor.

	EINTERNAL               Internal error




int ioctl(int fd, int request = AUDIO_PAUSE);

    DESCRIPTION

	This ioctl call suspends the audio stream being played. Decoding and playing are
	paused. It is then possible to restart again decoding and playing process of the
        audio stream using AUDIO_CONTINUE command.
        If  AUDIO_SOURCE_MEMORY is selected in the ioctl call AUDIO_SELECT_SOURCE, the
        DVB-subsystem will not decode (consume) any more data until the ioctl  call
        AUDIO_CONTINUE or AUDIO_PLAY is performed.

    PARAMETERS

	int fd			File descriptor returned by a previous call to open().

	int request		Equals AUDIO_PAUSE for this command.

    RETURNS
           

	EBADF			fd is not a valid open file descriptor.

	EINTERNAL		Internal error




int ioctl(int fd, int request = AUDIO_CONTINUE);

    DESCRIPTION

	This ioctl call restarts decoding and playing processes of the audio stream,
	 which was played before, a call to AUDIO_PAUSE was made.

    PARAMETERS

	int fd			File descriptor returned by a previous call to open().

	int request		Equals AUDIO_CONTINUE for this command.

    RETURNS

	EBADF			fd is not a valid open file descriptor.

	EINTERNAL               Internal error, possibly in the communication
                                with the DVB subsystem.




int ioctl(int fd, int request = AUDIO_SELECT_SOURCE, audioStreamSource_t source);

    DESCRIPTION

	This ioctl call informs the audio device which source shall be used for the 
	input data. The possible sources are demux or memory. If AUDIO_SOURCE_MEMORY 
	is selected, the data is fed to the Audio Device through the write command.

    PARAMETERS

	int fd			File descriptor returned by a previous call to open().

	int request		Equals AUDIO_SELECT_SOURCE for this command.

	audioStreamSource_t source	Indicates the source that shall be used for the
             			        Audio stream.

    RETURNS

	EBADF			fd is not a valid open file descriptor.

	EINTERNAL		Internal error




int ioctl(int fd, int request = AUDIO_SET_MUTE, boolean state);

    DESCRIPTION
    
	This ioctl call asks the audio device to mute the stream that is currently being
        played.

    PARAMETERS

	int fd			File descriptor returned by a previous call to open().

	int request		Equals AUDIO_SET_MUTE for this command.

	boolean state		Indicates if audio device shall mute or not.
                                TRUE     Audio Mute
                                FALSE   Audio Unmute

    RETURNS

	EBADF			fd is not a valid open file descriptor.

	EINTERNAL		Internal error,

        EINVAL                  Illegal input parameter.

int ioctl(int fd, int request = AUDIO_SET_AV_SYNC, boolean state);

    DESCRIPTION

	This ioctl call asks the Audio Device to turn ON or OFF A/V synchronisation.

    PARAMETERS

	int fd			File descriptor returned by a previous call to open().

	int request		Equals AUDIO_AV_SYNC for this command.

	boolean state		Tells the DVB subsystem if A/V synchronisation shall be ON or OFF.
                                TRUE    AV-sync ON
                                FALSE  AV-sync OFF

    RETURNS

    	EBADF			fd is not a valid open file descriptor.
        
	EINTERNAL		Internal error

	EINVAL                                  Illegal input parameter.




int ioctl(int fd, int request = AUDIO_SET_BYPASS_MODE, boolean mode);

    DESCRIPTION

	This ioctl call asks the Audio Device to bypass the Audio decoder and forward
	the stream without decoding. This mode shall be used if streams that can't be
	handled by the DVB system shall be decoded. Dolby DigitalTM streams are 
	automatically forwarded by the DVB subsystem.

    PARAMETERS

	int fd			File descriptor returned by a previous call to open().

	int request		Equals AUDIO_SET_BYPASS_MODE for this command.

	boolean mode		Enables or disables the decoding of the current
                                Audio stream in the DVB subsystem.
                                TRUE    Bypass is disabled
                                FALSE  Bypass is enabled

    RETURNS

	EBADF			fd is not a valid open file descriptor.
        
	EINTERNAL               Internal error

        EINVAL                  Illegal pointer mode.


int ioctl(int fd, int request = AUDIO_CHANNEL_SELECT, audioChannelSelect_t)

    DESCRIPTION
    
	This ioctl call asks the Audio Device to select the requested channel if possible.

    PARAMETERS

	int fd			File descriptor returned by a previous call to open().

	int request		Equals AUDIO_CHANNEL_SELECT for this command.

	audioChannelSelect_t ch Select the output format of the audio (Mono, stereo)

    RETURNS
	
	EBADF			fd is not a valid open file descriptor.

	EINTERNAL		Internal error

        EINVAL			Illegal pointer ch.




int ioctl(int fd, int request = AUDIO_GET_STATUS, struct audioStatus *status)

    DESCRIPTION

	This ioctl call asks the Audio Device to return the current state of the Audio
	Device.

    PARAMETERS

	int fd			File descriptor returned by a previous call to open().

        int request		Equals AUDIO_GET_STATUS for this command.

        struct audioStatus *status 	Returns the current state of Audio Device

    RETURNS

	EBADF			fd is not a valid open file descriptor.

	EINTERNAL		Internal error

        EFAULT			status points to invalid address