... | ... |
@@ -3256,6 +3256,10 @@ named options, expressed as a sequence of @var{key}=@var{value} pairs, |
3256 | 3256 |
separated by ":". |
3257 | 3257 |
|
3258 | 3258 |
@table @option |
3259 |
+@item max |
|
3260 |
+Set the maximum integer value to use for expressing numerator and |
|
3261 |
+denominator when reducing the expressed aspect ratio to a rational. |
|
3262 |
+Default value is @code{100}. |
|
3259 | 3263 |
|
3260 | 3264 |
@item r, ratio: |
3261 | 3265 |
Set the aspect ratio used by the filter. |
... | ... |
@@ -3268,6 +3272,9 @@ In case the form "@var{num}:@var{den}" the @code{:} character should |
3268 | 3268 |
be escaped. |
3269 | 3269 |
@end table |
3270 | 3270 |
|
3271 |
+If the keys are omitted in the named options list, the specifed values |
|
3272 |
+are assumed to be @var{ratio} and @var{max} in that order. |
|
3273 |
+ |
|
3271 | 3274 |
For example to change the display aspect ratio to 16:9, specify: |
3272 | 3275 |
@example |
3273 | 3276 |
setdar='16:9' |
... | ... |
@@ -3283,6 +3290,12 @@ To change the sample aspect ratio to 10:11, specify: |
3283 | 3283 |
setsar='10:11' |
3284 | 3284 |
@end example |
3285 | 3285 |
|
3286 |
+To set a display aspect ratio of 16:9, and specify a maximum integer value of |
|
3287 |
+1000 in the aspect ratio reduction, use the command: |
|
3288 |
+@example |
|
3289 |
+setdar=ratio='16:9':max=1000 |
|
3290 |
+@end example |
|
3291 |
+ |
|
3286 | 3292 |
@section setfield |
3287 | 3293 |
|
3288 | 3294 |
Force field for the output video frame. |
... | ... |
@@ -30,7 +30,7 @@ |
30 | 30 |
|
31 | 31 |
#define LIBAVFILTER_VERSION_MAJOR 3 |
32 | 32 |
#define LIBAVFILTER_VERSION_MINOR 20 |
33 |
-#define LIBAVFILTER_VERSION_MICRO 103 |
|
33 |
+#define LIBAVFILTER_VERSION_MICRO 104 |
|
34 | 34 |
|
35 | 35 |
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ |
36 | 36 |
LIBAVFILTER_VERSION_MINOR, \ |
... | ... |
@@ -35,12 +35,14 @@ typedef struct { |
35 | 35 |
const AVClass *class; |
36 | 36 |
AVRational ratio; |
37 | 37 |
char *ratio_str; |
38 |
+ int max; |
|
38 | 39 |
} AspectContext; |
39 | 40 |
|
40 | 41 |
#define OFFSET(x) offsetof(AspectContext, x) |
41 | 42 |
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM |
42 | 43 |
|
43 | 44 |
static const AVOption options[] = { |
45 |
+ {"max", "set max value for nominator or denominator in the ratio", OFFSET(max), AV_OPT_TYPE_INT, {.i64=100}, 1, INT_MAX, FLAGS }, |
|
44 | 46 |
{"ratio", "set ratio", OFFSET(ratio_str), AV_OPT_TYPE_STRING, {.str="0"}, 0, 0, FLAGS }, |
45 | 47 |
{"r", "set ratio", OFFSET(ratio_str), AV_OPT_TYPE_STRING, {.str="0"}, 0, 0, FLAGS }, |
46 | 48 |
{NULL} |
... | ... |
@@ -49,7 +51,7 @@ static const AVOption options[] = { |
49 | 49 |
static av_cold int init(AVFilterContext *ctx, const char *args, const AVClass *class) |
50 | 50 |
{ |
51 | 51 |
AspectContext *aspect = ctx->priv; |
52 |
- static const char *shorthand[] = { "ratio", NULL }; |
|
52 |
+ static const char *shorthand[] = { "ratio", "max", NULL }; |
|
53 | 53 |
char c; |
54 | 54 |
int ret; |
55 | 55 |
AVRational q; |
... | ... |
@@ -66,7 +68,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, const AVClass *c |
66 | 66 |
} |
67 | 67 |
|
68 | 68 |
if (aspect->ratio_str) { |
69 |
- ret = av_parse_ratio(&aspect->ratio, aspect->ratio_str, 100, 0, ctx); |
|
69 |
+ ret = av_parse_ratio(&aspect->ratio, aspect->ratio_str, aspect->max, 0, ctx); |
|
70 | 70 |
if (ret < 0 || aspect->ratio.num < 0 || aspect->ratio.den <= 0) { |
71 | 71 |
av_log(ctx, AV_LOG_ERROR, |
72 | 72 |
"Invalid string '%s' for aspect ratio\n", args); |