[FFmpeg-cvslog] avfilter: add w/h parameters in timeline

Clément Bœsch git at videolan.org
Tue Oct 7 15:13:47 CEST 2014


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Mon Oct  6 13:04:26 2014 +0200| [abaf4245a1722a3d1b86b9d1a5349f1306c8c7b8] | committer: Clément Bœsch

avfilter: add w/h parameters in timeline

Fixes Ticket #4008.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=abaf4245a1722a3d1b86b9d1a5349f1306c8c7b8
---

 doc/filters.texi       |    4 ++++
 libavfilter/avfilter.c |   21 +++++++++++++++++++--
 libavfilter/version.h  |    2 +-
 3 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 9632838..b9575f4 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -282,6 +282,10 @@ sequential number of the input frame, starting from 0
 
 @item pos
 the position in the file of the input frame, NAN if unknown
+
+ at item w
+ at item h
+width and height of the input frame if video
 @end table
 
 Additionally, these filters support an @option{enable} command that can be used
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 7b11467..3805912 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -381,8 +381,23 @@ int ff_poll_frame(AVFilterLink *link)
     return min;
 }
 
-static const char *const var_names[] = {   "t",   "n",   "pos",        NULL };
-enum                                   { VAR_T, VAR_N, VAR_POS, VAR_VARS_NB };
+static const char *const var_names[] = {
+    "t",
+    "n",
+    "pos",
+    "w",
+    "h",
+    NULL
+};
+
+enum {
+    VAR_T,
+    VAR_N,
+    VAR_POS,
+    VAR_W,
+    VAR_H,
+    VAR_VARS_NB
+};
 
 static int set_enable_expr(AVFilterContext *ctx, const char *expr)
 {
@@ -1071,6 +1086,8 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
         int64_t pos = av_frame_get_pkt_pos(out);
         dstctx->var_values[VAR_N] = link->frame_count;
         dstctx->var_values[VAR_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base);
+        dstctx->var_values[VAR_W] = link->w;
+        dstctx->var_values[VAR_H] = link->h;
         dstctx->var_values[VAR_POS] = pos == -1 ? NAN : pos;
 
         dstctx->is_disabled = fabs(av_expr_eval(dstctx->enable, dstctx->var_values, NULL)) < 0.5;
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 3e85c55..3759f97 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -31,7 +31,7 @@
 
 #define LIBAVFILTER_VERSION_MAJOR  5
 #define LIBAVFILTER_VERSION_MINOR  1
-#define LIBAVFILTER_VERSION_MICRO 102
+#define LIBAVFILTER_VERSION_MICRO 103
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
                                                LIBAVFILTER_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list