FFmpeg
Loading...
Searching...
No Matches
af_channelmap.c File Reference

audio channel mapping filter More...

#include <ctype.h>
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/mathematics.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/samplefmt.h"
#include "audio.h"
#include "avfilter.h"
#include "filters.h"
#include "formats.h"

Go to the source code of this file.

Data Structures

struct  ChannelMap
 
struct  ChannelMapContext
 

Macros

#define OFFSET(x)
 
#define A   AV_OPT_FLAG_AUDIO_PARAM
 
#define F   AV_OPT_FLAG_FILTERING_PARAM
 

Enumerations

enum  MappingMode {
  MAP_NONE , MAP_ONE_INT , MAP_ONE_STR , MAP_PAIR_INT_INT ,
  MAP_PAIR_INT_STR , MAP_PAIR_STR_INT , MAP_PAIR_STR_STR
}
 

Functions

 AVFILTER_DEFINE_CLASS (channelmap)
 
static void channelmap_uninit (AVFilterContext *ctx)
 
static char * split (char *message, char delim)
 
static int get_channel_idx (char **map, int *ch, char delim)
 
static int get_channel (char **map, int *ch, char delim)
 
static int check_idx_and_id (AVFilterContext *ctx, int channel_idx, int channel, AVChannelLayout *ch_layout, const char *io)
 
static av_cold int channelmap_init (AVFilterContext *ctx)
 
static int channelmap_query_formats (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 
static int channelmap_filter_frame (AVFilterLink *inlink, AVFrame *buf)
 
static int channelmap_config_input (AVFilterLink *inlink)
 

Variables

static const AVOption channelmap_options []
 
static const AVFilterPad avfilter_af_channelmap_inputs []
 
const FFFilter ff_af_channelmap
 

Detailed Description

audio channel mapping filter

Definition in file af_channelmap.c.

Macro Definition Documentation

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 69 of file af_channelmap.c.

◆ A

#define A   AV_OPT_FLAG_AUDIO_PARAM

Definition at line 70 of file af_channelmap.c.

◆ F

Definition at line 71 of file af_channelmap.c.

Enumeration Type Documentation

◆ MappingMode

Enumerator
MAP_NONE 
MAP_ONE_INT 
MAP_ONE_STR 
MAP_PAIR_INT_INT 
MAP_PAIR_INT_STR 
MAP_PAIR_STR_INT 
MAP_PAIR_STR_STR 

Definition at line 48 of file af_channelmap.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( channelmap )

◆ channelmap_uninit()

static void channelmap_uninit ( AVFilterContext * ctx)
static

Definition at line 82 of file af_channelmap.c.

◆ split()

◆ get_channel_idx()

static int get_channel_idx ( char ** map,
int * ch,
char delim )
static

Definition at line 96 of file af_channelmap.c.

Referenced by channelmap_init().

◆ get_channel()

static int get_channel ( char ** map,
int * ch,
char delim )
static

Definition at line 116 of file af_channelmap.c.

Referenced by channelmap_init().

◆ check_idx_and_id()

static int check_idx_and_id ( AVFilterContext * ctx,
int channel_idx,
int channel,
AVChannelLayout * ch_layout,
const char * io )
static

Definition at line 128 of file af_channelmap.c.

Referenced by channelmap_config_input(), and channelmap_init().

◆ channelmap_init()

static av_cold int channelmap_init ( AVFilterContext * ctx)
static

Definition at line 152 of file af_channelmap.c.

◆ channelmap_query_formats()

static int channelmap_query_formats ( const AVFilterContext * ctx,
AVFilterFormatsConfig ** cfg_in,
AVFilterFormatsConfig ** cfg_out )
static

Definition at line 340 of file af_channelmap.c.

◆ channelmap_filter_frame()

static int channelmap_filter_frame ( AVFilterLink * inlink,
AVFrame * buf )
static

Definition at line 364 of file af_channelmap.c.

◆ channelmap_config_input()

static int channelmap_config_input ( AVFilterLink * inlink)
static

Definition at line 411 of file af_channelmap.c.

Variable Documentation

◆ channelmap_options

const AVOption channelmap_options[]
static
Initial value:
= {
{ "map", "A comma-separated list of input channel numbers in output order.",
OFFSET(mapping_str), AV_OPT_TYPE_STRING, .flags = A|F },
{ "channel_layout", "Output channel layout.",
OFFSET(output_layout), AV_OPT_TYPE_CHLAYOUT, .flags = A|F },
{ NULL }
}
#define A(x)
Definition vpx_arith.h:28
#define NULL
Definition coverity.c:32
#define F(x)
#define OFFSET(x)
@ AV_OPT_TYPE_CHLAYOUT
Underlying C type is AVChannelLayout.
Definition opt.h:330
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition opt.h:275

Definition at line 72 of file af_channelmap.c.

◆ avfilter_af_channelmap_inputs

const AVFilterPad avfilter_af_channelmap_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = channelmap_filter_frame,
.config_props = channelmap_config_input,
},
}
static int channelmap_config_input(AVFilterLink *inlink)
static int channelmap_filter_frame(AVFilterLink *inlink, AVFrame *buf)
@ AVMEDIA_TYPE_AUDIO
Definition avutil.h:201
#define AVFILTERPAD_FLAG_NEEDS_WRITABLE
The filter expects writable frames from its input link, duplicating data buffers if needed.
Definition filters.h:59

Definition at line 438 of file af_channelmap.c.

◆ ff_af_channelmap

const FFFilter ff_af_channelmap
Initial value:
= {
.p.name = "channelmap",
.p.description = NULL_IF_CONFIG_SMALL("Remap audio channels."),
.p.priv_class = &channelmap_class,
.init = channelmap_init,
.uninit = channelmap_uninit,
.priv_size = sizeof(ChannelMapContext),
}
static const AVFilterPad avfilter_af_channelmap_inputs[]
static int channelmap_query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
static av_cold int channelmap_init(AVFilterContext *ctx)
static void channelmap_uninit(AVFilterContext *ctx)
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
Definition audio.c:34
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_QUERY_FUNC2(func)
Definition filters.h:241
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88

Definition at line 448 of file af_channelmap.c.