54 #define AFLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
55 #define VFLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
56 #define OFFSET(x) offsetof(LoopContext, x)
67 #if CONFIG_ALOOP_FILTER
76 if (!
s->fifo || !
s->left)
99 while (
s->loop != 0 &&
i < nb_samples) {
109 out->nb_samples = ret;
111 i +=
out->nb_samples;
112 s->current_sample +=
out->nb_samples;
118 if (
s->current_sample >=
s->nb_samples) {
119 s->duration =
s->pts;
120 s->current_sample = 0;
138 if (
s->nb_samples <
s->size) {
145 if (!
s->nb_samples) {
146 drain =
FFMAX(0,
s->start -
s->ignored_samples);
151 s->nb_samples += ret - drain;
153 if (
s->nb_samples ==
s->size && drain > 0) {
187 (
s->nb_samples <
s->size) ||
188 (
s->nb_samples >=
s->size &&
s->loop == 0)) {
191 if (
s->loop == 0 && nb_samples > 0) {
209 if (
s->eof &&
s->nb_samples > 0 &&
s->loop != 0) {
227 if (!
s->eof && (
s->nb_samples <
s->size || !
s->loop || !
s->size)) {
232 return afilter_frame(inlink,
frame);
237 s->size =
s->nb_samples;
242 if (
s->eof && (!
s->loop || !
s->size)) {
247 if (!
s->eof && (!
s->size ||
248 (
s->nb_samples <
s->size) ||
249 (
s->nb_samples >=
s->size &&
s->loop == 0))) {
251 }
else if (
s->loop &&
s->nb_samples ==
s->size) {
252 return arequest_frame(outlink);
258 static const AVOption aloop_options[] = {
271 .config_props = aconfig_input,
288 .priv_class = &aloop_class,
296 #if CONFIG_LOOP_FILTER
316 for (
i = 0;
i <
s->nb_frames;
i++)
334 out->pts +=
s->duration -
s->start_pts;
335 if (
out->pkt_duration)
343 if (
s->current_frame >=
s->nb_frames) {
345 s->current_frame = 0;
363 if (
s->nb_frames <
s->size) {
367 if (!
s->frames[
s->nb_frames]) {
401 if (!
s->eof && (
s->nb_frames <
s->size || !
s->loop || !
s->size)) {
411 s->size =
s->nb_frames;
416 if (
s->eof && (!
s->loop || !
s->size)) {
421 if (!
s->eof && (!
s->size ||
422 (
s->nb_frames <
s->size) ||
423 (
s->nb_frames >=
s->size &&
s->loop == 0))) {
425 }
else if (
s->loop &&
s->nb_frames ==
s->size) {
432 static const AVOption loop_options[] = {
461 .priv_class = &loop_class,
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
static int activate(AVFilterContext *ctx)
static int push_samples(ATempoContext *atempo, AVFilterLink *outlink, int n_out)
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().
static int push_frame(AVFilterContext *ctx, unsigned in_no, AVFrame *buf)
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_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
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.
static av_cold int init(AVCodecContext *avctx)
static av_cold int uninit(AVCodecContext *avctx)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
static void check_size(AVFilterContext *ctx)
a very simple circular buffer FIFO implementation
#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.
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples)
Write data to an AVAudioFifo.
int av_audio_fifo_peek_at(AVAudioFifo *af, void **data, int nb_samples, int offset)
Peek data from an AVAudioFifo.
void av_audio_fifo_free(AVAudioFifo *af)
Free an AVAudioFifo.
AVAudioFifo * av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, int nb_samples)
Allocate an AVAudioFifo.
int av_audio_fifo_size(AVAudioFifo *af)
Get the current number of samples in the AVAudioFifo available for reading.
int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples)
Read data from an AVAudioFifo.
int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples)
Drain data from an AVAudioFifo.
#define AVERROR_EOF
End of file.
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define AV_LOG_WARNING
Something somehow does not look correct.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
#define AVFILTER_DEFINE_CLASS(fname)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Context for an Audio FIFO Buffer.
Describe the class of an AVClass context structure.
A link between two filters.
int channels
Number of channels.
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
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0,...
AVFilterContext * dst
dest filter
int format
agreed upon media format
A filter pad used for either input or output.
const char * name
Pad name.
const char * name
Filter name.
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).
int64_t pkt_duration
duration of the corresponding packet, expressed in AVStream->time_base units, 0 if unknown.
uint8_t ** extended_data
pointers to the data planes/channels.
Rational number (pair of numerator and denominator).