FFmpeg
af_amerge.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011 Nicolas George <nicolas.george@normalesup.org>
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /**
22  * @file
23  * Audio merging filter
24  */
25 
26 #include "libavutil/avstring.h"
27 #include "libavutil/bprint.h"
29 #include "libavutil/mem.h"
30 #include "libavutil/opt.h"
31 #include "avfilter.h"
32 #include "filters.h"
33 #include "audio.h"
34 #include "formats.h"
35 
36 #define SWR_CH_MAX 64
37 
38 typedef struct AMergeContext {
39  const AVClass *class;
40  int nb_inputs;
41  int route[SWR_CH_MAX]; /**< channels routing, see copy_samples */
42  int bps;
43  struct amerge_input {
44  int nb_ch; /**< number of channels for the input */
45  } *in;
47 
48 #define OFFSET(x) offsetof(AMergeContext, x)
49 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
50 
51 static const AVOption amerge_options[] = {
52  { "inputs", "specify the number of inputs", OFFSET(nb_inputs),
53  AV_OPT_TYPE_INT, { .i64 = 2 }, 1, SWR_CH_MAX, FLAGS },
54  { NULL }
55 };
56 
57 AVFILTER_DEFINE_CLASS(amerge);
58 
60 {
61  AMergeContext *s = ctx->priv;
62 
63  av_freep(&s->in);
64 }
65 
67 {
68  static const enum AVSampleFormat packed_sample_fmts[] = {
75  };
76  AMergeContext *s = ctx->priv;
77  AVChannelLayout *inlayout[SWR_CH_MAX] = { NULL }, outlayout = { 0 };
78  uint64_t outmask = 0;
80  int i, ret, overlap = 0, nb_ch = 0;
81 
82  for (i = 0; i < s->nb_inputs; i++) {
83  if (!ctx->inputs[i]->incfg.channel_layouts ||
84  !ctx->inputs[i]->incfg.channel_layouts->nb_channel_layouts) {
86  "No channel layout for input %d\n", i + 1);
87  return AVERROR(EAGAIN);
88  }
89  inlayout[i] = &ctx->inputs[i]->incfg.channel_layouts->channel_layouts[0];
90  if (ctx->inputs[i]->incfg.channel_layouts->nb_channel_layouts > 1) {
91  char buf[256];
92  av_channel_layout_describe(inlayout[i], buf, sizeof(buf));
93  av_log(ctx, AV_LOG_INFO, "Using \"%s\" for input %d\n", buf, i + 1);
94  }
95  s->in[i].nb_ch = FF_LAYOUT2COUNT(inlayout[i]);
96  if (s->in[i].nb_ch) {
97  overlap++;
98  } else {
99  s->in[i].nb_ch = inlayout[i]->nb_channels;
100  if (av_channel_layout_subset(inlayout[i], outmask))
101  overlap++;
102  outmask |= inlayout[i]->order == AV_CHANNEL_ORDER_NATIVE ?
103  inlayout[i]->u.mask : 0;
104  }
105  nb_ch += s->in[i].nb_ch;
106  }
107  if (nb_ch > SWR_CH_MAX) {
108  av_log(ctx, AV_LOG_ERROR, "Too many channels (max %d)\n", SWR_CH_MAX);
109  return AVERROR(EINVAL);
110  }
111  if (overlap) {
113  "Input channel layouts overlap: "
114  "output layout will be determined by the number of distinct input channels\n");
115  for (i = 0; i < nb_ch; i++)
116  s->route[i] = i;
117  av_channel_layout_default(&outlayout, nb_ch);
118  if (!KNOWN(&outlayout) && nb_ch)
119  av_channel_layout_from_mask(&outlayout, 0xFFFFFFFFFFFFFFFFULL >> (64 - nb_ch));
120  } else {
121  int *route[SWR_CH_MAX];
122  int c, out_ch_number = 0;
123 
124  av_channel_layout_from_mask(&outlayout, outmask);
125  route[0] = s->route;
126  for (i = 1; i < s->nb_inputs; i++)
127  route[i] = route[i - 1] + s->in[i - 1].nb_ch;
128  for (c = 0; c < 64; c++)
129  for (i = 0; i < s->nb_inputs; i++)
130  if (av_channel_layout_index_from_channel(inlayout[i], c) >= 0)
131  *(route[i]++) = out_ch_number++;
132  }
133  if ((ret = ff_set_common_formats_from_list(ctx, packed_sample_fmts)) < 0)
134  return ret;
135  for (i = 0; i < s->nb_inputs; i++) {
136  layouts = NULL;
137  if ((ret = ff_add_channel_layout(&layouts, inlayout[i])) < 0)
138  return ret;
139  if ((ret = ff_channel_layouts_ref(layouts, &ctx->inputs[i]->outcfg.channel_layouts)) < 0)
140  return ret;
141  }
142  layouts = NULL;
143  if ((ret = ff_add_channel_layout(&layouts, &outlayout)) < 0)
144  return ret;
145  if ((ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->incfg.channel_layouts)) < 0)
146  return ret;
147 
149 }
150 
151 static int config_output(AVFilterLink *outlink)
152 {
153  AVFilterContext *ctx = outlink->src;
154  AMergeContext *s = ctx->priv;
155  AVBPrint bp;
156  int i;
157 
158  s->bps = av_get_bytes_per_sample(outlink->format);
159  outlink->time_base = ctx->inputs[0]->time_base;
160 
162  for (i = 0; i < s->nb_inputs; i++) {
163  av_bprintf(&bp, "%sin%d:", i ? " + " : "", i);
164  av_channel_layout_describe_bprint(&ctx->inputs[i]->ch_layout, &bp);
165  }
166  av_bprintf(&bp, " -> out:");
168  av_log(ctx, AV_LOG_VERBOSE, "%s\n", bp.str);
169 
170  return 0;
171 }
172 
173 /**
174  * Copy samples from several input streams to one output stream.
175  * @param nb_inputs number of inputs
176  * @param in inputs; used only for the nb_ch field;
177  * @param route routing values;
178  * input channel i goes to output channel route[i];
179  * i < in[0].nb_ch are the channels from the first output;
180  * i >= in[0].nb_ch are the channels from the second output
181  * @param ins pointer to the samples of each inputs, in packed format;
182  * will be left at the end of the copied samples
183  * @param outs pointer to the samples of the output, in packet format;
184  * must point to a buffer big enough;
185  * will be left at the end of the copied samples
186  * @param ns number of samples to copy
187  * @param bps bytes per sample
188  */
189 static inline void copy_samples(int nb_inputs, struct amerge_input in[],
190  int *route, uint8_t *ins[],
191  uint8_t **outs, int ns, int bps)
192 {
193  int *route_cur;
194  int i, c, nb_ch = 0;
195 
196  for (i = 0; i < nb_inputs; i++)
197  nb_ch += in[i].nb_ch;
198  while (ns--) {
199  route_cur = route;
200  for (i = 0; i < nb_inputs; i++) {
201  for (c = 0; c < in[i].nb_ch; c++) {
202  memcpy((*outs) + bps * *(route_cur++), ins[i], bps);
203  ins[i] += bps;
204  }
205  }
206  *outs += nb_ch * bps;
207  }
208 }
209 
210 static void free_frames(int nb_inputs, AVFrame **input_frames)
211 {
212  int i;
213  for (i = 0; i < nb_inputs; i++)
214  av_frame_free(&input_frames[i]);
215 }
216 
217 static int try_push_frame(AVFilterContext *ctx, int nb_samples)
218 {
219  AMergeContext *s = ctx->priv;
220  AVFilterLink *outlink = ctx->outputs[0];
221  int i, ret;
222  AVFrame *outbuf, *inbuf[SWR_CH_MAX] = { NULL };
223  uint8_t *outs, *ins[SWR_CH_MAX];
224 
225  for (i = 0; i < ctx->nb_inputs; i++) {
226  ret = ff_inlink_consume_samples(ctx->inputs[i], nb_samples, nb_samples, &inbuf[i]);
227  if (ret < 0) {
228  free_frames(i, inbuf);
229  return ret;
230  }
231  ins[i] = inbuf[i]->data[0];
232  }
233 
234  outbuf = ff_get_audio_buffer(outlink, nb_samples);
235  if (!outbuf) {
236  free_frames(s->nb_inputs, inbuf);
237  return AVERROR(ENOMEM);
238  }
239 
240  outs = outbuf->data[0];
241  outbuf->pts = inbuf[0]->pts;
242 
243  outbuf->nb_samples = nb_samples;
244  outbuf->duration = av_rescale_q(outbuf->nb_samples,
245  av_make_q(1, outlink->sample_rate),
246  outlink->time_base);
247 
248  if ((ret = av_channel_layout_copy(&outbuf->ch_layout, &outlink->ch_layout)) < 0) {
249  free_frames(s->nb_inputs, inbuf);
250  av_frame_free(&outbuf);
251  return ret;
252  }
253 
254  while (nb_samples) {
255  /* Unroll the most common sample formats: speed +~350% for the loop,
256  +~13% overall (including two common decoders) */
257  switch (s->bps) {
258  case 1:
259  copy_samples(s->nb_inputs, s->in, s->route, ins, &outs, nb_samples, 1);
260  break;
261  case 2:
262  copy_samples(s->nb_inputs, s->in, s->route, ins, &outs, nb_samples, 2);
263  break;
264  case 4:
265  copy_samples(s->nb_inputs, s->in, s->route, ins, &outs, nb_samples, 4);
266  break;
267  default:
268  copy_samples(s->nb_inputs, s->in, s->route, ins, &outs, nb_samples, s->bps);
269  break;
270  }
271 
272  nb_samples = 0;
273  }
274 
275  free_frames(s->nb_inputs, inbuf);
276  return ff_filter_frame(outlink, outbuf);
277 }
278 
280 {
281  int i, status;
282  int ret, nb_samples;
283  int64_t pts;
284 
286 
287  nb_samples = ff_inlink_queued_samples(ctx->inputs[0]);
288  for (i = 1; i < ctx->nb_inputs && nb_samples > 0; i++) {
289  nb_samples = FFMIN(ff_inlink_queued_samples(ctx->inputs[i]), nb_samples);
290  }
291 
292  if (nb_samples) {
293  ret = try_push_frame(ctx, nb_samples);
294  if (ret < 0)
295  return ret;
296  }
297 
298  for (i = 0; i < ctx->nb_inputs; i++) {
299  if (ff_inlink_queued_samples(ctx->inputs[i]))
300  continue;
301 
302  if (ff_inlink_acknowledge_status(ctx->inputs[i], &status, &pts)) {
303  ff_outlink_set_status(ctx->outputs[0], status, pts);
304  return 0;
305  } else if (ff_outlink_frame_wanted(ctx->outputs[0])) {
306  ff_inlink_request_frame(ctx->inputs[i]);
307  return 0;
308  }
309  }
310 
311  return 0;
312 }
313 
315 {
316  AMergeContext *s = ctx->priv;
317  int i, ret;
318 
319  s->in = av_calloc(s->nb_inputs, sizeof(*s->in));
320  if (!s->in)
321  return AVERROR(ENOMEM);
322  for (i = 0; i < s->nb_inputs; i++) {
323  char *name = av_asprintf("in%d", i);
324  AVFilterPad pad = {
325  .name = name,
326  .type = AVMEDIA_TYPE_AUDIO,
327  };
328  if (!name)
329  return AVERROR(ENOMEM);
330  if ((ret = ff_append_inpad_free_name(ctx, &pad)) < 0)
331  return ret;
332  }
333  return 0;
334 }
335 
336 static const AVFilterPad amerge_outputs[] = {
337  {
338  .name = "default",
339  .type = AVMEDIA_TYPE_AUDIO,
340  .config_props = config_output,
341  },
342 };
343 
345  .name = "amerge",
346  .description = NULL_IF_CONFIG_SMALL("Merge two or more audio streams into "
347  "a single multi-channel stream."),
348  .priv_size = sizeof(AMergeContext),
349  .init = init,
350  .uninit = uninit,
351  .activate = activate,
352  .inputs = NULL,
355  .priv_class = &amerge_class,
357 };
ff_get_audio_buffer
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
Definition: audio.c:98
AVFilterChannelLayouts
A list of supported channel layouts.
Definition: formats.h:85
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:215
AMergeContext::bps
int bps
Definition: af_amerge.c:42
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
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
opt.h
try_push_frame
static int try_push_frame(AVFilterContext *ctx, int nb_samples)
Definition: af_amerge.c:217
av_bprint_init
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition: bprint.c:69
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1062
AVFrame::duration
int64_t duration
Duration of the frame, in the same units as pts.
Definition: frame.h:795
ff_channel_layouts_ref
int ff_channel_layouts_ref(AVFilterChannelLayouts *f, AVFilterChannelLayouts **ref)
Add *ref as a new reference to f.
Definition: formats.c:673
layouts
enum MovChannelLayoutTag * layouts
Definition: mov_chan.c:335
ff_af_amerge
const AVFilter ff_af_amerge
Definition: af_amerge.c:344
int64_t
long long int64_t
Definition: coverity.c:34
av_asprintf
char * av_asprintf(const char *fmt,...)
Definition: avstring.c:115
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:162
amerge_outputs
static const AVFilterPad amerge_outputs[]
Definition: af_amerge.c:336
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:389
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:501
AMergeContext::route
int route[SWR_CH_MAX]
channels routing, see copy_samples
Definition: af_amerge.c:41
AVOption
AVOption.
Definition: opt.h:429
AMergeContext::amerge_input
Definition: af_amerge.c:43
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:225
ff_set_common_all_samplerates
int ff_set_common_all_samplerates(AVFilterContext *ctx)
Equivalent to ff_set_common_samplerates(ctx, ff_all_samplerates())
Definition: formats.c:821
AVChannelLayout::order
enum AVChannelOrder order
Channel order used in this layout.
Definition: channel_layout.h:316
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:205
AVChannelLayout::mask
uint64_t mask
This member must be used for AV_CHANNEL_ORDER_NATIVE, and may be used for AV_CHANNEL_ORDER_AMBISONIC ...
Definition: channel_layout.h:343
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:321
av_channel_layout_describe_bprint
int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout, AVBPrint *bp)
bprint variant of av_channel_layout_describe().
Definition: channel_layout.c:594
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:410
FF_LAYOUT2COUNT
#define FF_LAYOUT2COUNT(l)
Decode a channel count encoded as a channel layout.
Definition: formats.h:108
formats.h
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_amerge.c:59
FF_FILTER_FORWARD_STATUS_BACK_ALL
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter)
Forward the status on an output link to all input links.
Definition: filters.h:447
AVChannelLayout::u
union AVChannelLayout::@421 u
Details about which channels are present in this layout.
init
static av_cold int init(AVFilterContext *ctx)
Definition: af_amerge.c:314
AV_BPRINT_SIZE_AUTOMATIC
#define AV_BPRINT_SIZE_AUTOMATIC
AVFrame::ch_layout
AVChannelLayout ch_layout
Channel layout of the audio data.
Definition: frame.h:790
pts
static int64_t pts
Definition: transcode_aac.c:644
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
AVFilterPad
A filter pad used for either input or output.
Definition: filters.h:38
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
av_cold
#define av_cold
Definition: attributes.h:90
av_channel_layout_describe
int av_channel_layout_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
Get a human-readable string describing the channel layout properties.
Definition: channel_layout.c:648
ff_outlink_set_status
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
Definition: filters.h:424
amerge_options
static const AVOption amerge_options[]
Definition: af_amerge.c:51
ff_inlink_request_frame
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Definition: avfilter.c:1594
s
#define s(width, name)
Definition: cbs_vp9.c:198
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_amerge.c:66
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
av_channel_layout_from_mask
int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask)
Initialize a native channel layout from a bitmask indicating which channels are present.
Definition: channel_layout.c:247
ff_set_common_formats_from_list
int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts)
Equivalent to ff_set_common_formats(ctx, ff_make_format_list(fmts))
Definition: formats.c:873
activate
static int activate(AVFilterContext *ctx)
Definition: af_amerge.c:279
filters.h
ctx
AVFormatContext * ctx
Definition: movenc.c:49
av_rescale_q
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:142
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
AMergeContext::amerge_input::nb_ch
int nb_ch
number of channels for the input
Definition: af_amerge.c:44
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
ff_inlink_consume_samples
int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max, AVFrame **rframe)
Take samples from the link's FIFO and update the link's stats.
Definition: avfilter.c:1511
NULL
#define NULL
Definition: coverity.c:32
ff_append_inpad_free_name
int ff_append_inpad_free_name(AVFilterContext *f, AVFilterPad *p)
Definition: avfilter.c:132
AMergeContext::in
struct AMergeContext::amerge_input * in
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
ff_add_channel_layout
int ff_add_channel_layout(AVFilterChannelLayouts **l, const AVChannelLayout *channel_layout)
Definition: formats.c:521
ff_inlink_acknowledge_status
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
Definition: avfilter.c:1438
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
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
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:311
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:425
bps
unsigned bps
Definition: movenc.c:1877
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
av_make_q
static AVRational av_make_q(int num, int den)
Create an AVRational.
Definition: rational.h:71
AV_CHANNEL_ORDER_NATIVE
@ AV_CHANNEL_ORDER_NATIVE
The native channel order, i.e.
Definition: channel_layout.h:122
ns
#define ns(max_value, name, subs,...)
Definition: cbs_av1.c:616
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:220
av_channel_layout_default
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
Definition: channel_layout.c:834
AVFrame::nb_samples
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:469
bprint.h
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
av_get_bytes_per_sample
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
Definition: samplefmt.c:108
AV_SAMPLE_FMT_U8
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
Definition: samplefmt.h:57
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(amerge)
FLAGS
#define FLAGS
Definition: af_amerge.c:49
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:58
AVFilterPad::name
const char * name
Pad name.
Definition: filters.h:44
ff_inlink_queued_samples
int ff_inlink_queued_samples(AVFilterLink *link)
Definition: avfilter.c:1466
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Definition: mem.c:264
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)
Copy samples from several input streams to one output stream.
Definition: af_amerge.c:189
AVFilter
Filter definition.
Definition: avfilter.h:201
ret
ret
Definition: filter_design.txt:187
free_frames
static void free_frames(int nb_inputs, AVFrame **input_frames)
Definition: af_amerge.c:210
av_bprintf
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition: bprint.c:99
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
status
ov_status_e status
Definition: dnn_backend_openvino.c:100
channel_layout.h
av_channel_layout_subset
uint64_t av_channel_layout_subset(const AVChannelLayout *channel_layout, uint64_t mask)
Find out what channels from a given set are present in a channel layout, without regard for their pos...
Definition: channel_layout.c:860
av_channel_layout_index_from_channel
int av_channel_layout_index_from_channel(const AVChannelLayout *channel_layout, enum AVChannel channel)
Get the index of a given channel in a channel layout.
Definition: channel_layout.c:708
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
avfilter.h
KNOWN
#define KNOWN(l)
Definition: formats.h:111
AVFilterContext
An instance of a filter.
Definition: avfilter.h:457
av_channel_layout_copy
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
Definition: channel_layout.c:444
mem.h
audio.h
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
AMergeContext::nb_inputs
int nb_inputs
Definition: af_amerge.c:40
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
ff_outlink_frame_wanted
the definition of that something depends on the semantic of the filter The callback must examine the status of the filter s links and proceed accordingly The status of output links is stored in the status_in and status_out fields and tested by the ff_outlink_frame_wanted() function. If this function returns true
AV_SAMPLE_FMT_DBL
@ AV_SAMPLE_FMT_DBL
double
Definition: samplefmt.h:61
avstring.h
AV_SAMPLE_FMT_S32
@ AV_SAMPLE_FMT_S32
signed 32 bits
Definition: samplefmt.h:59
AV_SAMPLE_FMT_FLT
@ AV_SAMPLE_FMT_FLT
float
Definition: samplefmt.h:60
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: filters.h:236