67 #define OFFSET(x) offsetof(JoinContext, x)
68 #define A AV_OPT_FLAG_AUDIO_PARAM
71 {
"channel_layout",
"Channel layout of the "
73 {
"map",
"A comma-separated list of channels maps in the format "
74 "'input_stream.input_channel-output_channel.",
93 if (link == ctx->
inputs[i])
105 char separator =
'|';
108 #if FF_API_OLD_FILTER_OPTS
109 if (cur && strchr(cur,
',')) {
111 "separate the mappings.\n");
116 while (cur && *cur) {
117 char *sep, *next, *p;
118 uint64_t in_channel = 0, out_channel = 0;
119 int input_idx, out_ch_idx, in_ch_idx;
121 next = strchr(cur, separator);
126 if (!(sep = strchr(cur,
'-'))) {
133 #define PARSE_CHANNEL(str, var, inout) \
134 if (!(var = av_get_channel_layout(str))) { \
135 av_log(ctx, AV_LOG_ERROR, "Invalid " inout " channel: %s.\n", str);\
136 return AVERROR(EINVAL); \
138 if (av_get_channel_layout_nb_channels(var) != 1) { \
139 av_log(ctx, AV_LOG_ERROR, "Channel map describes more than one " \
140 inout " channel.\n"); \
141 return AVERROR(EINVAL); \
148 "requested channel layout.\n", sep);
161 input_idx = strtol(cur, &cur, 0);
162 if (input_idx < 0 || input_idx >= s->
inputs) {
171 in_ch_idx = strtol(cur, &p, 0);
218 for (i = 0; i < s->
inputs; i++) {
222 snprintf(name,
sizeof(name),
"input%d", i);
360 "output channel '%s'.\n",
395 int linesize = INT_MAX;
412 for (j = 1; !i && j < ctx->
nb_inputs; j++)
446 for (j = 0; j < nb_buffers; j++)
450 s->
buffers[nb_buffers++] = buf;
466 if (!frame->
buf[i]) {
516 "multi-channel output"),
518 .priv_class = &join_class,
525 .
outputs = avfilter_af_join_outputs,
uint64_t in_channel
layout describing the input channel
This structure describes decoded (raw) audio or video data.
#define AV_LOG_WARNING
Something somehow does not look correct.
static const AVFilterPad outputs[]
Main libavfilter public API header.
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
static av_cold void uninit(AVFilterContext *ctx)
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
int nb_extended_buf
Number of elements in extended_buf.
int request_samples
Audio only, the destination filter sets this to a non-zero value to request that buffers with the giv...
enum AVMediaType type
AVFilterPad type.
#define FF_ARRAY_ELEMS(a)
struct AVFilterChannelLayouts * in_channel_layouts
AVBufferRef ** buffers
Temporary storage for buffer references, for assembling the output frame.
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
const char * name
Pad name.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
AVFilterLink ** inputs
array of pointers to input links
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static av_cold void join_uninit(AVFilterContext *ctx)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index)
Get the channel with the given index in channel_layout.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static av_cold int join_init(AVFilterContext *ctx)
static void guess_map_matching(AVFilterContext *ctx, ChannelMap *ch, uint64_t *inputs)
int av_get_channel_layout_channel_index(uint64_t channel_layout, uint64_t channel)
Get the index of a channel in channel_layout.
int input
input stream index
#define AV_LOG_VERBOSE
Detailed information.
static int join_query_formats(AVFilterContext *ctx)
A filter pad used for either input or output.
A link between two filters.
AVFilterPad * input_pads
array of input pads
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int sample_rate
samples per second
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
int(* filter_frame)(AVFilterLink *link, AVFrame *frame)
Filtering callback.
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
simple assert() macros that are a bit more flexible than ISO C assert().
struct AVFilterChannelLayouts * out_channel_layouts
void av_log(void *avcl, int level, const char *fmt,...)
const char * av_get_channel_name(uint64_t channel)
Get the name of a given channel.
uint64_t channel_layout
Channel layout of the audio data.
static const AVOption join_options[]
audio channel layout utility functions
unsigned nb_inputs
number of input pads
AVBufferRef ** extended_buf
For planar audio which requires more than AV_NUM_DATA_POINTERS AVBufferRef pointers, this array will hold all the references which cannot fit into AVFrame.buf.
AVBufferRef * av_frame_get_plane_buffer(AVFrame *frame, int plane)
Get the buffer reference a given data plane is stored in.
static const AVClass join_class
AVFilterContext * src
source filter
static const AVFilterPad avfilter_af_join_outputs[]
int format
agreed upon media format
int in_channel_idx
index of in_channel in the input stream data
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
char * av_strdup(const char *s)
Duplicate the string s.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Describe the class of an AVClass context structure.
int sample_rate
Sample rate of the audio data.
#define PARSE_CHANNEL(str, var, inout)
static const AVFilterPad inputs[]
uint64_t out_channel
layout describing the output channel
const char * name
Filter name.
AVFilterLink ** outputs
array of pointers to output links
enum MovChannelLayoutTag * layouts
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVFrame ** input_frames
Temporary storage for input frames, until we get one on each input.
A reference to a data buffer.
void av_opt_free(void *obj)
Free all allocated objects in obj.
static void guess_map_any(AVFilterContext *ctx, ChannelMap *ch, uint64_t *inputs)
common internal and external API header
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
static int parse_maps(AVFilterContext *ctx)
uint64_t channel_layout
channel layout of current buffer (see libavutil/channel_layout.h)
static av_cold int init(AVCodecParserContext *s)
static int join_request_frame(AVFilterLink *outlink)
char * channel_layout_str
AVFilterContext * dst
dest filter
static void ff_insert_inpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new input pad for the filter.
uint64_t av_get_channel_layout(const char *name)
Return a channel layout id that matches name, or 0 if no match is found.
static int join_config_output(AVFilterLink *outlink)
int needs_fifo
The filter expects a fifo to be inserted on its input link, typically because it has a delay...
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
static int filter_frame(AVFilterLink *link, AVFrame *frame)
uint8_t ** extended_data
pointers to the data planes/channels.
int nb_samples
number of audio samples (per channel) described by this frame
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...