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
25db1407
Commit
25db1407
authored
Feb 16, 2005
by
Steve Lhomme
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mkv.cpp: use time-based seeking whenever possible
parent
ce1647fa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2922 additions
and
2919 deletions
+2922
-2919
modules/demux/mkv.cpp
modules/demux/mkv.cpp
+2922
-2919
No files found.
modules/demux/mkv.cpp
View file @
25db1407
...
...
@@ -1355,11 +1355,7 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
}
#endif
if
(
i_pts
<
p_sys
->
i_start_pts
)
{
p_block
->
i_pts
=
-
1
;
}
else
if
(
tk
.
fmt
.
i_cat
!=
VIDEO_ES
)
if
(
tk
.
fmt
.
i_cat
!=
VIDEO_ES
)
{
p_block
->
i_dts
=
p_block
->
i_pts
=
i_pts
;
}
...
...
@@ -1391,7 +1387,7 @@ static void Seek( demux_t *p_demux, mtime_t i_date, int i_percent)
int64_t
i_block_ref1
;
int64_t
i_block_ref2
;
int
i_index
;
int
i_index
=
0
;
int
i_track_skipping
;
int
i_track
;
...
...
@@ -1408,6 +1404,12 @@ static void Seek( demux_t *p_demux, mtime_t i_date, int i_percent)
/* seek without index or without date */
if
(
i_percent
>=
0
&&
(
config_GetInt
(
p_demux
,
"mkv-seek-percent"
)
||
!
p_sys
->
b_cues
||
i_date
<
0
))
{
if
(
p_sys
->
f_duration
>=
0
)
{
i_date
=
i_percent
*
p_sys
->
f_duration
*
10
;
}
else
{
int64_t
i_pos
=
i_percent
*
stream_Size
(
p_demux
->
s
)
/
100
;
...
...
@@ -1424,9 +1426,9 @@ static void Seek( demux_t *p_demux, mtime_t i_date, int i_percent)
i_index
--
;
}
p_sys
->
in
->
setFilePointer
(
p_sys
->
index
[
i_index
].
i_position
,
seek_beginning
);
i_date
=
p_sys
->
index
[
i_index
].
i_time
;
#if 0
if( p_sys->index[i_index].i_position < i_pos )
{
EbmlElement *el;
...
...
@@ -1452,12 +1454,13 @@ static void Seek( demux_t *p_demux, mtime_t i_date, int i_percent)
}
}
}
#endif
}
else
{
for
(
i_index
=
0
;
i_index
<
p_sys
->
i_index
;
i_index
++
)
}
for
(
;
i_index
<
p_sys
->
i_index
;
i_index
++
)
{
if
(
p_sys
->
index
[
i_index
].
i_time
>=
i_date
)
if
(
p_sys
->
index
[
i_index
].
i_time
>
i_date
)
{
break
;
}
...
...
@@ -1475,7 +1478,7 @@ static void Seek( demux_t *p_demux, mtime_t i_date, int i_percent)
p_sys
->
in
->
setFilePointer
(
p_sys
->
index
[
i_index
].
i_position
,
seek_beginning
);
}
/* now parse until key frame */
#define tk p_sys->track[i_track]
...
...
@@ -1512,14 +1515,18 @@ static void Seek( demux_t *p_demux, mtime_t i_date, int i_percent)
if
(
i_track
<
p_sys
->
i_track
)
{
if
(
tk
.
fmt
.
i_cat
==
VIDEO_ES
&&
i_block_ref1
==
-
1
&&
tk
.
b_search_keyframe
)
if
(
tk
.
fmt
.
i_cat
==
VIDEO_ES
)
{
if
(
i_block_ref1
==
-
1
&&
tk
.
b_search_keyframe
)
{
tk
.
b_search_keyframe
=
VLC_FALSE
;
i_track_skipping
--
;
}
if
(
tk
.
fmt
.
i_cat
==
VIDEO_ES
&&
!
tk
.
b_search_keyframe
)
if
(
!
tk
.
b_search_keyframe
)
{
BlockDecode
(
p_demux
,
block
,
0
,
0
);
/* es_out_Control( p_demux->out, ES_OUT_SET_PCR, block->GlobalTimecode() / (mtime_t) 1000 );*/
}
}
}
...
...
@@ -1557,7 +1564,7 @@ static int Demux( demux_t *p_demux)
p_sys
->
i_pts
=
block
->
GlobalTimecode
()
/
(
mtime_t
)
1000
;
if
(
p_sys
->
i_pts
>
p_sys
->
i_start_pts
)
if
(
p_sys
->
i_pts
>
=
p_sys
->
i_start_pts
)
{
es_out_Control
(
p_demux
->
out
,
ES_OUT_SET_PCR
,
p_sys
->
i_pts
);
}
...
...
@@ -1567,11 +1574,7 @@ static int Demux( demux_t *p_demux)
delete
block
;
i_block_count
++
;
if
(
i_start_pts
==
-
1
)
{
i_start_pts
=
p_sys
->
i_pts
;
}
else
if
(
p_sys
->
i_pts
>
i_start_pts
+
(
mtime_t
)
100000
||
i_block_count
>
5
)
if
(
p_sys
->
i_pts
>
i_start_pts
+
(
mtime_t
)
100000
||
i_block_count
>
5
)
{
return
1
;
}
...
...
@@ -2623,7 +2626,7 @@ static void ParseInfo( demux_t *p_demux, EbmlElement *info )
}
}
p_sys
->
f_duration
=
p_sys
->
f_duration
*
p_sys
->
i_timescale
/
1000000.0
;
p_sys
->
f_duration
*=
p_sys
->
i_timescale
/
1000000.0
;
}
...
...
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