Le quintidi 25 prairial, an CCXXV, Thomas Mundt a écrit :
> Patch attached. This fixes ticket #2674. I inserted a FIXME message as a
> reminder.
> Please comment.

I am sorry to say I do not like it. The timestamp computation code in
vf_fps is already quite complex, and this patch is making it more
complex, introducing frames_in_proc which should not be needed just to
fix the last timestamp, and obviously the EOF handling duplicates the
filter_frame() logic.

Rule of thumb: if you are about to copy-paste a non-trivial block of
code, stop and refactor.

I think the way forward for this filter is to rewrite the core logic
using the activate() design. It should be much simpler since the
framework already handles a FIFO. If you are interested in it, you
probably will need to rebase push this series:

https://ffmpeg.org/pipermail/ffmpeg-devel/2017-April/209678.html

and use the attached patch.

Regards,

-- 
  Nicolas George
From b7a20596861a8baeb746dbe8922c874ab48e26f5 Mon Sep 17 00:00:00 2001
From: Nicolas George <geo...@nsup.org>
Date: Sun, 23 Apr 2017 14:05:01 +0200
Subject: [PATCH 5/6] lavfi: add ff_inlink_query_fifo().

Signed-off-by: Nicolas George <geo...@nsup.org>
---
 libavfilter/avfilter.c | 14 ++++++++++++++
 libavfilter/filters.h  |  7 +++++++
 2 files changed, 21 insertions(+)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index ecfb872ed8..ee79743928 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1638,6 +1638,20 @@ void ff_inlink_request_frame(AVFilterLink *link)
     ff_filter_set_ready(link->src, 100);
 }
 
+void ff_inlink_query_fifo(AVFilterLink *link,
+                          size_t *frames, uint64_t *samples,
+                          int *status, int64_t *status_pts)
+{
+    if (*frames)
+        *frames = ff_framequeue_queued_frames(&link->fifo);
+    if (*samples)
+        *samples = ff_framequeue_queued_samples(&link->fifo);
+    if (*status)
+        *status = link->status_in;
+    if (*status_pts)
+        *status_pts = link->status_in_pts;
+}
+
 const AVClass *avfilter_get_class(void)
 {
     return &avfilter_class;
diff --git a/libavfilter/filters.h b/libavfilter/filters.h
index 2c78d60e62..870fbc4708 100644
--- a/libavfilter/filters.h
+++ b/libavfilter/filters.h
@@ -134,4 +134,11 @@ int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts
  */
 void ff_inlink_request_frame(AVFilterLink *link);
 
+/**
+ * Query the properties of the link FIFO and surrounding properties.
+ */
+void ff_inlink_query_fifo(AVFilterLink *link,
+                          size_t *frames, uint64_t *samples,
+                          int *status, int64_t *status_pts);
+
 #endif /* AVFILTER_FILTERS_H */
-- 
2.11.0

Attachment: signature.asc
Description: Digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to