Libav
af_join.c
Go to the documentation of this file.
1 /*
2  *
3  * This file is part of Libav.
4  *
5  * Libav is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * Libav is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with Libav; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
28 #include "libavutil/avassert.h"
30 #include "libavutil/common.h"
31 #include "libavutil/opt.h"
32 
33 #include "audio.h"
34 #include "avfilter.h"
35 #include "formats.h"
36 #include "internal.h"
37 
38 typedef struct ChannelMap {
39  int input;
40  int in_channel_idx;
41  uint64_t in_channel;
42  uint64_t out_channel;
43 } ChannelMap;
44 
45 typedef struct JoinContext {
46  const AVClass *class;
47 
48  int inputs;
49  char *map;
51  uint64_t channel_layout;
52 
55 
60 
65 } JoinContext;
66 
67 #define OFFSET(x) offsetof(JoinContext, x)
68 #define A AV_OPT_FLAG_AUDIO_PARAM
69 static const AVOption join_options[] = {
70  { "inputs", "Number of input streams.", OFFSET(inputs), AV_OPT_TYPE_INT, { .i64 = 2 }, 1, INT_MAX, A },
71  { "channel_layout", "Channel layout of the "
72  "output stream.", OFFSET(channel_layout_str), AV_OPT_TYPE_STRING, {.str = "stereo"}, 0, 0, A },
73  { "map", "A comma-separated list of channels maps in the format "
74  "'input_stream.input_channel-output_channel.",
75  OFFSET(map), AV_OPT_TYPE_STRING, .flags = A },
76  { NULL },
77 };
78 
79 static const AVClass join_class = {
80  .class_name = "join filter",
81  .item_name = av_default_item_name,
82  .option = join_options,
83  .version = LIBAVUTIL_VERSION_INT,
84 };
85 
86 static int filter_frame(AVFilterLink *link, AVFrame *frame)
87 {
88  AVFilterContext *ctx = link->dst;
89  JoinContext *s = ctx->priv;
90  int i;
91 
92  for (i = 0; i < ctx->nb_inputs; i++)
93  if (link == ctx->inputs[i])
94  break;
95  av_assert0(i < ctx->nb_inputs);
96  av_assert0(!s->input_frames[i]);
97  s->input_frames[i] = frame;
98 
99  return 0;
100 }
101 
102 static int parse_maps(AVFilterContext *ctx)
103 {
104  JoinContext *s = ctx->priv;
105  char separator = '|';
106  char *cur = s->map;
107 
108 #if FF_API_OLD_FILTER_OPTS
109  if (cur && strchr(cur, ',')) {
110  av_log(ctx, AV_LOG_WARNING, "This syntax is deprecated, use '|' to "
111  "separate the mappings.\n");
112  separator = ',';
113  }
114 #endif
115 
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;
120 
121  next = strchr(cur, separator);
122  if (next)
123  *next++ = 0;
124 
125  /* split the map into input and output parts */
126  if (!(sep = strchr(cur, '-'))) {
127  av_log(ctx, AV_LOG_ERROR, "Missing separator '-' in channel "
128  "map '%s'\n", cur);
129  return AVERROR(EINVAL);
130  }
131  *sep++ = 0;
132 
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); \
137  } \
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); \
142  }
143 
144  /* parse output channel */
145  PARSE_CHANNEL(sep, out_channel, "output");
146  if (!(out_channel & s->channel_layout)) {
147  av_log(ctx, AV_LOG_ERROR, "Output channel '%s' is not present in "
148  "requested channel layout.\n", sep);
149  return AVERROR(EINVAL);
150  }
151 
153  out_channel);
154  if (s->channels[out_ch_idx].input >= 0) {
155  av_log(ctx, AV_LOG_ERROR, "Multiple maps for output channel "
156  "'%s'.\n", sep);
157  return AVERROR(EINVAL);
158  }
159 
160  /* parse input channel */
161  input_idx = strtol(cur, &cur, 0);
162  if (input_idx < 0 || input_idx >= s->inputs) {
163  av_log(ctx, AV_LOG_ERROR, "Invalid input stream index: %d.\n",
164  input_idx);
165  return AVERROR(EINVAL);
166  }
167 
168  if (*cur)
169  cur++;
170 
171  in_ch_idx = strtol(cur, &p, 0);
172  if (p == cur) {
173  /* channel specifier is not a number,
174  * try to parse as channel name */
175  PARSE_CHANNEL(cur, in_channel, "input");
176  }
177 
178  s->channels[out_ch_idx].input = input_idx;
179  if (in_channel)
180  s->channels[out_ch_idx].in_channel = in_channel;
181  else
182  s->channels[out_ch_idx].in_channel_idx = in_ch_idx;
183 
184  cur = next;
185  }
186  return 0;
187 }
188 
190 {
191  JoinContext *s = ctx->priv;
192  int ret, i;
193 
195  av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout '%s'.\n",
196  s->channel_layout_str);
197  ret = AVERROR(EINVAL);
198  goto fail;
199  }
200 
202  s->channels = av_mallocz(sizeof(*s->channels) * s->nb_channels);
203  s->buffers = av_mallocz(sizeof(*s->buffers) * s->nb_channels);
204  s->input_frames = av_mallocz(sizeof(*s->input_frames) * s->inputs);
205  if (!s->channels || !s->buffers|| !s->input_frames) {
206  ret = AVERROR(ENOMEM);
207  goto fail;
208  }
209 
210  for (i = 0; i < s->nb_channels; i++) {
212  s->channels[i].input = -1;
213  }
214 
215  if ((ret = parse_maps(ctx)) < 0)
216  goto fail;
217 
218  for (i = 0; i < s->inputs; i++) {
219  char name[32];
220  AVFilterPad pad = { 0 };
221 
222  snprintf(name, sizeof(name), "input%d", i);
223  pad.type = AVMEDIA_TYPE_AUDIO;
224  pad.name = av_strdup(name);
226 
227  pad.needs_fifo = 1;
228 
229  ff_insert_inpad(ctx, i, &pad);
230  }
231 
232 fail:
233  av_opt_free(s);
234  return ret;
235 }
236 
238 {
239  JoinContext *s = ctx->priv;
240  int i;
241 
242  for (i = 0; i < ctx->nb_inputs; i++) {
243  av_freep(&ctx->input_pads[i].name);
244  av_frame_free(&s->input_frames[i]);
245  }
246 
247  av_freep(&s->channels);
248  av_freep(&s->buffers);
249  av_freep(&s->input_frames);
250 }
251 
253 {
254  JoinContext *s = ctx->priv;
256  int i;
257 
260 
261  for (i = 0; i < ctx->nb_inputs; i++)
263  &ctx->inputs[i]->out_channel_layouts);
264 
267 
268  return 0;
269 }
270 
272  uint64_t *inputs)
273 {
274  int i;
275 
276  for (i = 0; i < ctx->nb_inputs; i++) {
277  AVFilterLink *link = ctx->inputs[i];
278 
279  if (ch->out_channel & link->channel_layout &&
280  !(ch->out_channel & inputs[i])) {
281  ch->input = i;
282  ch->in_channel = ch->out_channel;
283  inputs[i] |= ch->out_channel;
284  return;
285  }
286  }
287 }
288 
290  uint64_t *inputs)
291 {
292  int i;
293 
294  for (i = 0; i < ctx->nb_inputs; i++) {
295  AVFilterLink *link = ctx->inputs[i];
296 
297  if ((inputs[i] & link->channel_layout) != link->channel_layout) {
298  uint64_t unused = link->channel_layout & ~inputs[i];
299 
300  ch->input = i;
302  inputs[i] |= ch->in_channel;
303  return;
304  }
305  }
306 }
307 
308 static int join_config_output(AVFilterLink *outlink)
309 {
310  AVFilterContext *ctx = outlink->src;
311  JoinContext *s = ctx->priv;
312  uint64_t *inputs; // nth element tracks which channels are used from nth input
313  int i, ret = 0;
314 
315  /* initialize inputs to user-specified mappings */
316  if (!(inputs = av_mallocz(sizeof(*inputs) * ctx->nb_inputs)))
317  return AVERROR(ENOMEM);
318  for (i = 0; i < s->nb_channels; i++) {
319  ChannelMap *ch = &s->channels[i];
320  AVFilterLink *inlink;
321 
322  if (ch->input < 0)
323  continue;
324 
325  inlink = ctx->inputs[ch->input];
326 
327  if (!ch->in_channel)
329  ch->in_channel_idx);
330 
331  if (!(ch->in_channel & inlink->channel_layout)) {
332  av_log(ctx, AV_LOG_ERROR, "Requested channel %s is not present in "
333  "input stream #%d.\n", av_get_channel_name(ch->in_channel),
334  ch->input);
335  ret = AVERROR(EINVAL);
336  goto fail;
337  }
338 
339  inputs[ch->input] |= ch->in_channel;
340  }
341 
342  /* guess channel maps when not explicitly defined */
343  /* first try unused matching channels */
344  for (i = 0; i < s->nb_channels; i++) {
345  ChannelMap *ch = &s->channels[i];
346 
347  if (ch->input < 0)
348  guess_map_matching(ctx, ch, inputs);
349  }
350 
351  /* if the above failed, try to find _any_ unused input channel */
352  for (i = 0; i < s->nb_channels; i++) {
353  ChannelMap *ch = &s->channels[i];
354 
355  if (ch->input < 0)
356  guess_map_any(ctx, ch, inputs);
357 
358  if (ch->input < 0) {
359  av_log(ctx, AV_LOG_ERROR, "Could not find input channel for "
360  "output channel '%s'.\n",
362  goto fail;
363  }
364 
366  ch->in_channel);
367  }
368 
369  /* print mappings */
370  av_log(ctx, AV_LOG_VERBOSE, "mappings: ");
371  for (i = 0; i < s->nb_channels; i++) {
372  ChannelMap *ch = &s->channels[i];
373  av_log(ctx, AV_LOG_VERBOSE, "%d.%s => %s ", ch->input,
376  }
377  av_log(ctx, AV_LOG_VERBOSE, "\n");
378 
379  for (i = 0; i < ctx->nb_inputs; i++) {
380  if (!inputs[i])
381  av_log(ctx, AV_LOG_WARNING, "No channels are used from input "
382  "stream %d.\n", i);
383  }
384 
385 fail:
386  av_freep(&inputs);
387  return ret;
388 }
389 
390 static int join_request_frame(AVFilterLink *outlink)
391 {
392  AVFilterContext *ctx = outlink->src;
393  JoinContext *s = ctx->priv;
394  AVFrame *frame;
395  int linesize = INT_MAX;
396  int nb_samples = 0;
397  int nb_buffers = 0;
398  int i, j, ret;
399 
400  /* get a frame on each input */
401  for (i = 0; i < ctx->nb_inputs; i++) {
402  AVFilterLink *inlink = ctx->inputs[i];
403 
404  if (!s->input_frames[i] &&
405  (ret = ff_request_frame(inlink)) < 0)
406  return ret;
407 
408  /* request the same number of samples on all inputs */
409  if (i == 0) {
410  nb_samples = s->input_frames[0]->nb_samples;
411 
412  for (j = 1; !i && j < ctx->nb_inputs; j++)
413  ctx->inputs[j]->request_samples = nb_samples;
414  }
415  }
416 
417  /* setup the output frame */
418  frame = av_frame_alloc();
419  if (!frame)
420  return AVERROR(ENOMEM);
421  if (s->nb_channels > FF_ARRAY_ELEMS(frame->data)) {
422  frame->extended_data = av_mallocz(s->nb_channels *
423  sizeof(*frame->extended_data));
424  if (!frame->extended_data) {
425  ret = AVERROR(ENOMEM);
426  goto fail;
427  }
428  }
429 
430  /* copy the data pointers */
431  for (i = 0; i < s->nb_channels; i++) {
432  ChannelMap *ch = &s->channels[i];
433  AVFrame *cur = s->input_frames[ch->input];
434  AVBufferRef *buf;
435 
436  frame->extended_data[i] = cur->extended_data[ch->in_channel_idx];
437  linesize = FFMIN(linesize, cur->linesize[0]);
438 
439  /* add the buffer where this plan is stored to the list if it's
440  * not already there */
442  if (!buf) {
443  ret = AVERROR(EINVAL);
444  goto fail;
445  }
446  for (j = 0; j < nb_buffers; j++)
447  if (s->buffers[j]->buffer == buf->buffer)
448  break;
449  if (j == i)
450  s->buffers[nb_buffers++] = buf;
451  }
452 
453  /* create references to the buffers we copied to output */
454  if (nb_buffers > FF_ARRAY_ELEMS(frame->buf)) {
455  frame->nb_extended_buf = nb_buffers - FF_ARRAY_ELEMS(frame->buf);
456  frame->extended_buf = av_mallocz(sizeof(*frame->extended_buf) *
457  frame->nb_extended_buf);
458  if (!frame->extended_buf) {
459  frame->nb_extended_buf = 0;
460  ret = AVERROR(ENOMEM);
461  goto fail;
462  }
463  }
464  for (i = 0; i < FFMIN(FF_ARRAY_ELEMS(frame->buf), nb_buffers); i++) {
465  frame->buf[i] = av_buffer_ref(s->buffers[i]);
466  if (!frame->buf[i]) {
467  ret = AVERROR(ENOMEM);
468  goto fail;
469  }
470  }
471  for (i = 0; i < frame->nb_extended_buf; i++) {
472  frame->extended_buf[i] = av_buffer_ref(s->buffers[i +
473  FF_ARRAY_ELEMS(frame->buf)]);
474  if (!frame->extended_buf[i]) {
475  ret = AVERROR(ENOMEM);
476  goto fail;
477  }
478  }
479 
480  frame->nb_samples = nb_samples;
481  frame->channel_layout = outlink->channel_layout;
482  frame->sample_rate = outlink->sample_rate;
483  frame->format = outlink->format;
484  frame->pts = s->input_frames[0]->pts;
485  frame->linesize[0] = linesize;
486  if (frame->data != frame->extended_data) {
487  memcpy(frame->data, frame->extended_data, sizeof(*frame->data) *
488  FFMIN(FF_ARRAY_ELEMS(frame->data), s->nb_channels));
489  }
490 
491  ret = ff_filter_frame(outlink, frame);
492 
493  for (i = 0; i < ctx->nb_inputs; i++)
494  av_frame_free(&s->input_frames[i]);
495 
496  return ret;
497 
498 fail:
499  av_frame_free(&frame);
500  return ret;
501 }
502 
504  {
505  .name = "default",
506  .type = AVMEDIA_TYPE_AUDIO,
507  .config_props = join_config_output,
508  .request_frame = join_request_frame,
509  },
510  { NULL }
511 };
512 
514  .name = "join",
515  .description = NULL_IF_CONFIG_SMALL("Join multiple audio streams into "
516  "multi-channel output"),
517  .priv_size = sizeof(JoinContext),
518  .priv_class = &join_class,
519 
520  .init = join_init,
521  .uninit = join_uninit,
523 
524  .inputs = NULL,
525  .outputs = avfilter_af_join_outputs,
526 
528 };
uint64_t in_channel
layout describing the input channel
Definition: af_channelmap.c:41
This structure describes decoded (raw) audio or video data.
Definition: frame.h:135
AVOption.
Definition: opt.h:234
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:129
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:232
Main libavfilter public API header.
#define A
Definition: af_join.c:68
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
Definition: frame.h:393
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_amix.c:514
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
Definition: avfilter.h:404
int nb_extended_buf
Number of elements in extended_buf.
Definition: frame.h:411
static int query_formats(AVFilterContext *ctx)
Definition: af_aformat.c:112
enum AVMediaType type
AVFilterPad type.
Definition: internal.h:47
#define FF_ARRAY_ELEMS(a)
AVBufferRef ** buffers
Temporary storage for buffer references, for assembling the output frame.
Definition: af_join.c:64
char * map
Definition: af_join.c:49
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
Definition: mem.c:198
const char * name
Pad name.
Definition: internal.h:42
int nb_channels
Definition: af_join.c:53
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:38
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:571
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:733
#define av_cold
Definition: attributes.h:66
static av_cold void join_uninit(AVFilterContext *ctx)
Definition: af_join.c:237
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:57
AVOptions.
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).
Definition: frame.h:211
const char * name
static av_cold int join_init(AVFilterContext *ctx)
Definition: af_join.c:189
void ff_channel_layouts_ref(AVFilterChannelLayouts *f, AVFilterChannelLayouts **ref)
Add *ref as a new reference to f.
Definition: formats.c:261
static void guess_map_matching(AVFilterContext *ctx, ChannelMap *ch, uint64_t *inputs)
Definition: af_join.c:271
static int flags
Definition: log.c:44
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
Definition: af_join.c:39
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:139
void ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:379
static int join_query_formats(AVFilterContext *ctx)
Definition: af_join.c:252
A filter pad used for either input or output.
Definition: internal.h:36
AVFilterPad * input_pads
array of input pads
Definition: avfilter.h:570
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:123
int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout)
Definition: formats.c:204
#define AVERROR(e)
Definition: error.h:43
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:69
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:150
void * priv
private data for use by the filter
Definition: avfilter.h:584
int(* filter_frame)(AVFilterLink *link, AVFrame *frame)
Filtering callback.
Definition: internal.h:75
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().
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:169
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.
Definition: frame.h:381
static const AVOption join_options[]
Definition: af_join.c:69
audio channel layout utility functions
unsigned nb_inputs
number of input pads
Definition: avfilter.h:575
#define FFMIN(a, b)
Definition: common.h:57
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.
Definition: frame.h:407
AVBufferRef * av_frame_get_plane_buffer(AVFrame *frame, int plane)
Get the buffer reference a given data plane is stored in.
Definition: frame.c:414
static const AVClass join_class
Definition: af_join.c:79
AVFilterFormats * ff_planar_sample_fmts(void)
Construct a formats list containing all planar sample formats.
Definition: formats.c:230
AVFilter ff_af_join
Definition: af_join.c:513
LIBAVUTIL_VERSION_INT
Definition: eval.c:55
AVFilterChannelLayouts * ff_all_channel_layouts(void)
Construct an empty AVFilterChannelLayouts/AVFilterFormats struct – representing any channel layout/...
Definition: formats.c:248
static const AVFilterPad avfilter_af_join_outputs[]
Definition: af_join.c:503
int in_channel_idx
index of in_channel in the input stream data
Definition: af_channelmap.c:43
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
Definition: frame.h:186
NULL
Definition: eval.c:55
char * av_strdup(const char *s)
Duplicate the string s.
Definition: mem.c:213
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:153
av_default_item_name
Definition: dnxhdenc.c:52
int inputs
Definition: af_join.c:48
AVBuffer * buffer
Definition: buffer.h:82
Describe the class of an AVClass context structure.
Definition: log.h:33
int sample_rate
Sample rate of the audio data.
Definition: frame.h:376
#define PARSE_CHANNEL(str, var, inout)
Filter definition.
Definition: avfilter.h:421
static const AVFilterPad inputs[]
Definition: af_ashowinfo.c:221
uint64_t out_channel
layout describing the output channel
Definition: af_channelmap.c:42
const char * name
Filter name.
Definition: avfilter.h:425
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:578
enum MovChannelLayoutTag * layouts
Definition: mov_chan.c:433
AVFilterFormats * ff_all_samplerates(void)
Definition: formats.c:242
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:141
AVFrame ** input_frames
Temporary storage for input frames, until we get one on each input.
Definition: af_join.c:59
ChannelMap * channels
Definition: af_join.c:54
void ff_set_common_samplerates(AVFilterContext *ctx, AVFilterFormats *samplerates)
Definition: formats.c:367
A reference to a data buffer.
Definition: buffer.h:81
#define OFFSET(x)
Definition: af_join.c:67
void av_opt_free(void *obj)
Free all allocated objects in obj.
Definition: opt.c:659
static void guess_map_any(AVFilterContext *ctx, ChannelMap *ch, uint64_t *inputs)
Definition: af_join.c:289
common internal and external API header
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition: buffer.c:92
static int parse_maps(AVFilterContext *ctx)
Definition: af_join.c:102
static av_cold int init(AVCodecParserContext *s)
Definition: h264_parser.c:499
static int join_request_frame(AVFilterLink *outlink)
Definition: af_join.c:390
char * channel_layout_str
Definition: af_join.c:50
static void ff_insert_inpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new input pad for the filter.
Definition: internal.h:170
uint64_t av_get_channel_layout(const char *name)
Return a channel layout id that matches name, or 0 if no match is found.
An instance of a filter.
Definition: avfilter.h:563
static int join_config_output(AVFilterLink *outlink)
Definition: af_join.c:308
int needs_fifo
The filter expects a fifo to be inserted on its input link, typically because it has a delay...
Definition: internal.h:119
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
Definition: avfilter.c:249
static int filter_frame(AVFilterLink *link, AVFrame *frame)
Definition: af_join.c:86
internal API functions
uint8_t ** extended_data
pointers to the data planes/channels.
Definition: frame.h:169
uint64_t channel_layout
Definition: af_join.c:51
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:179
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:205