28 #include "libavutil/channel_layout.h"
29 #include "libavutil/opt.h"
30 #include "libswresample/swresample.h"
44 #define OFFSET(x) offsetof(AConvertContext, x)
45 #define A AV_OPT_FLAG_AUDIO_PARAM
46 #define F AV_OPT_FLAG_FILTERING_PARAM
116 char buf1[64], buf2[64];
135 -1, inlink ->channel_layout);
139 "fmt:%s cl:%s -> fmt:%s cl:%s\n",
190 .priv_class = &aconvert_class,
194 .
inputs = aconvert_inputs,
This structure describes decoded (raw) audio or video data.
static const AVOption aconvert_options[]
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.
const char * name
Filter name.
void * priv
private data for use by the filter
#define AV_LOG_WARNING
Something somehow does not look correct.
static const AVFilterPad outputs[]
struct SwrContext * swr_alloc_set_opts(struct SwrContext *s, int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, int64_t 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.
static av_cold int init(AVFilterContext *ctx)
static const AVFilterPad aconvert_inputs[]
uint8_t ** extended_data
pointers to the data planes/channels.
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
static enum AVSampleFormat formats[]
static int query_formats(AVFilterContext *ctx)
void av_frame_set_channels(AVFrame *frame, int val)
const char * name
Pad name.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
struct AVFilterChannelLayouts * in_channel_layouts
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
int swr_convert(struct SwrContext *s, uint8_t **out, int out_count, const uint8_t **in, int in_count)
Convert audio.
#define AV_LOG_VERBOSE
Detailed information.
A filter pad used for either input or output.
A link between two filters.
enum AVSampleFormat out_sample_fmt
int sample_rate
samples per second
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
AVFilterContext * src
source filter
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
uint64_t channel_layout
Channel layout of the audio data.
int format
agreed upon media format
A list of supported channel layouts.
Main libavfilter public API header.
AVFilterLink ** outputs
array of pointers to output links
AVSampleFormat
Audio Sample Formats.
AVFilterFormats * out_formats
void swr_free(struct SwrContext **s)
Free the given SwrContext and set the pointer to NULL.
Describe the class of an AVClass context structure.
static const AVFilterPad inputs[]
AVFilterLink ** inputs
array of pointers to input links
AVFilterContext * dst
dest filter
static av_cold void uninit(AVFilterContext *ctx)
enum MovChannelLayoutTag * layouts
AVFilter avfilter_af_aconvert
static int config_output(AVFilterLink *outlink)
uint64_t channel_layout
channel layout of current buffer (see libavutil/channel_layout.h)
int channels
Number of channels.
static int filter_frame(AVFilterLink *inlink, AVFrame *insamplesref)
char * channel_layout_str
#define AVFILTER_DEFINE_CLASS(fname)
struct AVFilterChannelLayouts * out_channel_layouts
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively.
int nb_samples
number of audio samples (per channel) described by this frame
static const AVFilterPad aconvert_outputs[]
int swr_init(struct SwrContext *s)
Initialize context after user parameters have been set.
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.