FFmpeg
Loading...
Searching...
No Matches
af_aresample.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Stefano Sabatini
3 * Copyright (c) 2011 Mina Nagy Zaki
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22/**
23 * @file
24 * resampling audio filter
25 */
26
27#include "libavutil/avstring.h"
30#include "libavutil/opt.h"
31#include "libavutil/samplefmt.h"
32#include "libavutil/avassert.h"
34#include "avfilter.h"
35#include "audio.h"
36#include "filters.h"
37#include "formats.h"
38
47
49{
50 AResampleContext *aresample = ctx->priv;
51
52 aresample->next_pts = AV_NOPTS_VALUE;
53 aresample->swr = swr_alloc();
54 if (!aresample->swr)
55 return AVERROR(ENOMEM);
56
57 return 0;
58}
59
61{
62 AResampleContext *aresample = ctx->priv;
63 swr_free(&aresample->swr);
64}
65
67 AVFilterFormatsConfig **cfg_in,
68 AVFilterFormatsConfig **cfg_out)
69{
70 const AResampleContext *aresample = ctx->priv;
71 enum AVSampleFormat out_format;
72 AVChannelLayout out_layout = { 0 };
73 int64_t out_rate;
74
75 AVFilterFormats *in_formats, *out_formats;
76 AVFilterFormats *in_samplerates, *out_samplerates;
77 AVFilterChannelLayouts *in_layouts, *out_layouts;
78 int ret;
79
80 if (aresample->sample_rate_arg > 0)
81 av_opt_set_int(aresample->swr, "osr", aresample->sample_rate_arg, 0);
82 av_opt_get_sample_fmt(aresample->swr, "osf", 0, &out_format);
83 av_opt_get_int(aresample->swr, "osr", 0, &out_rate);
84
86 if ((ret = ff_formats_ref(in_formats, &cfg_in[0]->formats)) < 0)
87 return ret;
88
89 in_samplerates = ff_all_samplerates();
90 if ((ret = ff_formats_ref(in_samplerates, &cfg_in[0]->samplerates)) < 0)
91 return ret;
92
93 in_layouts = ff_all_channel_counts();
94 if ((ret = ff_channel_layouts_ref(in_layouts, &cfg_in[0]->channel_layouts)) < 0)
95 return ret;
96
97 if(out_rate > 0) {
98 int ratelist[] = { out_rate, -1 };
99 out_samplerates = ff_make_format_list(ratelist);
100 } else {
101 out_samplerates = ff_all_samplerates();
102 }
103
104 if ((ret = ff_formats_ref(out_samplerates, &cfg_out[0]->samplerates)) < 0)
105 return ret;
106
107 if(out_format != AV_SAMPLE_FMT_NONE) {
108 enum AVSampleFormat formatlist[] = { out_format, AV_SAMPLE_FMT_NONE };
109 out_formats = ff_make_sample_format_list(formatlist);
110 } else
111 out_formats = ff_all_formats(AVMEDIA_TYPE_AUDIO);
112 if ((ret = ff_formats_ref(out_formats, &cfg_out[0]->formats)) < 0)
113 return ret;
114
115 av_opt_get_chlayout(aresample->swr, "ochl", 0, &out_layout);
116 if (av_channel_layout_check(&out_layout)) {
117 const AVChannelLayout layout_list[] = { out_layout, { 0 } };
118 out_layouts = ff_make_channel_layout_list(layout_list);
119 } else
120 out_layouts = ff_all_channel_counts();
121 av_channel_layout_uninit(&out_layout);
122
123 return ff_channel_layouts_ref(out_layouts, &cfg_out[0]->channel_layouts);
124}
125
126#define SWR_CH_MAX 64
127
128static int config_output(AVFilterLink *outlink)
129{
130 int ret;
131 AVFilterContext *ctx = outlink->src;
132 AVFilterLink *inlink = ctx->inputs[0];
133 AResampleContext *aresample = ctx->priv;
134 AVChannelLayout out_layout = { 0 };
135 int64_t out_rate;
136 const AVFrameSideData *sd;
137 enum AVSampleFormat out_format;
139 char inchl_buf[128], outchl_buf[128];
140
141 ret = swr_alloc_set_opts2(&aresample->swr,
142 &outlink->ch_layout, outlink->format, outlink->sample_rate,
143 &inlink->ch_layout, inlink->format, inlink->sample_rate,
144 0, ctx);
145 if (ret < 0)
146 return ret;
147
148 sd = av_frame_side_data_get(inlink->side_data, inlink->nb_side_data,
150 if (sd) {
151 const AVDownmixMatrix *dm = (AVDownmixMatrix *)sd->data;
152
153 if (inlink->ch_layout.nb_channels == dm->in_ch_count &&
155 swr_set_matrix(aresample->swr,
156 (double *)((uint8_t *)dm + dm->coeffs_offset),
157 dm->in_ch_count);
158
159 switch (dm->downmix_type) {
162 break;
165 break;
166 default:
167 break;
168 }
169 }
170 }
171
172 sd = av_frame_side_data_get(inlink->side_data, inlink->nb_side_data,
174 if (sd) {
175 const AVDownmixInfo *di = (AVDownmixInfo *)sd->data;
176 double center_mix_level, surround_mix_level;
177
178 switch (di->preferred_downmix_type) {
181 center_mix_level = di->center_mix_level_ltrt;
182 surround_mix_level = di->surround_mix_level_ltrt;
183 break;
186 center_mix_level = di->center_mix_level_ltrt;
187 surround_mix_level = di->surround_mix_level_ltrt;
188 break;
189 default:
190 center_mix_level = di->center_mix_level;
191 surround_mix_level = di->surround_mix_level;
192 break;
193 }
194
195 // Don't use Dolby Surround compatible coeffs when not downmixing to stereo
199 center_mix_level = di->center_mix_level;
200 surround_mix_level = di->surround_mix_level;
201 }
202
203 av_log(ctx, AV_LOG_VERBOSE, "Mix levels: center %f - "
204 "surround %f - lfe %f.\n",
205 center_mix_level, surround_mix_level, di->lfe_mix_level);
206
207 av_opt_set_double(aresample->swr, "clev", center_mix_level, 0);
208 av_opt_set_double(aresample->swr, "slev", surround_mix_level, 0);
209 av_opt_set_double(aresample->swr, "lfe_mix_level", di->lfe_mix_level, 0);
210 av_opt_set_int(aresample->swr, "matrix_encoding", matrix_encoding, 0);
211 }
212
213 if (av_channel_layout_compare(&outlink->ch_layout, &inlink->ch_layout)) {
216
218 AVFrameSideData *side_data = av_frame_side_data_new(&outlink->side_data, &outlink->nb_side_data,
220 sizeof(matrix_encoding), 0);
221
222 if (!side_data)
223 return AVERROR(ENOMEM);
224
225 *(enum AVMatrixEncoding *)side_data->data = matrix_encoding;
226 }
227 }
228
229 ret = swr_init(aresample->swr);
230 if (ret < 0)
231 return ret;
232
233 av_opt_get_int(aresample->swr, "osr", 0, &out_rate);
234 av_opt_get_chlayout(aresample->swr, "ochl", 0, &out_layout);
235 av_opt_get_sample_fmt(aresample->swr, "osf", 0, &out_format);
236 outlink->time_base = (AVRational) {1, out_rate};
237
238 av_assert0(outlink->sample_rate == out_rate);
239 av_assert0(!av_channel_layout_compare(&outlink->ch_layout, &out_layout));
240 av_assert0(outlink->format == out_format);
241
242 av_channel_layout_uninit(&out_layout);
243
244 aresample->ratio = (double)outlink->sample_rate / inlink->sample_rate;
245
246 av_channel_layout_describe(&inlink ->ch_layout, inchl_buf, sizeof(inchl_buf));
247 av_channel_layout_describe(&outlink->ch_layout, outchl_buf, sizeof(outchl_buf));
248
249 av_log(ctx, AV_LOG_VERBOSE, "ch:%d chl:%s fmt:%s r:%dHz -> ch:%d chl:%s fmt:%s r:%dHz\n",
250 inlink ->ch_layout.nb_channels, inchl_buf, av_get_sample_fmt_name(inlink->format), inlink->sample_rate,
251 outlink->ch_layout.nb_channels, outchl_buf, av_get_sample_fmt_name(outlink->format), outlink->sample_rate);
252 return 0;
253}
254
255static int filter_frame(AVFilterLink *inlink, AVFrame *insamplesref, AVFrame **outsamplesref_ret)
256{
257 AVFilterContext *ctx = inlink->dst;
258 AResampleContext *aresample = ctx->priv;
259 const int n_in = insamplesref->nb_samples;
260 int64_t delay;
261 int n_out = n_in * aresample->ratio + 32;
262 AVFilterLink *const outlink = inlink->dst->outputs[0];
263 AVFrame *outsamplesref;
264 int ret;
265
266 *outsamplesref_ret = NULL;
267 delay = swr_get_delay(aresample->swr, outlink->sample_rate);
268 if (delay > 0)
269 n_out += FFMIN(delay, FFMAX(4096, n_out));
270
271 outsamplesref = ff_get_audio_buffer(outlink, n_out);
272 if (!outsamplesref)
273 return AVERROR(ENOMEM);
274
275 av_frame_copy_props(outsamplesref, insamplesref);
276 outsamplesref->format = outlink->format;
277 ret = av_channel_layout_copy(&outsamplesref->ch_layout, &outlink->ch_layout);
278 if (ret < 0) {
279 av_frame_free(&outsamplesref);
280 return ret;
281 }
282 outsamplesref->sample_rate = outlink->sample_rate;
283
284 if (av_channel_layout_compare(&outsamplesref->ch_layout, &insamplesref->ch_layout))
285 av_frame_side_data_remove_by_props(&outsamplesref->side_data, &outsamplesref->nb_side_data,
287
288 if(insamplesref->pts != AV_NOPTS_VALUE) {
289 int64_t inpts = av_rescale(insamplesref->pts, inlink->time_base.num * (int64_t)outlink->sample_rate * inlink->sample_rate, inlink->time_base.den);
290 int64_t outpts= swr_next_pts(aresample->swr, inpts);
291 aresample->next_pts =
292 outsamplesref->pts = ROUNDED_DIV(outpts, inlink->sample_rate);
293 } else {
294 outsamplesref->pts = AV_NOPTS_VALUE;
295 }
296 n_out = swr_convert(aresample->swr, outsamplesref->extended_data, n_out,
297 (void *)insamplesref->extended_data, n_in);
298 if (n_out <= 0) {
299 av_frame_free(&outsamplesref);
300 return 0;
301 }
302
303 aresample->more_data = outsamplesref->nb_samples == n_out; // Indicate that there is probably more data in our buffers
304
305 outsamplesref->nb_samples = n_out;
306
307 *outsamplesref_ret = outsamplesref;
308 return 1;
309}
310
311static int flush_frame(AVFilterLink *outlink, int final, AVFrame **outsamplesref_ret)
312{
313 AVFilterContext *ctx = outlink->src;
314 AResampleContext *aresample = ctx->priv;
315 AVFilterLink *const inlink = outlink->src->inputs[0];
316 AVFrame *outsamplesref;
317 int n_out = 4096;
318 int64_t pts;
319
320 outsamplesref = ff_get_audio_buffer(outlink, n_out);
321 *outsamplesref_ret = outsamplesref;
322 if (!outsamplesref)
323 return AVERROR(ENOMEM);
324
325 pts = swr_next_pts(aresample->swr, INT64_MIN);
326 pts = ROUNDED_DIV(pts, inlink->sample_rate);
327
328 n_out = swr_convert(aresample->swr, outsamplesref->extended_data, n_out, final ? NULL : (void*)outsamplesref->extended_data, 0);
329 if (n_out <= 0) {
330 av_frame_free(&outsamplesref);
331 return n_out;
332 }
333
334 outsamplesref->sample_rate = outlink->sample_rate;
335 outsamplesref->nb_samples = n_out;
336
337 outsamplesref->pts = pts;
338
339 return 1;
340}
341
343{
344 AVFilterLink *inlink = ctx->inputs[0];
345 AVFilterLink *outlink = ctx->outputs[0];
346 AResampleContext *aresample = ctx->priv;
347 AVFrame *frame;
348 int ret = 0, status;
349 int64_t pts;
350
351 FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
352
353 // First try to get data from the internal buffers
354 if (aresample->more_data) {
355 AVFrame *outsamplesref;
356
357 ret = flush_frame(outlink, 0, &outsamplesref);
358 if (ret < 0)
359 return ret;
360 if (ret > 0)
361 return ff_filter_frame(outlink, outsamplesref);
362 }
363 aresample->more_data = 0;
364
365 // Then consume frames from inlink
366 while ((ret = ff_inlink_consume_frame(inlink, &frame))) {
367 AVFrame *outsamplesref;
368 if (ret < 0)
369 return ret;
370
371 ret = filter_frame(inlink, frame, &outsamplesref);
373 if (ret < 0)
374 return ret;
375 if (ret > 0)
376 return ff_filter_frame(outlink, outsamplesref);
377 }
378
379 // If we hit the end flush
380 if (ff_inlink_acknowledge_status(inlink, &status, &pts)) {
381 AVFrame *outsamplesref;
382
383 ret = flush_frame(outlink, 1, &outsamplesref);
384 if (ret < 0)
385 return ret;
386 if (ret > 0)
387 return ff_filter_frame(outlink, outsamplesref);
388 ff_outlink_set_status(outlink, status, aresample->next_pts);
389 return 0;
390 }
391
392 // If not, request more data from the input
393 FF_FILTER_FORWARD_WANTED(outlink, inlink);
394
395 return FFERROR_NOT_READY;
396}
397
398static const AVClass *resample_child_class_iterate(void **iter)
399{
400 const AVClass *c = *iter ? NULL : swr_get_class();
401 *iter = (void*)(uintptr_t)c;
402 return c;
403}
404
405static void *resample_child_next(void *obj, void *prev)
406{
407 AResampleContext *s = obj;
408 return prev ? NULL : s->swr;
409}
410
411#define OFFSET(x) offsetof(AResampleContext, x)
412#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
413
414static const AVOption options[] = {
415 {"sample_rate", NULL, OFFSET(sample_rate_arg), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
416 {NULL}
417};
418
419static const AVClass aresample_class = {
420 .class_name = "aresample",
421 .item_name = av_default_item_name,
422 .option = options,
423 .version = LIBAVUTIL_VERSION_INT,
424 .child_class_iterate = resample_child_class_iterate,
425 .child_next = resample_child_next,
426};
427
429 {
430 .name = "default",
431 .config_props = config_output,
432 .type = AVMEDIA_TYPE_AUDIO,
433 },
434};
435
437 .p.name = "aresample",
438 .p.description = NULL_IF_CONFIG_SMALL("Resample audio data."),
439 .p.priv_class = &aresample_class,
440 .preinit = preinit,
441 .activate = activate,
442 .uninit = uninit,
443 .priv_size = sizeof(AResampleContext),
447};
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition aeval.c:246
static int filter_frame(AVFilterLink *inlink, AVFrame *insamplesref, AVFrame **outsamplesref_ret)
static const AVFilterPad aresample_outputs[]
const FFFilter ff_af_aresample
static const AVClass * resample_child_class_iterate(void **iter)
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
static int activate(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)
static av_cold int preinit(AVFilterContext *ctx)
#define OFFSET(x)
static void * resample_child_next(void *obj, void *prev)
static int config_output(AVFilterLink *outlink)
static const AVClass aresample_class
static int flush_frame(AVFilterLink *outlink, int final, AVFrame **outsamplesref_ret)
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
Definition audio.c:34
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
Definition audio.c:74
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition avassert.h:42
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:1467
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1068
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Definition avfilter.c:1520
Main libavfilter public API header.
#define s(width, name)
Definition cbs_vp9.c:198
Public libavutil channel layout APIs header.
#define FLAGS
Definition cmdutils.c:598
#define ROUNDED_DIV(a, b)
Definition common.h:58
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
static const uint16_t channel_layouts[7]
Definition dca_lbr.c:112
static AVFrame * frame
audio downmix medatata
AVFilterFormats * ff_all_formats(enum AVMediaType type)
Return a list of all formats supported by FFmpeg for the given media type.
Definition formats.c:602
int ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
Add ref as a new reference to formats.
Definition formats.c:756
AVFilterChannelLayouts * ff_all_channel_counts(void)
Construct an AVFilterChannelLayouts coding for any channel layout, with known or unknown disposition.
Definition formats.c:688
AVFilterChannelLayouts * ff_make_channel_layout_list(const AVChannelLayout *fmts)
Definition formats.c:511
int ff_channel_layouts_ref(AVFilterChannelLayouts *f, AVFilterChannelLayouts **ref)
Add *ref as a new reference to f.
Definition formats.c:751
AVFilterFormats * ff_all_samplerates(void)
Definition formats.c:673
av_warn_unused_result AVFilterFormats * ff_make_sample_format_list(const enum AVSampleFormat *fmts)
Create a list of supported sample formats.
av_warn_unused_result AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
AVMatrixEncoding
@ AV_MATRIX_ENCODING_NONE
@ AV_MATRIX_ENCODING_DOLBY
@ AV_MATRIX_ENCODING_DPLII
@ AV_DOWNMIX_TYPE_LTRT
Lt/Rt 2-channel downmix, Dolby Surround compatible.
@ AV_DOWNMIX_TYPE_DPLII
Lt/Rt 2-channel downmix, Dolby Pro Logic II compatible.
#define AV_CHANNEL_LAYOUT_STEREO
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
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.
int av_channel_layout_check(const AVChannelLayout *channel_layout)
Check whether a channel layout is valid, i.e.
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
#define AVERROR(e)
Definition error.h:45
AVFrameSideData * av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd, enum AVFrameSideDataType type, size_t size, unsigned int flags)
Add new side data entry to an array.
Definition side_data.c:204
void av_frame_side_data_remove_by_props(AVFrameSideData ***sd, int *nb_sd, int props)
Remove and free all side data instances that match any of the given side data properties.
Definition side_data.c:123
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition frame.c:599
static const AVFrameSideData * av_frame_side_data_get(AVFrameSideData *const *sd, const int nb_sd, enum AVFrameSideDataType type)
Wrapper around av_frame_side_data_get_c() to workaround the limitation that for any type T the conver...
Definition frame.h:1196
@ AV_SIDE_DATA_PROP_CHANNEL_DEPENDENT
Side data depends on the channel layout.
Definition frame.h:368
@ AV_FRAME_DATA_DOWNMIX_MATRIX
Metadata relevant to a downmix procedure in the form of a remixig matrix.
Definition frame.h:307
@ AV_FRAME_DATA_DOWNMIX_INFO
Metadata relevant to a downmix procedure.
Definition frame.h:73
@ AV_FRAME_DATA_MATRIXENCODING
The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
Definition frame.h:68
#define AV_LOG_VERBOSE
Detailed information.
Definition log.h:226
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
@ AVMEDIA_TYPE_AUDIO
Definition avutil.h:201
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
Definition samplefmt.c:51
AVSampleFormat
Audio sample formats.
Definition samplefmt.h:55
@ AV_SAMPLE_FMT_NONE
Definition samplefmt.h:56
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition avutil.h:247
#define LIBAVUTIL_VERSION_INT
Definition version.h:85
av_cold struct SwrContext * swr_alloc(void)
Allocate SwrContext.
Definition options.c:148
int64_t swr_get_delay(struct SwrContext *s, int64_t base)
Gets the delay the next input sample will experience relative to the next output sample.
Definition swresample.c:879
int swr_alloc_set_opts2(struct SwrContext **ps, const AVChannelLayout *out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, const AVChannelLayout *in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, int log_offset, void *log_ctx)
Allocate SwrContext if needed and set/reset common parameters.
Definition swresample.c:54
av_cold void swr_free(SwrContext **ss)
Free the given SwrContext and set the pointer to NULL.
Definition swresample.c:137
const AVClass * swr_get_class(void)
Get the AVClass for SwrContext.
Definition options.c:143
int64_t swr_next_pts(struct SwrContext *s, int64_t pts)
Convert the next timestamp from input to output timestamps are in 1/(in_sample_rate * out_sample_rate...
Definition swresample.c:929
int attribute_align_arg swr_convert(struct SwrContext *s, uint8_t *const *out_arg, int out_count, const uint8_t *const *in_arg, int in_count)
Convert audio.
Definition swresample.c:725
av_cold int swr_init(struct SwrContext *s)
Initialize context after user parameters have been set.
Definition swresample.c:156
int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride)
Set a customized remix matrix.
Definition rematrix.c:71
int av_opt_get_chlayout(void *obj, const char *name, int search_flags, AVChannelLayout *cl)
Definition opt.c:1443
int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val)
Definition opt.c:1345
int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt)
Definition opt.c:1438
int av_opt_set_double(void *obj, const char *name, double val, int search_flags)
Definition opt.c:939
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
Definition opt.c:934
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
static int config_output(AVBitStreamFilterLink *outlink)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FF_FILTER_FORWARD_WANTED(outlink, inlink)
Forward the frame_wanted_out flag from an output link to an input link.
Definition filters.h:694
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:629
#define FFERROR_NOT_READY
Filters implementation helper functions and internal structures.
Definition filters.h:34
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
Definition filters.h:639
#define FILTER_QUERY_FUNC2(func)
Definition filters.h:241
#define av_cold
Definition attributes.h:117
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
#define FFMIN(a, b)
Definition macros.h:49
#define FFMAX(a, b)
Definition macros.h:47
AVOptions.
formats
Definition signature.h:47
static av_cold int preinit(AVBitStreamFilterContext *ctx)
Definition source.c:137
struct SwrContext * swr
An AVChannelLayout holds information about the channel layout of audio data.
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
Definition log.h:76
This structure describes optional metadata relevant to a downmix procedure.
double lfe_mix_level
Absolute scale factor representing the level at which the LFE data is mixed into L/R channels during ...
double surround_mix_level_ltrt
Absolute scale factor representing the nominal level of the surround channels during an Lt/Rt compati...
double surround_mix_level
Absolute scale factor representing the nominal level of the surround channels during a regular downmi...
double center_mix_level
Absolute scale factor representing the nominal level of the center channel during a regular downmix.
enum AVDownmixType preferred_downmix_type
Type of downmix preferred by the mastering engineer.
double center_mix_level_ltrt
Absolute scale factor representing the nominal level of the center channel during an Lt/Rt compatible...
This structure describes optional metadata relevant to a downmix procedure in the form of a remixing ...
size_t coeffs_offset
Offset in bytes from the beginning of this structure at which the array of coefficients starts.
int in_ch_count
Input channel count.
enum AVDownmixType downmix_type
Type of downmix the coeffs will produce.
A list of supported channel layouts.
Definition formats.h:85
An instance of a filter.
Definition avfilter.h:273
AVFilterLink ** inputs
array of pointers to input links
Definition avfilter.h:281
AVFilterLink ** outputs
array of pointers to output links
Definition avfilter.h:285
Lists of formats / etc.
Definition avfilter.h:120
A list of supported formats for one end of a filter link.
Definition formats.h:64
A filter pad used for either input or output.
Definition filters.h:40
Structure to hold side data for an AVFrame.
Definition frame.h:327
uint8_t * data
Definition frame.h:329
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
int nb_samples
number of audio samples (per channel) described by this frame
Definition frame.h:552
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition frame.h:574
AVFrameSideData ** side_data
Definition frame.h:669
int nb_side_data
Definition frame.h:670
int sample_rate
Sample rate of the audio data.
Definition frame.h:635
AVChannelLayout ch_layout
Channel layout of the audio data.
Definition frame.h:815
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Definition frame.h:559
uint8_t ** extended_data
pointers to the data planes/channels.
Definition frame.h:533
AVOption.
Definition opt.h:428
Rational number (pair of numerator and denominator).
Definition rational.h:58
int num
Numerator.
Definition rational.h:59
int den
Denominator.
Definition rational.h:60
The libswresample context.
int64_t outpts
output PTS
int matrix_encoding
matrixed stereo encoding
libswresample public header
#define av_log(a,...)
static AVFormatContext * ctx
Definition movenc.c:49
static int64_t pts
static double c[64]