FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 #define FF_INTERNAL_FIELDS 1
27 #include "framequeue.h"
28 
29 #include "libavutil/avstring.h"
30 #include "libavutil/bprint.h"
32 #include "libavutil/opt.h"
33 #include "avfilter.h"
34 #include "filters.h"
35 #include "audio.h"
36 #include "internal.h"
37 
38 #define SWR_CH_MAX 64
39 
40 typedef struct AMergeContext {
41  const AVClass *class;
42  int nb_inputs;
43  int route[SWR_CH_MAX]; /**< channels routing, see copy_samples */
44  int bps;
45  struct amerge_input {
46  int nb_ch; /**< number of channels for the input */
47  } *in;
49 
50 #define OFFSET(x) offsetof(AMergeContext, x)
51 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
52 
53 static const AVOption amerge_options[] = {
54  { "inputs", "specify the number of inputs", OFFSET(nb_inputs),
55  AV_OPT_TYPE_INT, { .i64 = 2 }, 1, SWR_CH_MAX, FLAGS },
56  { NULL }
57 };
58 
59 AVFILTER_DEFINE_CLASS(amerge);
60 
62 {
63  AMergeContext *s = ctx->priv;
64  int i;
65 
66  for (i = 0; i < s->nb_inputs; i++) {
67  if (ctx->input_pads)
68  av_freep(&ctx->input_pads[i].name);
69  }
70  av_freep(&s->in);
71 }
72 
74 {
75  AMergeContext *s = ctx->priv;
76  int64_t inlayout[SWR_CH_MAX], outlayout = 0;
79  int i, ret, overlap = 0, nb_ch = 0;
80 
81  for (i = 0; i < s->nb_inputs; i++) {
82  if (!ctx->inputs[i]->in_channel_layouts ||
85  "No channel layout for input %d\n", i + 1);
86  return AVERROR(EAGAIN);
87  }
88  inlayout[i] = ctx->inputs[i]->in_channel_layouts->channel_layouts[0];
89  if (ctx->inputs[i]->in_channel_layouts->nb_channel_layouts > 1) {
90  char buf[256];
91  av_get_channel_layout_string(buf, sizeof(buf), 0, inlayout[i]);
92  av_log(ctx, AV_LOG_INFO, "Using \"%s\" for input %d\n", buf, i + 1);
93  }
94  s->in[i].nb_ch = FF_LAYOUT2COUNT(inlayout[i]);
95  if (s->in[i].nb_ch) {
96  overlap++;
97  } else {
98  s->in[i].nb_ch = av_get_channel_layout_nb_channels(inlayout[i]);
99  if (outlayout & inlayout[i])
100  overlap++;
101  outlayout |= inlayout[i];
102  }
103  nb_ch += s->in[i].nb_ch;
104  }
105  if (nb_ch > SWR_CH_MAX) {
106  av_log(ctx, AV_LOG_ERROR, "Too many channels (max %d)\n", SWR_CH_MAX);
107  return AVERROR(EINVAL);
108  }
109  if (overlap) {
110  av_log(ctx, AV_LOG_WARNING,
111  "Input channel layouts overlap: "
112  "output layout will be determined by the number of distinct input channels\n");
113  for (i = 0; i < nb_ch; i++)
114  s->route[i] = i;
115  outlayout = av_get_default_channel_layout(nb_ch);
116  if (!outlayout && nb_ch)
117  outlayout = 0xFFFFFFFFFFFFFFFFULL >> (64 - nb_ch);
118  } else {
119  int *route[SWR_CH_MAX];
120  int c, out_ch_number = 0;
121 
122  route[0] = s->route;
123  for (i = 1; i < s->nb_inputs; i++)
124  route[i] = route[i - 1] + s->in[i - 1].nb_ch;
125  for (c = 0; c < 64; c++)
126  for (i = 0; i < s->nb_inputs; i++)
127  if ((inlayout[i] >> c) & 1)
128  *(route[i]++) = out_ch_number++;
129  }
131  if ((ret = ff_set_common_formats(ctx, formats)) < 0)
132  return ret;
133  for (i = 0; i < s->nb_inputs; i++) {
134  layouts = NULL;
135  if ((ret = ff_add_channel_layout(&layouts, inlayout[i])) < 0)
136  return ret;
137  if ((ret = ff_channel_layouts_ref(layouts, &ctx->inputs[i]->out_channel_layouts)) < 0)
138  return ret;
139  }
140  layouts = NULL;
141  if ((ret = ff_add_channel_layout(&layouts, outlayout)) < 0)
142  return ret;
143  if ((ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->in_channel_layouts)) < 0)
144  return ret;
145 
147 }
148 
149 static int config_output(AVFilterLink *outlink)
150 {
151  AVFilterContext *ctx = outlink->src;
152  AMergeContext *s = ctx->priv;
153  AVBPrint bp;
154  int i;
155 
156  for (i = 1; i < s->nb_inputs; i++) {
157  if (ctx->inputs[i]->sample_rate != ctx->inputs[0]->sample_rate) {
158  av_log(ctx, AV_LOG_ERROR,
159  "Inputs must have the same sample rate "
160  "%d for in%d vs %d\n",
161  ctx->inputs[i]->sample_rate, i, ctx->inputs[0]->sample_rate);
162  return AVERROR(EINVAL);
163  }
164  }
165  s->bps = av_get_bytes_per_sample(ctx->outputs[0]->format);
166  outlink->sample_rate = ctx->inputs[0]->sample_rate;
167  outlink->time_base = ctx->inputs[0]->time_base;
168 
170  for (i = 0; i < s->nb_inputs; i++) {
171  av_bprintf(&bp, "%sin%d:", i ? " + " : "", i);
173  }
174  av_bprintf(&bp, " -> out:");
176  av_log(ctx, AV_LOG_VERBOSE, "%s\n", bp.str);
177 
178  return 0;
179 }
180 
181 /**
182  * Copy samples from several input streams to one output stream.
183  * @param nb_inputs number of inputs
184  * @param in inputs; used only for the nb_ch field;
185  * @param route routing values;
186  * input channel i goes to output channel route[i];
187  * i < in[0].nb_ch are the channels from the first output;
188  * i >= in[0].nb_ch are the channels from the second output
189  * @param ins pointer to the samples of each inputs, in packed format;
190  * will be left at the end of the copied samples
191  * @param outs pointer to the samples of the output, in packet format;
192  * must point to a buffer big enough;
193  * will be left at the end of the copied samples
194  * @param ns number of samples to copy
195  * @param bps bytes per sample
196  */
197 static inline void copy_samples(int nb_inputs, struct amerge_input in[],
198  int *route, uint8_t *ins[],
199  uint8_t **outs, int ns, int bps)
200 {
201  int *route_cur;
202  int i, c, nb_ch = 0;
203 
204  for (i = 0; i < nb_inputs; i++)
205  nb_ch += in[i].nb_ch;
206  while (ns--) {
207  route_cur = route;
208  for (i = 0; i < nb_inputs; i++) {
209  for (c = 0; c < in[i].nb_ch; c++) {
210  memcpy((*outs) + bps * *(route_cur++), ins[i], bps);
211  ins[i] += bps;
212  }
213  }
214  *outs += nb_ch * bps;
215  }
216 }
217 
218 static void free_frames(int nb_inputs, AVFrame **input_frames)
219 {
220  int i;
221  for (i = 0; i < nb_inputs; i++)
222  av_frame_free(&input_frames[i]);
223 }
224 
225 static int try_push_frame(AVFilterContext *ctx, int nb_samples)
226 {
227  AMergeContext *s = ctx->priv;
228  AVFilterLink *outlink = ctx->outputs[0];
229  int i, ret;
230  AVFrame *outbuf, *inbuf[SWR_CH_MAX] = { NULL };
231  uint8_t *outs, *ins[SWR_CH_MAX];
232 
233  for (i = 0; i < ctx->nb_inputs; i++) {
234  ret = ff_inlink_consume_samples(ctx->inputs[i], nb_samples, nb_samples, &inbuf[i]);
235  if (ret < 0) {
236  free_frames(i, inbuf);
237  return ret;
238  }
239  ins[i] = inbuf[i]->data[0];
240  }
241 
242  outbuf = ff_get_audio_buffer(ctx->outputs[0], nb_samples);
243  if (!outbuf) {
244  free_frames(s->nb_inputs, inbuf);
245  return AVERROR(ENOMEM);
246  }
247 
248  outs = outbuf->data[0];
249  outbuf->pts = inbuf[0]->pts;
250 
251  outbuf->nb_samples = nb_samples;
252  outbuf->channel_layout = outlink->channel_layout;
253  outbuf->channels = outlink->channels;
254 
255  while (nb_samples) {
256  /* Unroll the most common sample formats: speed +~350% for the loop,
257  +~13% overall (including two common decoders) */
258  switch (s->bps) {
259  case 1:
260  copy_samples(s->nb_inputs, s->in, s->route, ins, &outs, nb_samples, 1);
261  break;
262  case 2:
263  copy_samples(s->nb_inputs, s->in, s->route, ins, &outs, nb_samples, 2);
264  break;
265  case 4:
266  copy_samples(s->nb_inputs, s->in, s->route, ins, &outs, nb_samples, 4);
267  break;
268  default:
269  copy_samples(s->nb_inputs, s->in, s->route, ins, &outs, nb_samples, s->bps);
270  break;
271  }
272 
273  nb_samples = 0;
274  }
275 
276  free_frames(s->nb_inputs, inbuf);
277  return ff_filter_frame(ctx->outputs[0], outbuf);
278 }
279 
281 {
282  int i, status;
283  int ret, nb_samples;
284  int64_t pts;
285 
287 
288  nb_samples = ff_framequeue_queued_samples(&ctx->inputs[0]->fifo);
289  for (i = 1; i < ctx->nb_inputs && nb_samples > 0; i++) {
290  nb_samples = FFMIN(ff_framequeue_queued_samples(&ctx->inputs[i]->fifo), nb_samples);
291  }
292 
293  if (nb_samples) {
294  ret = try_push_frame(ctx, nb_samples);
295  if (ret < 0)
296  return ret;
297  }
298 
299  for (i = 0; i < ctx->nb_inputs; i++) {
300  if (ff_framequeue_queued_samples(&ctx->inputs[i]->fifo))
301  continue;
302 
303  if (ff_inlink_acknowledge_status(ctx->inputs[i], &status, &pts)) {
304  ff_outlink_set_status(ctx->outputs[0], status, pts);
305  return 0;
306  } else if (ff_outlink_frame_wanted(ctx->outputs[0])) {
308  return 0;
309  }
310  }
311 
312  return 0;
313 }
314 
316 {
317  AMergeContext *s = ctx->priv;
318  int i, ret;
319 
320  s->in = av_calloc(s->nb_inputs, sizeof(*s->in));
321  if (!s->in)
322  return AVERROR(ENOMEM);
323  for (i = 0; i < s->nb_inputs; i++) {
324  char *name = av_asprintf("in%d", i);
325  AVFilterPad pad = {
326  .name = name,
327  .type = AVMEDIA_TYPE_AUDIO,
328  };
329  if (!name)
330  return AVERROR(ENOMEM);
331  if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) {
332  av_freep(&pad.name);
333  return ret;
334  }
335  }
336  return 0;
337 }
338 
339 static const AVFilterPad amerge_outputs[] = {
340  {
341  .name = "default",
342  .type = AVMEDIA_TYPE_AUDIO,
343  .config_props = config_output,
344  },
345  { NULL }
346 };
347 
349  .name = "amerge",
350  .description = NULL_IF_CONFIG_SMALL("Merge two or more audio streams into "
351  "a single multi-channel stream."),
352  .priv_size = sizeof(AMergeContext),
353  .init = init,
354  .uninit = uninit,
356  .activate = activate,
357  .inputs = NULL,
358  .outputs = amerge_outputs,
359  .priv_class = &amerge_class,
361 };
struct AMergeContext::amerge_input * in
#define NULL
Definition: coverity.c:32
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition: bprint.c:94
int nb_ch
number of channels for the input
Definition: af_amerge.c:46
This structure describes decoded (raw) audio or video data.
Definition: frame.h:226
AVOption.
Definition: opt.h:246
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter)
Forward the status on an output link to all input links.
Definition: filters.h:212
Main libavfilter public API header.
#define SWR_CH_MAX
Definition: af_amerge.c:38
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
Definition: avfilter.h:105
AVFILTER_DEFINE_CLASS(amerge)
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:189
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Definition: avfilter.c:1607
static int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
Definition: filters.h:172
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
Definition: mem.c:244
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:283
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
const char * name
Pad name.
Definition: internal.h:60
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:346
static int activate(AVFilterContext *ctx)
Definition: af_amerge.c:280
int ff_channel_layouts_ref(AVFilterChannelLayouts *f, AVFilterChannelLayouts **ref)
Add *ref as a new reference to f.
Definition: formats.c:435
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1080
uint8_t
#define av_cold
Definition: attributes.h:82
AVOptions.
#define FF_LAYOUT2COUNT(l)
Decode a channel count encoded as a channel layout.
Definition: formats.h:108
static enum AVSampleFormat ff_packed_sample_fmts_array[]
Definition: audio.h:28
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:319
static av_cold int init(AVFilterContext *ctx)
Definition: af_amerge.c:315
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:192
#define av_log(a,...)
static void free_frames(int nb_inputs, AVFrame **input_frames)
Definition: af_amerge.c:218
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_amerge.c:61
A filter pad used for either input or output.
Definition: internal.h:54
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:1436
static const AVFilterPad amerge_outputs[]
Definition: af_amerge.c:339
AVFilterPad * input_pads
array of input pads
Definition: avfilter.h:345
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
int 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:568
static const AVOption amerge_options[]
Definition: af_amerge.c:53
int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout)
Definition: formats.c:343
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
Definition: audio.c:86
#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:202
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition: bprint.c:69
void * priv
private data for use by the filter
Definition: avfilter.h:353
uint64_t * channel_layouts
list of channel layouts
Definition: formats.h:86
uint64_t channel_layout
Channel layout of the audio data.
Definition: frame.h:404
char * av_asprintf(const char *fmt,...)
Definition: avstring.c:113
static int config_output(AVFilterLink *outlink)
Definition: af_amerge.c:149
int channels
number of audio channels, only used for audio.
Definition: frame.h:531
audio channel layout utility functions
unsigned nb_inputs
number of input pads
Definition: avfilter.h:347
#define FFMIN(a, b)
Definition: common.h:96
AVFormatContext * ctx
Definition: movenc.c:48
#define s(width, name)
Definition: cbs_vp9.c:257
static int try_push_frame(AVFilterContext *ctx, int nb_samples)
Definition: af_amerge.c:225
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
A list of supported channel layouts.
Definition: formats.h:85
void av_bprint_channel_layout(struct AVBPrint *bp, int nb_channels, uint64_t channel_layout)
Append a description of a channel layout to a bprint buffer.
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout)
Return a description of a channel layout.
#define FLAGS
Definition: af_amerge.c:51
static int query_formats(AVFilterContext *ctx)
Definition: af_amerge.c:73
#define AV_LOG_INFO
Standard information.
Definition: log.h:187
#define AV_BPRINT_SIZE_AUTOMATIC
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:1500
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
AVFilter ff_af_amerge
Definition: af_amerge.c:348
void * buf
Definition: avisynth_c.h:690
Describe the class of an AVClass context structure.
Definition: log.h:67
Filter definition.
Definition: avfilter.h:144
const char * name
Filter name.
Definition: avfilter.h:148
static uint64_t ff_framequeue_queued_samples(const FFFrameQueue *fq)
Get the number of queued samples.
Definition: framequeue.h:154
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:350
enum MovChannelLayoutTag * layouts
Definition: mov_chan.c:434
AVFilterFormats * ff_all_samplerates(void)
Definition: formats.c:395
static int64_t pts
#define flags(name, subs,...)
Definition: cbs_av1.c:596
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:240
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
Definition: samplefmt.c:106
#define ns(max_value, name, subs,...)
Definition: cbs_av1.c:714
int nb_channel_layouts
number of channel layouts
Definition: formats.h:87
#define OFFSET(x)
Definition: af_amerge.c:50
static double c[64]
unsigned bps
Definition: movenc.c:1484
int route[SWR_CH_MAX]
channels routing, see copy_samples
Definition: af_amerge.c:43
A list of supported formats for one end of a filter link.
Definition: formats.h:64
An instance of a filter.
Definition: avfilter.h:338
int64_t av_get_default_channel_layout(int nb_channels)
Return default channel layout for a given number of channels.
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:197
#define av_freep(p)
formats
Definition: signature.h:48
internal API functions
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:292
for(j=16;j >0;--j)
int ff_set_common_samplerates(AVFilterContext *ctx, AVFilterFormats *samplerates)
Definition: formats.c:556
const char * name
Definition: opengl_enc.c:103
static int ff_insert_inpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new input pad for the filter.
Definition: internal.h:277