Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
853cc025
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,发现更多精彩内容 >>
提交
853cc025
编写于
5月 15, 2014
作者:
V
Vittorio Giovara
提交者:
Anton Khirnov
5月 19, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mov: store display matrix in a stream side data
Signed-off-by:
N
Anton Khirnov
<
anton@khirnov.net
>
上级
bddd8cbf
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
10 deletion
+54
-10
libavformat/isom.h
libavformat/isom.h
+2
-0
libavformat/mov.c
libavformat/mov.c
+52
-10
未找到文件。
libavformat/isom.h
浏览文件 @
853cc025
...
...
@@ -135,6 +135,8 @@ typedef struct MOVStreamContext {
int64_t
track_end
;
///< used for dts generation in fragmented movie files
unsigned
int
rap_group_count
;
MOVSbgp
*
rap_group
;
int32_t
*
display_matrix
;
}
MOVStreamContext
;
typedef
struct
MOVContext
{
...
...
libavformat/mov.c
浏览文件 @
853cc025
...
...
@@ -2344,7 +2344,7 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int
width
;
int
height
;
int64_t
disp_transform
[
2
];
int
display_matrix
[
3
][
2
];
int
display_matrix
[
3
][
3
];
AVStream
*
st
;
MOVStreamContext
*
sc
;
int
version
;
...
...
@@ -2381,11 +2381,12 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
//read in the display matrix (outlined in ISO 14496-12, Section 6.2.2)
// they're kept in fixed point format through all calculations
// ignore u,v,z b/c we don't need the scale factor to calc aspect ratio
// save u,v,z to store the whole matrix in the AV_PKT_DATA_DISPLAYMATRIX
// side data, but the scale factor is not needed to calculate aspect ratio
for
(
i
=
0
;
i
<
3
;
i
++
)
{
display_matrix
[
i
][
0
]
=
avio_rb32
(
pb
);
// 16.16 fixed point
display_matrix
[
i
][
1
]
=
avio_rb32
(
pb
);
// 16.16 fixed point
avio_rb32
(
pb
);
// 2.30 fixed point (not used)
display_matrix
[
i
][
2
]
=
avio_rb32
(
pb
);
// 2.30 fixed point
}
width
=
avio_rb32
(
pb
);
// 16.16 fixed point track width
...
...
@@ -2393,6 +2394,25 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
sc
->
width
=
width
>>
16
;
sc
->
height
=
height
>>
16
;
// save the matrix when it is not the default identity
if
(
display_matrix
[
0
][
0
]
!=
(
1
<<
16
)
||
display_matrix
[
1
][
1
]
!=
(
1
<<
16
)
||
display_matrix
[
2
][
2
]
!=
(
1
<<
30
)
||
display_matrix
[
0
][
1
]
||
display_matrix
[
0
][
2
]
||
display_matrix
[
1
][
0
]
||
display_matrix
[
1
][
2
]
||
display_matrix
[
2
][
0
]
||
display_matrix
[
2
][
1
])
{
int
i
,
j
;
av_freep
(
&
sc
->
display_matrix
);
sc
->
display_matrix
=
av_malloc
(
sizeof
(
int32_t
)
*
9
);
if
(
!
sc
->
display_matrix
)
return
AVERROR
(
ENOMEM
);
for
(
i
=
0
;
i
<
3
;
i
++
)
for
(
j
=
0
;
j
<
3
;
j
++
)
sc
->
display_matrix
[
i
*
3
+
j
]
=
display_matrix
[
j
][
i
];
}
// transform the display width/height according to the matrix
// skip this if the display matrix is the default identity matrix
// or if it is rotating the picture, ex iPhone 3GS
...
...
@@ -2975,6 +2995,7 @@ static int mov_read_close(AVFormatContext *s)
av_freep
(
&
sc
->
stts_data
);
av_freep
(
&
sc
->
stps_data
);
av_freep
(
&
sc
->
rap_group
);
av_freep
(
&
sc
->
display_matrix
);
}
if
(
mov
->
dv_demux
)
{
...
...
@@ -3049,14 +3070,35 @@ static int mov_read_header(AVFormatContext *s)
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
AVStream
*
st
=
s
->
streams
[
i
];
MOVStreamContext
*
sc
=
st
->
priv_data
;
if
(
st
->
codec
->
codec_type
!=
AVMEDIA_TYPE_AUDIO
)
continue
;
err
=
ff_replaygain_export
(
st
,
s
->
metadata
);
if
(
err
<
0
)
{
mov_read_close
(
s
);
return
err
;
switch
(
st
->
codec
->
codec_type
)
{
case
AVMEDIA_TYPE_AUDIO
:
err
=
ff_replaygain_export
(
st
,
s
->
metadata
);
if
(
err
<
0
)
{
mov_read_close
(
s
);
return
err
;
}
break
;
case
AVMEDIA_TYPE_VIDEO
:
if
(
sc
->
display_matrix
)
{
AVPacketSideData
*
sd
,
*
tmp
;
tmp
=
av_realloc_array
(
st
->
side_data
,
st
->
nb_side_data
+
1
,
sizeof
(
*
tmp
));
if
(
!
tmp
)
return
AVERROR
(
ENOMEM
);
st
->
side_data
=
tmp
;
st
->
nb_side_data
++
;
sd
=
&
st
->
side_data
[
st
->
nb_side_data
-
1
];
sd
->
type
=
AV_PKT_DATA_DISPLAYMATRIX
;
sd
->
size
=
sizeof
(
int32_t
)
*
9
;
sd
->
data
=
(
uint8_t
*
)
sc
->
display_matrix
;
sc
->
display_matrix
=
NULL
;
}
break
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录