Go to the documentation of this file.
35 #if FF_API_OLD_CHANNEL_LAYOUT
39 in->ch_layout.u.mask !=
in->channel_layout))) {
55 #if FF_API_OLD_CHANNEL_LAYOUT
59 out->ch_layout.u.mask !=
out->channel_layout))) {
90 #if FF_API_OLD_CHANNEL_LAYOUT
94 in->ch_layout.u.mask !=
in->channel_layout))) {
102 s->in_sample_rate !=
in->sample_rate ||
103 s->in_sample_fmt !=
in->format) {
109 #if FF_API_OLD_CHANNEL_LAYOUT
113 out->ch_layout.u.mask !=
out->channel_layout))) {
122 s->out_sample_rate !=
out->sample_rate ||
123 s->out_sample_fmt !=
out->format) {
136 uint8_t **out_data =
NULL;
137 const uint8_t **in_data =
NULL;
138 int out_nb_samples = 0, in_nb_samples = 0;
141 out_data =
out->extended_data;
142 out_nb_samples =
out->nb_samples;
146 in_data = (
const uint8_t **)
in->extended_data;
147 in_nb_samples =
in->nb_samples;
150 ret =
swr_convert(
s, out_data, out_nb_samples, in_data, in_nb_samples);
167 int samples =
out->linesize[0] / bytes_per_sample;
173 #if FF_API_OLD_CHANNEL_LAYOUT
202 if (!
out->linesize[0]) {
205 out->nb_samples +=
in->nb_samples*(int64_t)
s->out_sample_rate /
s->in_sample_rate;
213 if (!
out->nb_samples)
#define FF_ENABLE_DEPRECATION_WARNINGS
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
This structure describes decoded (raw) audio or video data.
static int convert_frame(SwrContext *s, AVFrame *out, const AVFrame *in)
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
int swr_is_initialized(struct SwrContext *s)
Check whether an swr context has been initialized or not.
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.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_CHANNEL_ORDER_NATIVE
The native channel order, i.e.
av_cold int swr_init(struct SwrContext *s)
Initialize context after user parameters have been set.
static int available_samples(AVFrame *out)
#define AVERROR_INPUT_CHANGED
Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED)
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
The libswresample context.
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
int swr_convert_frame(SwrContext *s, AVFrame *out, const AVFrame *in)
Convert the samples in the input AVFrame and write them to the output AVFrame.
An AVChannelLayout holds information about the channel layout of audio data.
int av_opt_set_chlayout(void *obj, const char *name, const AVChannelLayout *channel_layout, int search_flags)
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
#define AVERROR_OUTPUT_CHANGED
Output changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_INPUT_CHANGED)
int attribute_align_arg swr_convert(struct SwrContext *s, uint8_t **out_arg, int out_count, const uint8_t **in_arg, int in_count)
Convert audio.
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
int swr_config_frame(SwrContext *s, const AVFrame *out, const AVFrame *in)
Configure or reconfigure the SwrContext using the information provided by the AVFrames.
static int config_changed(SwrContext *s, const AVFrame *out, const AVFrame *in)
FF_ENABLE_DEPRECATION_WARNINGS 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.
Filter the word “frame” indicates either a video frame or a group of audio samples
#define FF_DISABLE_DEPRECATION_WARNINGS
AudioData in
input audio data
av_cold void swr_close(SwrContext *s)
Closes the context so that swr_is_initialized() returns 0.