mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-24 17:12:34 +02:00
lavfi/trim: remove request frame hack
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
parent
4f8e4b8a54
commit
ed1c83508e
@ -69,7 +69,6 @@ typedef struct TrimContext {
|
|||||||
int64_t next_pts;
|
int64_t next_pts;
|
||||||
|
|
||||||
int eof;
|
int eof;
|
||||||
int got_output;
|
|
||||||
} TrimContext;
|
} TrimContext;
|
||||||
|
|
||||||
static int init(AVFilterContext *ctx)
|
static int init(AVFilterContext *ctx)
|
||||||
@ -104,22 +103,9 @@ static int config_input(AVFilterLink *inlink)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int request_frame(AVFilterLink *outlink)
|
static int config_output(AVFilterLink *outlink)
|
||||||
{
|
{
|
||||||
AVFilterContext *ctx = outlink->src;
|
outlink->flags |= FF_LINK_FLAG_REQUEST_LOOP;
|
||||||
TrimContext *s = ctx->priv;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
s->got_output = 0;
|
|
||||||
while (!s->got_output) {
|
|
||||||
if (s->eof)
|
|
||||||
return AVERROR_EOF;
|
|
||||||
|
|
||||||
ret = ff_request_frame(ctx->inputs[0]);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +168,6 @@ static int trim_filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
s->nb_frames++;
|
s->nb_frames++;
|
||||||
s->got_output = 1;
|
|
||||||
|
|
||||||
return ff_filter_frame(ctx->outputs[0], frame);
|
return ff_filter_frame(ctx->outputs[0], frame);
|
||||||
|
|
||||||
@ -224,7 +209,7 @@ static const AVFilterPad trim_outputs[] = {
|
|||||||
{
|
{
|
||||||
.name = "default",
|
.name = "default",
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.request_frame = request_frame,
|
.config_props = config_output,
|
||||||
},
|
},
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
@ -346,7 +331,6 @@ static int atrim_filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
|||||||
} else
|
} else
|
||||||
frame->nb_samples = end_sample;
|
frame->nb_samples = end_sample;
|
||||||
|
|
||||||
s->got_output = 1;
|
|
||||||
return ff_filter_frame(ctx->outputs[0], frame);
|
return ff_filter_frame(ctx->outputs[0], frame);
|
||||||
|
|
||||||
drop:
|
drop:
|
||||||
@ -387,7 +371,7 @@ static const AVFilterPad atrim_outputs[] = {
|
|||||||
{
|
{
|
||||||
.name = "default",
|
.name = "default",
|
||||||
.type = AVMEDIA_TYPE_AUDIO,
|
.type = AVMEDIA_TYPE_AUDIO,
|
||||||
.request_frame = request_frame,
|
.config_props = config_output,
|
||||||
},
|
},
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user