Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
3eec23f3
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,发现更多精彩内容 >>
提交
3eec23f3
编写于
2月 16, 2012
作者:
M
Martin Storsjö
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mov: Use defines for trun flags
Signed-off-by:
N
Martin Storsjö
<
martin@martin.st
>
上级
73328f24
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
27 addition
and
19 deletion
+27
-19
libavformat/isom.h
libavformat/isom.h
+7
-0
libavformat/mov.c
libavformat/mov.c
+8
-7
libavformat/movenc.c
libavformat/movenc.c
+12
-12
未找到文件。
libavformat/isom.h
浏览文件 @
3eec23f3
...
...
@@ -164,6 +164,13 @@ void ff_mp4_parse_es_descr(AVIOContext *pb, int *es_id);
#define MOV_TFHD_DEFAULT_FLAGS 0x20
#define MOV_TFHD_DURATION_IS_EMPTY 0x010000
#define MOV_TRUN_DATA_OFFSET 0x01
#define MOV_TRUN_FIRST_SAMPLE_FLAGS 0x04
#define MOV_TRUN_SAMPLE_DURATION 0x100
#define MOV_TRUN_SAMPLE_SIZE 0x200
#define MOV_TRUN_SAMPLE_FLAGS 0x400
#define MOV_TRUN_SAMPLE_CTS 0x800
int
ff_mov_read_esds
(
AVFormatContext
*
fc
,
AVIOContext
*
pb
,
MOVAtom
atom
);
enum
CodecID
ff_mov_get_lpcm_codec_id
(
int
bps
,
int
flags
);
...
...
libavformat/mov.c
浏览文件 @
3eec23f3
...
...
@@ -2262,8 +2262,8 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return
AVERROR
(
ENOMEM
);
sc
->
ctts_data
=
ctts_data
;
if
(
flags
&
0x001
)
data_offset
=
avio_rb32
(
pb
);
if
(
flags
&
0x004
)
first_sample_flags
=
avio_rb32
(
pb
);
if
(
flags
&
MOV_TRUN_DATA_OFFSET
)
data_offset
=
avio_rb32
(
pb
);
if
(
flags
&
MOV_TRUN_FIRST_SAMPLE_FLAGS
)
first_sample_flags
=
avio_rb32
(
pb
);
dts
=
sc
->
track_end
-
sc
->
time_offset
;
offset
=
frag
->
base_data_offset
+
data_offset
;
distance
=
0
;
...
...
@@ -2274,14 +2274,15 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
unsigned
sample_duration
=
frag
->
duration
;
int
keyframe
;
if
(
flags
&
0x100
)
sample_duration
=
avio_rb32
(
pb
);
if
(
flags
&
0x200
)
sample_size
=
avio_rb32
(
pb
);
if
(
flags
&
0x400
)
sample_flags
=
avio_rb32
(
pb
);
if
(
flags
&
MOV_TRUN_SAMPLE_DURATION
)
sample_duration
=
avio_rb32
(
pb
);
if
(
flags
&
MOV_TRUN_SAMPLE_SIZE
)
sample_size
=
avio_rb32
(
pb
);
if
(
flags
&
MOV_TRUN_SAMPLE_FLAGS
)
sample_flags
=
avio_rb32
(
pb
);
sc
->
ctts_data
[
sc
->
ctts_count
].
count
=
1
;
sc
->
ctts_data
[
sc
->
ctts_count
].
duration
=
(
flags
&
0x800
)
?
avio_rb32
(
pb
)
:
0
;
sc
->
ctts_data
[
sc
->
ctts_count
].
duration
=
(
flags
&
MOV_TRUN_SAMPLE_CTS
)
?
avio_rb32
(
pb
)
:
0
;
sc
->
ctts_count
++
;
if
((
keyframe
=
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_AUDIO
||
(
flags
&
0x004
&&
!
i
&&
!
(
sample_flags
&
0xffff0000
))
||
sample_flags
&
0x2000000
))
(
flags
&
MOV_TRUN_FIRST_SAMPLE_FLAGS
&&
!
i
&&
!
(
sample_flags
&
0xffff0000
))
||
sample_flags
&
0x2000000
))
distance
=
0
;
av_add_index_entry
(
st
,
offset
,
dts
,
sample_size
,
distance
,
keyframe
?
AVINDEX_KEYFRAME
:
0
);
...
...
libavformat/movenc.c
浏览文件 @
3eec23f3
...
...
@@ -2229,7 +2229,7 @@ static uint32_t get_sample_flags(MOVTrack *track, MOVIentry *entry)
static
int
mov_write_trun_tag
(
AVIOContext
*
pb
,
MOVTrack
*
track
)
{
int64_t
pos
=
avio_tell
(
pb
);
uint32_t
flags
=
1
;
/* data-offset-present */
uint32_t
flags
=
MOV_TRUN_DATA_OFFSET
;
int
i
;
for
(
i
=
0
;
i
<
track
->
entry
;
i
++
)
{
...
...
@@ -2237,16 +2237,16 @@ static int mov_write_trun_tag(AVIOContext *pb, MOVTrack *track)
track
->
track_duration
-
track
->
cluster
[
i
].
dts
+
track
->
start_dts
:
track
->
cluster
[
i
+
1
].
dts
-
track
->
cluster
[
i
].
dts
;
if
(
duration
!=
track
->
default_duration
)
flags
|=
0x100
;
/* sample-duration-present */
flags
|=
MOV_TRUN_SAMPLE_DURATION
;
if
(
track
->
cluster
[
i
].
size
!=
track
->
default_size
)
flags
|=
0x200
;
/* sample-size-present */
flags
|=
MOV_TRUN_SAMPLE_SIZE
;
if
(
i
>
0
&&
get_sample_flags
(
track
,
&
track
->
cluster
[
i
])
!=
track
->
default_sample_flags
)
flags
|=
0x400
;
/* sample-flags-present */
flags
|=
MOV_TRUN_SAMPLE_FLAGS
;
}
if
(
!
(
flags
&
0x400
))
flags
|=
0x4
;
/* first-sample-flags-present */
if
(
!
(
flags
&
MOV_TRUN_SAMPLE_FLAGS
))
flags
|=
MOV_TRUN_FIRST_SAMPLE_FLAGS
;
if
(
track
->
flags
&
MOV_TRACK_CTTS
)
flags
|=
0x800
;
/* sample-composition-time-offsets-present */
flags
|=
MOV_TRUN_SAMPLE_CTS
;
avio_wb32
(
pb
,
0
);
/* size placeholder */
ffio_wfourcc
(
pb
,
"trun"
);
...
...
@@ -2256,20 +2256,20 @@ static int mov_write_trun_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32
(
pb
,
track
->
entry
);
/* sample count */
track
->
moof_size_offset
=
avio_tell
(
pb
);
avio_wb32
(
pb
,
0
);
/* data offset */
if
(
flags
&
0x4
)
/* first sample flags */
if
(
flags
&
MOV_TRUN_FIRST_SAMPLE_FLAGS
)
avio_wb32
(
pb
,
get_sample_flags
(
track
,
&
track
->
cluster
[
0
]));
for
(
i
=
0
;
i
<
track
->
entry
;
i
++
)
{
int64_t
duration
=
i
+
1
==
track
->
entry
?
track
->
track_duration
-
track
->
cluster
[
i
].
dts
+
track
->
start_dts
:
track
->
cluster
[
i
+
1
].
dts
-
track
->
cluster
[
i
].
dts
;
if
(
flags
&
0x100
)
if
(
flags
&
MOV_TRUN_SAMPLE_DURATION
)
avio_wb32
(
pb
,
duration
);
if
(
flags
&
0x200
)
if
(
flags
&
MOV_TRUN_SAMPLE_SIZE
)
avio_wb32
(
pb
,
track
->
cluster
[
i
].
size
);
if
(
flags
&
0x400
)
if
(
flags
&
MOV_TRUN_SAMPLE_FLAGS
)
avio_wb32
(
pb
,
get_sample_flags
(
track
,
&
track
->
cluster
[
i
]));
if
(
flags
&
0x800
)
if
(
flags
&
MOV_TRUN_SAMPLE_CTS
)
avio_wb32
(
pb
,
track
->
cluster
[
i
].
cts
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录