[FFmpeg-cvslog] lavfi/crop: restore pos constant, and fix "t" variable misplacement in variable array

Stefano Sabatini git at videolan.org
Fri Apr 12 19:20:17 CEST 2013


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Fri Apr 12 19:15:06 2013 +0200| [1d86fe6970faad317ed1c337adfcf0c15ea16afe] | committer: Stefano Sabatini

lavfi/crop: restore pos constant, and fix "t" variable misplacement in variable array

Fix evaluation of expressions containing the t variable.

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

 doc/filters.texi      |    3 +++
 libavfilter/vf_crop.c |    4 ++++
 2 files changed, 7 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 419b0f3..efa17f2 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -2213,6 +2213,9 @@ pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
 @item n
 the number of input frame, starting from 0
 
+ at item pos
+the position in the file of the input frame, NAN if unknown
+
 @item t
 timestamp expressed in seconds, NAN if the input timestamp is unknown
 
diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c
index 02f0831..edfc98f 100644
--- a/libavfilter/vf_crop.c
+++ b/libavfilter/vf_crop.c
@@ -70,6 +70,7 @@ enum var_name {
     VAR_X,
     VAR_Y,
     VAR_N,
+    VAR_POS,
     VAR_T,
     VAR_VARS_NB
 };
@@ -169,6 +170,7 @@ static int config_input(AVFilterLink *link)
     crop->var_values[VAR_OUT_H] = crop->var_values[VAR_OH] = NAN;
     crop->var_values[VAR_N]     = 0;
     crop->var_values[VAR_T]     = NAN;
+    crop->var_values[VAR_POS]   = NAN;
 
     av_image_fill_max_pixsteps(crop->max_step, NULL, pix_desc);
     crop->hsub = pix_desc->log2_chroma_w;
@@ -259,6 +261,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
 
     crop->var_values[VAR_T] = frame->pts == AV_NOPTS_VALUE ?
         NAN : frame->pts * av_q2d(link->time_base);
+    crop->var_values[VAR_POS] = av_frame_get_pkt_pos(frame) == -1 ?
+        NAN : av_frame_get_pkt_pos(frame);
     crop->var_values[VAR_X] = av_expr_eval(crop->x_pexpr, crop->var_values, NULL);
     crop->var_values[VAR_Y] = av_expr_eval(crop->y_pexpr, crop->var_values, NULL);
     crop->var_values[VAR_X] = av_expr_eval(crop->x_pexpr, crop->var_values, NULL);



More information about the ffmpeg-cvslog mailing list