90 if ((ret =
ff_formats_ref(in_samplerates, &cfg_in[0]->samplerates)) < 0)
98 int ratelist[] = { out_rate, -1 };
104 if ((ret =
ff_formats_ref(out_samplerates, &cfg_out[0]->samplerates)) < 0)
139 char inchl_buf[128], outchl_buf[128];
176 double center_mix_level, surround_mix_level;
204 "surround %f - lfe %f.\n",
261 int n_out = n_in * aresample->
ratio + 32;
266 *outsamplesref_ret =
NULL;
307 *outsamplesref_ret = outsamplesref;
321 *outsamplesref_ret = outsamplesref;
401 *iter = (
void*)(uintptr_t)
c;
408 return prev ?
NULL :
s->swr;
411#define OFFSET(x) offsetof(AResampleContext, x)
412#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
420 .class_name =
"aresample",
437 .p.name =
"aresample",
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
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)
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.
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Main libavfilter public API header.
Public libavutil channel layout APIs header.
#define ROUNDED_DIV(a, b)
static const uint16_t channel_layouts[7]
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ 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.
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.
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.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
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...
@ AV_SIDE_DATA_PROP_CHANNEL_DEPENDENT
Side data depends on the channel layout.
@ AV_FRAME_DATA_DOWNMIX_MATRIX
Metadata relevant to a downmix procedure in the form of a remixig matrix.
@ AV_FRAME_DATA_DOWNMIX_INFO
Metadata relevant to a downmix procedure.
@ AV_FRAME_DATA_MATRIXENCODING
The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
#define AV_LOG_VERBOSE
Detailed information.
const char * av_default_item_name(void *ptr)
Return the context name.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
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.
AVSampleFormat
Audio sample formats.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define LIBAVUTIL_VERSION_INT
av_cold struct SwrContext * swr_alloc(void)
Allocate SwrContext.
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.
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.
av_cold void swr_free(SwrContext **ss)
Free the given SwrContext and set the pointer to NULL.
const AVClass * swr_get_class(void)
Get the AVClass for SwrContext.
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...
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.
av_cold int swr_init(struct SwrContext *s)
Initialize context after user parameters have been set.
int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride)
Set a customized remix matrix.
int av_opt_get_chlayout(void *obj, const char *name, int search_flags, AVChannelLayout *cl)
int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val)
int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt)
int av_opt_set_double(void *obj, const char *name, double val, int search_flags)
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
static int config_output(AVBitStreamFilterLink *outlink)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define FF_FILTER_FORWARD_WANTED(outlink, inlink)
Forward the frame_wanted_out flag from an output link to an input link.
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
#define FFERROR_NOT_READY
Filters implementation helper functions and internal structures.
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
#define FILTER_QUERY_FUNC2(func)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_cold int preinit(AVBitStreamFilterContext *ctx)
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.
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.
AVFilterLink ** inputs
array of pointers to input links
AVFilterLink ** outputs
array of pointers to output links
A link between two filters.
AVFilterContext * src
source filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
int sample_rate
samples per second
AVChannelLayout ch_layout
channel layout of current buffer (see libavutil/channel_layout.h)
AVFilterContext * dst
dest filter
int format
agreed upon media format
AVFrameSideData ** side_data
A filter pad used for either input or output.
Structure to hold side data for an AVFrame.
This structure describes decoded (raw) audio or video data.
int nb_samples
number of audio samples (per channel) described by this frame
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
AVFrameSideData ** side_data
int sample_rate
Sample rate of the audio data.
AVChannelLayout ch_layout
Channel layout of the audio data.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
uint8_t ** extended_data
pointers to the data planes/channels.
Rational number (pair of numerator and denominator).
The libswresample context.
int matrix_encoding
matrixed stereo encoding
libswresample public header
static AVFormatContext * ctx