FFmpeg
f_loop.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Paul B Mahol
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "config_components.h"
22 
23 #include "libavutil/audio_fifo.h"
24 #include "libavutil/internal.h"
25 #include "libavutil/opt.h"
26 #include "avfilter.h"
27 #include "audio.h"
28 #include "filters.h"
29 #include "internal.h"
30 #include "video.h"
31 
32 typedef struct LoopContext {
33  const AVClass *class;
34 
38  int nb_frames;
40  int64_t time_pts;
41  int64_t duration;
42  int64_t current_sample;
43  int64_t nb_samples;
44  int64_t ignored_samples;
45 
46  int loop;
47  int eof;
48  int64_t size;
49  int64_t start;
50  int64_t time;
51  int64_t pts;
52  int64_t pts_offset;
53  int64_t eof_pts;
54 } LoopContext;
55 
56 #define AFLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
57 #define VFLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
58 #define OFFSET(x) offsetof(LoopContext, x)
59 
61 {
62  LoopContext *s = ctx->priv;
63 
64  if (!s->size)
65  av_log(ctx, AV_LOG_WARNING, "Number of %s to loop is not set!\n",
66  ctx->input_pads[0].type == AVMEDIA_TYPE_VIDEO ? "frames" : "samples");
67 }
68 
70 {
71  LoopContext *s = ctx->priv;
72 
73  if (s->time != INT64_MAX) {
74  int64_t time_pts = av_rescale_q(s->time, AV_TIME_BASE_Q, tb);
75  if (s->time_pts == AV_NOPTS_VALUE || time_pts < s->time_pts)
76  s->time_pts = time_pts;
77  }
78 }
79 
80 #if CONFIG_ALOOP_FILTER
81 
82 static int aconfig_input(AVFilterLink *inlink)
83 {
84  AVFilterContext *ctx = inlink->dst;
85  LoopContext *s = ctx->priv;
86 
87  s->time_pts = AV_NOPTS_VALUE;
88 
89  s->fifo = av_audio_fifo_alloc(inlink->format, inlink->ch_layout.nb_channels, 8192);
90  s->left = av_audio_fifo_alloc(inlink->format, inlink->ch_layout.nb_channels, 8192);
91  if (!s->fifo || !s->left)
92  return AVERROR(ENOMEM);
93 
94  check_size(ctx);
95 
96  return 0;
97 }
98 
99 static av_cold void auninit(AVFilterContext *ctx)
100 {
101  LoopContext *s = ctx->priv;
102 
103  av_audio_fifo_free(s->fifo);
104  av_audio_fifo_free(s->left);
105 }
106 
107 static int push_samples(AVFilterContext *ctx, int nb_samples)
108 {
109  AVFilterLink *outlink = ctx->outputs[0];
110  LoopContext *s = ctx->priv;
111  AVFrame *out;
112  int ret = 0, i = 0;
113 
114  while (s->loop != 0 && i < nb_samples) {
115  out = ff_get_audio_buffer(outlink, FFMIN(nb_samples, s->nb_samples - s->current_sample));
116  if (!out)
117  return AVERROR(ENOMEM);
118  ret = av_audio_fifo_peek_at(s->fifo, (void **)out->extended_data, out->nb_samples, s->current_sample);
119  if (ret < 0) {
120  av_frame_free(&out);
121  return ret;
122  }
123  out->pts = s->pts;
124  out->nb_samples = ret;
125  s->pts += av_rescale_q(out->nb_samples, (AVRational){1, outlink->sample_rate}, outlink->time_base);
126  i += out->nb_samples;
127  s->current_sample += out->nb_samples;
128 
129  ret = ff_filter_frame(outlink, out);
130  if (ret < 0)
131  return ret;
132 
133  if (s->current_sample >= s->nb_samples) {
134  s->current_sample = 0;
135 
136  if (s->loop > 0)
137  s->loop--;
138  }
139  }
140 
141  return ret;
142 }
143 
144 static int afilter_frame(AVFilterLink *inlink, AVFrame *frame)
145 {
146  AVFilterContext *ctx = inlink->dst;
147  AVFilterLink *outlink = ctx->outputs[0];
148  LoopContext *s = ctx->priv;
149  int ret = 0;
150 
151  if (((s->start >= 0 && s->ignored_samples + frame->nb_samples > s->start) ||
152  (s->time_pts != AV_NOPTS_VALUE &&
153  frame->pts >= s->time_pts)) &&
154  s->size > 0 && s->loop != 0) {
155  if (s->nb_samples < s->size) {
156  int written = FFMIN(frame->nb_samples, s->size - s->nb_samples);
157  int drain = 0;
158 
159  if (s->start < 0)
160  s->start = inlink->sample_count_out - written;
161 
162  ret = av_audio_fifo_write(s->fifo, (void **)frame->extended_data, written);
163  if (ret < 0)
164  return ret;
165  if (!s->nb_samples) {
166  drain = FFMAX(0, s->start - s->ignored_samples);
167  s->pts = frame->pts;
168  av_audio_fifo_drain(s->fifo, drain);
169  s->pts += av_rescale_q(s->start - s->ignored_samples, (AVRational){1, outlink->sample_rate}, outlink->time_base);
170  }
171  s->nb_samples += ret - drain;
172  drain = frame->nb_samples - written;
173  if (s->nb_samples == s->size && drain > 0) {
174  int ret2;
175 
176  ret2 = av_audio_fifo_write(s->left, (void **)frame->extended_data, frame->nb_samples);
177  if (ret2 < 0)
178  return ret2;
179  av_audio_fifo_drain(s->left, drain);
180  }
181  frame->nb_samples = ret;
182  s->pts += av_rescale_q(ret, (AVRational){1, outlink->sample_rate}, outlink->time_base);
183  ret = ff_filter_frame(outlink, frame);
184  } else {
185  int nb_samples = frame->nb_samples;
186 
188  ret = push_samples(ctx, nb_samples);
189  }
190  } else {
191  s->ignored_samples += frame->nb_samples;
192  frame->pts = s->pts;
193  s->pts += av_rescale_q(frame->nb_samples, (AVRational){1, outlink->sample_rate}, outlink->time_base);
194  ret = ff_filter_frame(outlink, frame);
195  }
196 
197  return ret;
198 }
199 
200 static int arequest_frame(AVFilterLink *outlink)
201 {
202  AVFilterContext *ctx = outlink->src;
203  LoopContext *s = ctx->priv;
204  int ret = 0;
205 
206  if ((!s->size) ||
207  (s->nb_samples < s->size) ||
208  (s->nb_samples >= s->size && s->loop == 0)) {
209  int nb_samples = av_audio_fifo_size(s->left);
210 
211  if (s->loop == 0 && nb_samples > 0) {
212  AVFrame *out;
213 
214  out = ff_get_audio_buffer(outlink, nb_samples);
215  if (!out)
216  return AVERROR(ENOMEM);
217  av_audio_fifo_read(s->left, (void **)out->extended_data, nb_samples);
218  out->pts = s->pts;
219  s->pts += av_rescale_q(nb_samples, (AVRational){1, outlink->sample_rate}, outlink->time_base);
220  ret = ff_filter_frame(outlink, out);
221  if (ret < 0)
222  return ret;
223  }
224  ret = ff_request_frame(ctx->inputs[0]);
225  } else {
226  ret = push_samples(ctx, 1024);
227  }
228 
229  if (s->eof && s->nb_samples > 0 && s->loop != 0) {
230  ret = push_samples(ctx, 1024);
231  }
232 
233  return ret;
234 }
235 
236 static int aactivate(AVFilterContext *ctx)
237 {
238  AVFilterLink *inlink = ctx->inputs[0];
239  AVFilterLink *outlink = ctx->outputs[0];
240  LoopContext *s = ctx->priv;
241  AVFrame *frame = NULL;
242  int ret, status;
243 
245 
246  update_time(ctx, inlink->time_base);
247 
248  if (!s->eof && (s->nb_samples < s->size || !s->loop || !s->size)) {
249  const int in_nb_samples = FFMIN(1024, s->size - s->nb_samples);
250  if (in_nb_samples == 0)
252  else
253  ret = ff_inlink_consume_samples(inlink, in_nb_samples, in_nb_samples, &frame);
254  if (ret < 0)
255  return ret;
256  if (ret > 0)
257  return afilter_frame(inlink, frame);
258  }
259 
260  if (!s->eof && ff_inlink_acknowledge_status(inlink, &status, &s->eof_pts)) {
261  if (status == AVERROR_EOF) {
262  s->size = s->nb_samples;
263  s->eof = 1;
264  }
265  }
266 
267  if (s->eof && (!s->loop || !s->size)) {
268  ff_outlink_set_status(outlink, AVERROR_EOF, s->eof_pts + s->pts_offset);
269  return 0;
270  }
271 
272  if (!s->eof && (!s->size ||
273  (s->nb_samples < s->size) ||
274  (s->nb_samples >= s->size && s->loop == 0))) {
276  } else if (s->loop && s->nb_samples == s->size) {
277  return arequest_frame(outlink);
278  }
279 
280  return FFERROR_NOT_READY;
281 }
282 
283 static const AVOption aloop_options[] = {
284  { "loop", "number of loops", OFFSET(loop), AV_OPT_TYPE_INT, {.i64 = 0 }, -1, INT_MAX, AFLAGS },
285  { "size", "max number of samples to loop", OFFSET(size), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT32_MAX, AFLAGS },
286  { "start", "set the loop start sample", OFFSET(start), AV_OPT_TYPE_INT64, {.i64 = 0 }, -1, INT64_MAX, AFLAGS },
287  { "time", "set the loop start time", OFFSET(time), AV_OPT_TYPE_DURATION, {.i64=INT64_MAX}, INT64_MIN, INT64_MAX, AFLAGS },
288  { NULL }
289 };
290 
291 AVFILTER_DEFINE_CLASS(aloop);
292 
293 static const AVFilterPad ainputs[] = {
294  {
295  .name = "default",
296  .type = AVMEDIA_TYPE_AUDIO,
297  .config_props = aconfig_input,
298  },
299 };
300 
301 const AVFilter ff_af_aloop = {
302  .name = "aloop",
303  .description = NULL_IF_CONFIG_SMALL("Loop audio samples."),
304  .priv_size = sizeof(LoopContext),
305  .priv_class = &aloop_class,
306  .activate = aactivate,
307  .uninit = auninit,
308  FILTER_INPUTS(ainputs),
310 };
311 #endif /* CONFIG_ALOOP_FILTER */
312 
313 #if CONFIG_LOOP_FILTER
314 
315 static av_cold int init(AVFilterContext *ctx)
316 {
317  LoopContext *s = ctx->priv;
318 
319  s->time_pts = AV_NOPTS_VALUE;
320 
321  s->frames = av_calloc(s->size, sizeof(*s->frames));
322  if (!s->frames)
323  return AVERROR(ENOMEM);
324 
325  check_size(ctx);
326 
327  return 0;
328 }
329 
330 static void free_frames(AVFilterContext *ctx)
331 {
332  LoopContext *s = ctx->priv;
333 
334  for (int i = 0; i < s->nb_frames; i++)
335  av_frame_free(&s->frames[i]);
336 }
337 
338 static av_cold void uninit(AVFilterContext *ctx)
339 {
340  LoopContext *s = ctx->priv;
341 
342  free_frames(ctx);
343  av_freep(&s->frames);
344  s->nb_frames = 0;
345 }
346 
347 static int push_frame(AVFilterContext *ctx)
348 {
349  AVFilterLink *outlink = ctx->outputs[0];
350  LoopContext *s = ctx->priv;
351  AVFrame *out;
352  int ret;
353 
354  out = av_frame_clone(s->frames[s->current_frame]);
355  if (!out)
356  return AVERROR(ENOMEM);
357  out->pts += s->pts_offset;
358  ret = ff_filter_frame(outlink, out);
359  s->current_frame++;
360 
361  if (s->current_frame >= s->nb_frames) {
362  s->current_frame = 0;
363 
364  s->pts_offset += s->duration;
365  if (s->loop > 0)
366  s->loop--;
367  if (s->loop == 0)
368  free_frames(ctx);
369  }
370 
371  return ret;
372 }
373 
375 {
376  AVFilterContext *ctx = inlink->dst;
377  AVFilterLink *outlink = ctx->outputs[0];
378  LoopContext *s = ctx->priv;
379  int64_t duration;
380  int ret = 0;
381 
382  if (((s->start >= 0 && inlink->frame_count_out >= s->start) ||
383  (s->time_pts != AV_NOPTS_VALUE &&
384  frame->pts >= s->time_pts)) &&
385  s->size > 0 && s->loop != 0) {
386  if (s->nb_frames < s->size) {
387  s->frames[s->nb_frames] = av_frame_clone(frame);
388  if (!s->frames[s->nb_frames]) {
390  return AVERROR(ENOMEM);
391  }
392  s->nb_frames++;
393  if (frame->duration)
395  else
396  duration = av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base);
397  s->duration += duration;
398  s->pts_offset = s->duration;
399  ret = ff_filter_frame(outlink, frame);
400  } else {
402  ret = push_frame(ctx);
403  }
404  } else {
405  frame->pts += s->pts_offset - s->duration;
406  ret = ff_filter_frame(outlink, frame);
407  }
408 
409  return ret;
410 }
411 
412 static int activate(AVFilterContext *ctx)
413 {
414  AVFilterLink *inlink = ctx->inputs[0];
415  AVFilterLink *outlink = ctx->outputs[0];
416  LoopContext *s = ctx->priv;
417  AVFrame *frame = NULL;
418  int ret, status;
419 
420  ret = ff_outlink_get_status(outlink);
421  if (ret) {
423  free_frames(ctx);
424  return 0;
425  }
426 
427  update_time(ctx, inlink->time_base);
428 
429  if (!s->eof && (s->nb_frames < s->size || !s->loop || !s->size)) {
431  if (ret < 0)
432  return ret;
433  if (ret > 0)
434  return filter_frame(inlink, frame);
435  }
436 
437  if (!s->eof && ff_inlink_acknowledge_status(inlink, &status, &s->eof_pts)) {
438  if (status == AVERROR_EOF) {
439  s->size = s->nb_frames;
440  s->eof = 1;
441  }
442  }
443 
444  if (s->eof && (!s->loop || !s->size)) {
445  ff_outlink_set_status(outlink, AVERROR_EOF, s->eof_pts + s->pts_offset);
446  free_frames(ctx);
447  return 0;
448  }
449 
450  if (!s->eof && (!s->size ||
451  (s->nb_frames < s->size) ||
452  (s->nb_frames >= s->size && s->loop == 0))) {
454  } else if (s->loop && s->nb_frames == s->size) {
455  return push_frame(ctx);
456  }
457 
458  return FFERROR_NOT_READY;
459 }
460 
461 static const AVOption loop_options[] = {
462  { "loop", "number of loops", OFFSET(loop), AV_OPT_TYPE_INT, {.i64 = 0 }, -1, INT_MAX, VFLAGS },
463  { "size", "max number of frames to loop", OFFSET(size), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT16_MAX, VFLAGS },
464  { "start", "set the loop start frame", OFFSET(start), AV_OPT_TYPE_INT64, {.i64 = 0 }, -1, INT64_MAX, VFLAGS },
465  { "time", "set the loop start time", OFFSET(time), AV_OPT_TYPE_DURATION, {.i64=INT64_MAX}, INT64_MIN, INT64_MAX, VFLAGS },
466  { NULL }
467 };
468 
470 
471 const AVFilter ff_vf_loop = {
472  .name = "loop",
473  .description = NULL_IF_CONFIG_SMALL("Loop video frames."),
474  .priv_size = sizeof(LoopContext),
475  .priv_class = &loop_class,
476  .init = init,
477  .uninit = uninit,
478  .activate = activate,
481 };
482 #endif /* CONFIG_LOOP_FILTER */
av_audio_fifo_free
void av_audio_fifo_free(AVAudioFifo *af)
Free an AVAudioFifo.
Definition: audio_fifo.c:48
ff_get_audio_buffer
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
Definition: audio.c:107
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
AVERROR
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
opt.h
out
FILE * out
Definition: movenc.c:54
push_samples
static int push_samples(ATempoContext *atempo, AVFilterLink *outlink, int n_out)
Definition: af_atempo.c:1024
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:978
AVFrame::duration
int64_t duration
Duration of the frame, in the same units as pts.
Definition: frame.h:807
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
check_size
static void check_size(AVFilterContext *ctx)
Definition: f_loop.c:60
FFERROR_NOT_READY
return FFERROR_NOT_READY
Definition: filter_design.txt:204
av_audio_fifo_write
int av_audio_fifo_write(AVAudioFifo *af, void *const *data, int nb_samples)
Write data to an AVAudioFifo.
Definition: audio_fifo.c:119
AV_TIME_BASE_Q
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition: avutil.h:264
inlink
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
Definition: filter_design.txt:212
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:100
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:340
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:452
AVOption
AVOption.
Definition: opt.h:251
AV_OPT_TYPE_DURATION
@ AV_OPT_TYPE_DURATION
Definition: opt.h:239
ff_request_frame
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
Definition: avfilter.c:431
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:170
video.h
LoopContext::nb_frames
int nb_frames
Definition: f_loop.c:38
LoopContext
Definition: f_loop.c:32
FF_FILTER_FORWARD_STATUS_BACK
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
Definition: filters.h:199
ff_inlink_consume_frame
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Definition: avfilter.c:1383
AVAudioFifo
Context for an Audio FIFO Buffer.
Definition: audio_fifo.c:37
LoopContext::nb_samples
int64_t nb_samples
Definition: f_loop.c:43
av_audio_fifo_drain
int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples)
Drain data from an AVAudioFifo.
Definition: audio_fifo.c:195
LoopContext::pts
int64_t pts
Definition: f_loop.c:51
loop
static int loop
Definition: ffplay.c:337
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:47
push_frame
static int push_frame(AVFilterLink *outlink)
Definition: af_apad.c:92
av_cold
#define av_cold
Definition: attributes.h:90
LoopContext::pts_offset
int64_t pts_offset
Definition: f_loop.c:52
ff_video_default_filterpad
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition: video.c:36
duration
int64_t duration
Definition: movenc.c:64
ff_outlink_set_status
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
Definition: filters.h:189
LoopContext::size
int64_t size
Definition: f_loop.c:48
s
#define s(width, name)
Definition: cbs_vp9.c:198
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
LoopContext::duration
int64_t duration
Definition: f_loop.c:41
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts_bsf.c:365
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Definition: opt.h:226
filters.h
ctx
AVFormatContext * ctx
Definition: movenc.c:48
av_frame_clone
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:609
av_rescale_q
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Definition: mathematics.c:142
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:192
frame
static AVFrame * frame
Definition: demux_decode.c:54
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
ff_inlink_consume_samples
int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max, AVFrame **rframe)
Take samples from the link's FIFO and update the link's stats.
Definition: avfilter.c:1402
NULL
#define NULL
Definition: coverity.c:32
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
av_audio_fifo_alloc
AVAudioFifo * av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, int nb_samples)
Allocate an AVAudioFifo.
Definition: audio_fifo.c:62
activate
filter_frame For filters that do not use the activate() callback
LoopContext::loop
int loop
Definition: f_loop.c:46
ff_audio_default_filterpad
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
Definition: audio.c:32
AFLAGS
#define AFLAGS
Definition: f_loop.c:56
filter_frame
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition: dolby_e.c:1059
ff_inlink_acknowledge_status
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
Definition: avfilter.c:1337
LoopContext::time
int64_t time
Definition: f_loop.c:50
ff_inlink_set_status
void ff_inlink_set_status(AVFilterLink *link, int status)
Set the status on an input link.
Definition: avfilter.c:1514
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:106
av_audio_fifo_read
int av_audio_fifo_read(AVAudioFifo *af, void *const *data, int nb_samples)
Read data from an AVAudioFifo.
Definition: audio_fifo.c:175
size
int size
Definition: twinvq_data.h:10344
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
LoopContext::current_frame
int current_frame
Definition: f_loop.c:39
FF_FILTER_FORWARD_WANTED
FF_FILTER_FORWARD_WANTED(outlink, inlink)
av_audio_fifo_size
int av_audio_fifo_size(AVAudioFifo *af)
Get the current number of samples in the AVAudioFifo available for reading.
Definition: audio_fifo.c:222
internal.h
AVFILTER_DEFINE_CLASS
#define AVFILTER_DEFINE_CLASS(fname)
Definition: internal.h:319
ff_af_aloop
const AVFilter ff_af_aloop
AVFrame::nb_samples
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:420
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
internal.h
AVFrame::extended_data
uint8_t ** extended_data
pointers to the data planes/channels.
Definition: frame.h:401
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
tb
#define tb
Definition: regdef.h:68
audio_fifo.h
av_inv_q
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:159
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:53
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Definition: mem.c:262
LoopContext::ignored_samples
int64_t ignored_samples
Definition: f_loop.c:44
AVFilter
Filter definition.
Definition: avfilter.h:166
LoopContext::frames
AVFrame ** frames
Definition: f_loop.c:37
ret
ret
Definition: filter_design.txt:187
LoopContext::eof_pts
int64_t eof_pts
Definition: f_loop.c:53
LoopContext::current_sample
int64_t current_sample
Definition: f_loop.c:42
free_frames
static void free_frames(int nb_inputs, AVFrame **input_frames)
Definition: af_amerge.c:213
LoopContext::eof
int eof
Definition: f_loop.c:47
status
ov_status_e status
Definition: dnn_backend_openvino.c:119
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
avfilter.h
OFFSET
#define OFFSET(x)
Definition: f_loop.c:58
LoopContext::left
AVAudioFifo * left
Definition: f_loop.c:36
update_time
static void update_time(AVFilterContext *ctx, AVRational tb)
Definition: f_loop.c:69
LoopContext::fifo
AVAudioFifo * fifo
Definition: f_loop.c:35
ff_outlink_get_status
int ff_outlink_get_status(AVFilterLink *link)
Get the status on an output link.
Definition: avfilter.c:1529
AVFilterContext
An instance of a filter.
Definition: avfilter.h:397
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
audio.h
ff_vf_loop
const AVFilter ff_vf_loop
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:193
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
LoopContext::start
int64_t start
Definition: f_loop.c:49
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
uninit
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:285
LoopContext::time_pts
int64_t time_pts
Definition: f_loop.c:40
VFLAGS
#define VFLAGS
Definition: f_loop.c:57
av_audio_fifo_peek_at
int av_audio_fifo_peek_at(const AVAudioFifo *af, void *const *data, int nb_samples, int offset)
Peek data from an AVAudioFifo.
Definition: audio_fifo.c:150