FFmpeg
Data Structures | Macros | Functions | Variables
channel_layout.c File Reference
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "avassert.h"
#include "channel_layout.h"
#include "bprint.h"
#include "common.h"
#include "error.h"
#include "macros.h"
#include "opt.h"

Go to the source code of this file.

Data Structures

struct  channel_name
 
struct  channel_layout_name
 

Macros

#define CHAN_IS_AMBI(x)
 

Functions

static const char * get_channel_name (enum AVChannel channel_id)
 
void av_channel_name_bprint (AVBPrint *bp, enum AVChannel channel_id)
 bprint variant of av_channel_name(). More...
 
int av_channel_name (char *buf, size_t buf_size, enum AVChannel channel_id)
 Get a human readable string in an abbreviated form describing a given channel. More...
 
void av_channel_description_bprint (AVBPrint *bp, enum AVChannel channel_id)
 bprint variant of av_channel_description(). More...
 
int av_channel_description (char *buf, size_t buf_size, enum AVChannel channel_id)
 Get a human readable string describing a given channel. More...
 
enum AVChannel av_channel_from_string (const char *str)
 This is the inverse function of av_channel_name(). More...
 
static FF_DISABLE_DEPRECATION_WARNINGS 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...
 
int av_get_extended_channel_layout (const char *name, uint64_t *channel_layout, int *nb_channels)
 Return a channel layout and the number of channels based on the specified name. 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...
 
FF_ENABLE_DEPRECATION_WARNINGS int av_channel_layout_from_mask (AVChannelLayout *channel_layout, uint64_t mask)
 Initialize a native channel layout from a bitmask indicating which channels are present. More...
 
int av_channel_layout_from_string (AVChannelLayout *channel_layout, const char *str)
 Initialize a channel layout from a given string description. More...
 
void av_channel_layout_uninit (AVChannelLayout *channel_layout)
 Free any allocated data in the channel layout and reset the channel count to 0. More...
 
int av_channel_layout_copy (AVChannelLayout *dst, const AVChannelLayout *src)
 Make a copy of a channel layout. More...
 
static int ambisonic_order (const AVChannelLayout *channel_layout)
 If the layout is n-th order standard-order ambisonic, with optional extra non-diegetic channels at the end, return the order. More...
 
static int try_describe_ambisonic (AVBPrint *bp, const AVChannelLayout *channel_layout)
 If the custom layout is n-th order standard-order ambisonic, with optional extra non-diegetic channels at the end, write its string description in bp. More...
 
int av_channel_layout_describe_bprint (const AVChannelLayout *channel_layout, AVBPrint *bp)
 bprint variant of av_channel_layout_describe(). More...
 
int av_channel_layout_describe (const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
 Get a human-readable string describing the channel layout properties. More...
 
enum AVChannel av_channel_layout_channel_from_index (const AVChannelLayout *channel_layout, unsigned int idx)
 Get the channel with the given index in a channel layout. More...
 
enum AVChannel av_channel_layout_channel_from_string (const AVChannelLayout *channel_layout, const char *str)
 Get a channel described by the given string. More...
 
int av_channel_layout_index_from_channel (const AVChannelLayout *channel_layout, enum AVChannel channel)
 Get the index of a given channel in a channel layout. More...
 
int av_channel_layout_index_from_string (const AVChannelLayout *channel_layout, const char *str)
 Get the index in a channel layout of a channel described by the given string. More...
 
int av_channel_layout_check (const AVChannelLayout *channel_layout)
 Check whether a channel layout is valid, i.e. More...
 
int av_channel_layout_compare (const AVChannelLayout *chl, const AVChannelLayout *chl1)
 Check whether two channel layouts are semantically the same, i.e. More...
 
void av_channel_layout_default (AVChannelLayout *ch_layout, int nb_channels)
 Get the default channel layout for a given number of channels. More...
 
const AVChannelLayoutav_channel_layout_standard (void **opaque)
 Iterate over all standard channel layouts. More...
 
uint64_t av_channel_layout_subset (const AVChannelLayout *channel_layout, uint64_t mask)
 Find out what channels from a given set are present in a channel layout, without regard for their positions. More...
 

Variables

static const struct channel_name channel_names []
 
static const struct channel_layout_name channel_layout_map []
 

Detailed Description

audio channel layout utility functions

Definition in file channel_layout.c.

Macro Definition Documentation

◆ CHAN_IS_AMBI

#define CHAN_IS_AMBI (   x)
Value:

Definition at line 38 of file channel_layout.c.

Function Documentation

◆ get_channel_name()

static const char* get_channel_name ( enum AVChannel  channel_id)
static

Definition at line 79 of file channel_layout.c.

Referenced by av_bprint_channel_layout(), and av_get_channel_name().

◆ get_channel_layout_single()

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

Definition at line 207 of file channel_layout.c.

Referenced by av_get_channel_layout().

◆ ambisonic_order()

static int ambisonic_order ( const AVChannelLayout channel_layout)
static

If the layout is n-th order standard-order ambisonic, with optional extra non-diegetic channels at the end, return the order.

Return a negative error code otherwise.

Definition at line 655 of file channel_layout.c.

Referenced by ff_opus_parse_extradata(), mov_read_SA3D(), and try_describe_ambisonic().

◆ try_describe_ambisonic()

static int try_describe_ambisonic ( AVBPrint *  bp,
const AVChannelLayout channel_layout 
)
static

If the custom layout is n-th order standard-order ambisonic, with optional extra non-diegetic channels at the end, write its string description in bp.

Return a negative error code otherwise.

Definition at line 698 of file channel_layout.c.

Referenced by av_channel_layout_describe_bprint().

Variable Documentation

◆ channel_names

const struct channel_name channel_names[]
static

◆ channel_layout_map

const struct channel_layout_name channel_layout_map[]
static
AV_CHAN_AMBISONIC_END
@ AV_CHAN_AMBISONIC_END
Definition: channel_layout.h:98
AV_CHAN_AMBISONIC_BASE
@ AV_CHAN_AMBISONIC_BASE
Range of channels between AV_CHAN_AMBISONIC_BASE and AV_CHAN_AMBISONIC_END represent Ambisonic compon...
Definition: channel_layout.h:95