Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
fabb990e
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,发现更多精彩内容 >>
提交
fabb990e
编写于
6月 22, 2008
作者:
B
Baptiste Coudurier
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cosmetics, pts->dts
Originally committed as revision 13881 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
148c8d80
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
20 addition
and
20 deletion
+20
-20
libavformat/ffm.h
libavformat/ffm.h
+1
-1
libavformat/ffmdec.c
libavformat/ffmdec.c
+15
-15
libavformat/ffmenc.c
libavformat/ffmenc.c
+4
-4
未找到文件。
libavformat/ffm.h
浏览文件 @
fabb990e
...
...
@@ -48,7 +48,7 @@ typedef struct FFMContext {
int
first_packet
;
/* true if first packet, needed to set the discontinuity tag */
int
packet_size
;
int
frame_offset
;
int64_t
p
ts
;
int64_t
d
ts
;
uint8_t
*
packet_ptr
,
*
packet_end
;
uint8_t
packet
[
FFM_PACKET_SIZE
];
}
FFMContext
;
...
...
libavformat/ffmdec.c
浏览文件 @
fabb990e
...
...
@@ -99,7 +99,7 @@ static int ffm_read_data(AVFormatContext *s,
retry_read:
get_be16
(
pb
);
/* PACKET_ID */
fill_size
=
get_be16
(
pb
);
ffm
->
p
ts
=
get_be64
(
pb
);
ffm
->
d
ts
=
get_be64
(
pb
);
frame_offset
=
get_be16
(
pb
);
get_buffer
(
pb
,
ffm
->
packet
,
ffm
->
packet_size
-
FFM_HEADER_SIZE
);
ffm
->
packet_end
=
ffm
->
packet
+
(
ffm
->
packet_size
-
FFM_HEADER_SIZE
-
fill_size
);
...
...
@@ -156,18 +156,18 @@ static void ffm_seek1(AVFormatContext *s, offset_t pos1)
url_fseek
(
pb
,
pos
,
SEEK_SET
);
}
static
int64_t
get_
p
ts
(
AVFormatContext
*
s
,
offset_t
pos
)
static
int64_t
get_
d
ts
(
AVFormatContext
*
s
,
offset_t
pos
)
{
ByteIOContext
*
pb
=
s
->
pb
;
int64_t
p
ts
;
int64_t
d
ts
;
ffm_seek1
(
s
,
pos
);
url_fskip
(
pb
,
4
);
p
ts
=
get_be64
(
pb
);
d
ts
=
get_be64
(
pb
);
#ifdef DEBUG_SEEK
av_log
(
s
,
AV_LOG_DEBUG
,
"pts=%0.6f
\n
"
,
pts
/
1000000
.
0
);
#endif
return
p
ts
;
return
d
ts
;
}
static
void
adjust_write_index
(
AVFormatContext
*
s
)
...
...
@@ -184,18 +184,18 @@ static void adjust_write_index(AVFormatContext *s)
pos_min
=
0
;
pos_max
=
ffm
->
file_size
-
2
*
FFM_PACKET_SIZE
;
pts_start
=
get_
p
ts
(
s
,
pos_min
);
pts_start
=
get_
d
ts
(
s
,
pos_min
);
pts
=
get_
p
ts
(
s
,
pos_max
);
pts
=
get_
d
ts
(
s
,
pos_max
);
if
(
pts
-
100000
>
pts_start
)
goto
end
;
ffm
->
write_index
=
FFM_PACKET_SIZE
;
pts_start
=
get_
p
ts
(
s
,
pos_min
);
pts_start
=
get_
d
ts
(
s
,
pos_min
);
pts
=
get_
p
ts
(
s
,
pos_max
);
pts
=
get_
d
ts
(
s
,
pos_max
);
if
(
pts
-
100000
<=
pts_start
)
{
while
(
1
)
{
...
...
@@ -207,7 +207,7 @@ static void adjust_write_index(AVFormatContext *s)
if
(
newpos
==
pos_min
)
break
;
newpts
=
get_
p
ts
(
s
,
newpos
);
newpts
=
get_
d
ts
(
s
,
newpos
);
if
(
newpts
-
100000
<=
pts
)
{
pos_max
=
newpos
;
...
...
@@ -220,7 +220,7 @@ static void adjust_write_index(AVFormatContext *s)
}
//printf("Adjusted write index from %"PRId64" to %"PRId64": pts=%0.6f\n", orig_write_index, ffm->write_index, pts / 1000000.);
//printf("pts range %0.6f - %0.6f\n", get_
pts(s, 0) / 1000000. , get_p
ts(s, ffm->file_size - 2 * FFM_PACKET_SIZE) / 1000000. );
//printf("pts range %0.6f - %0.6f\n", get_
dts(s, 0) / 1000000. , get_d
ts(s, ffm->file_size - 2 * FFM_PACKET_SIZE) / 1000000. );
end:
url_fseek
(
pb
,
ptr
,
SEEK_SET
);
...
...
@@ -337,7 +337,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
ffm
->
packet_ptr
=
ffm
->
packet
;
ffm
->
packet_end
=
ffm
->
packet
;
ffm
->
frame_offset
=
0
;
ffm
->
p
ts
=
0
;
ffm
->
d
ts
=
0
;
ffm
->
read_state
=
READ_HEADER
;
ffm
->
first_packet
=
1
;
return
0
;
...
...
@@ -431,8 +431,8 @@ static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, in
pos_min
=
0
;
pos_max
=
ffm
->
file_size
-
2
*
FFM_PACKET_SIZE
;
while
(
pos_min
<=
pos_max
)
{
pts_min
=
get_
p
ts
(
s
,
pos_min
);
pts_max
=
get_
p
ts
(
s
,
pos_max
);
pts_min
=
get_
d
ts
(
s
,
pos_min
);
pts_max
=
get_
d
ts
(
s
,
pos_max
);
/* linear interpolation */
pos1
=
(
double
)(
pos_max
-
pos_min
)
*
(
double
)(
wanted_pts
-
pts_min
)
/
(
double
)(
pts_max
-
pts_min
);
...
...
@@ -441,7 +441,7 @@ static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, in
pos
=
pos_min
;
else
if
(
pos
>=
pos_max
)
pos
=
pos_max
;
pts
=
get_
p
ts
(
s
,
pos
);
pts
=
get_
d
ts
(
s
,
pos
);
/* check if we are lucky */
if
(
pts
==
wanted_pts
)
{
goto
found
;
...
...
libavformat/ffmenc.c
浏览文件 @
fabb990e
...
...
@@ -37,7 +37,7 @@ static void flush_packet(AVFormatContext *s)
/* put header */
put_be16
(
pb
,
PACKET_ID
);
put_be16
(
pb
,
fill_size
);
put_be64
(
pb
,
ffm
->
p
ts
);
put_be64
(
pb
,
ffm
->
d
ts
);
h
=
ffm
->
frame_offset
;
if
(
ffm
->
first_packet
)
h
|=
0x8000
;
...
...
@@ -54,14 +54,14 @@ static void flush_packet(AVFormatContext *s)
/* 'first' is true if first data of a frame */
static
void
ffm_write_data
(
AVFormatContext
*
s
,
const
uint8_t
*
buf
,
int
size
,
int64_t
p
ts
,
int
header
)
int64_t
d
ts
,
int
header
)
{
FFMContext
*
ffm
=
s
->
priv_data
;
int
len
;
if
(
header
&&
ffm
->
frame_offset
==
0
)
{
ffm
->
frame_offset
=
ffm
->
packet_ptr
-
ffm
->
packet
+
FFM_HEADER_SIZE
;
ffm
->
pts
=
p
ts
;
ffm
->
dts
=
d
ts
;
}
/* write as many packets as needed */
...
...
@@ -180,7 +180,7 @@ static int ffm_write_header(AVFormatContext *s)
ffm
->
packet_end
=
ffm
->
packet
+
ffm
->
packet_size
-
FFM_HEADER_SIZE
;
assert
(
ffm
->
packet_end
>=
ffm
->
packet
);
ffm
->
frame_offset
=
0
;
ffm
->
p
ts
=
0
;
ffm
->
d
ts
=
0
;
ffm
->
first_packet
=
1
;
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录