2016-02-11 23:05:54 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Paul B Mahol
|
|
|
|
*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "libavutil/audio_fifo.h"
|
|
|
|
#include "libavutil/fifo.h"
|
|
|
|
#include "libavutil/internal.h"
|
|
|
|
#include "libavutil/opt.h"
|
|
|
|
#include "avfilter.h"
|
|
|
|
#include "audio.h"
|
2018-11-02 11:11:24 +02:00
|
|
|
#include "filters.h"
|
2016-02-11 23:05:54 +02:00
|
|
|
#include "formats.h"
|
|
|
|
#include "internal.h"
|
|
|
|
#include "video.h"
|
|
|
|
|
|
|
|
typedef struct LoopContext {
|
|
|
|
const AVClass *class;
|
|
|
|
|
|
|
|
AVAudioFifo *fifo;
|
|
|
|
AVAudioFifo *left;
|
|
|
|
AVFrame **frames;
|
|
|
|
int nb_frames;
|
|
|
|
int current_frame;
|
|
|
|
int64_t start_pts;
|
|
|
|
int64_t duration;
|
|
|
|
int64_t current_sample;
|
|
|
|
int64_t nb_samples;
|
|
|
|
int64_t ignored_samples;
|
|
|
|
|
|
|
|
int loop;
|
2018-11-02 11:11:24 +02:00
|
|
|
int eof;
|
2016-02-11 23:05:54 +02:00
|
|
|
int64_t size;
|
|
|
|
int64_t start;
|
|
|
|
int64_t pts;
|
|
|
|
} LoopContext;
|
|
|
|
|
|
|
|
#define AFLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
|
|
|
|
#define VFLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
|
|
|
|
#define OFFSET(x) offsetof(LoopContext, x)
|
|
|
|
|
2019-05-23 22:20:44 +02:00
|
|
|
static void check_size(AVFilterContext *ctx)
|
|
|
|
{
|
|
|
|
LoopContext *s = ctx->priv;
|
|
|
|
|
|
|
|
if (!s->size)
|
|
|
|
av_log(ctx, AV_LOG_WARNING, "Number of %s to loop is not set!\n",
|
|
|
|
ctx->input_pads[0].type == AVMEDIA_TYPE_VIDEO ? "frames" : "samples");
|
|
|
|
}
|
|
|
|
|
2016-02-11 23:05:54 +02:00
|
|
|
#if CONFIG_ALOOP_FILTER
|
|
|
|
|
|
|
|
static int aconfig_input(AVFilterLink *inlink)
|
|
|
|
{
|
|
|
|
AVFilterContext *ctx = inlink->dst;
|
|
|
|
LoopContext *s = ctx->priv;
|
|
|
|
|
|
|
|
s->fifo = av_audio_fifo_alloc(inlink->format, inlink->channels, 8192);
|
|
|
|
s->left = av_audio_fifo_alloc(inlink->format, inlink->channels, 8192);
|
|
|
|
if (!s->fifo || !s->left)
|
|
|
|
return AVERROR(ENOMEM);
|
|
|
|
|
2019-05-23 22:20:44 +02:00
|
|
|
check_size(ctx);
|
|
|
|
|
2016-02-11 23:05:54 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static av_cold void auninit(AVFilterContext *ctx)
|
|
|
|
{
|
|
|
|
LoopContext *s = ctx->priv;
|
|
|
|
|
|
|
|
av_audio_fifo_free(s->fifo);
|
|
|
|
av_audio_fifo_free(s->left);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int push_samples(AVFilterContext *ctx, int nb_samples)
|
|
|
|
{
|
|
|
|
AVFilterLink *outlink = ctx->outputs[0];
|
|
|
|
LoopContext *s = ctx->priv;
|
|
|
|
AVFrame *out;
|
2021-09-11 22:08:32 +02:00
|
|
|
int ret = 0, i = 0;
|
2016-02-11 23:05:54 +02:00
|
|
|
|
|
|
|
while (s->loop != 0 && i < nb_samples) {
|
|
|
|
out = ff_get_audio_buffer(outlink, FFMIN(nb_samples, s->nb_samples - s->current_sample));
|
|
|
|
if (!out)
|
|
|
|
return AVERROR(ENOMEM);
|
|
|
|
ret = av_audio_fifo_peek_at(s->fifo, (void **)out->extended_data, out->nb_samples, s->current_sample);
|
2016-05-29 21:21:59 +02:00
|
|
|
if (ret < 0) {
|
|
|
|
av_frame_free(&out);
|
2016-02-11 23:05:54 +02:00
|
|
|
return ret;
|
2016-05-29 21:21:59 +02:00
|
|
|
}
|
2016-02-11 23:05:54 +02:00
|
|
|
out->pts = s->pts;
|
|
|
|
out->nb_samples = ret;
|
2019-11-17 16:21:07 +02:00
|
|
|
s->pts += av_rescale_q(out->nb_samples, (AVRational){1, outlink->sample_rate}, outlink->time_base);
|
2016-02-11 23:05:54 +02:00
|
|
|
i += out->nb_samples;
|
|
|
|
s->current_sample += out->nb_samples;
|
|
|
|
|
|
|
|
ret = ff_filter_frame(outlink, out);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
if (s->current_sample >= s->nb_samples) {
|
2019-11-17 17:20:58 +02:00
|
|
|
s->duration = s->pts;
|
2016-02-11 23:05:54 +02:00
|
|
|
s->current_sample = 0;
|
|
|
|
|
|
|
|
if (s->loop > 0)
|
|
|
|
s->loop--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int afilter_frame(AVFilterLink *inlink, AVFrame *frame)
|
|
|
|
{
|
|
|
|
AVFilterContext *ctx = inlink->dst;
|
|
|
|
AVFilterLink *outlink = ctx->outputs[0];
|
|
|
|
LoopContext *s = ctx->priv;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (s->ignored_samples + frame->nb_samples > s->start && s->size > 0 && s->loop != 0) {
|
|
|
|
if (s->nb_samples < s->size) {
|
|
|
|
int written = FFMIN(frame->nb_samples, s->size - s->nb_samples);
|
|
|
|
int drain = 0;
|
|
|
|
|
|
|
|
ret = av_audio_fifo_write(s->fifo, (void **)frame->extended_data, written);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
if (!s->nb_samples) {
|
|
|
|
drain = FFMAX(0, s->start - s->ignored_samples);
|
|
|
|
s->pts = frame->pts;
|
|
|
|
av_audio_fifo_drain(s->fifo, drain);
|
2019-11-17 16:21:07 +02:00
|
|
|
s->pts += av_rescale_q(s->start - s->ignored_samples, (AVRational){1, outlink->sample_rate}, outlink->time_base);
|
2016-02-11 23:05:54 +02:00
|
|
|
}
|
|
|
|
s->nb_samples += ret - drain;
|
|
|
|
drain = frame->nb_samples - written;
|
|
|
|
if (s->nb_samples == s->size && drain > 0) {
|
|
|
|
int ret2;
|
|
|
|
|
|
|
|
ret2 = av_audio_fifo_write(s->left, (void **)frame->extended_data, frame->nb_samples);
|
|
|
|
if (ret2 < 0)
|
|
|
|
return ret2;
|
|
|
|
av_audio_fifo_drain(s->left, drain);
|
|
|
|
}
|
|
|
|
frame->nb_samples = ret;
|
2019-11-17 16:21:07 +02:00
|
|
|
s->pts += av_rescale_q(ret, (AVRational){1, outlink->sample_rate}, outlink->time_base);
|
2016-02-11 23:05:54 +02:00
|
|
|
ret = ff_filter_frame(outlink, frame);
|
|
|
|
} else {
|
|
|
|
int nb_samples = frame->nb_samples;
|
|
|
|
|
|
|
|
av_frame_free(&frame);
|
|
|
|
ret = push_samples(ctx, nb_samples);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
s->ignored_samples += frame->nb_samples;
|
|
|
|
frame->pts = s->pts;
|
2019-11-17 16:21:07 +02:00
|
|
|
s->pts += av_rescale_q(frame->nb_samples, (AVRational){1, outlink->sample_rate}, outlink->time_base);
|
2016-02-11 23:05:54 +02:00
|
|
|
ret = ff_filter_frame(outlink, frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int arequest_frame(AVFilterLink *outlink)
|
|
|
|
{
|
|
|
|
AVFilterContext *ctx = outlink->src;
|
|
|
|
LoopContext *s = ctx->priv;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if ((!s->size) ||
|
|
|
|
(s->nb_samples < s->size) ||
|
|
|
|
(s->nb_samples >= s->size && s->loop == 0)) {
|
|
|
|
int nb_samples = av_audio_fifo_size(s->left);
|
|
|
|
|
|
|
|
if (s->loop == 0 && nb_samples > 0) {
|
|
|
|
AVFrame *out;
|
|
|
|
|
|
|
|
out = ff_get_audio_buffer(outlink, nb_samples);
|
|
|
|
if (!out)
|
|
|
|
return AVERROR(ENOMEM);
|
|
|
|
av_audio_fifo_read(s->left, (void **)out->extended_data, nb_samples);
|
|
|
|
out->pts = s->pts;
|
2019-11-17 16:21:07 +02:00
|
|
|
s->pts += av_rescale_q(nb_samples, (AVRational){1, outlink->sample_rate}, outlink->time_base);
|
2016-02-11 23:05:54 +02:00
|
|
|
ret = ff_filter_frame(outlink, out);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
ret = ff_request_frame(ctx->inputs[0]);
|
|
|
|
} else {
|
|
|
|
ret = push_samples(ctx, 1024);
|
|
|
|
}
|
|
|
|
|
2019-11-17 17:20:58 +02:00
|
|
|
if (s->eof && s->nb_samples > 0 && s->loop != 0) {
|
|
|
|
ret = push_samples(ctx, 1024);
|
2016-02-11 23:05:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-11-17 17:20:58 +02:00
|
|
|
static int aactivate(AVFilterContext *ctx)
|
|
|
|
{
|
|
|
|
AVFilterLink *inlink = ctx->inputs[0];
|
|
|
|
AVFilterLink *outlink = ctx->outputs[0];
|
|
|
|
LoopContext *s = ctx->priv;
|
|
|
|
AVFrame *frame = NULL;
|
|
|
|
int ret, status;
|
|
|
|
int64_t pts;
|
|
|
|
|
|
|
|
FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
|
|
|
|
|
|
|
|
if (!s->eof && (s->nb_samples < s->size || !s->loop || !s->size)) {
|
|
|
|
ret = ff_inlink_consume_frame(inlink, &frame);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
if (ret > 0)
|
|
|
|
return afilter_frame(inlink, frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!s->eof && ff_inlink_acknowledge_status(inlink, &status, &pts)) {
|
|
|
|
if (status == AVERROR_EOF) {
|
|
|
|
s->size = s->nb_samples;
|
|
|
|
s->eof = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s->eof && (!s->loop || !s->size)) {
|
|
|
|
ff_outlink_set_status(outlink, AVERROR_EOF, s->duration);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!s->eof && (!s->size ||
|
|
|
|
(s->nb_samples < s->size) ||
|
|
|
|
(s->nb_samples >= s->size && s->loop == 0))) {
|
|
|
|
FF_FILTER_FORWARD_WANTED(outlink, inlink);
|
|
|
|
} else if (s->loop && s->nb_samples == s->size) {
|
|
|
|
return arequest_frame(outlink);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FFERROR_NOT_READY;
|
|
|
|
}
|
|
|
|
|
2016-02-11 23:05:54 +02:00
|
|
|
static const AVOption aloop_options[] = {
|
|
|
|
{ "loop", "number of loops", OFFSET(loop), AV_OPT_TYPE_INT, {.i64 = 0 }, -1, INT_MAX, AFLAGS },
|
|
|
|
{ "size", "max number of samples to loop", OFFSET(size), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT32_MAX, AFLAGS },
|
|
|
|
{ "start", "set the loop start sample", OFFSET(start), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT64_MAX, AFLAGS },
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
AVFILTER_DEFINE_CLASS(aloop);
|
|
|
|
|
|
|
|
static const AVFilterPad ainputs[] = {
|
|
|
|
{
|
|
|
|
.name = "default",
|
|
|
|
.type = AVMEDIA_TYPE_AUDIO,
|
|
|
|
.config_props = aconfig_input,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static const AVFilterPad aoutputs[] = {
|
|
|
|
{
|
|
|
|
.name = "default",
|
|
|
|
.type = AVMEDIA_TYPE_AUDIO,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-04-19 18:33:56 +02:00
|
|
|
const AVFilter ff_af_aloop = {
|
2016-02-11 23:05:54 +02:00
|
|
|
.name = "aloop",
|
|
|
|
.description = NULL_IF_CONFIG_SMALL("Loop audio samples."),
|
|
|
|
.priv_size = sizeof(LoopContext),
|
|
|
|
.priv_class = &aloop_class,
|
2019-11-17 17:20:58 +02:00
|
|
|
.activate = aactivate,
|
2016-02-11 23:05:54 +02:00
|
|
|
.uninit = auninit,
|
2021-08-12 13:05:31 +02:00
|
|
|
FILTER_INPUTS(ainputs),
|
|
|
|
FILTER_OUTPUTS(aoutputs),
|
2016-02-11 23:05:54 +02:00
|
|
|
};
|
|
|
|
#endif /* CONFIG_ALOOP_FILTER */
|
|
|
|
|
|
|
|
#if CONFIG_LOOP_FILTER
|
|
|
|
|
|
|
|
static av_cold int init(AVFilterContext *ctx)
|
|
|
|
{
|
|
|
|
LoopContext *s = ctx->priv;
|
|
|
|
|
|
|
|
s->frames = av_calloc(s->size, sizeof(*s->frames));
|
|
|
|
if (!s->frames)
|
|
|
|
return AVERROR(ENOMEM);
|
|
|
|
|
2019-05-23 22:20:44 +02:00
|
|
|
check_size(ctx);
|
|
|
|
|
2016-02-11 23:05:54 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static av_cold void uninit(AVFilterContext *ctx)
|
|
|
|
{
|
|
|
|
LoopContext *s = ctx->priv;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < s->nb_frames; i++)
|
|
|
|
av_frame_free(&s->frames[i]);
|
|
|
|
|
|
|
|
av_freep(&s->frames);
|
|
|
|
s->nb_frames = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int push_frame(AVFilterContext *ctx)
|
|
|
|
{
|
|
|
|
AVFilterLink *outlink = ctx->outputs[0];
|
|
|
|
LoopContext *s = ctx->priv;
|
2018-11-02 12:20:30 +02:00
|
|
|
int64_t pts, duration;
|
2016-02-11 23:05:54 +02:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
AVFrame *out = av_frame_clone(s->frames[s->current_frame]);
|
|
|
|
|
|
|
|
if (!out)
|
|
|
|
return AVERROR(ENOMEM);
|
|
|
|
out->pts += s->duration - s->start_pts;
|
2018-11-02 12:20:30 +02:00
|
|
|
if (out->pkt_duration)
|
|
|
|
duration = out->pkt_duration;
|
|
|
|
else
|
|
|
|
duration = av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base);
|
|
|
|
pts = out->pts + duration;
|
2016-02-11 23:05:54 +02:00
|
|
|
ret = ff_filter_frame(outlink, out);
|
|
|
|
s->current_frame++;
|
|
|
|
|
|
|
|
if (s->current_frame >= s->nb_frames) {
|
|
|
|
s->duration = pts;
|
|
|
|
s->current_frame = 0;
|
|
|
|
|
|
|
|
if (s->loop > 0)
|
|
|
|
s->loop--;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
|
|
|
{
|
|
|
|
AVFilterContext *ctx = inlink->dst;
|
|
|
|
AVFilterLink *outlink = ctx->outputs[0];
|
|
|
|
LoopContext *s = ctx->priv;
|
2018-11-02 12:20:30 +02:00
|
|
|
int64_t duration;
|
2016-02-11 23:05:54 +02:00
|
|
|
int ret = 0;
|
|
|
|
|
2016-08-30 15:28:41 +02:00
|
|
|
if (inlink->frame_count_out >= s->start && s->size > 0 && s->loop != 0) {
|
2016-02-11 23:05:54 +02:00
|
|
|
if (s->nb_frames < s->size) {
|
|
|
|
if (!s->nb_frames)
|
|
|
|
s->start_pts = frame->pts;
|
|
|
|
s->frames[s->nb_frames] = av_frame_clone(frame);
|
|
|
|
if (!s->frames[s->nb_frames]) {
|
|
|
|
av_frame_free(&frame);
|
|
|
|
return AVERROR(ENOMEM);
|
|
|
|
}
|
|
|
|
s->nb_frames++;
|
2018-11-02 12:20:30 +02:00
|
|
|
if (frame->pkt_duration)
|
|
|
|
duration = frame->pkt_duration;
|
|
|
|
else
|
|
|
|
duration = av_rescale_q(1, av_inv_q(outlink->frame_rate), outlink->time_base);
|
|
|
|
s->duration = frame->pts + duration;
|
2016-02-11 23:05:54 +02:00
|
|
|
ret = ff_filter_frame(outlink, frame);
|
|
|
|
} else {
|
|
|
|
av_frame_free(&frame);
|
|
|
|
ret = push_frame(ctx);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
frame->pts += s->duration;
|
|
|
|
ret = ff_filter_frame(outlink, frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-11-02 11:11:24 +02:00
|
|
|
static int activate(AVFilterContext *ctx)
|
2016-02-11 23:05:54 +02:00
|
|
|
{
|
2018-11-02 11:11:24 +02:00
|
|
|
AVFilterLink *inlink = ctx->inputs[0];
|
|
|
|
AVFilterLink *outlink = ctx->outputs[0];
|
2016-02-11 23:05:54 +02:00
|
|
|
LoopContext *s = ctx->priv;
|
2018-11-02 11:11:24 +02:00
|
|
|
AVFrame *frame = NULL;
|
|
|
|
int ret, status;
|
|
|
|
int64_t pts;
|
2016-02-11 23:05:54 +02:00
|
|
|
|
2018-11-02 11:11:24 +02:00
|
|
|
FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
|
|
|
|
|
2019-05-19 21:16:03 +02:00
|
|
|
if (!s->eof && (s->nb_frames < s->size || !s->loop || !s->size)) {
|
2018-11-02 11:11:24 +02:00
|
|
|
ret = ff_inlink_consume_frame(inlink, &frame);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
if (ret > 0)
|
|
|
|
return filter_frame(inlink, frame);
|
2016-02-11 23:05:54 +02:00
|
|
|
}
|
|
|
|
|
2018-11-02 11:11:24 +02:00
|
|
|
if (!s->eof && ff_inlink_acknowledge_status(inlink, &status, &pts)) {
|
2019-05-19 21:16:03 +02:00
|
|
|
if (status == AVERROR_EOF) {
|
|
|
|
s->size = s->nb_frames;
|
2018-11-02 11:11:24 +02:00
|
|
|
s->eof = 1;
|
2019-05-19 21:16:03 +02:00
|
|
|
}
|
2016-02-11 23:05:54 +02:00
|
|
|
}
|
|
|
|
|
2019-05-19 21:16:03 +02:00
|
|
|
if (s->eof && (!s->loop || !s->size)) {
|
2018-11-02 11:11:24 +02:00
|
|
|
ff_outlink_set_status(outlink, AVERROR_EOF, s->duration);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!s->eof && (!s->size ||
|
|
|
|
(s->nb_frames < s->size) ||
|
|
|
|
(s->nb_frames >= s->size && s->loop == 0))) {
|
|
|
|
FF_FILTER_FORWARD_WANTED(outlink, inlink);
|
|
|
|
} else if (s->loop && s->nb_frames == s->size) {
|
|
|
|
return push_frame(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FFERROR_NOT_READY;
|
2016-02-11 23:05:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static const AVOption loop_options[] = {
|
|
|
|
{ "loop", "number of loops", OFFSET(loop), AV_OPT_TYPE_INT, {.i64 = 0 }, -1, INT_MAX, VFLAGS },
|
|
|
|
{ "size", "max number of frames to loop", OFFSET(size), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT16_MAX, VFLAGS },
|
|
|
|
{ "start", "set the loop start frame", OFFSET(start), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT64_MAX, VFLAGS },
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
AVFILTER_DEFINE_CLASS(loop);
|
|
|
|
|
|
|
|
static const AVFilterPad inputs[] = {
|
|
|
|
{
|
2018-11-02 11:11:24 +02:00
|
|
|
.name = "default",
|
|
|
|
.type = AVMEDIA_TYPE_VIDEO,
|
2016-02-11 23:05:54 +02:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static const AVFilterPad outputs[] = {
|
|
|
|
{
|
2018-11-02 11:11:24 +02:00
|
|
|
.name = "default",
|
|
|
|
.type = AVMEDIA_TYPE_VIDEO,
|
2016-02-11 23:05:54 +02:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-04-19 18:33:56 +02:00
|
|
|
const AVFilter ff_vf_loop = {
|
2016-02-11 23:05:54 +02:00
|
|
|
.name = "loop",
|
|
|
|
.description = NULL_IF_CONFIG_SMALL("Loop video frames."),
|
|
|
|
.priv_size = sizeof(LoopContext),
|
|
|
|
.priv_class = &loop_class,
|
|
|
|
.init = init,
|
|
|
|
.uninit = uninit,
|
2018-11-02 11:11:24 +02:00
|
|
|
.activate = activate,
|
2021-08-12 13:05:31 +02:00
|
|
|
FILTER_INPUTS(inputs),
|
|
|
|
FILTER_OUTPUTS(outputs),
|
2016-02-11 23:05:54 +02:00
|
|
|
};
|
|
|
|
#endif /* CONFIG_LOOP_FILTER */
|