Audio format definitions
[Audio]

Definitions for several variations of audio data. More...


Data Structures

struct  gavl_audio_format_t
 Audio Format. More...

Defines

#define GAVL_MAX_CHANNELS   128
 Maximum number of audio channels.

Enumerations

enum  gavl_sample_format_t {
  GAVL_SAMPLE_NONE = 0,
  GAVL_SAMPLE_U8 = 1,
  GAVL_SAMPLE_S8 = 2,
  GAVL_SAMPLE_U16 = 3,
  GAVL_SAMPLE_S16 = 4,
  GAVL_SAMPLE_S32 = 5,
  GAVL_SAMPLE_FLOAT = 6,
  GAVL_SAMPLE_DOUBLE = 7
}
 Format of one audio sample. More...
enum  gavl_interleave_mode_t {
  GAVL_INTERLEAVE_NONE = 0,
  GAVL_INTERLEAVE_2 = 1,
  GAVL_INTERLEAVE_ALL = 2
}
enum  gavl_channel_id_t {
  GAVL_CHID_NONE = 0,
  GAVL_CHID_FRONT_CENTER,
  GAVL_CHID_FRONT_LEFT,
  GAVL_CHID_FRONT_RIGHT,
  GAVL_CHID_FRONT_CENTER_LEFT,
  GAVL_CHID_FRONT_CENTER_RIGHT,
  GAVL_CHID_REAR_LEFT,
  GAVL_CHID_REAR_RIGHT,
  GAVL_CHID_REAR_CENTER,
  GAVL_CHID_SIDE_LEFT,
  GAVL_CHID_SIDE_RIGHT,
  GAVL_CHID_LFE,
  GAVL_CHID_AUX
}
 Audio channel setup. More...

Functions

const char * gavl_sample_format_to_string (gavl_sample_format_t format)
 Convert a gavl_sample_format_t to a human readable string.
gavl_sample_format_t gavl_string_to_sample_format (const char *str)
 Convert a string to a sample format.
int gavl_num_sample_formats ()
 Get total number of supported sample formats.
gavl_sample_format_t gavl_get_sample_format (int index)
 Get the sample format from index.
const char * gavl_channel_id_to_string (gavl_channel_id_t id)
 Convert a gavl_channel_id_t to a human readable string.
const char * gavl_interleave_mode_to_string (gavl_interleave_mode_t mode)
 Convert a gavl_interleave_mode_t to a human readable string.
void gavl_audio_format_dump (const gavl_audio_format_t *format)
 Dump an audio format to stderr.
int gavl_channel_index (const gavl_audio_format_t *format, gavl_channel_id_t id)
 Get the index of a particular channel for a given format.
int gavl_front_channels (const gavl_audio_format_t *format)
 Get number of front channels for a given format.
int gavl_rear_channels (const gavl_audio_format_t *format)
 Get number of rear channels for a given format.
int gavl_side_channels (const gavl_audio_format_t *format)
 Get number of side channels for a given format.
int gavl_aux_channels (const gavl_audio_format_t *format)
 Get number of aux channels for a given format.
int gavl_lfe_channels (const gavl_audio_format_t *format)
 Get number of LFE channels for a given format.
void gavl_audio_format_copy (gavl_audio_format_t *dst, const gavl_audio_format_t *src)
 Copy one audio format to another.
int gavl_audio_formats_equal (const gavl_audio_format_t *format_1, const gavl_audio_format_t *format_2)
 Compare 2 audio formats.
void gavl_set_channel_setup (gavl_audio_format_t *format)
 Set the default channel setup and indices.
int gavl_bytes_per_sample (gavl_sample_format_t format)
 Get the number of bytes per sample for a given sample format.


Detailed Description

Definitions for several variations of audio data.

Define Documentation

#define GAVL_MAX_CHANNELS   128

Maximum number of audio channels.


Enumeration Type Documentation

Format of one audio sample.

For multibyte numbers, the byte order is always machine native endian

Enumerator:
GAVL_SAMPLE_NONE  Undefined
GAVL_SAMPLE_U8  Unsigned 8 bit
GAVL_SAMPLE_S8  Signed 8 bit
GAVL_SAMPLE_U16  Unsigned 16 bit
GAVL_SAMPLE_S16  Signed 16 bit
GAVL_SAMPLE_S32  Signed 32 bit
GAVL_SAMPLE_FLOAT  Floating point (-1.0 .. 1.0)
GAVL_SAMPLE_DOUBLE  Double (-1.0 .. 1.0)

