Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
fc50a8de
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,体验更适合开发者的 AI 搜索 >>
提交
fc50a8de
编写于
12月 11, 2020
作者:
P
Paul B Mahol
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avfilter/af_afade: add support for commands to afade filter
上级
d7646937
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
34 deletion
+54
-34
doc/filters.texi
doc/filters.texi
+4
-0
libavfilter/af_afade.c
libavfilter/af_afade.c
+50
-34
未找到文件。
doc/filters.texi
浏览文件 @
fc50a8de
...
...
@@ -1086,6 +1086,10 @@ no fade applied
@end table
@end table
@subsection Commands
This filter supports the all above options as @ref{commands}.
@subsection Examples
@itemize
...
...
libavfilter/af_afade.c
浏览文件 @
fc50a8de
...
...
@@ -55,6 +55,7 @@ enum CurveType { NONE = -1, TRI, QSIN, ESIN, HSIN, LOG, IPAR, QUA, CUB, SQU, CBR
#define OFFSET(x) offsetof(AudioFadeContext, x)
#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
#define TFLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
static
int
query_formats
(
AVFilterContext
*
ctx
)
{
...
...
@@ -229,8 +230,10 @@ static int config_output(AVFilterLink *outlink)
if
(
s
->
duration
)
s
->
nb_samples
=
av_rescale
(
s
->
duration
,
outlink
->
sample_rate
,
AV_TIME_BASE
);
s
->
duration
=
0
;
if
(
s
->
start_time
)
s
->
start_sample
=
av_rescale
(
s
->
start_time
,
outlink
->
sample_rate
,
AV_TIME_BASE
);
s
->
start_time
=
0
;
return
0
;
}
...
...
@@ -238,40 +241,40 @@ static int config_output(AVFilterLink *outlink)
#if CONFIG_AFADE_FILTER
static
const
AVOption
afade_options
[]
=
{
{
"type"
,
"set the fade direction"
,
OFFSET
(
type
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
FLAGS
,
"type"
},
{
"t"
,
"set the fade direction"
,
OFFSET
(
type
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
FLAGS
,
"type"
},
{
"in"
,
"fade-in"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
FLAGS
,
"type"
},
{
"out"
,
"fade-out"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
FLAGS
,
"type"
},
{
"start_sample"
,
"set number of first sample to start fading"
,
OFFSET
(
start_sample
),
AV_OPT_TYPE_INT64
,
{.
i64
=
0
},
0
,
INT64_MAX
,
FLAGS
},
{
"ss"
,
"set number of first sample to start fading"
,
OFFSET
(
start_sample
),
AV_OPT_TYPE_INT64
,
{.
i64
=
0
},
0
,
INT64_MAX
,
FLAGS
},
{
"nb_samples"
,
"set number of samples for fade duration"
,
OFFSET
(
nb_samples
),
AV_OPT_TYPE_INT64
,
{.
i64
=
44100
},
1
,
INT64_MAX
,
FLAGS
},
{
"ns"
,
"set number of samples for fade duration"
,
OFFSET
(
nb_samples
),
AV_OPT_TYPE_INT64
,
{.
i64
=
44100
},
1
,
INT64_MAX
,
FLAGS
},
{
"start_time"
,
"set time to start fading"
,
OFFSET
(
start_time
),
AV_OPT_TYPE_DURATION
,
{.
i64
=
0
.
},
0
,
INT64_MAX
,
FLAGS
},
{
"st"
,
"set time to start fading"
,
OFFSET
(
start_time
),
AV_OPT_TYPE_DURATION
,
{.
i64
=
0
.
},
0
,
INT64_MAX
,
FLAGS
},
{
"duration"
,
"set fade duration"
,
OFFSET
(
duration
),
AV_OPT_TYPE_DURATION
,
{.
i64
=
0
.
},
0
,
INT64_MAX
,
FLAGS
},
{
"d"
,
"set fade duration"
,
OFFSET
(
duration
),
AV_OPT_TYPE_DURATION
,
{.
i64
=
0
.
},
0
,
INT64_MAX
,
FLAGS
},
{
"curve"
,
"set fade curve type"
,
OFFSET
(
curve
),
AV_OPT_TYPE_INT
,
{.
i64
=
TRI
},
NONE
,
NB_CURVES
-
1
,
FLAGS
,
"curve"
},
{
"c"
,
"set fade curve type"
,
OFFSET
(
curve
),
AV_OPT_TYPE_INT
,
{.
i64
=
TRI
},
NONE
,
NB_CURVES
-
1
,
FLAGS
,
"curve"
},
{
"nofade"
,
"no fade; keep audio as-is"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
NONE
},
0
,
0
,
FLAGS
,
"curve"
},
{
"tri"
,
"linear slope"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
TRI
},
0
,
0
,
FLAGS
,
"curve"
},
{
"qsin"
,
"quarter of sine wave"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
QSIN
},
0
,
0
,
FLAGS
,
"curve"
},
{
"esin"
,
"exponential sine wave"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
ESIN
},
0
,
0
,
FLAGS
,
"curve"
},
{
"hsin"
,
"half of sine wave"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
HSIN
},
0
,
0
,
FLAGS
,
"curve"
},
{
"log"
,
"logarithmic"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
LOG
},
0
,
0
,
FLAGS
,
"curve"
},
{
"ipar"
,
"inverted parabola"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
IPAR
},
0
,
0
,
FLAGS
,
"curve"
},
{
"qua"
,
"quadratic"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
QUA
},
0
,
0
,
FLAGS
,
"curve"
},
{
"cub"
,
"cubic"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
CUB
},
0
,
0
,
FLAGS
,
"curve"
},
{
"squ"
,
"square root"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
SQU
},
0
,
0
,
FLAGS
,
"curve"
},
{
"cbr"
,
"cubic root"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
CBR
},
0
,
0
,
FLAGS
,
"curve"
},
{
"par"
,
"parabola"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
PAR
},
0
,
0
,
FLAGS
,
"curve"
},
{
"exp"
,
"exponential"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
EXP
},
0
,
0
,
FLAGS
,
"curve"
},
{
"iqsin"
,
"inverted quarter of sine wave"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
IQSIN
},
0
,
0
,
FLAGS
,
"curve"
},
{
"ihsin"
,
"inverted half of sine wave"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
IHSIN
},
0
,
0
,
FLAGS
,
"curve"
},
{
"dese"
,
"double-exponential seat"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
DESE
},
0
,
0
,
FLAGS
,
"curve"
},
{
"desi"
,
"double-exponential sigmoid"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
DESI
},
0
,
0
,
FLAGS
,
"curve"
},
{
"losi"
,
"logistic sigmoid"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
LOSI
},
0
,
0
,
FLAGS
,
"curve"
},
{
"sinc"
,
"sine cardinal function"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
SINC
},
0
,
0
,
FLAGS
,
"curve"
},
{
"isinc"
,
"inverted sine cardinal function"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
ISINC
},
0
,
0
,
FLAGS
,
"curve"
},
{
"type"
,
"set the fade direction"
,
OFFSET
(
type
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
T
FLAGS
,
"type"
},
{
"t"
,
"set the fade direction"
,
OFFSET
(
type
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
T
FLAGS
,
"type"
},
{
"in"
,
"fade-in"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
T
FLAGS
,
"type"
},
{
"out"
,
"fade-out"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
T
FLAGS
,
"type"
},
{
"start_sample"
,
"set number of first sample to start fading"
,
OFFSET
(
start_sample
),
AV_OPT_TYPE_INT64
,
{.
i64
=
0
},
0
,
INT64_MAX
,
T
FLAGS
},
{
"ss"
,
"set number of first sample to start fading"
,
OFFSET
(
start_sample
),
AV_OPT_TYPE_INT64
,
{.
i64
=
0
},
0
,
INT64_MAX
,
T
FLAGS
},
{
"nb_samples"
,
"set number of samples for fade duration"
,
OFFSET
(
nb_samples
),
AV_OPT_TYPE_INT64
,
{.
i64
=
44100
},
1
,
INT64_MAX
,
T
FLAGS
},
{
"ns"
,
"set number of samples for fade duration"
,
OFFSET
(
nb_samples
),
AV_OPT_TYPE_INT64
,
{.
i64
=
44100
},
1
,
INT64_MAX
,
T
FLAGS
},
{
"start_time"
,
"set time to start fading"
,
OFFSET
(
start_time
),
AV_OPT_TYPE_DURATION
,
{.
i64
=
0
.
},
0
,
INT64_MAX
,
T
FLAGS
},
{
"st"
,
"set time to start fading"
,
OFFSET
(
start_time
),
AV_OPT_TYPE_DURATION
,
{.
i64
=
0
.
},
0
,
INT64_MAX
,
T
FLAGS
},
{
"duration"
,
"set fade duration"
,
OFFSET
(
duration
),
AV_OPT_TYPE_DURATION
,
{.
i64
=
0
.
},
0
,
INT64_MAX
,
T
FLAGS
},
{
"d"
,
"set fade duration"
,
OFFSET
(
duration
),
AV_OPT_TYPE_DURATION
,
{.
i64
=
0
.
},
0
,
INT64_MAX
,
T
FLAGS
},
{
"curve"
,
"set fade curve type"
,
OFFSET
(
curve
),
AV_OPT_TYPE_INT
,
{.
i64
=
TRI
},
NONE
,
NB_CURVES
-
1
,
T
FLAGS
,
"curve"
},
{
"c"
,
"set fade curve type"
,
OFFSET
(
curve
),
AV_OPT_TYPE_INT
,
{.
i64
=
TRI
},
NONE
,
NB_CURVES
-
1
,
T
FLAGS
,
"curve"
},
{
"nofade"
,
"no fade; keep audio as-is"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
NONE
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"tri"
,
"linear slope"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
TRI
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"qsin"
,
"quarter of sine wave"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
QSIN
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"esin"
,
"exponential sine wave"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
ESIN
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"hsin"
,
"half of sine wave"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
HSIN
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"log"
,
"logarithmic"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
LOG
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"ipar"
,
"inverted parabola"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
IPAR
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"qua"
,
"quadratic"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
QUA
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"cub"
,
"cubic"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
CUB
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"squ"
,
"square root"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
SQU
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"cbr"
,
"cubic root"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
CBR
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"par"
,
"parabola"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
PAR
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"exp"
,
"exponential"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
EXP
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"iqsin"
,
"inverted quarter of sine wave"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
IQSIN
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"ihsin"
,
"inverted half of sine wave"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
IHSIN
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"dese"
,
"double-exponential seat"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
DESE
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"desi"
,
"double-exponential sigmoid"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
DESI
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"losi"
,
"logistic sigmoid"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
LOSI
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"sinc"
,
"sine cardinal function"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
SINC
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
"isinc"
,
"inverted sine cardinal function"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
ISINC
},
0
,
0
,
T
FLAGS
,
"curve"
},
{
NULL
}
};
...
...
@@ -332,6 +335,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
return
ff_filter_frame
(
outlink
,
out_buf
);
}
static
int
process_command
(
AVFilterContext
*
ctx
,
const
char
*
cmd
,
const
char
*
args
,
char
*
res
,
int
res_len
,
int
flags
)
{
int
ret
;
ret
=
ff_filter_process_command
(
ctx
,
cmd
,
args
,
res
,
res_len
,
flags
);
if
(
ret
<
0
)
return
ret
;
return
config_output
(
ctx
->
outputs
[
0
]);
}
static
const
AVFilterPad
avfilter_af_afade_inputs
[]
=
{
{
.
name
=
"default"
,
...
...
@@ -359,6 +374,7 @@ AVFilter ff_af_afade = {
.
inputs
=
avfilter_af_afade_inputs
,
.
outputs
=
avfilter_af_afade_outputs
,
.
priv_class
=
&
afade_class
,
.
process_command
=
process_command
,
.
flags
=
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
,
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录