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
6e701044
Commit
6e701044
authored
Oct 21, 2005
by
Steve Lhomme
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mkv.cpp: implement working support for the new SimpleBlock (only when libmatroska 0.8.0 is used)
parent
7c18bb22
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
28 deletions
+66
-28
modules/demux/mkv.cpp
modules/demux/mkv.cpp
+66
-28
No files found.
modules/demux/mkv.cpp
View file @
6e701044
...
@@ -1678,31 +1678,39 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, int64_t *pi_ref1, int64
...
@@ -1678,31 +1678,39 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, int64_t *pi_ref1, int64
for
(
;;
)
for
(
;;
)
{
{
EbmlElement
*
el
;
EbmlElement
*
el
=
NULL
;
int
i_level
;
int
i_level
;
if
(
ep
==
NULL
)
if
(
ep
==
NULL
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
el
=
ep
->
Get
();
#if LIBMATROSKA_VERSION >= 0x000800
i_level
=
ep
->
GetLevel
();
if
(
pp_simpleblock
!=
NULL
||
((
el
=
ep
->
Get
())
==
NULL
&&
pp_block
!=
NULL
)
)
#else
if
(
el
==
NULL
&&
pp_block
!=
NULL
)
if
(
(
el
=
ep
->
Get
())
==
NULL
&&
pp_block
!=
NULL
)
#endif
{
{
/* update the index */
/* update the index */
#define idx p_indexes[i_index - 1]
#define idx p_indexes[i_index - 1]
if
(
i_index
>
0
&&
idx
.
i_time
==
-
1
)
if
(
i_index
>
0
&&
idx
.
i_time
==
-
1
)
{
{
idx
.
i_time
=
(
*
pp_block
).
GlobalTimecode
()
/
(
mtime_t
)
1000
;
#if LIBMATROSKA_VERSION >= 0x000800
if
(
pp_simpleblock
!=
NULL
)
idx
.
i_time
=
pp_simpleblock
->
GlobalTimecode
()
/
(
mtime_t
)
1000
;
else
#endif
idx
.
i_time
=
(
*
pp_block
).
GlobalTimecode
()
/
(
mtime_t
)
1000
;
idx
.
b_key
=
*
pi_ref1
==
0
?
VLC_TRUE
:
VLC_FALSE
;
idx
.
b_key
=
*
pi_ref1
==
0
?
VLC_TRUE
:
VLC_FALSE
;
}
}
#undef idx
#undef idx
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
i_level
=
ep
->
GetLevel
();
if
(
el
==
NULL
)
if
(
el
==
NULL
)
{
{
if
(
ep
->
GetLevel
()
>
1
)
if
(
i_level
>
1
)
{
{
ep
->
Up
();
ep
->
Up
();
continue
;
continue
;
...
@@ -1769,8 +1777,6 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, int64_t *pi_ref1, int64
...
@@ -1769,8 +1777,6 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, int64_t *pi_ref1, int64
pp_simpleblock
->
ReadData
(
es
.
I_O
()
);
pp_simpleblock
->
ReadData
(
es
.
I_O
()
);
pp_simpleblock
->
SetParent
(
*
cluster
);
pp_simpleblock
->
SetParent
(
*
cluster
);
ep
->
Keep
();
}
}
#endif
#endif
break
;
break
;
...
@@ -1836,8 +1842,13 @@ static block_t *MemToBlock( demux_t *p_demux, uint8_t *p_mem, int i_mem)
...
@@ -1836,8 +1842,13 @@ static block_t *MemToBlock( demux_t *p_demux, uint8_t *p_mem, int i_mem)
return
p_block
;
return
p_block
;
}
}
#if LIBMATROSKA_VERSION >= 0x000800
static
void
BlockDecode
(
demux_t
*
p_demux
,
KaxBlock
*
block
,
KaxSimpleBlock
*
simpleblock
,
mtime_t
i_pts
,
mtime_t
i_duration
,
bool
f_mandatory
)
#else
static
void
BlockDecode
(
demux_t
*
p_demux
,
KaxBlock
*
block
,
mtime_t
i_pts
,
static
void
BlockDecode
(
demux_t
*
p_demux
,
KaxBlock
*
block
,
mtime_t
i_pts
,
mtime_t
i_duration
,
bool
f_unreferenced
)
mtime_t
i_duration
,
bool
f_mandatory
)
#endif
{
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
matroska_segment_c
*
p_segment
=
p_sys
->
p_current_segment
->
Segment
();
matroska_segment_c
*
p_segment
=
p_sys
->
p_current_segment
->
Segment
();
...
@@ -1849,7 +1860,12 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
...
@@ -1849,7 +1860,12 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
#define tk p_segment->tracks[i_track]
#define tk p_segment->tracks[i_track]
for
(
i_track
=
0
;
i_track
<
p_segment
->
tracks
.
size
();
i_track
++
)
for
(
i_track
=
0
;
i_track
<
p_segment
->
tracks
.
size
();
i_track
++
)
{
{
#if LIBMATROSKA_VERSION >= 0x000800
if
(
(
block
!=
NULL
&&
tk
->
i_number
==
block
->
TrackNum
())
||
(
simpleblock
!=
NULL
&&
tk
->
i_number
==
simpleblock
->
TrackNum
()))
#else
if
(
tk
->
i_number
==
block
->
TrackNum
()
)
if
(
tk
->
i_number
==
block
->
TrackNum
()
)
#endif
{
{
break
;
break
;
}
}
...
@@ -1894,12 +1910,28 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
...
@@ -1894,12 +1910,28 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
tk
->
b_inited
=
VLC_TRUE
;
tk
->
b_inited
=
VLC_TRUE
;
#if LIBMATROSKA_VERSION >= 0x000800
for
(
i
=
0
;
(
block
!=
NULL
&&
i
<
block
->
NumberFrames
())
||
(
simpleblock
!=
NULL
&&
i
<
simpleblock
->
NumberFrames
());
i
++
)
#else
for
(
i
=
0
;
i
<
block
->
NumberFrames
();
i
++
)
for
(
i
=
0
;
i
<
block
->
NumberFrames
();
i
++
)
#endif
{
{
block_t
*
p_block
;
block_t
*
p_block
;
DataBuffer
&
data
=
block
->
GetBuffer
(
i
);
DataBuffer
*
data
;
#if LIBMATROSKA_VERSION >= 0x000800
if
(
simpleblock
!=
NULL
)
{
data
=
&
simpleblock
->
GetBuffer
(
i
);
// condition when the DTS is correct (keyframe or B frame == NOT P frame)
f_mandatory
=
simpleblock
->
IsDiscardable
()
||
simpleblock
->
IsKeyframe
();
}
else
#endif
data
=
&
block
->
GetBuffer
(
i
);
p_block
=
MemToBlock
(
p_demux
,
data
.
Buffer
(),
data
.
Size
()
);
p_block
=
MemToBlock
(
p_demux
,
data
->
Buffer
(),
data
->
Size
()
);
if
(
p_block
==
NULL
)
if
(
p_block
==
NULL
)
{
{
...
@@ -1943,7 +1975,7 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
...
@@ -1943,7 +1975,7 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
else
else
{
{
p_block
->
i_pts
=
i_pts
;
p_block
->
i_pts
=
i_pts
;
if
(
f_
unreferenced
)
if
(
f_
mandatory
)
p_block
->
i_dts
=
p_block
->
i_pts
;
p_block
->
i_dts
=
p_block
->
i_pts
;
else
else
p_block
->
i_dts
=
min
(
i_pts
,
tk
->
i_last_dts
+
(
tk
->
i_default_duration
>>
10
));
p_block
->
i_dts
=
min
(
i_pts
,
tk
->
i_last_dts
+
(
tk
->
i_default_duration
>>
10
));
...
@@ -1995,11 +2027,19 @@ matroska_stream_c *demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, EbmlS
...
@@ -1995,11 +2027,19 @@ matroska_stream_c *demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, EbmlS
}
}
EDocTypeReadVersion
doc_read_version
=
GetChild
<
EDocTypeReadVersion
>
(
*
static_cast
<
EbmlHead
*>
(
p_l0
));
EDocTypeReadVersion
doc_read_version
=
GetChild
<
EDocTypeReadVersion
>
(
*
static_cast
<
EbmlHead
*>
(
p_l0
));
#if LIBMATROSKA_VERSION >= 0x000800
if
(
uint64
(
doc_read_version
)
>
2
)
{
msg_Err
(
p_demux
,
"This matroska file is needs version "
I64Fd
" and this VLC only supports version 1 & 2"
,
uint64
(
doc_read_version
));
return
NULL
;
}
#else
if
(
uint64
(
doc_read_version
)
!=
1
)
if
(
uint64
(
doc_read_version
)
!=
1
)
{
{
msg_Err
(
p_demux
,
"This matroska file is needs version "
I64Fd
" and this VLC only supports version 1"
,
uint64
(
doc_read_version
));
msg_Err
(
p_demux
,
"This matroska file is needs version "
I64Fd
" and this VLC only supports version 1"
,
uint64
(
doc_read_version
));
return
NULL
;
return
NULL
;
}
}
#endif
delete
p_l0
;
delete
p_l0
;
...
@@ -3301,6 +3341,11 @@ static int Demux( demux_t *p_demux)
...
@@ -3301,6 +3341,11 @@ static int Demux( demux_t *p_demux)
}
}
}
}
#if LIBMATROSKA_VERSION >= 0x000800
if
(
simpleblock
!=
NULL
)
p_sys
->
i_pts
=
(
p_sys
->
i_chapter_time
+
simpleblock
->
GlobalTimecode
())
/
(
mtime_t
)
1000
;
else
#endif
p_sys
->
i_pts
=
(
p_sys
->
i_chapter_time
+
block
->
GlobalTimecode
())
/
(
mtime_t
)
1000
;
p_sys
->
i_pts
=
(
p_sys
->
i_chapter_time
+
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
)
...
@@ -3311,9 +3356,6 @@ static int Demux( demux_t *p_demux)
...
@@ -3311,9 +3356,6 @@ static int Demux( demux_t *p_demux)
{
{
i_return
=
1
;
i_return
=
1
;
delete
block
;
delete
block
;
#if LIBMATROSKA_VERSION >= 0x000800
delete
simpleblock
;
#endif
break
;
break
;
}
}
}
}
...
@@ -3324,9 +3366,6 @@ static int Demux( demux_t *p_demux)
...
@@ -3324,9 +3366,6 @@ static int Demux( demux_t *p_demux)
if
(
!
p_vsegment
->
SelectNext
()
)
if
(
!
p_vsegment
->
SelectNext
()
)
{
{
delete
block
;
delete
block
;
#if LIBMATROSKA_VERSION >= 0x000800
delete
simpleblock
;
#endif
break
;
break
;
}
}
p_segment
->
UnSelect
(
);
p_segment
->
UnSelect
(
);
...
@@ -3339,21 +3378,19 @@ static int Demux( demux_t *p_demux)
...
@@ -3339,21 +3378,19 @@ static int Demux( demux_t *p_demux)
{
{
msg_Err
(
p_demux
,
"Failed to select new segment"
);
msg_Err
(
p_demux
,
"Failed to select new segment"
);
delete
block
;
delete
block
;
#if LIBMATROSKA_VERSION >= 0x000800
delete
simpleblock
;
#endif
break
;
break
;
}
}
delete
block
;
delete
block
;
continue
;
continue
;
}
}
#if LIBMATROSKA_VERSION >= 0x000800
BlockDecode
(
p_demux
,
block
,
simpleblock
,
p_sys
->
i_pts
,
i_block_duration
,
i_block_ref1
>=
0
||
i_block_ref2
>
0
);
#else
BlockDecode
(
p_demux
,
block
,
p_sys
->
i_pts
,
i_block_duration
,
i_block_ref1
>=
0
||
i_block_ref2
>
0
);
BlockDecode
(
p_demux
,
block
,
p_sys
->
i_pts
,
i_block_duration
,
i_block_ref1
>=
0
||
i_block_ref2
>
0
);
#endif
delete
block
;
delete
block
;
#if LIBMATROSKA_VERSION >= 0x000800
delete
simpleblock
;
#endif
i_block_count
++
;
i_block_count
++
;
// TODO optimize when there is need to leave or when seeking has been called
// TODO optimize when there is need to leave or when seeking has been called
...
@@ -5457,15 +5494,16 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
...
@@ -5457,15 +5494,16 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
}
}
if
(
!
tracks
[
i_track
]
->
b_search_keyframe
)
if
(
!
tracks
[
i_track
]
->
b_search_keyframe
)
{
{
#if LIBMATROSKA_VERSION >= 0x000800
BlockDecode
(
&
sys
.
demuxer
,
block
,
simpleblock
,
sys
.
i_pts
,
0
,
i_block_ref1
>=
0
||
i_block_ref2
>
0
);
#else
BlockDecode
(
&
sys
.
demuxer
,
block
,
sys
.
i_pts
,
0
,
i_block_ref1
>=
0
||
i_block_ref2
>
0
);
BlockDecode
(
&
sys
.
demuxer
,
block
,
sys
.
i_pts
,
0
,
i_block_ref1
>=
0
||
i_block_ref2
>
0
);
#endif
}
}
}
}
}
}
delete
block
;
delete
block
;
#if LIBMATROSKA_VERSION >= 0x000800
delete
simpleblock
;
#endif
}
}
}
}
...
...
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