Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
2fc9f597
Commit
2fc9f597
authored
Jun 02, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mux: mp4: add composition time (fix #711)
parent
dbbb8dd1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
4 deletions
+33
-4
modules/mux/mp4.c
modules/mux/mp4.c
+33
-4
No files found.
modules/mux/mp4.c
View file @
2fc9f597
...
...
@@ -110,6 +110,7 @@ typedef struct
/* stats */
int64_t
i_dts_start
;
int64_t
i_duration
;
bool
b_hasbframes
;
/* for later stco fix-up (fast start files) */
uint64_t
i_stco_pos
;
...
...
@@ -413,6 +414,7 @@ static int AddStream(sout_mux_t *p_mux, sout_input_t *p_input)
calloc
(
p_stream
->
i_entry_max
,
sizeof
(
mp4_entry_t
));
p_stream
->
i_dts_start
=
0
;
p_stream
->
i_duration
=
0
;
p_stream
->
b_hasbframes
=
false
;
p_input
->
p_sys
=
p_stream
;
...
...
@@ -502,9 +504,15 @@ static int Mux(sout_mux_t *p_mux)
mp4_entry_t
*
e
=
&
p_stream
->
entry
[
p_stream
->
i_entry_count
];
e
->
i_pos
=
p_sys
->
i_pos
;
e
->
i_size
=
p_data
->
i_buffer
;
e
->
i_pts_dts
=
p_data
->
i_pts
-
p_data
->
i_dts
;
if
(
e
->
i_pts_dts
<
0
)
e
->
i_pts_dts
=
0
;
if
(
p_data
->
i_dts
>
VLC_TS_INVALID
&&
p_data
->
i_pts
>
p_data
->
i_dts
)
{
e
->
i_pts_dts
=
p_data
->
i_pts
-
p_data
->
i_dts
;
if
(
!
p_stream
->
b_hasbframes
)
p_stream
->
b_hasbframes
=
true
;
}
else
e
->
i_pts_dts
=
0
;
e
->
i_length
=
p_data
->
i_length
;
e
->
i_flags
=
p_data
->
i_flags
;
...
...
@@ -1408,7 +1416,26 @@ static bo_t *GetStblBox(sout_mux_t *p_mux, mp4_stream_t *p_stream)
}
bo_fix_32be
(
stts
,
12
,
i_index
);
/* FIXME add ctts ?? FIXME */
/* composition time handling */
bo_t
*
ctts
=
NULL
;
if
(
p_stream
->
b_hasbframes
&&
(
ctts
=
box_full_new
(
"ctts"
,
0
,
0
))
)
{
bo_add_32be
(
ctts
,
0
);
i_index
=
0
;
for
(
unsigned
i
=
0
;
i
<
p_stream
->
i_entry_count
;
i_index
++
)
{
int
i_first
=
i
;
mtime_t
i_offset
=
p_stream
->
entry
[
i
].
i_pts_dts
;
for
(;
i
<
p_stream
->
i_entry_count
;
++
i
)
if
(
i
==
p_stream
->
i_entry_count
||
p_stream
->
entry
[
i
].
i_pts_dts
!=
i_offset
)
break
;
bo_add_32be
(
ctts
,
i
-
i_first
);
// sample-count
bo_add_32be
(
ctts
,
i_offset
*
i_timescale
/
CLOCK_FREQ
);
// sample-offset
}
bo_fix_32be
(
ctts
,
12
,
i_index
);
}
bo_t
*
stsz
=
box_full_new
(
"stsz"
,
0
,
0
);
int
i_size
=
0
;
...
...
@@ -1453,6 +1480,8 @@ static bo_t *GetStblBox(sout_mux_t *p_mux, mp4_stream_t *p_stream)
box_gather
(
stbl
,
stts
);
if
(
stss
)
box_gather
(
stbl
,
stss
);
if
(
ctts
)
box_gather
(
stbl
,
ctts
);
box_gather
(
stbl
,
stsc
);
box_gather
(
stbl
,
stsz
);
p_stream
->
i_stco_pos
=
stbl
->
len
+
16
;
...
...
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