[FFmpeg-devel] [PATCH] pad: add support for "sar" variable
Stefano Sabatini
stefano.sabatini-lala at poste.it
Sat Jul 2 17:32:47 CEST 2011
Also add a "dar" alias for "a", for avoiding confusion with sar/dar.
---
doc/filters.texi | 5 ++++-
libavfilter/vf_pad.c | 10 +++++++---
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/doc/filters.texi b/doc/filters.texi
index 15b43ad..0218f50 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1129,9 +1129,12 @@ same as @var{out_w} and @var{out_h}
x and y offsets as specified by the @var{x} and @var{y}
expressions, or NAN if not yet specified
- at item a
+ at item dar, a
input display aspect ratio, same as @var{iw} / @var{ih}
+ at item sar
+input sample aspect ratio
+
@item hsub, vsub
horizontal and vertical chroma subsample values. For example for the
pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
index 0ca5bd0..2fc8e47 100644
--- a/libavfilter/vf_pad.c
+++ b/libavfilter/vf_pad.c
@@ -44,7 +44,8 @@ static const char *var_names[] = {
"out_h", "oh",
"x",
"y",
- "a",
+ "a", "dar",
+ "sar",
"hsub",
"vsub",
NULL
@@ -60,7 +61,8 @@ enum var_name {
VAR_OUT_H, VAR_OH,
VAR_X,
VAR_Y,
- VAR_A,
+ VAR_A, VAR_DAR,
+ VAR_SAR,
VAR_HSUB,
VAR_VSUB,
VARS_NB
@@ -155,7 +157,9 @@ static int config_input(AVFilterLink *inlink)
var_values[VAR_IN_H] = var_values[VAR_IH] = inlink->h;
var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN;
var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN;
- var_values[VAR_A] = (float) inlink->w / inlink->h;
+ var_values[VAR_DAR] = var_values[VAR_A] = (float) inlink->w / inlink->h;
+ var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ?
+ (float) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1;
var_values[VAR_HSUB] = 1<<pad->hsub;
var_values[VAR_VSUB] = 2<<pad->vsub;
--
1.7.2.5
More information about the ffmpeg-devel
mailing list