Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
cff29563
Commit
cff29563
authored
Apr 01, 2014
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mp4 mux: encode video orientation
parent
3f4eb3aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
modules/mux/mp4.c
modules/mux/mp4.c
+24
-2
No files found.
modules/mux/mp4.c
View file @
cff29563
...
@@ -1451,8 +1451,26 @@ static bo_t *GetStblBox(sout_mux_t *p_mux, mp4_stream_t *p_stream)
...
@@ -1451,8 +1451,26 @@ static bo_t *GetStblBox(sout_mux_t *p_mux, mp4_stream_t *p_stream)
static
int64_t
get_timestamp
(
void
);
static
int64_t
get_timestamp
(
void
);
static
const
uint32_t
mvhd_matrix
[
9
]
=
static
void
matrix_apply_rotation
(
es_format_t
*
fmt
,
uint32_t
mvhd_matrix
[
9
])
{
0x10000
,
0
,
0
,
0
,
0x10000
,
0
,
0
,
0
,
0x40000000
};
{
enum
video_orientation_t
orientation
=
ORIENT_NORMAL
;
if
(
fmt
->
i_cat
==
VIDEO_ES
)
orientation
=
fmt
->
video
.
orientation
;
#define ATAN(a, b) do { mvhd_matrix[1] = (a) << 16; \
mvhd_matrix[0] = (b) << 16; \
} while(0)
switch
(
orientation
)
{
case
ORIENT_ROTATED_90
:
ATAN
(
1
,
0
);
break
;
case
ORIENT_ROTATED_180
:
ATAN
(
0
,
-
1
);
break
;
case
ORIENT_ROTATED_270
:
ATAN
(
-
1
,
0
);
break
;
default:
ATAN
(
0
,
1
);
break
;
}
mvhd_matrix
[
3
]
=
mvhd_matrix
[
0
]
?
0
:
0x10000
;
mvhd_matrix
[
4
]
=
mvhd_matrix
[
1
]
?
0
:
0x10000
;
}
static
bo_t
*
GetMoovBox
(
sout_mux_t
*
p_mux
)
static
bo_t
*
GetMoovBox
(
sout_mux_t
*
p_mux
)
{
{
...
@@ -1494,6 +1512,9 @@ static bo_t *GetMoovBox(sout_mux_t *p_mux)
...
@@ -1494,6 +1512,9 @@ static bo_t *GetMoovBox(sout_mux_t *p_mux)
bo_add_16be
(
mvhd
,
0
);
// reserved
bo_add_16be
(
mvhd
,
0
);
// reserved
for
(
int
i
=
0
;
i
<
2
;
i
++
)
for
(
int
i
=
0
;
i
<
2
;
i
++
)
bo_add_32be
(
mvhd
,
0
);
// reserved
bo_add_32be
(
mvhd
,
0
);
// reserved
uint32_t
mvhd_matrix
[
9
]
=
{
0x10000
,
0
,
0
,
0
,
0x10000
,
0
,
0
,
0
,
0x40000000
};
for
(
int
i
=
0
;
i
<
9
;
i
++
)
for
(
int
i
=
0
;
i
<
9
;
i
++
)
bo_add_32be
(
mvhd
,
mvhd_matrix
[
i
]);
// matrix
bo_add_32be
(
mvhd
,
mvhd_matrix
[
i
]);
// matrix
for
(
int
i
=
0
;
i
<
6
;
i
++
)
for
(
int
i
=
0
;
i
<
6
;
i
++
)
...
@@ -1551,6 +1572,7 @@ static bo_t *GetMoovBox(sout_mux_t *p_mux)
...
@@ -1551,6 +1572,7 @@ static bo_t *GetMoovBox(sout_mux_t *p_mux)
// volume
// volume
bo_add_16be
(
tkhd
,
p_stream
->
fmt
.
i_cat
==
AUDIO_ES
?
0x100
:
0
);
bo_add_16be
(
tkhd
,
p_stream
->
fmt
.
i_cat
==
AUDIO_ES
?
0x100
:
0
);
bo_add_16be
(
tkhd
,
0
);
// reserved
bo_add_16be
(
tkhd
,
0
);
// reserved
matrix_apply_rotation
(
&
p_stream
->
fmt
,
mvhd_matrix
);
for
(
int
i
=
0
;
i
<
9
;
i
++
)
for
(
int
i
=
0
;
i
<
9
;
i
++
)
bo_add_32be
(
tkhd
,
mvhd_matrix
[
i
]);
// matrix
bo_add_32be
(
tkhd
,
mvhd_matrix
[
i
]);
// matrix
if
(
p_stream
->
fmt
.
i_cat
==
AUDIO_ES
)
{
if
(
p_stream
->
fmt
.
i_cat
==
AUDIO_ES
)
{
...
...
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