Interleave mode of the channels

Enumerator:
GAVL_INTERLEAVE_NONE  No interleaving, all channels separate
GAVL_INTERLEAVE_2  Interleaved pairs of channels
GAVL_INTERLEAVE_ALL  Everything interleaved

Audio channel setup.

These are the channel locations used to identify the channel order for an audio format

Enumerator:
GAVL_CHID_NONE  Undefined
GAVL_CHID_FRONT_CENTER  For mono
GAVL_CHID_FRONT_LEFT  Front left
GAVL_CHID_FRONT_RIGHT  Front right
GAVL_CHID_FRONT_CENTER_LEFT  Left of Center
GAVL_CHID_FRONT_CENTER_RIGHT  Right of Center
GAVL_CHID_REAR_LEFT  Rear left
GAVL_CHID_REAR_RIGHT  Rear right
GAVL_CHID_REAR_CENTER  Rear Center
GAVL_CHID_SIDE_LEFT  Side left
GAVL_CHID_SIDE_RIGHT  Side right
GAVL_CHID_LFE  Subwoofer
GAVL_CHID_AUX  Additional channel (can be more than one)


Function Documentation

const char* gavl_sample_format_to_string ( gavl_sample_format_t  format  ) 

Convert a gavl_sample_format_t to a human readable string.

Parameters:
format A sample format
Returns:
A string describing the format

gavl_sample_format_t gavl_string_to_sample_format ( const char *  str  ) 

Convert a string to a sample format.

Parameters:
str String
str must be one of the strings returned by gavl_sample_format_to_string

int gavl_num_sample_formats (  ) 

Get total number of supported sample formats.

Returns:
total number of supported sample formats

gavl_sample_format_t gavl_get_sample_format ( int  index  ) 

Get the sample format from index.

Parameters:
index index (must be between 0 and the result of gavl_num_sample_formats)
Returns:
The sample format corresponding to index or GAVL_SAMPLE_NONE.

const char* gavl_channel_id_to_string ( gavl_channel_id_t  id  ) 

Convert a gavl_channel_id_t to a human readable string.

Parameters:
id A channel id

const char* gavl_interleave_mode_to_string ( gavl_interleave_mode_t  mode  ) 

Convert a gavl_interleave_mode_t to a human readable string.

Parameters:
mode An interleave mode

void gavl_audio_format_dump ( const gavl_audio_format_t format  ) 

Dump an audio format to stderr.

Parameters:
format An audio format

int gavl_channel_index ( const gavl_audio_format_t format,
gavl_channel_id_t  id 
)

Get the index of a particular channel for a given format.

Parameters:
format An audio format
id A channel id
Returns:
The index of the channel in the format or -1 if such a channel is not present

int gavl_front_channels ( const gavl_audio_format_t format  ) 

Get number of front channels for a given format.

Parameters:
format An audio format

int gavl_rear_channels ( const gavl_audio_format_t format  ) 

Get number of rear channels for a given format.

Parameters:
format An audio format

int gavl_side_channels ( const gavl_audio_format_t format  ) 

Get number of side channels for a given format.

Parameters:
format An audio format

int gavl_aux_channels ( const gavl_audio_format_t format  ) 

Get number of aux channels for a given format.

Parameters:
format An audio format

int gavl_lfe_channels ( const gavl_audio_format_t format  ) 

Get number of LFE channels for a given format.

Parameters:
format An audio format

void gavl_audio_format_copy ( gavl_audio_format_t dst,
const gavl_audio_format_t src 
)

Copy one audio format to another.

Parameters:
dst Destination format
src Source format

int gavl_audio_formats_equal ( const gavl_audio_format_t format_1,
const gavl_audio_format_t format_2 
)

Compare 2 audio formats.

Parameters:
format_1 First format
format_2 Second format
Returns:
1 if the formats are equal, 0 else

void gavl_set_channel_setup ( gavl_audio_format_t format  ) 

Set the default channel setup and indices.

Parameters:
format An audio format
Set a default channel setup and channel indices if only the number of channels is known. The result might be wrong if you have something else than mono or stereo from a stream, which has no informtions about the speaker configurations.

int gavl_bytes_per_sample ( gavl_sample_format_t  format  ) 

Get the number of bytes per sample for a given sample format.

Parameters:
format A sample format


Generated on Thu Apr 9 21:03:25 2009 for gavl by  doxygen 1.5.7.1