Go to the documentation of this file.
61 if (
s->in_ch_layout !=
in->channel_layout ||
62 s->in_sample_rate !=
in->sample_rate ||
63 s->in_sample_fmt !=
in->format) {
69 if (
s->out_ch_layout !=
out->channel_layout ||
70 s->out_sample_rate !=
out->sample_rate ||
71 s->out_sample_fmt !=
out->format) {
83 uint8_t **out_data =
NULL;
84 const uint8_t **in_data =
NULL;
85 int out_nb_samples = 0, in_nb_samples = 0;
88 out_data =
out->extended_data;
89 out_nb_samples =
out->nb_samples;
93 in_data = (
const uint8_t **)
in->extended_data;
94 in_nb_samples =
in->nb_samples;
114 int samples =
out->linesize[0] / bytes_per_sample;
142 if (!
out->linesize[0]) {
145 out->nb_samples +=
in->nb_samples*(int64_t)
s->out_sample_rate /
s->in_sample_rate;
153 if (!
out->nb_samples)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
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 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_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_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
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.
#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)
Filter the word “frame” indicates either a video frame or a group of audio samples
AudioData in
input audio data
av_cold void swr_close(SwrContext *s)
Closes the context so that swr_is_initialized() returns 0.