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
bef4a289
Commit
bef4a289
authored
May 20, 2005
by
Steve Lhomme
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mkv.cpp: Improve the block UnGet()
parent
f0923351
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
13 deletions
+29
-13
modules/demux/mkv.cpp
modules/demux/mkv.cpp
+29
-13
No files found.
modules/demux/mkv.cpp
View file @
bef4a289
...
...
@@ -517,7 +517,7 @@ class EbmlParser
void
Reset
(
demux_t
*
p_demux
);
EbmlElement
*
Get
(
void
);
void
Keep
(
void
);
void
UnGet
(
uint64
i_restart
_pos
);
EbmlElement
*
UnGet
(
uint64
i_block_pos
,
uint64
i_cluster
_pos
);
int
GetLevel
(
void
);
...
...
@@ -984,6 +984,8 @@ public:
,
i_chapters_position
(
-
1
)
,
i_tags_position
(
-
1
)
,
cluster
(
NULL
)
,
i_block_pos
(
0
)
,
i_cluster_pos
(
0
)
,
i_start_pos
(
0
)
,
p_segment_uid
(
NULL
)
,
p_prev_segment_uid
(
NULL
)
...
...
@@ -1084,6 +1086,8 @@ public:
int64_t
i_tags_position
;
KaxCluster
*
cluster
;
uint64
i_block_pos
;
uint64
i_cluster_pos
;
int64_t
i_start_pos
;
KaxSegmentUID
*
p_segment_uid
;
KaxPrevUID
*
p_prev_segment_uid
;
...
...
@@ -1128,7 +1132,7 @@ public:
void
LoadTags
(
);
void
InformationCreate
(
);
void
Seek
(
mtime_t
i_date
,
mtime_t
i_time_offset
);
int
BlockGet
(
KaxBlock
*
&
pp_block
,
uint64
&
i_cuepos
,
int64_t
*
pi_ref1
,
int64_t
*
pi_ref2
,
int64_t
*
pi_duration
);
int
BlockGet
(
KaxBlock
*
&
pp_block
,
int64_t
*
pi_ref1
,
int64_t
*
pi_ref2
,
int64_t
*
pi_duration
);
bool
Select
(
mtime_t
i_start_time
);
void
UnSelect
(
);
...
...
@@ -1609,10 +1613,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
}
}
int
matroska_segment_c
::
BlockGet
(
KaxBlock
*
&
pp_block
,
uint64
&
i_cuepos
,
int64_t
*
pi_ref1
,
int64_t
*
pi_ref2
,
int64_t
*
pi_duration
)
int
matroska_segment_c
::
BlockGet
(
KaxBlock
*
&
pp_block
,
int64_t
*
pi_ref1
,
int64_t
*
pi_ref2
,
int64_t
*
pi_duration
)
{
pp_block
=
NULL
;
i_cuepos
=
0
;
*
pi_ref1
=
-
1
;
*
pi_ref2
=
-
1
;
...
...
@@ -1658,6 +1661,7 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, uint64 & i_cuepos, int6
if
(
MKV_IS_ID
(
el
,
KaxCluster
)
)
{
cluster
=
(
KaxCluster
*
)
el
;
i_cluster_pos
=
cluster
->
GetElementPosition
();
/* add it to the index */
if
(
i_index
==
0
||
...
...
@@ -1698,7 +1702,7 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, uint64 & i_cuepos, int6
}
else
if
(
MKV_IS_ID
(
el
,
KaxBlockGroup
)
)
{
i_
cue
pos
=
el
->
GetElementPosition
();
i_
block_
pos
=
el
->
GetElementPosition
();
ep
->
Down
();
}
break
;
...
...
@@ -3118,12 +3122,11 @@ static int Demux( demux_t *p_demux)
}
KaxBlock
*
block
;
uint64
i_cuepos
;
int64_t
i_block_duration
=
0
;
int64_t
i_block_ref1
;
int64_t
i_block_ref2
;
if
(
p_segment
->
BlockGet
(
block
,
i_cuepos
,
&
i_block_ref1
,
&
i_block_ref2
,
&
i_block_duration
)
)
if
(
p_segment
->
BlockGet
(
block
,
&
i_block_ref1
,
&
i_block_ref2
,
&
i_block_duration
)
)
{
if
(
p_vsegment
->
Edition
()
&&
p_vsegment
->
Edition
()
->
b_ordered
)
{
...
...
@@ -3316,7 +3319,7 @@ EbmlParser::~EbmlParser( void )
}
}
void
EbmlParser
::
UnGet
(
uint64
i_restart
_pos
)
EbmlElement
*
EbmlParser
::
UnGet
(
uint64
i_block_pos
,
uint64
i_cluster
_pos
)
{
if
(
mi_user_level
>
mi_level
)
{
...
...
@@ -3329,7 +3332,21 @@ void EbmlParser::UnGet( uint64 i_restart_pos )
}
m_got
=
NULL
;
mb_keep
=
VLC_FALSE
;
m_es
->
I_O
().
setFilePointer
(
i_restart_pos
,
seek_beginning
);
if
(
m_el
[
1
]
->
GetElementPosition
()
==
i_cluster_pos
)
{
m_es
->
I_O
().
setFilePointer
(
i_block_pos
,
seek_beginning
);
return
(
EbmlMaster
*
)
m_el
[
mi_level
-
1
];
}
else
{
// seek to the previous Cluster
m_es
->
I_O
().
setFilePointer
(
i_cluster_pos
,
seek_beginning
);
mi_level
--
;
mi_user_level
--
;
delete
m_el
[
mi_level
];
m_el
[
mi_level
]
=
NULL
;
return
NULL
;
}
}
void
EbmlParser
::
Up
(
void
)
...
...
@@ -5037,7 +5054,7 @@ bool matroska_segment_c::Preload( )
cluster
=
(
KaxCluster
*
)
el
;
i_start_pos
=
cluster
->
GetElementPosition
();
i_
cluster_pos
=
i_
start_pos
=
cluster
->
GetElementPosition
();
ParseCluster
(
);
ep
->
Down
();
...
...
@@ -5201,7 +5218,6 @@ void virtual_segment_c::AppendUID( const EbmlBinary * p_UID )
void
matroska_segment_c
::
Seek
(
mtime_t
i_date
,
mtime_t
i_time_offset
)
{
KaxBlock
*
block
;
uint64
i_cuepos
;
int
i_track_skipping
;
int64_t
i_block_duration
;
int64_t
i_block_ref1
;
...
...
@@ -5259,7 +5275,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
while
(
i_track_skipping
>
0
)
{
if
(
BlockGet
(
block
,
i_cuepos
,
&
i_block_ref1
,
&
i_block_ref2
,
&
i_block_duration
)
)
if
(
BlockGet
(
block
,
&
i_block_ref1
,
&
i_block_ref2
,
&
i_block_duration
)
)
{
msg_Warn
(
&
sys
.
demuxer
,
"cannot get block EOF?"
);
...
...
@@ -5281,7 +5297,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
{
if
(
sys
.
i_pts
>=
sys
.
i_start_pts
)
{
ep
->
UnGet
(
i_cuepos
);
cluster
=
static_cast
<
KaxCluster
*>
(
ep
->
UnGet
(
i_block_pos
,
i_cluster_pos
)
);
i_track_skipping
=
0
;
}
else
if
(
tracks
[
i_track
]
->
fmt
.
i_cat
==
VIDEO_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