Commit e5368cda authored by Stefan Westerfeld's avatar Stefan Westerfeld

avfilter/asubprocess: get rid of config_input

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent 1ba2d089
...@@ -46,6 +46,7 @@ typedef struct SP ...@@ -46,6 +46,7 @@ typedef struct SP
} SP; } SP;
enum { enum {
STATE_START = 0,
STATE_EXPECT_RIFF, STATE_EXPECT_RIFF,
STATE_EXPECT_CHUNK, STATE_EXPECT_CHUNK,
STATE_SKIP_CHUNK, STATE_SKIP_CHUNK,
...@@ -54,7 +55,7 @@ enum { ...@@ -54,7 +55,7 @@ enum {
STATE_ERROR STATE_ERROR
}; };
typedef struct AndioWMarkContext { typedef struct ASubProcessContext {
const AVClass *class; const AVClass *class;
const char *command; const char *command;
...@@ -433,33 +434,6 @@ static int write_wav_header(AVFilterContext *ctx, ASubProcessContext *s, int nb_ ...@@ -433,33 +434,6 @@ static int write_wav_header(AVFilterContext *ctx, ASubProcessContext *s, int nb_
return ret; return ret;
} }
static int config_input(AVFilterLink *inlink)
{
AVFilterContext *ctx = inlink->dst;
ASubProcessContext *s = ctx->priv;
int ret;
ret = sp_new(ctx);
if (ret != 0)
return ret;
ret = write_wav_header(ctx, s, inlink->ch_layout.nb_channels, inlink->sample_rate);
if (ret != 0)
return ret;
#if 0
if (s->rbs)
rubberband_delete(s->rbs);
s->rbs = rubberband_new(inlink->sample_rate, inlink->ch_layout.nb_channels, opts, 1. / s->tempo, s->pitch);
if (!s->rbs)
return AVERROR(ENOMEM);
s->first_pts = AV_NOPTS_VALUE;
#endif
s->state = STATE_EXPECT_RIFF;
return 0;
}
static void read_samples(ASubProcessContext *s, int32_t *data, int count) static void read_samples(ASubProcessContext *s, int32_t *data, int count)
{ {
int sample_size = s->out_bit_depth / 8; int sample_size = s->out_bit_depth / 8;
...@@ -588,6 +562,18 @@ static int activate(AVFilterContext *ctx) ...@@ -588,6 +562,18 @@ static int activate(AVFilterContext *ctx)
int64_t pts; int64_t pts;
int status, ret; int status, ret;
if (s->state == STATE_START) {
ret = sp_new(ctx);
if (ret != 0)
return ret;
s->state = STATE_EXPECT_RIFF;
ret = write_wav_header(ctx, s, inlink->ch_layout.nb_channels, inlink->sample_rate);
if (ret != 0)
return ret;
}
FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
ret = try_read_frame(ctx); ret = try_read_frame(ctx);
...@@ -635,14 +621,6 @@ static int activate(AVFilterContext *ctx) ...@@ -635,14 +621,6 @@ static int activate(AVFilterContext *ctx)
return FFERROR_NOT_READY; return FFERROR_NOT_READY;
} }
static const AVFilterPad asubprocess_inputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_AUDIO,
.config_props = config_input,
},
};
const AVFilter ff_af_asubprocess = { const AVFilter ff_af_asubprocess = {
.name = "asubprocess", .name = "asubprocess",
.description = NULL_IF_CONFIG_SMALL("Filter audio stream with subprocess."), .description = NULL_IF_CONFIG_SMALL("Filter audio stream with subprocess."),
...@@ -651,7 +629,7 @@ const AVFilter ff_af_asubprocess = { ...@@ -651,7 +629,7 @@ const AVFilter ff_af_asubprocess = {
.init = init, .init = init,
.uninit = uninit, .uninit = uninit,
.activate = activate, .activate = activate,
FILTER_INPUTS(asubprocess_inputs), FILTER_INPUTS(ff_audio_default_filterpad),
FILTER_OUTPUTS(ff_audio_default_filterpad), FILTER_OUTPUTS(ff_audio_default_filterpad),
FILTER_SINGLE_SAMPLEFMT(AV_SAMPLE_FMT_S32), FILTER_SINGLE_SAMPLEFMT(AV_SAMPLE_FMT_S32),
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment