Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
7ca2ee05
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 搜索 >>
提交
7ca2ee05
编写于
9月 30, 2018
作者:
M
Marton Balint
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avfilter/f_cue: use inlink fifo for queueing frames
Signed-off-by:
N
Marton Balint
<
cus@passwd.hu
>
上级
8f14170b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
58 deletion
+29
-58
libavfilter/f_cue.c
libavfilter/f_cue.c
+29
-58
未找到文件。
libavfilter/f_cue.c
浏览文件 @
7ca2ee05
...
@@ -22,7 +22,6 @@
...
@@ -22,7 +22,6 @@
#include "libavutil/time.h"
#include "libavutil/time.h"
#include "avfilter.h"
#include "avfilter.h"
#include "filters.h"
#include "filters.h"
#include "framequeue.h"
#include "internal.h"
#include "internal.h"
typedef
struct
CueContext
{
typedef
struct
CueContext
{
...
@@ -32,73 +31,49 @@ typedef struct CueContext {
...
@@ -32,73 +31,49 @@ typedef struct CueContext {
int64_t
preroll
;
int64_t
preroll
;
int64_t
buffer
;
int64_t
buffer
;
int
status
;
int
status
;
FFFrameQueue
queue
;
}
CueContext
;
}
CueContext
;
static
av_cold
int
init
(
AVFilterContext
*
ctx
)
{
CueContext
*
s
=
ctx
->
priv
;
ff_framequeue_init
(
&
s
->
queue
,
&
ctx
->
graph
->
internal
->
frame_queues
);
return
0
;
}
static
av_cold
void
uninit
(
AVFilterContext
*
ctx
)
{
CueContext
*
s
=
ctx
->
priv
;
ff_framequeue_free
(
&
s
->
queue
);
}
static
int
activate
(
AVFilterContext
*
ctx
)
static
int
activate
(
AVFilterContext
*
ctx
)
{
{
AVFilterLink
*
inlink
=
ctx
->
inputs
[
0
];
AVFilterLink
*
inlink
=
ctx
->
inputs
[
0
];
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
CueContext
*
s
=
ctx
->
priv
;
CueContext
*
s
=
ctx
->
priv
;
int64_t
pts
;
AVFrame
*
frame
=
NULL
;
FF_FILTER_FORWARD_STATUS_BACK
(
outlink
,
inlink
);
FF_FILTER_FORWARD_STATUS_BACK
(
outlink
,
inlink
);
if
(
s
->
status
<
3
||
s
->
status
==
5
)
{
if
(
ff_inlink_queued_frames
(
inlink
))
{
int
ret
=
ff_inlink_consume_frame
(
inlink
,
&
frame
);
AVFrame
*
frame
=
ff_inlink_peek_frame
(
inlink
,
0
);
if
(
ret
<
0
)
int64_t
pts
=
av_rescale_q
(
frame
->
pts
,
inlink
->
time_base
,
AV_TIME_BASE_Q
);
return
ret
;
if
(
frame
)
pts
=
av_rescale_q
(
frame
->
pts
,
inlink
->
time_base
,
AV_TIME_BASE_Q
);
}
if
(
!
s
->
status
&&
frame
)
{
if
(
!
s
->
status
)
{
s
->
first_pts
=
pts
;
s
->
first_pts
=
pts
;
s
->
status
++
;
s
->
status
++
;
}
if
(
s
->
status
==
1
&&
frame
)
{
if
(
pts
-
s
->
first_pts
<
s
->
preroll
)
return
ff_filter_frame
(
outlink
,
frame
);
s
->
first_pts
=
pts
;
s
->
status
++
;
}
if
(
s
->
status
==
2
&&
frame
)
{
int
ret
=
ff_framequeue_add
(
&
s
->
queue
,
frame
);
if
(
ret
<
0
)
{
av_frame_free
(
&
frame
);
return
ret
;
}
}
frame
=
NULL
;
if
(
s
->
status
==
1
)
{
if
(
!
(
pts
-
s
->
first_pts
<
s
->
buffer
&&
(
av_gettime
()
-
s
->
cue
)
<
0
))
if
(
pts
-
s
->
first_pts
<
s
->
preroll
)
{
ff_inlink_consume_frame
(
inlink
,
&
frame
);
return
ff_filter_frame
(
outlink
,
frame
);
}
s
->
first_pts
=
pts
;
s
->
status
++
;
s
->
status
++
;
}
if
(
s
->
status
==
2
)
{
frame
=
ff_inlink_peek_frame
(
inlink
,
ff_inlink_queued_frames
(
inlink
)
-
1
);
pts
=
av_rescale_q
(
frame
->
pts
,
inlink
->
time_base
,
AV_TIME_BASE_Q
);
if
(
!
(
pts
-
s
->
first_pts
<
s
->
buffer
&&
(
av_gettime
()
-
s
->
cue
)
<
0
))
s
->
status
++
;
}
if
(
s
->
status
==
3
)
{
int64_t
diff
;
while
((
diff
=
(
av_gettime
()
-
s
->
cue
))
<
0
)
av_usleep
(
av_clip
(
-
diff
/
2
,
100
,
1000000
));
s
->
status
++
;
}
if
(
s
->
status
==
4
)
{
ff_inlink_consume_frame
(
inlink
,
&
frame
);
return
ff_filter_frame
(
outlink
,
frame
);
}
}
}
if
(
s
->
status
==
3
)
{
int64_t
diff
;
while
((
diff
=
(
av_gettime
()
-
s
->
cue
))
<
0
)
av_usleep
(
av_clip
(
-
diff
/
2
,
100
,
1000000
));
s
->
status
++
;
}
if
(
s
->
status
==
4
)
{
if
(
ff_framequeue_queued_frames
(
&
s
->
queue
))
return
ff_filter_frame
(
outlink
,
ff_framequeue_take
(
&
s
->
queue
));
s
->
status
++
;
}
if
(
s
->
status
==
5
&&
frame
)
return
ff_filter_frame
(
outlink
,
frame
);
FF_FILTER_FORWARD_STATUS
(
inlink
,
outlink
);
FF_FILTER_FORWARD_STATUS
(
inlink
,
outlink
);
FF_FILTER_FORWARD_WANTED
(
outlink
,
inlink
);
FF_FILTER_FORWARD_WANTED
(
outlink
,
inlink
);
...
@@ -140,8 +115,6 @@ AVFilter ff_vf_cue = {
...
@@ -140,8 +115,6 @@ AVFilter ff_vf_cue = {
.
description
=
NULL_IF_CONFIG_SMALL
(
"Delay filtering to match a cue."
),
.
description
=
NULL_IF_CONFIG_SMALL
(
"Delay filtering to match a cue."
),
.
priv_size
=
sizeof
(
CueContext
),
.
priv_size
=
sizeof
(
CueContext
),
.
priv_class
=
&
cue_class
,
.
priv_class
=
&
cue_class
,
.
init
=
init
,
.
uninit
=
uninit
,
.
inputs
=
cue_inputs
,
.
inputs
=
cue_inputs
,
.
outputs
=
cue_outputs
,
.
outputs
=
cue_outputs
,
.
activate
=
activate
,
.
activate
=
activate
,
...
@@ -173,8 +146,6 @@ AVFilter ff_af_acue = {
...
@@ -173,8 +146,6 @@ AVFilter ff_af_acue = {
.
description
=
NULL_IF_CONFIG_SMALL
(
"Delay filtering to match a cue."
),
.
description
=
NULL_IF_CONFIG_SMALL
(
"Delay filtering to match a cue."
),
.
priv_size
=
sizeof
(
CueContext
),
.
priv_size
=
sizeof
(
CueContext
),
.
priv_class
=
&
acue_class
,
.
priv_class
=
&
acue_class
,
.
init
=
init
,
.
uninit
=
uninit
,
.
inputs
=
acue_inputs
,
.
inputs
=
acue_inputs
,
.
outputs
=
acue_outputs
,
.
outputs
=
acue_outputs
,
.
activate
=
activate
,
.
activate
=
activate
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录