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

Go to the source code of this file.

Data Structures

struct  ChannelMap
 
struct  JoinContext
 

Macros

#define OFFSET(x)   offsetof(JoinContext, x)
 
#define A   AV_OPT_FLAG_AUDIO_PARAM
 
#define F   AV_OPT_FLAG_FILTERING_PARAM
 
#define PARSE_CHANNEL(str, var, inout)
 

Functions

 AVFILTER_DEFINE_CLASS (join)
 
static int parse_maps (AVFilterContext *ctx)
 
static av_cold int join_init (AVFilterContext *ctx)
 
static av_cold void join_uninit (AVFilterContext *ctx)
 
static int join_query_formats (AVFilterContext *ctx)
 
static void guess_map_matching (AVFilterContext *ctx, ChannelMap *ch, uint64_t *inputs)
 
static void guess_map_any (AVFilterContext *ctx, ChannelMap *ch, uint64_t *inputs)
 
static int join_config_output (AVFilterLink *outlink)
 
static int try_push_frame (AVFilterContext *ctx)
 
static int activate (AVFilterContext *ctx)
 

Variables

static const AVOption join_options []
 
static const AVFilterPad avfilter_af_join_outputs []
 
const AVFilter ff_af_join
 

Detailed Description

Audio join filter

Join multiple audio inputs as different channels in a single output

Definition in file af_join.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 69 of file af_join.c.

◆ A

#define A   AV_OPT_FLAG_AUDIO_PARAM

Definition at line 70 of file af_join.c.

◆ F

Definition at line 71 of file af_join.c.

◆ PARSE_CHANNEL

#define PARSE_CHANNEL (   str,
  var,
  inout 
)
Value:
if (!(var = av_get_channel_layout(str))) { \
av_log(ctx, AV_LOG_ERROR, "Invalid " inout " channel: %s.\n", str);\
return AVERROR(EINVAL); \
} \
av_log(ctx, AV_LOG_ERROR, "Channel map describes more than one " \
inout " channel.\n"); \
return AVERROR(EINVAL); \
}

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( join  )

◆ parse_maps()

static int parse_maps ( AVFilterContext ctx)
static

Definition at line 84 of file af_join.c.

Referenced by join_init().

◆ join_init()

static av_cold int join_init ( AVFilterContext ctx)
static

Definition at line 163 of file af_join.c.

◆ join_uninit()

static av_cold void join_uninit ( AVFilterContext ctx)
static

Definition at line 204 of file af_join.c.

◆ join_query_formats()

static int join_query_formats ( AVFilterContext ctx)
static

Definition at line 218 of file af_join.c.

◆ guess_map_matching()

static void guess_map_matching ( AVFilterContext ctx,
ChannelMap ch,
uint64_t *  inputs 
)
static

Definition at line 241 of file af_join.c.

Referenced by join_config_output().

◆ guess_map_any()

static void guess_map_any ( AVFilterContext ctx,
ChannelMap ch,
uint64_t *  inputs 
)
static

Definition at line 259 of file af_join.c.

Referenced by join_config_output().

◆ join_config_output()

static int join_config_output ( AVFilterLink outlink)
static

Definition at line 278 of file af_join.c.

◆ try_push_frame()

static int try_push_frame ( AVFilterContext ctx)
static

Definition at line 360 of file af_join.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 481 of file af_join.c.

Variable Documentation

◆ join_options

const AVOption join_options[]
static
Initial value:
= {
{ "inputs", "Number of input streams.", OFFSET(inputs), AV_OPT_TYPE_INT, { .i64 = 2 }, 1, INT_MAX, A|F },
{ "channel_layout", "Channel layout of the "
"output stream.", OFFSET(channel_layout_str), AV_OPT_TYPE_STRING, {.str = "stereo"}, 0, 0, A|F },
{ "map", "A comma-separated list of channels maps in the format "
"'input_stream.input_channel-output_channel.",
OFFSET(map), AV_OPT_TYPE_STRING, .flags = A|F },
{ NULL }
}

Definition at line 72 of file af_join.c.

◆ avfilter_af_join_outputs

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

Definition at line 527 of file af_join.c.

◆ ff_af_join

const AVFilter ff_af_join
Initial value:
= {
.name = "join",
.description = NULL_IF_CONFIG_SMALL("Join multiple audio streams into "
"multi-channel output."),
.priv_size = sizeof(JoinContext),
.priv_class = &join_class,
}

Definition at line 535 of file af_join.c.

AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:168
av_get_channel_layout
uint64_t av_get_channel_layout(const char *name)
Return a channel layout id that matches name, or 0 if no match is found.
Definition: channel_layout.c:145
init
static int init
Definition: av_tx.c:47
join_query_formats
static int join_query_formats(AVFilterContext *ctx)
Definition: af_join.c:218
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:110
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
ctx
AVFormatContext * ctx
Definition: movenc.c:48
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
av_get_channel_layout_nb_channels
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
Definition: channel_layout.c:226
F
#define F
Definition: af_join.c:71
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:117
A
#define A
Definition: af_join.c:70
JoinContext
Definition: af_join.c:45
join_uninit
static av_cold void join_uninit(AVFilterContext *ctx)
Definition: af_join.c:204
OFFSET
#define OFFSET(x)
Definition: af_join.c:69
activate
static int activate(AVFilterContext *ctx)
Definition: af_join.c:481
avfilter_af_join_outputs
static const AVFilterPad avfilter_af_join_outputs[]
Definition: af_join.c:527
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
map
const VDPAUPixFmtMap * map
Definition: hwcontext_vdpau.c:71
join_config_output
static int join_config_output(AVFilterLink *outlink)
Definition: af_join.c:278
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
join_init
static av_cold int join_init(AVFilterContext *ctx)
Definition: af_join.c:163
convert_header.str
string str
Definition: convert_header.py:20
uninit
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:282
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:228