Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
012f04a2
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,发现更多精彩内容 >>
提交
012f04a2
编写于
5月 04, 2012
作者:
A
Anton Khirnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lavfi: autoinsert resample filter when necessary.
上级
d371e7b9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
42 addition
and
16 deletion
+42
-16
libavfilter/avfiltergraph.c
libavfilter/avfiltergraph.c
+42
-16
未找到文件。
libavfilter/avfiltergraph.c
浏览文件 @
012f04a2
...
...
@@ -152,8 +152,7 @@ AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name)
static
int
query_formats
(
AVFilterGraph
*
graph
,
AVClass
*
log_ctx
)
{
int
i
,
j
,
ret
;
int
scaler_count
=
0
;
char
inst_name
[
30
];
int
scaler_count
=
0
,
resampler_count
=
0
;
/* ask all the sub-filters for their supported media formats */
for
(
i
=
0
;
i
<
graph
->
filter_count
;
i
++
)
{
...
...
@@ -172,23 +171,50 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
if
(
link
&&
link
->
in_formats
!=
link
->
out_formats
)
{
if
(
!
avfilter_merge_formats
(
link
->
in_formats
,
link
->
out_formats
))
{
AVFilterContext
*
scale
;
AVFilterContext
*
convert
;
AVFilter
*
filter
;
AVFilterLink
*
inlink
,
*
outlink
;
char
scale_args
[
256
];
/* couldn't merge format lists. auto-insert scale filter */
snprintf
(
inst_name
,
sizeof
(
inst_name
),
"auto-inserted scaler %d"
,
scaler_count
++
);
snprintf
(
scale_args
,
sizeof
(
scale_args
),
"0:0:%s"
,
graph
->
scale_sws_opts
);
if
((
ret
=
avfilter_graph_create_filter
(
&
scale
,
avfilter_get_by_name
(
"scale"
),
inst_name
,
scale_args
,
NULL
,
graph
))
<
0
)
return
ret
;
if
((
ret
=
avfilter_insert_filter
(
link
,
scale
,
0
,
0
))
<
0
)
char
inst_name
[
30
];
/* couldn't merge format lists. auto-insert conversion filter */
switch
(
link
->
type
)
{
case
AVMEDIA_TYPE_VIDEO
:
snprintf
(
inst_name
,
sizeof
(
inst_name
),
"auto-inserted scaler %d"
,
scaler_count
++
);
snprintf
(
scale_args
,
sizeof
(
scale_args
),
"0:0:%s"
,
graph
->
scale_sws_opts
);
if
((
ret
=
avfilter_graph_create_filter
(
&
convert
,
avfilter_get_by_name
(
"scale"
),
inst_name
,
scale_args
,
NULL
,
graph
))
<
0
)
return
ret
;
break
;
case
AVMEDIA_TYPE_AUDIO
:
if
(
!
(
filter
=
avfilter_get_by_name
(
"resample"
)))
{
av_log
(
log_ctx
,
AV_LOG_ERROR
,
"'resample' filter "
"not present, cannot convert audio formats.
\n
"
);
return
AVERROR
(
EINVAL
);
}
snprintf
(
inst_name
,
sizeof
(
inst_name
),
"auto-inserted resampler %d"
,
resampler_count
++
);
if
((
ret
=
avfilter_graph_create_filter
(
&
convert
,
avfilter_get_by_name
(
"resample"
),
inst_name
,
NULL
,
NULL
,
graph
))
<
0
)
return
ret
;
break
;
default:
return
AVERROR
(
EINVAL
);
}
if
((
ret
=
avfilter_insert_filter
(
link
,
convert
,
0
,
0
))
<
0
)
return
ret
;
scale
->
filter
->
query_formats
(
scale
);
i
f
(((
link
=
scale
->
inputs
[
0
])
&&
!
avfilter_merge_formats
(
link
->
in_formats
,
link
->
out_formats
))
||
((
link
=
scale
->
outputs
[
0
])
&&
!
avfilter_merge_formats
(
link
->
in_formats
,
link
->
out_formats
)
))
{
convert
->
filter
->
query_formats
(
convert
);
i
nlink
=
convert
->
inputs
[
0
];
outlink
=
convert
->
outputs
[
0
];
if
(
!
avfilter_merge_formats
(
inlink
->
in_formats
,
inlink
->
out_formats
)
||
!
avfilter_merge_formats
(
outlink
->
in_formats
,
outlink
->
out_formats
))
{
av_log
(
log_ctx
,
AV_LOG_ERROR
,
"Impossible to convert between the formats supported by the filter "
"'%s' and the filter '%s'
\n
"
,
link
->
src
->
name
,
link
->
dst
->
name
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录