Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
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
Steve Lhomme
VLC
Commits
ee976cf4
Commit
ee976cf4
authored
May 02, 2017
by
François Cartegnie
🤞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: mp4: use sidx index for seeking
parent
b32c50d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
modules/demux/mp4/mp4.c
modules/demux/mp4/mp4.c
+35
-0
No files found.
modules/demux/mp4/mp4.c
View file @
ee976cf4
...
...
@@ -165,6 +165,8 @@ static bool GetMoofDataRange( MP4_Box_t *p_moov, MP4_Box_t *p_moof,
static
int
ProbeFragments
(
demux_t
*
p_demux
,
bool
b_force
,
bool
*
pb_fragmented
);
static
int
ProbeIndex
(
demux_t
*
p_demux
);
static
int
LeafGetMoofBySidxIndex
(
demux_t
*
p_demux
,
mtime_t
i_target_time
,
uint64_t
*
pi_moof_pos
,
mtime_t
*
pi_sampletime
);
static
int
LeafGetMoofByTfraIndex
(
demux_t
*
p_demux
,
const
mtime_t
i_target_time
,
unsigned
i_track_ID
,
uint64_t
*
pi_moof_pos
,
mtime_t
*
pi_sampletime
);
static
int
LeafGetTrackAndChunkByMOOVPos
(
demux_t
*
p_demux
,
uint64_t
*
pi_pos
,
...
...
@@ -1540,6 +1542,10 @@ static int LeafSeekToTime( demux_t *p_demux, mtime_t i_nztime )
{
msg_Dbg
(
p_demux
,
"seeking to sync point %"
PRId64
,
i_sync_time
);
}
else
if
(
LeafGetMoofBySidxIndex
(
p_demux
,
i_nztime
,
&
i64
,
&
i_sync_time
)
==
VLC_SUCCESS
)
{
msg_Dbg
(
p_demux
,
"seeking to sidx moof pos %"
PRId64
" %"
PRId64
,
i64
,
i_sync_time
);
}
else
if
(
!
p_sys
->
b_fragments_probed
&&
!
p_sys
->
b_fastseekable
)
{
const
char
*
psz_msg
=
_
(
...
...
@@ -4615,6 +4621,35 @@ static int LeafMapTrafTrunContextes( demux_t *p_demux, MP4_Box_t *p_moof )
return
VLC_SUCCESS
;
}
static
int
LeafGetMoofBySidxIndex
(
demux_t
*
p_demux
,
mtime_t
i_target_time
,
uint64_t
*
pi_moof_pos
,
mtime_t
*
pi_sampletime
)
{
const
MP4_Box_t
*
p_sidx
=
MP4_BoxGet
(
p_demux
->
p_sys
->
p_root
,
"sidx"
);
const
MP4_Box_data_sidx_t
*
p_data
;
if
(
!
p_sidx
||
!
((
p_data
=
BOXDATA
(
p_sidx
)))
||
!
p_data
->
i_timescale
)
return
VLC_EGENERIC
;
i_target_time
=
MP4_rescale
(
i_target_time
,
CLOCK_FREQ
,
p_data
->
i_timescale
);
/* sidx refers to offsets from end of sidx pos in the file + first offset */
uint64_t
i_pos
=
p_data
->
i_first_offset
+
p_sidx
->
i_pos
+
p_sidx
->
i_size
;
stime_t
i_time
=
0
;
for
(
uint16_t
i
=
0
;
i
<
p_data
->
i_reference_count
;
i
++
)
{
if
(
i_time
+
p_data
->
p_items
[
i
].
i_subsegment_duration
>
i_target_time
)
{
*
pi_sampletime
=
MP4_rescale
(
i_time
,
p_data
->
i_timescale
,
p_demux
->
p_sys
->
i_timescale
);
*
pi_moof_pos
=
i_pos
;
return
VLC_SUCCESS
;
}
i_pos
+=
p_data
->
p_items
[
i
].
i_referenced_size
;
i_time
+=
p_data
->
p_items
[
i
].
i_subsegment_duration
;
}
return
VLC_EGENERIC
;
}
static
int
LeafGetMoofByTfraIndex
(
demux_t
*
p_demux
,
const
mtime_t
i_target_time
,
unsigned
i_track_ID
,
uint64_t
*
pi_moof_pos
,
mtime_t
*
pi_sampletime
)
{
...
...
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