Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
e63a17bf
Commit
e63a17bf
authored
May 20, 2014
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/mov: use av_display_rotation_get() for rotate metadata.
parent
fa972dcf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
16 deletions
+14
-16
mov.c
libavformat/mov.c
+14
-16
No files found.
libavformat/mov.c
View file @
e63a17bf
...
...
@@ -31,6 +31,7 @@
#include "libavutil/attributes.h"
#include "libavutil/channel_layout.h"
#include "libavutil/display.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat.h"
#include "libavutil/mathematics.h"
...
...
@@ -2610,22 +2611,8 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
sc
->
width
=
width
>>
16
;
sc
->
height
=
height
>>
16
;
//Assign clockwise rotate values based on transform matrix so that
//we can compensate for iPhone orientation during capture.
if
(
display_matrix
[
1
][
0
]
==
-
65536
&&
display_matrix
[
0
][
1
]
==
65536
)
{
av_dict_set
(
&
st
->
metadata
,
"rotate"
,
"90"
,
0
);
}
if
(
display_matrix
[
0
][
0
]
==
-
65536
&&
display_matrix
[
1
][
1
]
==
-
65536
)
{
av_dict_set
(
&
st
->
metadata
,
"rotate"
,
"180"
,
0
);
}
if
(
display_matrix
[
1
][
0
]
==
65536
&&
display_matrix
[
0
][
1
]
==
-
65536
)
{
av_dict_set
(
&
st
->
metadata
,
"rotate"
,
"270"
,
0
);
}
// save the matrix when it is not the default identity
// save the matrix and add rotate metadata 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
)
||
...
...
@@ -2633,6 +2620,7 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
display_matrix
[
1
][
0
]
||
display_matrix
[
1
][
2
]
||
display_matrix
[
2
][
0
]
||
display_matrix
[
2
][
1
])
{
int
i
,
j
;
double
rotate
;
av_freep
(
&
sc
->
display_matrix
);
sc
->
display_matrix
=
av_malloc
(
sizeof
(
int32_t
)
*
9
);
...
...
@@ -2642,6 +2630,16 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
for
(
i
=
0
;
i
<
3
;
i
++
)
for
(
j
=
0
;
j
<
3
;
j
++
)
sc
->
display_matrix
[
i
*
3
+
j
]
=
display_matrix
[
j
][
i
];
rotate
=
av_display_rotation_get
(
sc
->
display_matrix
);
if
(
!
isnan
(
rotate
))
{
char
rotate_buf
[
64
];
rotate
=
-
rotate
;
if
(
rotate
<
0
)
// for backward compatibility
rotate
+=
360
;
snprintf
(
rotate_buf
,
sizeof
(
rotate_buf
),
"%g"
,
rotate
);
av_dict_set
(
&
st
->
metadata
,
"rotate"
,
rotate_buf
,
0
);
}
}
// transform the display width/height according to the matrix
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment