FFmpeg
Data Structures | Macros | Functions | Variables
af_amerge.c File Reference
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/channel_layout.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "filters.h"
#include "audio.h"
#include "formats.h"

Go to the source code of this file.

Data Structures

struct  AMergeContext
 
struct  AMergeContext::amerge_input
 

Macros

#define SWR_CH_MAX   64
 
#define OFFSET(x)   offsetof(AMergeContext, x)
 
#define FLAGS   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (amerge)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_output (AVFilterLink *outlink)
 
static void copy_samples (int nb_inputs, struct amerge_input in[], int *route, uint8_t *ins[], uint8_t **outs, int ns, int bps)
 Copy samples from several input streams to one output stream. More...
 
static void free_frames (int nb_inputs, AVFrame **input_frames)
 
static int try_push_frame (AVFilterContext *ctx, int nb_samples)
 
static int activate (AVFilterContext *ctx)
 
static av_cold int init (AVFilterContext *ctx)
 

Variables

static const AVOption amerge_options []
 
static const AVFilterPad amerge_outputs []
 
const AVFilter ff_af_amerge
 

Detailed Description

Audio merging filter

Definition in file af_amerge.c.

Macro Definition Documentation

◆ SWR_CH_MAX

#define SWR_CH_MAX   64

Definition at line 36 of file af_amerge.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(AMergeContext, x)

Definition at line 48 of file af_amerge.c.

◆ FLAGS

Definition at line 49 of file af_amerge.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( amerge  )

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 59 of file af_amerge.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 66 of file af_amerge.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 151 of file af_amerge.c.

◆ copy_samples()

static void copy_samples ( int  nb_inputs,
struct amerge_input  in[],
int *  route,
uint8_t *  ins[],
uint8_t **  outs,
int  ns,
int  bps 
)
inlinestatic

Copy samples from several input streams to one output stream.

Parameters
nb_inputsnumber of inputs
ininputs; used only for the nb_ch field;
routerouting values; input channel i goes to output channel route[i]; i < in[0].nb_ch are the channels from the first output; i >= in[0].nb_ch are the channels from the second output
inspointer to the samples of each inputs, in packed format; will be left at the end of the copied samples
outspointer to the samples of the output, in packet format; must point to a buffer big enough; will be left at the end of the copied samples
nsnumber of samples to copy
bpsbytes per sample

Definition at line 189 of file af_amerge.c.

Referenced by try_push_frame().

◆ free_frames()

static void free_frames ( int  nb_inputs,
AVFrame **  input_frames 
)
static

Definition at line 210 of file af_amerge.c.

Referenced by try_push_frame().

◆ try_push_frame()

static int try_push_frame ( AVFilterContext ctx,
int  nb_samples 
)
static

Definition at line 217 of file af_amerge.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 279 of file af_amerge.c.

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 314 of file af_amerge.c.

Variable Documentation

◆ amerge_options

const AVOption amerge_options[]
static
Initial value:
= {
{ "inputs", "specify the number of inputs", OFFSET(nb_inputs),
AV_OPT_TYPE_INT, { .i64 = 2 }, 1, SWR_CH_MAX, FLAGS },
{ NULL }
}

Definition at line 51 of file af_amerge.c.

◆ amerge_outputs

const AVFilterPad amerge_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
},
}

Definition at line 336 of file af_amerge.c.

◆ ff_af_amerge

const AVFilter ff_af_amerge
Initial value:
= {
.name = "amerge",
.description = NULL_IF_CONFIG_SMALL("Merge two or more audio streams into "
"a single multi-channel stream."),
.priv_size = sizeof(AMergeContext),
.init = init,
.priv_class = &amerge_class,
}

Definition at line 344 of file af_amerge.c.

amerge_outputs
static const AVFilterPad amerge_outputs[]
Definition: af_amerge.c:336
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_amerge.c:59
init
static av_cold int init(AVFilterContext *ctx)
Definition: af_amerge.c:314
AMergeContext
Definition: af_amerge.c:38
AVFILTER_FLAG_DYNAMIC_INPUTS
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
Definition: avfilter.h:141
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_amerge.c:66
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
activate
static int activate(AVFilterContext *ctx)
Definition: af_amerge.c:279
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
NULL
#define NULL
Definition: coverity.c:32
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
OFFSET
#define OFFSET(x)
Definition: af_amerge.c:48
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
FLAGS
#define FLAGS
Definition: af_amerge.c:49
SWR_CH_MAX
#define SWR_CH_MAX
Definition: af_amerge.c:36
config_output
static int config_output(AVFilterLink *outlink)
Definition: af_amerge.c:151
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: filters.h:236