channel_layout.c File Reference

audio channel layout utility functions More...

#include "avstring.h"
#include "avutil.h"
#include "channel_layout.h"
#include "bprint.h"
#include "common.h"
Include dependency graph for channel_layout.c:

Go to the source code of this file.

Data Structures

struct  channel_name
 

Functions

static const char * get_channel_name (int channel_id)
 
static uint64_t get_channel_layout_single (const char *name, int name_len)
 
uint64_t av_get_channel_layout (const char *name)
 Return a channel layout id that matches name, or 0 if no match is found. More...
 
void av_bprint_channel_layout (struct AVBPrint *bp, int nb_channels, uint64_t channel_layout)
 Append a description of a channel layout to a bprint buffer. More...
 
void av_get_channel_layout_string (char *buf, int buf_size, int nb_channels, uint64_t channel_layout)
 Return a description of a channel layout. More...
 
int av_get_channel_layout_nb_channels (uint64_t channel_layout)
 Return the number of channels in the channel layout. More...
 
int64_t av_get_default_channel_layout (int nb_channels)
 Return default channel layout for a given number of channels. More...
 
int av_get_channel_layout_channel_index (uint64_t channel_layout, uint64_t channel)
 Get the index of a channel in channel_layout. More...
 
const char * av_get_channel_name (uint64_t channel)
 Get the name of a given channel. More...
 
const char * av_get_channel_description (uint64_t channel)
 Get the description of a given channel. More...
 
uint64_t av_channel_layout_extract_channel (uint64_t channel_layout, int index)
 Get the channel with the given index in channel_layout. More...
 
int av_get_standard_channel_layout (unsigned index, uint64_t *layout, const char **name)
 Get the value and name of a standard channel layout. More...
 

Variables

static const struct channel_name channel_names []
 
struct {
   const char *   name
 
   int   nb_channels
 
   uint64_t   layout
 
channel_layout_map []
 

Detailed Description

audio channel layout utility functions

Definition in file channel_layout.c.

Function Documentation

static uint64_t get_channel_layout_single ( const char *  name,
int  name_len 
)
static

Definition at line 106 of file channel_layout.c.

Referenced by av_get_channel_layout().

static const char* get_channel_name ( int  channel_id)
static

Definition at line 65 of file channel_layout.c.

Referenced by av_bprint_channel_layout(), and av_get_channel_name().

Variable Documentation

const { ... } channel_layout_map[]
Initial value:
= {
{ "mono", 1, AV_CH_LAYOUT_MONO },
{ "stereo", 2, AV_CH_LAYOUT_STEREO },
{ "2.1", 3, AV_CH_LAYOUT_2POINT1 },
{ "3.0", 3, AV_CH_LAYOUT_SURROUND },
{ "3.0(back)", 3, AV_CH_LAYOUT_2_1 },
{ "4.0", 4, AV_CH_LAYOUT_4POINT0 },
{ "quad", 4, AV_CH_LAYOUT_QUAD },
{ "quad(side)", 4, AV_CH_LAYOUT_2_2 },
{ "3.1", 4, AV_CH_LAYOUT_3POINT1 },
{ "5.0(side)", 5, AV_CH_LAYOUT_5POINT0 },
{ "4.1", 5, AV_CH_LAYOUT_4POINT1 },
{ "5.1(side)", 6, AV_CH_LAYOUT_5POINT1 },
{ "6.0", 6, AV_CH_LAYOUT_6POINT0 },
{ "6.0(front)", 6, AV_CH_LAYOUT_6POINT0_FRONT },
{ "hexagonal", 6, AV_CH_LAYOUT_HEXAGONAL },
{ "6.1", 7, AV_CH_LAYOUT_6POINT1 },
{ "6.1(front)", 7, AV_CH_LAYOUT_6POINT1_FRONT },
{ "7.0", 7, AV_CH_LAYOUT_7POINT0 },
{ "7.0(front)", 7, AV_CH_LAYOUT_7POINT0_FRONT },
{ "7.1", 8, AV_CH_LAYOUT_7POINT1 },
{ "7.1(wide)", 8, AV_CH_LAYOUT_7POINT1_WIDE_BACK },
{ "7.1(wide-side)", 8, AV_CH_LAYOUT_7POINT1_WIDE },
{ "octagonal", 8, AV_CH_LAYOUT_OCTAGONAL },
{ "downmix", 2, AV_CH_LAYOUT_STEREO_DOWNMIX, },
}
#define AV_CH_LAYOUT_7POINT1
#define AV_CH_LAYOUT_4POINT1
#define AV_CH_LAYOUT_6POINT1
#define AV_CH_LAYOUT_6POINT0
#define AV_CH_LAYOUT_SURROUND
#define AV_CH_LAYOUT_7POINT0_FRONT
#define AV_CH_LAYOUT_4POINT0
#define AV_CH_LAYOUT_7POINT0
#define AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_5POINT0
#define AV_CH_LAYOUT_HEXAGONAL
#define AV_CH_LAYOUT_5POINT1
#define AV_CH_LAYOUT_QUAD
#define AV_CH_LAYOUT_2_1
#define AV_CH_LAYOUT_2_2
#define AV_CH_LAYOUT_6POINT0_FRONT
#define AV_CH_LAYOUT_STEREO_DOWNMIX
#define AV_CH_LAYOUT_3POINT1
#define AV_CH_LAYOUT_5POINT1_BACK
#define AV_CH_LAYOUT_6POINT1_BACK
#define AV_CH_LAYOUT_7POINT1_WIDE_BACK
#define AV_CH_LAYOUT_5POINT0_BACK
#define AV_CH_LAYOUT_OCTAGONAL
#define AV_CH_LAYOUT_7POINT1_WIDE
#define AV_CH_LAYOUT_2POINT1
#define AV_CH_LAYOUT_6POINT1_FRONT
#define AV_CH_LAYOUT_MONO

Referenced by av_bprint_channel_layout(), av_get_default_channel_layout(), av_get_standard_channel_layout(), and get_channel_layout_single().

const struct channel_name channel_names[]
static
Initial value:
= {
[0] = { "FL", "front left" },
[1] = { "FR", "front right" },
[2] = { "FC", "front center" },
[3] = { "LFE", "low frequency" },
[4] = { "BL", "back left" },
[5] = { "BR", "back right" },
[6] = { "FLC", "front left-of-center" },
[7] = { "FRC", "front right-of-center" },
[8] = { "BC", "back center" },
[9] = { "SL", "side left" },
[10] = { "SR", "side right" },
[11] = { "TC", "top center" },
[12] = { "TFL", "top front left" },
[13] = { "TFC", "top front center" },
[14] = { "TFR", "top front right" },
[15] = { "TBL", "top back left" },
[16] = { "TBC", "top back center" },
[17] = { "TBR", "top back right" },
[29] = { "DL", "downmix left" },
[30] = { "DR", "downmix right" },
[31] = { "WL", "wide left" },
[32] = { "WR", "wide right" },
[33] = { "SDL", "surround direct left" },
[34] = { "SDR", "surround direct right" },
[35] = { "LFE2", "low frequency 2" },
}

Definition at line 37 of file channel_layout.c.

uint64_t layout
const char* name

Definition at line 73 of file channel_layout.c.