[01/12] lavfi: add a frame_rate field to AVFilterLink.

Message ID 1446573448-19335-1-git-send-email-stebbins@jetheaddev.com
State New
Headers show

Commit Message

John Stebbins Nov. 3, 2015, 5:57 p.m.
From: Nicolas George <nicolas.george@normalesup.org>

(cherry picked from ffmpeg commit 7b42036b3b23c85f473bf9369e37fa8da22eaf93)
---
 libavfilter/avfilter.c |  2 ++
 libavfilter/avfilter.h | 12 ++++++++++++
 libavfilter/version.h  |  2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)

Comments

Anton Khirnov Nov. 9, 2015, 7:23 a.m. | #1
Thanks for the patches, all pushed.

Patch

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 64b2645..cd98d16 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -195,6 +195,8 @@  int avfilter_config_links(AVFilterContext *filter)
                         link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1};
 
                 if (link->src->nb_inputs) {
+                    if (!link->frame_rate.num && !link->frame_rate.den)
+                        link->frame_rate = link->src->inputs[0]->frame_rate;
                     if (!link->w)
                         link->w = link->src->inputs[0]->w;
                     if (!link->h)
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 9dbfeea..1890858 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -375,6 +375,18 @@  struct AVFilterLink {
         AVLINK_STARTINIT,       ///< started, but incomplete
         AVLINK_INIT             ///< complete
     } init_state;
+
+    /**
+     * Frame rate of the stream on the link, or 1/0 if unknown or variable;
+     * if left to 0/0, will be automatically copied from the first input
+     * of the source filter if it exists.
+     *
+     * Sources should set it to the real constant frame rate.
+     * If the source frame rate is unknown or variable, set this to 1/0.
+     * Filters should update it if necessary depending on their function.
+     * Sinks can use it to set a default output frame rate.
+     */
+    AVRational frame_rate;
 };
 
 /**
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 3cbd8f8..884cfa0 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,7 +30,7 @@ 
 #include "libavutil/version.h"
 
 #define LIBAVFILTER_VERSION_MAJOR  6
-#define LIBAVFILTER_VERSION_MINOR  0
+#define LIBAVFILTER_VERSION_MINOR  1
 #define LIBAVFILTER_VERSION_MICRO  0
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \