summaryrefslogtreecommitdiff
path: root/libavfilter/fifo.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-11-27 07:49:45 +0100
committerAnton Khirnov <anton@khirnov.net>2012-11-28 08:50:19 +0100
commit565e4993c63f797e2d50ad2f1e8f62fdbe299666 (patch)
treebae5282b2ee875de4b01467f3cfaab54b0ab6ec0 /libavfilter/fifo.c
parentbb6c67bb36b136de10256f0999128df4a42f9ffc (diff)
lavfi: merge start_frame/draw_slice/end_frame
Any alleged performance benefits gained from the split are purely mythological and do not justify added code complexity.
Diffstat (limited to 'libavfilter/fifo.c')
-rw-r--r--libavfilter/fifo.c43
1 files changed, 7 insertions, 36 deletions
diff --git a/libavfilter/fifo.c b/libavfilter/fifo.c
index 1bfacafd50..88c44fe3b9 100644
--- a/libavfilter/fifo.c
+++ b/libavfilter/fifo.c
@@ -77,7 +77,6 @@ static int add_to_queue(AVFilterLink *inlink, AVFilterBufferRef *buf)
{
FifoContext *fifo = inlink->dst->priv;
- inlink->cur_buf = NULL;
fifo->last->next = av_mallocz(sizeof(Buf));
if (!fifo->last->next) {
avfilter_unref_buffer(buf);
@@ -99,16 +98,6 @@ static void queue_pop(FifoContext *s)
s->root.next = tmp;
}
-static int end_frame(AVFilterLink *inlink)
-{
- return 0;
-}
-
-static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
-{
- return 0;
-}
-
/**
* Move data pointers and pts offset samples forward.
*/
@@ -228,7 +217,7 @@ static int return_audio_frame(AVFilterContext *ctx)
buf_out = s->buf_out;
s->buf_out = NULL;
}
- return ff_filter_samples(link, buf_out);
+ return ff_filter_frame(link, buf_out);
}
static int request_frame(AVFilterLink *outlink)
@@ -241,27 +230,11 @@ static int request_frame(AVFilterLink *outlink)
return ret;
}
- /* by doing this, we give ownership of the reference to the next filter,
- * so we don't have to worry about dereferencing it ourselves. */
- switch (outlink->type) {
- case AVMEDIA_TYPE_VIDEO:
- if ((ret = ff_start_frame(outlink, fifo->root.next->buf)) < 0 ||
- (ret = ff_draw_slice(outlink, 0, outlink->h, 1)) < 0 ||
- (ret = ff_end_frame(outlink)) < 0)
- return ret;
-
+ if (outlink->request_samples) {
+ return return_audio_frame(outlink->src);
+ } else {
+ ret = ff_filter_frame(outlink, fifo->root.next->buf);
queue_pop(fifo);
- break;
- case AVMEDIA_TYPE_AUDIO:
- if (outlink->request_samples) {
- return return_audio_frame(outlink->src);
- } else {
- ret = ff_filter_samples(outlink, fifo->root.next->buf);
- queue_pop(fifo);
- }
- break;
- default:
- return AVERROR(EINVAL);
}
return ret;
@@ -272,9 +245,7 @@ static const AVFilterPad avfilter_vf_fifo_inputs[] = {
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.get_video_buffer = ff_null_get_video_buffer,
- .start_frame = add_to_queue,
- .draw_slice = draw_slice,
- .end_frame = end_frame,
+ .filter_frame = add_to_queue,
.rej_perms = AV_PERM_REUSE2,
},
{ NULL }
@@ -307,7 +278,7 @@ static const AVFilterPad avfilter_af_afifo_inputs[] = {
.name = "default",
.type = AVMEDIA_TYPE_AUDIO,
.get_audio_buffer = ff_null_get_audio_buffer,
- .filter_samples = add_to_queue,
+ .filter_frame = add_to_queue,
.rej_perms = AV_PERM_REUSE2,
},
{ NULL }