Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
608be2ac
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,发现更多精彩内容 >>
提交
608be2ac
编写于
8月 26, 2009
作者:
I
Ivan Schreter
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cosmetic changes in read_seek* routines.
Originally committed as revision 19723 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
5dd3707b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
19 deletion
+26
-19
libavformat/mpegts.c
libavformat/mpegts.c
+26
-19
未找到文件。
libavformat/mpegts.c
浏览文件 @
608be2ac
...
...
@@ -1524,9 +1524,12 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
return
timestamp
;
}
static
int
read_seek
(
AVFormatContext
*
s
,
int
stream_index
,
int64_t
target_ts
,
int
flags
);
static
int
read_seek2
(
AVFormatContext
*
s
,
int
stream_index
,
int64_t
min_ts
,
int64_t
target_ts
,
int64_t
max_ts
,
int
flags
)
static
int
read_seek2
(
AVFormatContext
*
s
,
int
stream_index
,
int64_t
min_ts
,
int64_t
target_ts
,
int64_t
max_ts
,
int
flags
)
{
int64_t
pos
;
...
...
@@ -1538,14 +1541,15 @@ static int read_seek2(AVFormatContext *s, int stream_index, int64_t min_ts, int6
backup
=
ff_store_parser_state
(
s
);
// detect direction of seeking for search purposes
flags
|=
(
target_ts
-
min_ts
>
(
uint64_t
)(
max_ts
-
target_ts
))
?
AVSEEK_FLAG_BACKWARD
:
0
;
flags
|=
(
target_ts
-
min_ts
>
(
uint64_t
)(
max_ts
-
target_ts
))
?
AVSEEK_FLAG_BACKWARD
:
0
;
if
(
flags
&
AVSEEK_FLAG_BYTE
)
{
/
* use position directly, we will search starting from it */
/
/ use position directly, we will search starting from it
pos
=
target_ts
;
}
else
{
/
* search for some position with good timestamp match */
if
(
stream_index
<
0
)
{
/
/ search for some position with good timestamp match
if
(
stream_index
<
0
)
{
stream_index_gen_search
=
av_find_default_stream_index
(
s
);
if
(
stream_index_gen_search
<
0
)
{
ff_restore_parser_state
(
s
,
backup
);
...
...
@@ -1553,8 +1557,10 @@ static int read_seek2(AVFormatContext *s, int stream_index, int64_t min_ts, int6
}
st
=
s
->
streams
[
stream_index_gen_search
];
/* timestamp for default must be expressed in AV_TIME_BASE units */
ts_adj
=
av_rescale
(
target_ts
,
st
->
time_base
.
den
,
AV_TIME_BASE
*
(
int64_t
)
st
->
time_base
.
num
);
// timestamp for default must be expressed in AV_TIME_BASE units
ts_adj
=
av_rescale
(
target_ts
,
st
->
time_base
.
den
,
AV_TIME_BASE
*
(
int64_t
)
st
->
time_base
.
num
);
}
else
{
ts_adj
=
target_ts
;
stream_index_gen_search
=
stream_index
;
...
...
@@ -1570,8 +1576,10 @@ static int read_seek2(AVFormatContext *s, int stream_index, int64_t min_ts, int6
}
}
/* search for actual matching keyframe/starting position for all streams */
if
(
ff_gen_syncpoint_search
(
s
,
stream_index
,
pos
,
min_ts
,
target_ts
,
max_ts
,
flags
)
<
0
)
{
// search for actual matching keyframe/starting position for all streams
if
(
ff_gen_syncpoint_search
(
s
,
stream_index
,
pos
,
min_ts
,
target_ts
,
max_ts
,
flags
)
<
0
)
{
ff_restore_parser_state
(
s
,
backup
);
return
-
1
;
}
...
...
@@ -1584,17 +1592,16 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, in
{
int
ret
;
if
(
flags
&
AVSEEK_FLAG_BACKWARD
)
{
ret
=
read_seek2
(
s
,
stream_index
,
INT64_MIN
,
target_ts
,
target_ts
,
flags
&
~
AVSEEK_FLAG_BACKWARD
)
;
if
(
ret
<
0
)
{
// for compatibility reasons, seek to best-fitting timestamp
ret
=
read_seek2
(
s
,
stream_index
,
INT64_MIN
,
target_ts
,
INT64_MAX
,
flags
&
~
AVSEEK_FLAG_BACKWARD
);
}
flags
&=
~
AVSEEK_FLAG_BACKWARD
;
ret
=
read_seek2
(
s
,
stream_index
,
INT64_MIN
,
target_ts
,
target_ts
,
flags
);
if
(
ret
<
0
)
// for compatibility reasons, seek to the best-fitting timestamp
ret
=
read_seek2
(
s
,
stream_index
,
INT64_MIN
,
target_ts
,
INT64_MAX
,
flags
);
}
else
{
ret
=
read_seek2
(
s
,
stream_index
,
target_ts
,
target_ts
,
INT64_MAX
,
flags
);
if
(
ret
<
0
)
{
// for compatibility reasons, seek to best-fitting timestamp
if
(
ret
<
0
)
// for compatibility reasons, seek to
the
best-fitting timestamp
ret
=
read_seek2
(
s
,
stream_index
,
INT64_MIN
,
target_ts
,
INT64_MAX
,
flags
);
}
}
return
ret
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录