diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2012-04-18 11:02:22 +0200 |
---|---|---|
committer | Nicolas George <nicolas.george@normalesup.org> | 2012-04-23 14:13:40 +0200 |
commit | 2ce797277926358d98593c3743d57eb037d44956 (patch) | |
tree | e29c142b6201530b8665de0f79ba7752a18d480a /libavfilter/avfilter.c | |
parent | e0761feec4dc9d10bd0fa58a0472b69277563e92 (diff) | |
download | ffmpeg-2ce797277926358d98593c3743d57eb037d44956.tar.gz |
avfiltergraph: add avfilter_graph_request_oldest().
Keep a heap of all sink links ordered by timestamps.
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r-- | libavfilter/avfilter.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 28c2599d0e..6bc66d0248 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -278,6 +278,8 @@ int avfilter_config_links(AVFilterContext *filter) if (!link) continue; + link->current_pts = AV_NOPTS_VALUE; + switch (link->init_state) { case AVLINK_INIT: continue; @@ -568,6 +570,15 @@ int avfilter_poll_frame(AVFilterLink *link) return min; } +static void update_link_current_pts(AVFilterLink *link) +{ + if (link->cur_buf->pts == AV_NOPTS_VALUE) + return; + link->current_pts = link->cur_buf->pts; /* TODO use duration */ + if (link->graph && link->age_index >= 0) + ff_avfilter_graph_update_heap(link->graph, link); +} + /* XXX: should we do the duplicating of the picture ref here, instead of * forcing the source filter to do it? */ void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) @@ -608,6 +619,7 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) } start_frame(link, link->cur_buf); + update_link_current_pts(link); } void avfilter_end_frame(AVFilterLink *link) @@ -712,6 +724,7 @@ void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) link->cur_buf = samplesref; filter_samples(link, link->cur_buf); + update_link_current_pts(link); } #define MAX_REGISTERED_AVFILTERS_NB 128 |