mirror of https://git.ffmpeg.org/ffmpeg.git
avfilter/af_aderivative: add timeline support
This commit is contained in:
parent
66f8f9ed29
commit
9e11a7e193
|
@ -16,6 +16,7 @@
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "libavutil/opt.h"
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "avfilter.h"
|
#include "avfilter.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
@ -103,8 +104,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||||
AVFilterContext *ctx = inlink->dst;
|
AVFilterContext *ctx = inlink->dst;
|
||||||
ADerivativeContext *s = ctx->priv;
|
ADerivativeContext *s = ctx->priv;
|
||||||
AVFilterLink *outlink = ctx->outputs[0];
|
AVFilterLink *outlink = ctx->outputs[0];
|
||||||
AVFrame *out = ff_get_audio_buffer(outlink, in->nb_samples);
|
AVFrame *out;
|
||||||
|
|
||||||
|
if (ctx->is_disabled) {
|
||||||
|
if (s->prev)
|
||||||
|
av_samples_set_silence(s->prev->extended_data, 0, 1,
|
||||||
|
s->prev->channels,
|
||||||
|
s->prev->format);
|
||||||
|
|
||||||
|
return ff_filter_frame(outlink, in);
|
||||||
|
}
|
||||||
|
|
||||||
|
out = ff_get_audio_buffer(outlink, in->nb_samples);
|
||||||
if (!out) {
|
if (!out) {
|
||||||
av_frame_free(&in);
|
av_frame_free(&in);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
@ -149,23 +160,33 @@ static const AVFilterPad aderivative_outputs[] = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const AVOption aderivative_options[] = {
|
||||||
|
{ NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
AVFILTER_DEFINE_CLASS_EXT(aderivative, "aderivative/aintegral", aderivative_options);
|
||||||
|
|
||||||
const AVFilter ff_af_aderivative = {
|
const AVFilter ff_af_aderivative = {
|
||||||
.name = "aderivative",
|
.name = "aderivative",
|
||||||
.description = NULL_IF_CONFIG_SMALL("Compute derivative of input audio."),
|
.description = NULL_IF_CONFIG_SMALL("Compute derivative of input audio."),
|
||||||
.priv_size = sizeof(ADerivativeContext),
|
.priv_size = sizeof(ADerivativeContext),
|
||||||
|
.priv_class = &aderivative_class,
|
||||||
.uninit = uninit,
|
.uninit = uninit,
|
||||||
FILTER_INPUTS(aderivative_inputs),
|
FILTER_INPUTS(aderivative_inputs),
|
||||||
FILTER_OUTPUTS(aderivative_outputs),
|
FILTER_OUTPUTS(aderivative_outputs),
|
||||||
FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLTP,
|
FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLTP,
|
||||||
AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_DBLP),
|
AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_DBLP),
|
||||||
|
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
|
||||||
};
|
};
|
||||||
|
|
||||||
const AVFilter ff_af_aintegral = {
|
const AVFilter ff_af_aintegral = {
|
||||||
.name = "aintegral",
|
.name = "aintegral",
|
||||||
.description = NULL_IF_CONFIG_SMALL("Compute integral of input audio."),
|
.description = NULL_IF_CONFIG_SMALL("Compute integral of input audio."),
|
||||||
.priv_size = sizeof(ADerivativeContext),
|
.priv_size = sizeof(ADerivativeContext),
|
||||||
|
.priv_class = &aderivative_class,
|
||||||
.uninit = uninit,
|
.uninit = uninit,
|
||||||
FILTER_INPUTS(aderivative_inputs),
|
FILTER_INPUTS(aderivative_inputs),
|
||||||
FILTER_OUTPUTS(aderivative_outputs),
|
FILTER_OUTPUTS(aderivative_outputs),
|
||||||
FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP),
|
FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP),
|
||||||
|
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue