mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avfilter/asrc_sinc: switch to activate
Allow to set the EOF timestamp.
This commit is contained in:
parent
52091fcb5c
commit
9153038e0a
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "avfilter.h"
|
#include "avfilter.h"
|
||||||
|
#include "filters.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
typedef struct SincContext {
|
typedef struct SincContext {
|
||||||
@ -44,17 +45,22 @@ typedef struct SincContext {
|
|||||||
RDFTContext *rdft, *irdft;
|
RDFTContext *rdft, *irdft;
|
||||||
} SincContext;
|
} SincContext;
|
||||||
|
|
||||||
static int request_frame(AVFilterLink *outlink)
|
static int activate(AVFilterContext *ctx)
|
||||||
{
|
{
|
||||||
AVFilterContext *ctx = outlink->src;
|
AVFilterLink *outlink = ctx->outputs[0];
|
||||||
SincContext *s = ctx->priv;
|
SincContext *s = ctx->priv;
|
||||||
const float *coeffs = s->coeffs;
|
const float *coeffs = s->coeffs;
|
||||||
AVFrame *frame = NULL;
|
AVFrame *frame = NULL;
|
||||||
int nb_samples;
|
int nb_samples;
|
||||||
|
|
||||||
|
if (!ff_outlink_frame_wanted(outlink))
|
||||||
|
return FFERROR_NOT_READY;
|
||||||
|
|
||||||
nb_samples = FFMIN(s->nb_samples, s->n - s->pts);
|
nb_samples = FFMIN(s->nb_samples, s->n - s->pts);
|
||||||
if (nb_samples <= 0)
|
if (nb_samples <= 0) {
|
||||||
return AVERROR_EOF;
|
ff_outlink_set_status(outlink, AVERROR_EOF, s->pts);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(frame = ff_get_audio_buffer(outlink, nb_samples)))
|
if (!(frame = ff_get_audio_buffer(outlink, nb_samples)))
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
@ -406,7 +412,6 @@ static const AVFilterPad sinc_outputs[] = {
|
|||||||
.name = "default",
|
.name = "default",
|
||||||
.type = AVMEDIA_TYPE_AUDIO,
|
.type = AVMEDIA_TYPE_AUDIO,
|
||||||
.config_props = config_output,
|
.config_props = config_output,
|
||||||
.request_frame = request_frame,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -438,6 +443,7 @@ const AVFilter ff_asrc_sinc = {
|
|||||||
.priv_class = &sinc_class,
|
.priv_class = &sinc_class,
|
||||||
.query_formats = query_formats,
|
.query_formats = query_formats,
|
||||||
.uninit = uninit,
|
.uninit = uninit,
|
||||||
|
.activate = activate,
|
||||||
.inputs = NULL,
|
.inputs = NULL,
|
||||||
FILTER_OUTPUTS(sinc_outputs),
|
FILTER_OUTPUTS(sinc_outputs),
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user