44 #define OFFSET(x) offsetof(ASNSContext, x)
45 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
48 {
"nb_out_samples",
"set the number of per-frame output samples",
OFFSET(nb_out_samples),
AV_OPT_TYPE_INT, {.i64=1024}, 1, INT_MAX,
FLAGS },
49 {
"n",
"set the number of per-frame output samples",
OFFSET(nb_out_samples),
AV_OPT_TYPE_INT, {.i64=1024}, 1, INT_MAX,
FLAGS },
88 int ret, nb_out_samples, nb_pad_samples;
123 return nb_out_samples;
135 av_log(ctx,
AV_LOG_DEBUG,
"No space for %d samples, stretching audio fifo\n", nb_samples);
139 "Stretching audio fifo failed, discarded %d samples\n", nb_samples);
190 .
name =
"asetnsamples",
193 .priv_class = &asetnsamples_class,
196 .
inputs = asetnsamples_inputs,
197 .
outputs = asetnsamples_outputs,
AVAudioFifo * av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, int nb_samples)
Allocate an AVAudioFifo.
int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples)
Read data from an AVAudioFifo.
This structure describes decoded (raw) audio or video data.
static av_cold int init(AVFilterContext *ctx)
static int config_props_output(AVFilterLink *outlink)
static const AVOption asetnsamples_options[]
AVFilter ff_af_asetnsamples
Main libavfilter public API header.
void av_audio_fifo_free(AVAudioFifo *af)
Free an AVAudioFifo.
static av_cold void uninit(AVFilterContext *ctx)
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static const AVFilterPad asetnsamples_outputs[]
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
#define AVERROR_EOF
End of file.
#define AV_LOG_VERBOSE
Detailed information.
static const AVFilterPad asetnsamples_inputs[]
A filter pad used for either input or output.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
A link between two filters.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_audio_fifo_space(AVAudioFifo *af)
Get the current number of samples in the AVAudioFifo available for writing.
int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt)
Fill an audio buffer with silence.
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.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
simple assert() macros that are a bit more flexible than ISO C assert().
static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
Context for an Audio FIFO Buffer.
uint64_t channel_layout
Channel layout of the audio data.
int av_audio_fifo_size(AVAudioFifo *af)
Get the current number of samples in the AVAudioFifo available for reading.
audio channel layout utility functions
int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples)
Reallocate an AVAudioFifo.
static int request_frame(AVFilterLink *outlink)
AVFilterContext * src
source filter
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
int format
agreed upon media format
Describe the class of an AVClass context structure.
int sample_rate
Sample rate of the audio data.
Rational number (pair of numerator and denominator).
int nb_out_samples
how many samples to output
AVAudioFifo * fifo
samples are queued here
const char * name
Filter name.
AVFilterLink ** outputs
array of pointers to output links
int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples)
Write data to an AVAudioFifo.
static int push_samples(AVFilterLink *outlink)
AVFILTER_DEFINE_CLASS(asetnsamples)
uint64_t channel_layout
channel layout of current buffer (see libavutil/channel_layout.h)
int channels
Number of channels.
AVFilterContext * dst
dest filter
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
uint8_t ** extended_data
pointers to the data planes/channels.
int nb_samples
number of audio samples (per channel) described by this frame
#define AV_NOPTS_VALUE
Undefined timestamp value.