Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
71ef1ec7
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
71ef1ec7
编写于
4月 11, 2013
作者:
C
Clément Bœsch
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lavfi/aspect: switch to an AVOptions-based system.
This is heavily based on
2831b307
by Anton Khirnov <anton@khirnov.net>
上级
647fe2e7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
42 addition
and
52 deletion
+42
-52
doc/filters.texi
doc/filters.texi
+20
-20
libavfilter/avfilter.c
libavfilter/avfilter.c
+0
-2
libavfilter/vf_aspect.c
libavfilter/vf_aspect.c
+20
-28
tests/lavfi-regression.sh
tests/lavfi-regression.sh
+2
-2
未找到文件。
doc/filters.texi
浏览文件 @
71ef1ec7
...
...
@@ -5030,18 +5030,10 @@ Keep in mind that the sample aspect ratio set by the @code{setsar}
filter may be changed by later filters in the filterchain, e.g. if
another "setsar" or a "setdar" filter is applied.
The @code{setdar} and @code{setsar} filters accept a string in the
form @var{num}:@var{den} expressing an aspect ratio, or the following
named options, expressed as a sequence of @var{key}=@var{value} pairs,
separated by ":".
The filters accept the following options:
@table @option
@item max
Set the maximum integer value to use for expressing numerator and
denominator when reducing the expressed aspect ratio to a rational.
Default value is @code{100}.
@item r, ratio, dar, sar:
@item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
Set the aspect ratio used by the filter.
The parameter can be a floating point number string, an expression, or
...
...
@@ -5050,33 +5042,41 @@ a string of the form @var{num}:@var{den}, where @var{num} and
the parameter is not specified, it is assumed the value "0".
In case the form "@var{num}:@var{den}" the @code{:} character should
be escaped.
@item max
Set the maximum integer value to use for expressing numerator and
denominator when reducing the expressed aspect ratio to a rational.
Default value is @code{100}.
@end table
If the keys are omitted in the named options list, the specifed values
are assumed to be @var{ratio} and @var{max} in that order.
@subsection Examples
For example to change the display aspect ratio to 16:9, specify:
@itemize
@item
To change the display aspect ratio to 16:9, specify one of the following:
@example
setdar='16:9'
# the above is equivalent to
setdar=1.77777
setdar=dar=1.77777
setdar=dar=16/9
setdar=dar=1.77777
@end example
@item
To change the sample aspect ratio to 10:11, specify:
@example
setsar='10:11'
# the above is equivalent to
setsar='sar=10/11'
setsar=sar=10/11
@end example
@item
To set a display aspect ratio of 16:9, and specify a maximum integer value of
1000 in the aspect ratio reduction, use the command:
@example
setdar=ratio=
'16:9'
:max=1000
setdar=ratio=
16/9
:max=1000
@end example
@end itemize
@anchor{setfield}
@section setfield
...
...
libavfilter/avfilter.c
浏览文件 @
71ef1ec7
...
...
@@ -681,8 +681,6 @@ static const char *const filters_left_to_update[] = {
"mp"
,
"pan"
,
"scale"
,
"setdar"
,
"setsar"
,
};
static
int
filter_use_deprecated_init
(
const
char
*
name
)
...
...
libavfilter/vf_aspect.c
浏览文件 @
71ef1ec7
...
...
@@ -38,7 +38,6 @@
typedef
struct
{
const
AVClass
*
class
;
AVRational
aspect
;
char
*
ratio_str
;
int
max
;
#if FF_API_OLD_FILTER_OPTS
float
aspect_num
,
aspect_den
;
...
...
@@ -49,26 +48,11 @@ typedef struct {
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
{
AspectContext
*
s
=
ctx
->
priv
;
static
const
char
*
shorthand
[]
=
{
"ratio"
,
"max"
,
NULL
};
char
c
;
int
ret
;
AVRational
q
;
if
(
args
&&
sscanf
(
args
,
"%d:%d%c"
,
&
q
.
num
,
&
q
.
den
,
&
c
)
==
2
)
{
s
->
ratio_str
=
av_strdup
(
args
);
if
(
s
->
aspect_num
>
0
&&
s
->
aspect_den
>
0
)
{
av_log
(
ctx
,
AV_LOG_WARNING
,
"num:den syntax is deprecated, please use num/den or named options instead
\n
"
);
}
else
if
((
ret
=
av_opt_set_from_string
(
s
,
args
,
shorthand
,
"="
,
":"
))
<
0
)
{
return
ret
;
}
if
(
s
->
ratio_str
)
{
ret
=
av_parse_ratio
(
&
s
->
aspect
,
s
->
ratio_str
,
s
->
max
,
0
,
ctx
);
if
(
ret
<
0
||
s
->
aspect
.
num
<
0
||
s
->
aspect
.
den
<=
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid string '%s' for aspect ratio
\n
"
,
args
);
return
AVERROR
(
EINVAL
);
}
s
->
aspect
=
av_d2q
(
s
->
aspect_num
/
s
->
aspect_den
,
INT_MAX
);
}
return
0
;
...
...
@@ -111,11 +95,15 @@ static int setdar_config_props(AVFilterLink *inlink)
}
static
const
AVOption
setdar_options
[]
=
{
{
"max"
,
"set max value for nominator or denominator in the ratio"
,
OFFSET
(
max
),
AV_OPT_TYPE_INT
,
{.
i64
=
100
},
1
,
INT_MAX
,
FLAGS
},
{
"ratio"
,
"display aspect ratio"
,
OFFSET
(
ratio_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"0"
},
0
,
0
,
FLAGS
},
{
"r"
,
"display aspect ratio"
,
OFFSET
(
ratio_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"0"
},
0
,
0
,
FLAGS
},
{
"dar"
,
"display aspect ratio"
,
OFFSET
(
ratio_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"0"
},
0
,
0
,
FLAGS
},
{
NULL
}
#if FF_API_OLD_FILTER_OPTS
{
"dar_num"
,
NULL
,
OFFSET
(
aspect_num
),
AV_OPT_TYPE_FLOAT
,
{
.
dbl
=
0
},
0
,
FLT_MAX
,
FLAGS
},
{
"dar_den"
,
NULL
,
OFFSET
(
aspect_den
),
AV_OPT_TYPE_FLOAT
,
{
.
dbl
=
0
},
0
,
FLT_MAX
,
FLAGS
},
#endif
{
"dar"
,
"set display aspect ratio"
,
OFFSET
(
aspect
),
AV_OPT_TYPE_RATIONAL
,
{.
dbl
=
0
},
0
,
INT_MAX
,
FLAGS
},
{
"ratio"
,
"set display aspect ratio"
,
OFFSET
(
aspect
),
AV_OPT_TYPE_RATIONAL
,
{.
dbl
=
0
},
0
,
INT_MAX
,
FLAGS
},
{
"r"
,
"set display aspect ratio"
,
OFFSET
(
aspect
),
AV_OPT_TYPE_RATIONAL
,
{.
dbl
=
0
},
0
,
INT_MAX
,
FLAGS
},
{
"max"
,
"set max value for nominator or denominator in the ratio"
,
OFFSET
(
max
),
AV_OPT_TYPE_INT
,
{.
i64
=
100
},
1
,
INT_MAX
,
FLAGS
},
{
NULL
}
};
AVFILTER_DEFINE_CLASS
(
setdar
);
...
...
@@ -170,11 +158,15 @@ static int setsar_config_props(AVFilterLink *inlink)
}
static
const
AVOption
setsar_options
[]
=
{
{
"max"
,
"set max value for nominator or denominator in the ratio"
,
OFFSET
(
max
),
AV_OPT_TYPE_INT
,
{.
i64
=
100
},
1
,
INT_MAX
,
FLAGS
},
{
"ratio"
,
"sample (pixel) aspect ratio"
,
OFFSET
(
ratio_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"0"
},
0
,
0
,
FLAGS
},
{
"r"
,
"sample (pixel) aspect ratio"
,
OFFSET
(
ratio_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"0"
},
0
,
0
,
FLAGS
},
{
"sar"
,
"sample (pixel) aspect ratio"
,
OFFSET
(
ratio_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"0"
},
0
,
0
,
FLAGS
},
{
NULL
}
#if FF_API_OLD_FILTER_OPTS
{
"sar_num"
,
NULL
,
OFFSET
(
aspect_num
),
AV_OPT_TYPE_FLOAT
,
{
.
dbl
=
0
},
0
,
FLT_MAX
,
FLAGS
},
{
"sar_den"
,
NULL
,
OFFSET
(
aspect_den
),
AV_OPT_TYPE_FLOAT
,
{
.
dbl
=
0
},
0
,
FLT_MAX
,
FLAGS
},
#endif
{
"sar"
,
"set sample (pixel) aspect ratio"
,
OFFSET
(
aspect
),
AV_OPT_TYPE_RATIONAL
,
{.
dbl
=
0
},
0
,
INT_MAX
,
FLAGS
},
{
"ratio"
,
"set sample (pixel) aspect ratio"
,
OFFSET
(
aspect
),
AV_OPT_TYPE_RATIONAL
,
{.
dbl
=
0
},
0
,
INT_MAX
,
FLAGS
},
{
"r"
,
"set sample (pixel) aspect ratio"
,
OFFSET
(
aspect
),
AV_OPT_TYPE_RATIONAL
,
{.
dbl
=
0
},
0
,
INT_MAX
,
FLAGS
},
{
"max"
,
"set max value for nominator or denominator in the ratio"
,
OFFSET
(
max
),
AV_OPT_TYPE_INT
,
{.
i64
=
100
},
1
,
INT_MAX
,
FLAGS
},
{
NULL
}
};
AVFILTER_DEFINE_CLASS
(
setsar
);
...
...
tests/lavfi-regression.sh
浏览文件 @
71ef1ec7
...
...
@@ -60,8 +60,8 @@ do_lavfi "pp6" "pp=be/fd"
do_lavfi
"scale200"
"scale=200:200"
do_lavfi
"scale500"
"scale=500:500"
do_lavfi
"select"
"select=not(eq(mod(n
\,
2)
\,
0)+eq(mod(n
\,
3)
\,
0))"
do_lavfi
"setdar"
"setdar=16/9"
do_lavfi
"setsar"
"setsar=16/11"
do_lavfi
"setdar"
"setdar=
dar=
16/9"
do_lavfi
"setsar"
"setsar=
sar=
16/11"
do_lavfi
"thumbnail"
"thumbnail=10"
do_lavfi
"tile"
"tile=3x3:nb_frames=5:padding=7:margin=2"
do_lavfi
"transpose"
"transpose"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录