Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
27aff3c2
Commit
27aff3c2
authored
Apr 19, 2005
by
Steve Lhomme
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mkv.cpp: changed the name of classes and prepare the DVD interpretor
parent
97746399
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
142 additions
and
136 deletions
+142
-136
modules/demux/mkv.cpp
modules/demux/mkv.cpp
+142
-136
No files found.
modules/demux/mkv.cpp
View file @
27aff3c2
...
@@ -330,7 +330,7 @@ typedef struct
...
@@ -330,7 +330,7 @@ typedef struct
vlc_bool_t
b_key
;
vlc_bool_t
b_key
;
}
mkv_index_t
;
}
mkv_index_t
;
class
chapter_codec_cmds_
t
class
chapter_codec_cmds_
c
{
{
public:
public:
void
SetPrivate
(
const
KaxChapterProcessPrivate
&
private_data
)
void
SetPrivate
(
const
KaxChapterProcessPrivate
&
private_data
)
...
@@ -348,15 +348,21 @@ protected:
...
@@ -348,15 +348,21 @@ protected:
std
::
vector
<
KaxChapterProcessData
>
leave_cmds
;
std
::
vector
<
KaxChapterProcessData
>
leave_cmds
;
};
};
class
dvd_c
hapter_codec_t
:
public
chapter_codec_cmds_t
class
dvd_c
ommand_interpretor_c
{
{
};
};
class
matroska_script_codec_t
:
public
chapter_codec_cmds_t
class
dvd_chapter_codec_c
:
public
chapter_codec_cmds_c
{
{
protected:
static
dvd_command_interpretor_c
interpreter
;
};
};
class
chapter_translation_t
class
matroska_script_codec_c
:
public
chapter_codec_cmds_c
{
};
class
chapter_translation_c
{
{
public:
public:
KaxChapterTranslateID
translated
;
KaxChapterTranslateID
translated
;
...
@@ -364,10 +370,10 @@ public:
...
@@ -364,10 +370,10 @@ public:
std
::
vector
<
uint64_t
>
editions
;
std
::
vector
<
uint64_t
>
editions
;
};
};
class
chapter_item_
t
class
chapter_item_
c
{
{
public:
public:
chapter_item_
t
()
chapter_item_
c
()
:
i_start_time
(
0
)
:
i_start_time
(
0
)
,
i_end_time
(
-
1
)
,
i_end_time
(
-
1
)
,
i_user_start_time
(
-
1
)
,
i_user_start_time
(
-
1
)
...
@@ -379,22 +385,22 @@ public:
...
@@ -379,22 +385,22 @@ public:
int64_t
RefreshChapters
(
bool
b_ordered
,
int64_t
i_prev_user_time
);
int64_t
RefreshChapters
(
bool
b_ordered
,
int64_t
i_prev_user_time
);
void
PublishChapters
(
input_title_t
&
title
,
int
i_level
);
void
PublishChapters
(
input_title_t
&
title
,
int
i_level
);
const
chapter_item_
t
*
FindTimecode
(
mtime_t
i_timecode
)
const
;
const
chapter_item_
c
*
FindTimecode
(
mtime_t
i_timecode
)
const
;
void
Append
(
const
chapter_item_
t
&
edition
);
void
Append
(
const
chapter_item_
c
&
edition
);
chapter_item_
t
*
FindChapter
(
const
chapter_item_t
&
chapter
);
chapter_item_
c
*
FindChapter
(
const
chapter_item_c
&
chapter
);
int64_t
i_start_time
,
i_end_time
;
int64_t
i_start_time
,
i_end_time
;
int64_t
i_user_start_time
,
i_user_end_time
;
/* the time in the stream when an edition is ordered */
int64_t
i_user_start_time
,
i_user_end_time
;
/* the time in the stream when an edition is ordered */
std
::
vector
<
chapter_item_
t
>
sub_chapters
;
std
::
vector
<
chapter_item_
c
>
sub_chapters
;
int
i_seekpoint_num
;
int
i_seekpoint_num
;
int64_t
i_uid
;
int64_t
i_uid
;
bool
b_display_seekpoint
;
bool
b_display_seekpoint
;
std
::
string
psz_name
;
std
::
string
psz_name
;
chapter_item_
t
*
psz_parent
;
chapter_item_
c
*
psz_parent
;
std
::
vector
<
chapter_codec_cmds_
t
>
codecs
;
std
::
vector
<
chapter_codec_cmds_
c
>
codecs
;
bool
operator
<
(
const
chapter_item_
t
&
item
)
const
bool
operator
<
(
const
chapter_item_
c
&
item
)
const
{
{
return
(
i_user_start_time
<
item
.
i_user_start_time
||
(
i_user_start_time
==
item
.
i_user_start_time
&&
i_user_end_time
<
item
.
i_user_end_time
)
);
return
(
i_user_start_time
<
item
.
i_user_start_time
||
(
i_user_start_time
==
item
.
i_user_start_time
&&
i_user_end_time
<
item
.
i_user_end_time
)
);
}
}
...
@@ -403,10 +409,10 @@ public:
...
@@ -403,10 +409,10 @@ public:
bool
Leave
()
const
;
bool
Leave
()
const
;
};
};
class
chapter_edition_
t
:
public
chapter_item_t
class
chapter_edition_
c
:
public
chapter_item_c
{
{
public:
public:
chapter_edition_
t
()
chapter_edition_
c
()
:
b_ordered
(
false
)
:
b_ordered
(
false
)
{}
{}
...
@@ -417,12 +423,12 @@ public:
...
@@ -417,12 +423,12 @@ public:
bool
b_ordered
;
bool
b_ordered
;
};
};
class
demux_sys_
t
;
class
demux_sys_
c
;
class
matroska_segment_
t
class
matroska_segment_
c
{
{
public:
public:
matroska_segment_
t
(
demux_sys_t
&
demuxer
,
EbmlStream
&
estream
)
matroska_segment_
c
(
demux_sys_c
&
demuxer
,
EbmlStream
&
estream
)
:
segment
(
NULL
)
:
segment
(
NULL
)
,
es
(
estream
)
,
es
(
estream
)
,
i_timescale
(
MKVD_TIMECODESCALE
)
,
i_timescale
(
MKVD_TIMECODESCALE
)
...
@@ -449,7 +455,7 @@ public:
...
@@ -449,7 +455,7 @@ public:
index
=
(
mkv_index_t
*
)
malloc
(
sizeof
(
mkv_index_t
)
*
i_index_max
);
index
=
(
mkv_index_t
*
)
malloc
(
sizeof
(
mkv_index_t
)
*
i_index_max
);
}
}
virtual
~
matroska_segment_
t
()
virtual
~
matroska_segment_
c
()
{
{
for
(
size_t
i_track
=
0
;
i_track
<
tracks
.
size
();
i_track
++
)
for
(
size_t
i_track
=
0
;
i_track
<
tracks
.
size
();
i_track
++
)
{
{
...
@@ -532,23 +538,23 @@ public:
...
@@ -532,23 +538,23 @@ public:
char
*
psz_title
;
char
*
psz_title
;
char
*
psz_date_utc
;
char
*
psz_date_utc
;
std
::
vector
<
chapter_edition_
t
>
stored_editions
;
std
::
vector
<
chapter_edition_
c
>
stored_editions
;
int
i_default_edition
;
int
i_default_edition
;
std
::
vector
<
chapter_translation_
t
>
translations
;
std
::
vector
<
chapter_translation_
c
>
translations
;
std
::
vector
<
KaxSegmentFamily
>
families
;
std
::
vector
<
KaxSegmentFamily
>
families
;
demux_sys_
t
&
sys
;
demux_sys_
c
&
sys
;
EbmlParser
*
ep
;
EbmlParser
*
ep
;
bool
b_preloaded
;
bool
b_preloaded
;
bool
Preload
(
);
bool
Preload
(
);
bool
PreloadFamily
(
const
matroska_segment_
t
&
segment
);
bool
PreloadFamily
(
const
matroska_segment_
c
&
segment
);
void
ParseInfo
(
KaxInfo
*
info
);
void
ParseInfo
(
KaxInfo
*
info
);
void
ParseChapters
(
KaxChapters
*
chapters
);
void
ParseChapters
(
KaxChapters
*
chapters
);
void
ParseSeekHead
(
KaxSeekHead
*
seekhead
);
void
ParseSeekHead
(
KaxSeekHead
*
seekhead
);
void
ParseTracks
(
KaxTracks
*
tracks
);
void
ParseTracks
(
KaxTracks
*
tracks
);
void
ParseChapterAtom
(
int
i_level
,
KaxChapterAtom
*
ca
,
chapter_item_
t
&
chapters
);
void
ParseChapterAtom
(
int
i_level
,
KaxChapterAtom
*
ca
,
chapter_item_
c
&
chapters
);
void
ParseTrackEntry
(
KaxTrackEntry
*
m
);
void
ParseTrackEntry
(
KaxTrackEntry
*
m
);
void
ParseCluster
(
);
void
ParseCluster
(
);
void
IndexAppendCluster
(
KaxCluster
*
cluster
);
void
IndexAppendCluster
(
KaxCluster
*
cluster
);
...
@@ -559,14 +565,14 @@ public:
...
@@ -559,14 +565,14 @@ public:
int
BlockGet
(
KaxBlock
**
pp_block
,
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
);
bool
Select
(
mtime_t
i_start_time
);
void
UnSelect
(
);
void
UnSelect
(
);
static
bool
CompareSegmentUIDs
(
const
matroska_segment_
t
*
item_a
,
const
matroska_segment_t
*
item_b
);
static
bool
CompareSegmentUIDs
(
const
matroska_segment_
c
*
item_a
,
const
matroska_segment_c
*
item_b
);
};
};
// class holding hard-linked segment together in the playback order
// class holding hard-linked segment together in the playback order
class
virtual_segment_
t
class
virtual_segment_
c
{
{
public:
public:
virtual_segment_
t
(
matroska_segment_t
*
p_segment
)
virtual_segment_
c
(
matroska_segment_c
*
p_segment
)
:
i_current_segment
(
0
)
:
i_current_segment
(
0
)
,
i_current_edition
(
-
1
)
,
i_current_edition
(
-
1
)
,
psz_current_chapter
(
NULL
)
,
psz_current_chapter
(
NULL
)
...
@@ -579,13 +585,13 @@ public:
...
@@ -579,13 +585,13 @@ public:
}
}
void
Sort
();
void
Sort
();
size_t
AddSegment
(
matroska_segment_
t
*
p_segment
);
size_t
AddSegment
(
matroska_segment_
c
*
p_segment
);
void
PreloadLinked
(
);
void
PreloadLinked
(
);
mtime_t
Duration
(
)
const
;
mtime_t
Duration
(
)
const
;
void
LoadCues
(
);
void
LoadCues
(
);
void
Seek
(
demux_t
&
demuxer
,
mtime_t
i_date
,
mtime_t
i_time_offset
,
const
chapter_item_
t
*
psz_chapter
);
void
Seek
(
demux_t
&
demuxer
,
mtime_t
i_date
,
mtime_t
i_time_offset
,
const
chapter_item_
c
*
psz_chapter
);
inline
chapter_edition_
t
*
Edition
()
inline
chapter_edition_
c
*
Edition
()
{
{
if
(
i_current_edition
>=
0
&&
size_t
(
i_current_edition
)
<
editions
.
size
()
)
if
(
i_current_edition
>=
0
&&
size_t
(
i_current_edition
)
<
editions
.
size
()
)
return
&
editions
[
i_current_edition
];
return
&
editions
[
i_current_edition
];
...
@@ -597,14 +603,14 @@ public:
...
@@ -597,14 +603,14 @@ public:
return
(
editions
.
size
()
!=
0
&&
i_current_edition
>=
0
&&
editions
[
i_current_edition
].
b_ordered
);
return
(
editions
.
size
()
!=
0
&&
i_current_edition
>=
0
&&
editions
[
i_current_edition
].
b_ordered
);
}
}
matroska_segment_
t
*
Segment
()
const
matroska_segment_
c
*
Segment
()
const
{
{
if
(
linked_segments
.
size
()
==
0
||
i_current_segment
>=
linked_segments
.
size
()
)
if
(
linked_segments
.
size
()
==
0
||
i_current_segment
>=
linked_segments
.
size
()
)
return
NULL
;
return
NULL
;
return
linked_segments
[
i_current_segment
];
return
linked_segments
[
i_current_segment
];
}
}
inline
const
chapter_item_
t
*
CurrentChapter
()
const
{
inline
const
chapter_item_
c
*
CurrentChapter
()
const
{
return
psz_current_chapter
;
return
psz_current_chapter
;
}
}
...
@@ -623,27 +629,27 @@ public:
...
@@ -623,27 +629,27 @@ public:
bool
Select
(
input_title_t
&
title
);
bool
Select
(
input_title_t
&
title
);
protected:
protected:
std
::
vector
<
matroska_segment_
t
*>
linked_segments
;
std
::
vector
<
matroska_segment_
c
*>
linked_segments
;
std
::
vector
<
KaxSegmentUID
>
linked_uids
;
std
::
vector
<
KaxSegmentUID
>
linked_uids
;
size_t
i_current_segment
;
size_t
i_current_segment
;
std
::
vector
<
chapter_edition_
t
>
editions
;
std
::
vector
<
chapter_edition_
c
>
editions
;
int
i_current_edition
;
int
i_current_edition
;
const
chapter_item_
t
*
psz_current_chapter
;
const
chapter_item_
c
*
psz_current_chapter
;
void
AppendUID
(
const
EbmlBinary
&
UID
);
void
AppendUID
(
const
EbmlBinary
&
UID
);
};
};
class
matroska_stream_
t
class
matroska_stream_
c
{
{
public:
public:
matroska_stream_
t
(
demux_sys_t
&
demuxer
)
matroska_stream_
c
(
demux_sys_c
&
demuxer
)
:
p_in
(
NULL
)
:
p_in
(
NULL
)
,
p_es
(
NULL
)
,
p_es
(
NULL
)
,
sys
(
demuxer
)
,
sys
(
demuxer
)
{}
{}
virtual
~
matroska_stream_
t
()
virtual
~
matroska_stream_
c
()
{
{
delete
p_in
;
delete
p_in
;
delete
p_es
;
delete
p_es
;
...
@@ -652,15 +658,15 @@ public:
...
@@ -652,15 +658,15 @@ public:
IOCallback
*
p_in
;
IOCallback
*
p_in
;
EbmlStream
*
p_es
;
EbmlStream
*
p_es
;
std
::
vector
<
matroska_segment_
t
*>
segments
;
std
::
vector
<
matroska_segment_
c
*>
segments
;
demux_sys_
t
&
sys
;
demux_sys_
c
&
sys
;
};
};
class
demux_sys_
t
class
demux_sys_
c
{
{
public:
public:
demux_sys_
t
(
demux_t
&
demux
)
demux_sys_
c
(
demux_t
&
demux
)
:
demuxer
(
demux
)
:
demuxer
(
demux
)
,
i_pts
(
0
)
,
i_pts
(
0
)
,
i_start_pts
(
0
)
,
i_start_pts
(
0
)
...
@@ -671,7 +677,7 @@ public:
...
@@ -671,7 +677,7 @@ public:
,
f_duration
(
-
1.0
)
,
f_duration
(
-
1.0
)
{}
{}
virtual
~
demux_sys_
t
()
virtual
~
demux_sys_
c
()
{
{
for
(
size_t
i
=
0
;
i
<
streams
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
streams
.
size
();
i
++
)
delete
streams
[
i
];
delete
streams
[
i
];
...
@@ -690,23 +696,23 @@ public:
...
@@ -690,23 +696,23 @@ public:
input_title_t
*
title
;
input_title_t
*
title
;
std
::
vector
<
matroska_stream_
t
*>
streams
;
std
::
vector
<
matroska_stream_
c
*>
streams
;
std
::
vector
<
matroska_segment_
t
*>
opened_segments
;
std
::
vector
<
matroska_segment_
c
*>
opened_segments
;
virtual_segment_
t
*
p_current_segment
;
virtual_segment_
c
*
p_current_segment
;
/* duration of the stream */
/* duration of the stream */
float
f_duration
;
float
f_duration
;
matroska_segment_
t
*
FindSegment
(
const
EbmlBinary
&
uid
)
const
;
matroska_segment_
c
*
FindSegment
(
const
EbmlBinary
&
uid
)
const
;
void
PreloadFamily
(
const
matroska_segment_
t
&
of_segment
);
void
PreloadFamily
(
const
matroska_segment_
c
&
of_segment
);
void
PreloadLinked
(
matroska_segment_
t
*
p_segment
);
void
PreloadLinked
(
matroska_segment_
c
*
p_segment
);
bool
PreparePlayback
(
);
bool
PreparePlayback
(
);
matroska_stream_
t
*
AnalyseAllSegmentsFound
(
EbmlStream
*
p_estream
);
matroska_stream_
c
*
AnalyseAllSegmentsFound
(
EbmlStream
*
p_estream
);
};
};
static
int
Demux
(
demux_t
*
);
static
int
Demux
(
demux_t
*
);
static
int
Control
(
demux_t
*
,
int
,
va_list
);
static
int
Control
(
demux_t
*
,
int
,
va_list
);
static
void
Seek
(
demux_t
*
,
mtime_t
i_date
,
double
f_percent
,
const
chapter_item_
t
*
psz_chapter
);
static
void
Seek
(
demux_t
*
,
mtime_t
i_date
,
double
f_percent
,
const
chapter_item_
c
*
psz_chapter
);
#define MKV_IS_ID( el, C ) ( EbmlId( (*el) ) == C::ClassInfos.GlobalId )
#define MKV_IS_ID( el, C ) ( EbmlId( (*el) ) == C::ClassInfos.GlobalId )
...
@@ -718,9 +724,9 @@ static char *UTF8ToStr ( const UTFstring &u );
...
@@ -718,9 +724,9 @@ static char *UTF8ToStr ( const UTFstring &u );
static
int
Open
(
vlc_object_t
*
p_this
)
static
int
Open
(
vlc_object_t
*
p_this
)
{
{
demux_t
*
p_demux
=
(
demux_t
*
)
p_this
;
demux_t
*
p_demux
=
(
demux_t
*
)
p_this
;
demux_sys_
t
*
p_sys
;
demux_sys_
c
*
p_sys
;
matroska_stream_
t
*
p_stream
;
matroska_stream_
c
*
p_stream
;
matroska_segment_
t
*
p_segment
;
matroska_segment_
c
*
p_segment
;
uint8_t
*
p_peek
;
uint8_t
*
p_peek
;
std
::
string
s_path
,
s_filename
;
std
::
string
s_path
,
s_filename
;
vlc_stream_io_callback
*
p_io_callback
;
vlc_stream_io_callback
*
p_io_callback
;
...
@@ -736,7 +742,7 @@ static int Open( vlc_object_t * p_this )
...
@@ -736,7 +742,7 @@ static int Open( vlc_object_t * p_this )
/* Set the demux function */
/* Set the demux function */
p_demux
->
pf_demux
=
Demux
;
p_demux
->
pf_demux
=
Demux
;
p_demux
->
pf_control
=
Control
;
p_demux
->
pf_control
=
Control
;
p_demux
->
p_sys
=
p_sys
=
new
demux_sys_
t
(
*
p_demux
);
p_demux
->
p_sys
=
p_sys
=
new
demux_sys_
c
(
*
p_demux
);
p_io_callback
=
new
vlc_stream_io_callback
(
p_demux
->
s
);
p_io_callback
=
new
vlc_stream_io_callback
(
p_demux
->
s
);
p_io_stream
=
new
EbmlStream
(
*
p_io_callback
);
p_io_stream
=
new
EbmlStream
(
*
p_io_callback
);
...
@@ -859,7 +865,7 @@ error:
...
@@ -859,7 +865,7 @@ error:
static
void
Close
(
vlc_object_t
*
p_this
)
static
void
Close
(
vlc_object_t
*
p_this
)
{
{
demux_t
*
p_demux
=
(
demux_t
*
)
p_this
;
demux_t
*
p_demux
=
(
demux_t
*
)
p_this
;
demux_sys_
t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_
c
*
p_sys
=
p_demux
->
p_sys
;
delete
p_sys
;
delete
p_sys
;
}
}
...
@@ -869,7 +875,7 @@ static void Close( vlc_object_t *p_this )
...
@@ -869,7 +875,7 @@ static void Close( vlc_object_t *p_this )
*****************************************************************************/
*****************************************************************************/
static
int
Control
(
demux_t
*
p_demux
,
int
i_query
,
va_list
args
)
static
int
Control
(
demux_t
*
p_demux
,
int
i_query
,
va_list
args
)
{
{
demux_sys_
t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_
c
*
p_sys
=
p_demux
->
p_sys
;
int64_t
*
pi64
;
int64_t
*
pi64
;
double
*
pf
,
f
;
double
*
pf
,
f
;
int
i_skp
;
int
i_skp
;
...
@@ -951,7 +957,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
...
@@ -951,7 +957,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
}
}
}
}
int
matroska_segment_
t
::
BlockGet
(
KaxBlock
**
pp_block
,
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
;
*
pp_block
=
NULL
;
*
pi_ref1
=
-
1
;
*
pi_ref1
=
-
1
;
...
@@ -1106,8 +1112,8 @@ static block_t *MemToBlock( demux_t *p_demux, uint8_t *p_mem, int i_mem)
...
@@ -1106,8 +1112,8 @@ static block_t *MemToBlock( demux_t *p_demux, uint8_t *p_mem, int i_mem)
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
)
mtime_t
i_duration
)
{
{
demux_sys_
t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_
c
*
p_sys
=
p_demux
->
p_sys
;
matroska_segment_
t
*
p_segment
=
p_sys
->
p_current_segment
->
Segment
();
matroska_segment_
c
*
p_segment
=
p_sys
->
p_current_segment
->
Segment
();
size_t
i_track
;
size_t
i_track
;
unsigned
int
i
;
unsigned
int
i
;
...
@@ -1200,7 +1206,7 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
...
@@ -1200,7 +1206,7 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
#undef tk
#undef tk
}
}
matroska_stream_
t
*
demux_sys_t
::
AnalyseAllSegmentsFound
(
EbmlStream
*
p_estream
)
matroska_stream_
c
*
demux_sys_c
::
AnalyseAllSegmentsFound
(
EbmlStream
*
p_estream
)
{
{
int
i_upper_lvl
=
0
;
int
i_upper_lvl
=
0
;
size_t
i
;
size_t
i
;
...
@@ -1223,14 +1229,14 @@ matroska_stream_t *demux_sys_t::AnalyseAllSegmentsFound( EbmlStream *p_estream )
...
@@ -1223,14 +1229,14 @@ matroska_stream_t *demux_sys_t::AnalyseAllSegmentsFound( EbmlStream *p_estream )
return
NULL
;
return
NULL
;
}
}
matroska_stream_
t
*
p_stream1
=
new
matroska_stream_t
(
*
this
);
matroska_stream_
c
*
p_stream1
=
new
matroska_stream_c
(
*
this
);
while
(
p_l0
!=
0
)
while
(
p_l0
!=
0
)
{
{
if
(
EbmlId
(
*
p_l0
)
==
KaxSegment
::
ClassInfos
.
GlobalId
)
if
(
EbmlId
(
*
p_l0
)
==
KaxSegment
::
ClassInfos
.
GlobalId
)
{
{
EbmlParser
*
ep
;
EbmlParser
*
ep
;
matroska_segment_
t
*
p_segment1
=
new
matroska_segment_t
(
*
this
,
*
p_estream
);
matroska_segment_
c
*
p_segment1
=
new
matroska_segment_c
(
*
this
,
*
p_estream
);
b_keep_segment
=
false
;
b_keep_segment
=
false
;
ep
=
new
EbmlParser
(
p_estream
,
p_l0
,
&
demuxer
);
ep
=
new
EbmlParser
(
p_estream
,
p_l0
,
&
demuxer
);
...
@@ -1297,7 +1303,7 @@ matroska_stream_t *demux_sys_t::AnalyseAllSegmentsFound( EbmlStream *p_estream )
...
@@ -1297,7 +1303,7 @@ matroska_stream_t *demux_sys_t::AnalyseAllSegmentsFound( EbmlStream *p_estream )
return
p_stream1
;
return
p_stream1
;
}
}
bool
matroska_segment_
t
::
Select
(
mtime_t
i_start_time
)
bool
matroska_segment_
c
::
Select
(
mtime_t
i_start_time
)
{
{
size_t
i_track
;
size_t
i_track
;
...
@@ -1612,7 +1618,7 @@ bool matroska_segment_t::Select( mtime_t i_start_time )
...
@@ -1612,7 +1618,7 @@ bool matroska_segment_t::Select( mtime_t i_start_time )
return
true
;
return
true
;
}
}
void
matroska_segment_
t
::
UnSelect
(
)
void
matroska_segment_
c
::
UnSelect
(
)
{
{
size_t
i_track
;
size_t
i_track
;
...
@@ -1630,13 +1636,13 @@ void matroska_segment_t::UnSelect( )
...
@@ -1630,13 +1636,13 @@ void matroska_segment_t::UnSelect( )
ep
=
NULL
;
ep
=
NULL
;
}
}
bool
virtual_segment_
t
::
Select
(
input_title_t
&
title
)
bool
virtual_segment_
c
::
Select
(
input_title_t
&
title
)
{
{
if
(
linked_segments
.
size
()
==
0
)
if
(
linked_segments
.
size
()
==
0
)
return
false
;
return
false
;
// !!! should be called only once !!!
// !!! should be called only once !!!
matroska_segment_
t
*
p_segment
;
matroska_segment_
c
*
p_segment
;
size_t
i
,
j
;
size_t
i
,
j
;
// copy editions from the first segment
// copy editions from the first segment
...
@@ -1657,15 +1663,15 @@ bool virtual_segment_t::Select( input_title_t & title )
...
@@ -1657,15 +1663,15 @@ bool virtual_segment_t::Select( input_title_t & title )
return
true
;
return
true
;
}
}
void
chapter_edition_
t
::
PublishChapters
(
input_title_t
&
title
)
void
chapter_edition_
c
::
PublishChapters
(
input_title_t
&
title
)
{
{
title
.
i_seekpoint
=
0
;
title
.
i_seekpoint
=
0
;
if
(
title
.
seekpoint
!=
NULL
)
if
(
title
.
seekpoint
!=
NULL
)
free
(
title
.
seekpoint
);
free
(
title
.
seekpoint
);
chapter_item_
t
::
PublishChapters
(
title
,
0
);
chapter_item_
c
::
PublishChapters
(
title
,
0
);
}
}
void
chapter_item_
t
::
PublishChapters
(
input_title_t
&
title
,
int
i_level
)
void
chapter_item_
c
::
PublishChapters
(
input_title_t
&
title
,
int
i_level
)
{
{
if
(
b_display_seekpoint
)
if
(
b_display_seekpoint
)
{
{
...
@@ -1689,10 +1695,10 @@ void chapter_item_t::PublishChapters( input_title_t & title, int i_level )
...
@@ -1689,10 +1695,10 @@ void chapter_item_t::PublishChapters( input_title_t & title, int i_level )
}
}
}
}
void
virtual_segment_
t
::
UpdateCurrentToChapter
(
demux_t
&
demux
)
void
virtual_segment_
c
::
UpdateCurrentToChapter
(
demux_t
&
demux
)
{
{
demux_sys_
t
&
sys
=
*
demux
.
p_sys
;
demux_sys_
c
&
sys
=
*
demux
.
p_sys
;
const
chapter_item_
t
*
psz_curr_chapter
;
const
chapter_item_
c
*
psz_curr_chapter
;
/* update current chapter/seekpoint */
/* update current chapter/seekpoint */
if
(
editions
.
size
()
)
if
(
editions
.
size
()
)
...
@@ -1725,11 +1731,11 @@ void virtual_segment_t::UpdateCurrentToChapter( demux_t & demux )
...
@@ -1725,11 +1731,11 @@ void virtual_segment_t::UpdateCurrentToChapter( demux_t & demux )
}
}
}
}
void
chapter_item_
t
::
Append
(
const
chapter_item_t
&
chapter
)
void
chapter_item_
c
::
Append
(
const
chapter_item_c
&
chapter
)
{
{
// we are appending content for the same chapter UID
// we are appending content for the same chapter UID
size_t
i
;
size_t
i
;
chapter_item_
t
*
p_chapter
;
chapter_item_
c
*
p_chapter
;
for
(
i
=
0
;
i
<
chapter
.
sub_chapters
.
size
();
i
++
)
for
(
i
=
0
;
i
<
chapter
.
sub_chapters
.
size
();
i
++
)
{
{
...
@@ -1748,7 +1754,7 @@ void chapter_item_t::Append( const chapter_item_t & chapter )
...
@@ -1748,7 +1754,7 @@ void chapter_item_t::Append( const chapter_item_t & chapter )
i_user_end_time
=
max
(
i_user_end_time
,
chapter
.
i_user_end_time
);
i_user_end_time
=
max
(
i_user_end_time
,
chapter
.
i_user_end_time
);
}
}
chapter_item_
t
*
chapter_item_t
::
FindChapter
(
const
chapter_item_t
&
chapter
)
chapter_item_
c
*
chapter_item_c
::
FindChapter
(
const
chapter_item_c
&
chapter
)
{
{
size_t
i
;
size_t
i
;
for
(
i
=
0
;
i
<
sub_chapters
.
size
();
i
++
)
for
(
i
=
0
;
i
<
sub_chapters
.
size
();
i
++
)
...
@@ -1759,11 +1765,11 @@ chapter_item_t * chapter_item_t::FindChapter( const chapter_item_t & chapter )
...
@@ -1759,11 +1765,11 @@ chapter_item_t * chapter_item_t::FindChapter( const chapter_item_t & chapter )
return
NULL
;
return
NULL
;
}
}
static
void
Seek
(
demux_t
*
p_demux
,
mtime_t
i_date
,
double
f_percent
,
const
chapter_item_
t
*
psz_chapter
)
static
void
Seek
(
demux_t
*
p_demux
,
mtime_t
i_date
,
double
f_percent
,
const
chapter_item_
c
*
psz_chapter
)
{
{
demux_sys_
t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_
c
*
p_sys
=
p_demux
->
p_sys
;
virtual_segment_
t
*
p_vsegment
=
p_sys
->
p_current_segment
;
virtual_segment_
c
*
p_vsegment
=
p_sys
->
p_current_segment
;
matroska_segment_
t
*
p_segment
=
p_vsegment
->
Segment
();
matroska_segment_
c
*
p_segment
=
p_vsegment
->
Segment
();
mtime_t
i_time_offset
=
0
;
mtime_t
i_time_offset
=
0
;
int
i_index
;
int
i_index
;
...
@@ -1846,9 +1852,9 @@ static void Seek( demux_t *p_demux, mtime_t i_date, double f_percent, const chap
...
@@ -1846,9 +1852,9 @@ static void Seek( demux_t *p_demux, mtime_t i_date, double f_percent, const chap
*****************************************************************************/
*****************************************************************************/
static
int
Demux
(
demux_t
*
p_demux
)
static
int
Demux
(
demux_t
*
p_demux
)
{
{
demux_sys_
t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_
c
*
p_sys
=
p_demux
->
p_sys
;
virtual_segment_
t
*
p_vsegment
=
p_sys
->
p_current_segment
;
virtual_segment_
c
*
p_vsegment
=
p_sys
->
p_current_segment
;
matroska_segment_
t
*
p_segmet
=
p_vsegment
->
Segment
();
matroska_segment_
c
*
p_segmet
=
p_vsegment
->
Segment
();
if
(
p_segmet
==
NULL
)
return
0
;
if
(
p_segmet
==
NULL
)
return
0
;
int
i_block_count
=
0
;
int
i_block_count
=
0
;
...
@@ -1889,7 +1895,7 @@ static int Demux( demux_t *p_demux)
...
@@ -1889,7 +1895,7 @@ static int Demux( demux_t *p_demux)
{
{
if
(
p_vsegment
->
EditionIsOrdered
()
)
if
(
p_vsegment
->
EditionIsOrdered
()
)
{
{
const
chapter_item_
t
*
p_chap
=
p_vsegment
->
CurrentChapter
();
const
chapter_item_
c
*
p_chap
=
p_vsegment
->
CurrentChapter
();
// check if there are more chapters to read
// check if there are more chapters to read
if
(
p_chap
!=
NULL
)
if
(
p_chap
!=
NULL
)
{
{
...
@@ -2153,7 +2159,7 @@ EbmlElement *EbmlParser::Get( void )
...
@@ -2153,7 +2159,7 @@ EbmlElement *EbmlParser::Get( void )
* * InformationCreate : create all information, load tags if present
* * InformationCreate : create all information, load tags if present
*
*
*****************************************************************************/
*****************************************************************************/
void
matroska_segment_
t
::
LoadCues
(
)
void
matroska_segment_
c
::
LoadCues
(
)
{
{
int64_t
i_sav_position
=
es
.
I_O
().
getFilePointer
();
int64_t
i_sav_position
=
es
.
I_O
().
getFilePointer
();
EbmlParser
*
ep
;
EbmlParser
*
ep
;
...
@@ -2276,7 +2282,7 @@ void matroska_segment_t::LoadCues( )
...
@@ -2276,7 +2282,7 @@ void matroska_segment_t::LoadCues( )
es
.
I_O
().
setFilePointer
(
i_sav_position
,
seek_beginning
);
es
.
I_O
().
setFilePointer
(
i_sav_position
,
seek_beginning
);
}
}
void
matroska_segment_
t
::
LoadTags
(
)
void
matroska_segment_
c
::
LoadTags
(
)
{
{
int64_t
i_sav_position
=
es
.
I_O
().
getFilePointer
();
int64_t
i_sav_position
=
es
.
I_O
().
getFilePointer
();
EbmlParser
*
ep
;
EbmlParser
*
ep
;
...
@@ -2403,7 +2409,7 @@ void matroska_segment_t::LoadTags( )
...
@@ -2403,7 +2409,7 @@ void matroska_segment_t::LoadTags( )
/*****************************************************************************
/*****************************************************************************
* ParseSeekHead:
* ParseSeekHead:
*****************************************************************************/
*****************************************************************************/
void
matroska_segment_
t
::
ParseSeekHead
(
KaxSeekHead
*
seekhead
)
void
matroska_segment_
c
::
ParseSeekHead
(
KaxSeekHead
*
seekhead
)
{
{
EbmlElement
*
el
;
EbmlElement
*
el
;
size_t
i
,
j
;
size_t
i
,
j
;
...
@@ -2473,7 +2479,7 @@ void matroska_segment_t::ParseSeekHead( KaxSeekHead *seekhead )
...
@@ -2473,7 +2479,7 @@ void matroska_segment_t::ParseSeekHead( KaxSeekHead *seekhead )
/*****************************************************************************
/*****************************************************************************
* ParseTrackEntry:
* ParseTrackEntry:
*****************************************************************************/
*****************************************************************************/
void
matroska_segment_
t
::
ParseTrackEntry
(
KaxTrackEntry
*
m
)
void
matroska_segment_
c
::
ParseTrackEntry
(
KaxTrackEntry
*
m
)
{
{
size_t
i
,
j
,
k
,
n
;
size_t
i
,
j
,
k
,
n
;
...
@@ -2878,7 +2884,7 @@ void matroska_segment_t::ParseTrackEntry( KaxTrackEntry *m )
...
@@ -2878,7 +2884,7 @@ void matroska_segment_t::ParseTrackEntry( KaxTrackEntry *m )
/*****************************************************************************
/*****************************************************************************
* ParseTracks:
* ParseTracks:
*****************************************************************************/
*****************************************************************************/
void
matroska_segment_
t
::
ParseTracks
(
KaxTracks
*
tracks
)
void
matroska_segment_
c
::
ParseTracks
(
KaxTracks
*
tracks
)
{
{
EbmlElement
*
el
;
EbmlElement
*
el
;
unsigned
int
i
;
unsigned
int
i
;
...
@@ -2907,7 +2913,7 @@ void matroska_segment_t::ParseTracks( KaxTracks *tracks )
...
@@ -2907,7 +2913,7 @@ void matroska_segment_t::ParseTracks( KaxTracks *tracks )
/*****************************************************************************
/*****************************************************************************
* ParseInfo:
* ParseInfo:
*****************************************************************************/
*****************************************************************************/
void
matroska_segment_
t
::
ParseInfo
(
KaxInfo
*
info
)
void
matroska_segment_
c
::
ParseInfo
(
KaxInfo
*
info
)
{
{
EbmlElement
*
el
;
EbmlElement
*
el
;
EbmlMaster
*
m
;
EbmlMaster
*
m
;
...
@@ -3026,7 +3032,7 @@ void matroska_segment_t::ParseInfo( KaxInfo *info )
...
@@ -3026,7 +3032,7 @@ void matroska_segment_t::ParseInfo( KaxInfo *info )
else
if
(
MKV_IS_ID
(
l
,
KaxChapterTranslate
)
)
else
if
(
MKV_IS_ID
(
l
,
KaxChapterTranslate
)
)
{
{
KaxChapterTranslate
*
p_trans
=
static_cast
<
KaxChapterTranslate
*>
(
l
);
KaxChapterTranslate
*
p_trans
=
static_cast
<
KaxChapterTranslate
*>
(
l
);
chapter_translation_
t
translated
;
chapter_translation_
c
translated
;
p_trans
->
Read
(
es
,
p_trans
->
Generic
().
Context
,
i_upper_level
,
el
,
true
);
p_trans
->
Read
(
es
,
p_trans
->
Generic
().
Context
,
i_upper_level
,
el
,
true
);
for
(
j
=
0
;
j
<
p_trans
->
ListSize
();
j
++
)
for
(
j
=
0
;
j
<
p_trans
->
ListSize
();
j
++
)
...
@@ -3064,7 +3070,7 @@ void matroska_segment_t::ParseInfo( KaxInfo *info )
...
@@ -3064,7 +3070,7 @@ void matroska_segment_t::ParseInfo( KaxInfo *info )
/*****************************************************************************
/*****************************************************************************
* ParseChapterAtom
* ParseChapterAtom
*****************************************************************************/
*****************************************************************************/
void
matroska_segment_
t
::
ParseChapterAtom
(
int
i_level
,
KaxChapterAtom
*
ca
,
chapter_item_t
&
chapters
)
void
matroska_segment_
c
::
ParseChapterAtom
(
int
i_level
,
KaxChapterAtom
*
ca
,
chapter_item_c
&
chapters
)
{
{
size_t
i
,
j
;
size_t
i
,
j
;
...
@@ -3146,7 +3152,7 @@ void matroska_segment_t::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
...
@@ -3146,7 +3152,7 @@ void matroska_segment_t::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
msg_Dbg
(
&
sys
.
demuxer
,
"| | | | + ChapterProcess"
);
msg_Dbg
(
&
sys
.
demuxer
,
"| | | | + ChapterProcess"
);
KaxChapterProcess
*
cp
=
static_cast
<
KaxChapterProcess
*>
(
l
);
KaxChapterProcess
*
cp
=
static_cast
<
KaxChapterProcess
*>
(
l
);
chapter_codec_cmds_
t
*
p_ccodec
=
NULL
;
chapter_codec_cmds_
c
*
p_ccodec
=
NULL
;
for
(
j
=
0
;
j
<
cp
->
ListSize
();
j
++
)
for
(
j
=
0
;
j
<
cp
->
ListSize
();
j
++
)
{
{
...
@@ -3156,9 +3162,9 @@ void matroska_segment_t::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
...
@@ -3156,9 +3162,9 @@ void matroska_segment_t::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
{
{
KaxChapterProcessCodecID
*
p_codec_id
=
static_cast
<
KaxChapterProcessCodecID
*>
(
k
);
KaxChapterProcessCodecID
*
p_codec_id
=
static_cast
<
KaxChapterProcessCodecID
*>
(
k
);
if
(
uint32
(
*
p_codec_id
)
==
0
)
if
(
uint32
(
*
p_codec_id
)
==
0
)
p_ccodec
=
new
matroska_script_codec_
t
();
p_ccodec
=
new
matroska_script_codec_
c
();
else
if
(
uint32
(
*
p_codec_id
)
==
1
)
else
if
(
uint32
(
*
p_codec_id
)
==
1
)
p_ccodec
=
new
dvd_chapter_codec_
t
();
p_ccodec
=
new
dvd_chapter_codec_
c
();
break
;
break
;
}
}
}
}
...
@@ -3182,7 +3188,7 @@ void matroska_segment_t::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
...
@@ -3182,7 +3188,7 @@ void matroska_segment_t::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
}
}
else
if
(
MKV_IS_ID
(
l
,
KaxChapterAtom
)
)
else
if
(
MKV_IS_ID
(
l
,
KaxChapterAtom
)
)
{
{
chapter_item_
t
new_sub_chapter
;
chapter_item_
c
new_sub_chapter
;
ParseChapterAtom
(
i_level
+
1
,
static_cast
<
KaxChapterAtom
*>
(
l
),
new_sub_chapter
);
ParseChapterAtom
(
i_level
+
1
,
static_cast
<
KaxChapterAtom
*>
(
l
),
new_sub_chapter
);
new_sub_chapter
.
psz_parent
=
&
chapters
;
new_sub_chapter
.
psz_parent
=
&
chapters
;
chapters
.
sub_chapters
.
push_back
(
new_sub_chapter
);
chapters
.
sub_chapters
.
push_back
(
new_sub_chapter
);
...
@@ -3193,7 +3199,7 @@ void matroska_segment_t::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
...
@@ -3193,7 +3199,7 @@ void matroska_segment_t::ParseChapterAtom( int i_level, KaxChapterAtom *ca, chap
/*****************************************************************************
/*****************************************************************************
* ParseChapters:
* ParseChapters:
*****************************************************************************/
*****************************************************************************/
void
matroska_segment_
t
::
ParseChapters
(
KaxChapters
*
chapters
)
void
matroska_segment_
c
::
ParseChapters
(
KaxChapters
*
chapters
)
{
{
EbmlElement
*
el
;
EbmlElement
*
el
;
size_t
i
;
size_t
i
;
...
@@ -3209,7 +3215,7 @@ void matroska_segment_t::ParseChapters( KaxChapters *chapters )
...
@@ -3209,7 +3215,7 @@ void matroska_segment_t::ParseChapters( KaxChapters *chapters )
if
(
MKV_IS_ID
(
l
,
KaxEditionEntry
)
)
if
(
MKV_IS_ID
(
l
,
KaxEditionEntry
)
)
{
{
chapter_edition_
t
edition
;
chapter_edition_
c
edition
;
EbmlMaster
*
E
=
static_cast
<
EbmlMaster
*>
(
l
);
EbmlMaster
*
E
=
static_cast
<
EbmlMaster
*>
(
l
);
size_t
j
;
size_t
j
;
...
@@ -3220,7 +3226,7 @@ void matroska_segment_t::ParseChapters( KaxChapters *chapters )
...
@@ -3220,7 +3226,7 @@ void matroska_segment_t::ParseChapters( KaxChapters *chapters )
if
(
MKV_IS_ID
(
l
,
KaxChapterAtom
)
)
if
(
MKV_IS_ID
(
l
,
KaxChapterAtom
)
)
{
{
chapter_item_
t
new_sub_chapter
;
chapter_item_
c
new_sub_chapter
;
ParseChapterAtom
(
0
,
static_cast
<
KaxChapterAtom
*>
(
l
),
new_sub_chapter
);
ParseChapterAtom
(
0
,
static_cast
<
KaxChapterAtom
*>
(
l
),
new_sub_chapter
);
edition
.
sub_chapters
.
push_back
(
new_sub_chapter
);
edition
.
sub_chapters
.
push_back
(
new_sub_chapter
);
}
}
...
@@ -3264,7 +3270,7 @@ void matroska_segment_t::ParseChapters( KaxChapters *chapters )
...
@@ -3264,7 +3270,7 @@ void matroska_segment_t::ParseChapters( KaxChapters *chapters )
}
}
}
}
void
matroska_segment_
t
::
ParseCluster
(
)
void
matroska_segment_
c
::
ParseCluster
(
)
{
{
EbmlElement
*
el
;
EbmlElement
*
el
;
EbmlMaster
*
m
;
EbmlMaster
*
m
;
...
@@ -3294,7 +3300,7 @@ void matroska_segment_t::ParseCluster( )
...
@@ -3294,7 +3300,7 @@ void matroska_segment_t::ParseCluster( )
/*****************************************************************************
/*****************************************************************************
* InformationCreate:
* InformationCreate:
*****************************************************************************/
*****************************************************************************/
void
matroska_segment_
t
::
InformationCreate
(
)
void
matroska_segment_
c
::
InformationCreate
(
)
{
{
size_t
i_track
;
size_t
i_track
;
...
@@ -3369,7 +3375,7 @@ void matroska_segment_t::InformationCreate( )
...
@@ -3369,7 +3375,7 @@ void matroska_segment_t::InformationCreate( )
* Divers
* Divers
*****************************************************************************/
*****************************************************************************/
void
matroska_segment_
t
::
IndexAppendCluster
(
KaxCluster
*
cluster
)
void
matroska_segment_
c
::
IndexAppendCluster
(
KaxCluster
*
cluster
)
{
{
#define idx index[i_index]
#define idx index[i_index]
idx
.
i_track
=
-
1
;
idx
.
i_track
=
-
1
;
...
@@ -3415,18 +3421,18 @@ static char * UTF8ToStr( const UTFstring &u )
...
@@ -3415,18 +3421,18 @@ static char * UTF8ToStr( const UTFstring &u )
return
dst
;
return
dst
;
}
}
void
chapter_edition_
t
::
RefreshChapters
(
)
void
chapter_edition_
c
::
RefreshChapters
(
)
{
{
chapter_item_
t
::
RefreshChapters
(
b_ordered
,
-
1
);
chapter_item_
c
::
RefreshChapters
(
b_ordered
,
-
1
);
b_display_seekpoint
=
false
;
b_display_seekpoint
=
false
;
}
}
int64_t
chapter_item_
t
::
RefreshChapters
(
bool
b_ordered
,
int64_t
i_prev_user_time
)
int64_t
chapter_item_
c
::
RefreshChapters
(
bool
b_ordered
,
int64_t
i_prev_user_time
)
{
{
int64_t
i_user_time
=
i_prev_user_time
;
int64_t
i_user_time
=
i_prev_user_time
;
// first the sub-chapters, and then ourself
// first the sub-chapters, and then ourself
std
::
vector
<
chapter_item_
t
>::
iterator
index
=
sub_chapters
.
begin
();
std
::
vector
<
chapter_item_
c
>::
iterator
index
=
sub_chapters
.
begin
();
while
(
index
!=
sub_chapters
.
end
()
)
while
(
index
!=
sub_chapters
.
end
()
)
{
{
i_user_time
=
(
*
index
).
RefreshChapters
(
b_ordered
,
i_user_time
);
i_user_time
=
(
*
index
).
RefreshChapters
(
b_ordered
,
i_user_time
);
...
@@ -3468,13 +3474,13 @@ int64_t chapter_item_t::RefreshChapters( bool b_ordered, int64_t i_prev_user_tim
...
@@ -3468,13 +3474,13 @@ int64_t chapter_item_t::RefreshChapters( bool b_ordered, int64_t i_prev_user_tim
return
i_user_end_time
;
return
i_user_end_time
;
}
}
mtime_t
chapter_edition_
t
::
Duration
()
const
mtime_t
chapter_edition_
c
::
Duration
()
const
{
{
mtime_t
i_result
=
0
;
mtime_t
i_result
=
0
;
if
(
sub_chapters
.
size
()
)
if
(
sub_chapters
.
size
()
)
{
{
std
::
vector
<
chapter_item_
t
>::
const_iterator
index
=
sub_chapters
.
end
();
std
::
vector
<
chapter_item_
c
>::
const_iterator
index
=
sub_chapters
.
end
();
index
--
;
index
--
;
i_result
=
(
*
index
).
i_user_end_time
;
i_result
=
(
*
index
).
i_user_end_time
;
}
}
...
@@ -3482,15 +3488,15 @@ mtime_t chapter_edition_t::Duration() const
...
@@ -3482,15 +3488,15 @@ mtime_t chapter_edition_t::Duration() const
return
i_result
;
return
i_result
;
}
}
const
chapter_item_
t
*
chapter_item_t
::
FindTimecode
(
mtime_t
i_user_timecode
)
const
const
chapter_item_
c
*
chapter_item_c
::
FindTimecode
(
mtime_t
i_user_timecode
)
const
{
{
const
chapter_item_
t
*
psz_result
=
NULL
;
const
chapter_item_
c
*
psz_result
=
NULL
;
if
(
i_user_timecode
>=
i_user_start_time
&&
if
(
i_user_timecode
>=
i_user_start_time
&&
(
i_user_timecode
<
i_user_end_time
||
(
i_user_timecode
<
i_user_end_time
||
(
i_user_start_time
==
i_user_end_time
&&
i_user_timecode
==
i_user_end_time
)))
(
i_user_start_time
==
i_user_end_time
&&
i_user_timecode
==
i_user_end_time
)))
{
{
std
::
vector
<
chapter_item_
t
>::
const_iterator
index
=
sub_chapters
.
begin
();
std
::
vector
<
chapter_item_
c
>::
const_iterator
index
=
sub_chapters
.
begin
();
while
(
index
!=
sub_chapters
.
end
()
&&
psz_result
==
NULL
)
while
(
index
!=
sub_chapters
.
end
()
&&
psz_result
==
NULL
)
{
{
psz_result
=
(
*
index
).
FindTimecode
(
i_user_timecode
);
psz_result
=
(
*
index
).
FindTimecode
(
i_user_timecode
);
...
@@ -3504,14 +3510,14 @@ const chapter_item_t *chapter_item_t::FindTimecode( mtime_t i_user_timecode ) co
...
@@ -3504,14 +3510,14 @@ const chapter_item_t *chapter_item_t::FindTimecode( mtime_t i_user_timecode ) co
return
psz_result
;
return
psz_result
;
}
}
void
demux_sys_
t
::
PreloadFamily
(
const
matroska_segment_t
&
of_segment
)
void
demux_sys_
c
::
PreloadFamily
(
const
matroska_segment_c
&
of_segment
)
{
{
for
(
size_t
i
=
0
;
i
<
opened_segments
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
opened_segments
.
size
();
i
++
)
{
{
opened_segments
[
i
]
->
PreloadFamily
(
of_segment
);
opened_segments
[
i
]
->
PreloadFamily
(
of_segment
);
}
}
}
}
bool
matroska_segment_
t
::
PreloadFamily
(
const
matroska_segment_t
&
of_segment
)
bool
matroska_segment_
c
::
PreloadFamily
(
const
matroska_segment_c
&
of_segment
)
{
{
if
(
b_preloaded
)
if
(
b_preloaded
)
return
false
;
return
false
;
...
@@ -3529,12 +3535,12 @@ bool matroska_segment_t::PreloadFamily( const matroska_segment_t & of_segment )
...
@@ -3529,12 +3535,12 @@ bool matroska_segment_t::PreloadFamily( const matroska_segment_t & of_segment )
}
}
// preload all the linked segments for all preloaded segments
// preload all the linked segments for all preloaded segments
void
demux_sys_
t
::
PreloadLinked
(
matroska_segment_t
*
p_segment
)
void
demux_sys_
c
::
PreloadLinked
(
matroska_segment_c
*
p_segment
)
{
{
size_t
i_preloaded
,
i
;
size_t
i_preloaded
,
i
;
delete
p_current_segment
;
delete
p_current_segment
;
p_current_segment
=
new
virtual_segment_
t
(
p_segment
);
p_current_segment
=
new
virtual_segment_
c
(
p_segment
);
// fill our current virtual segment with all hard linked segments
// fill our current virtual segment with all hard linked segments
do
{
do
{
...
@@ -3550,7 +3556,7 @@ void demux_sys_t::PreloadLinked( matroska_segment_t *p_segment )
...
@@ -3550,7 +3556,7 @@ void demux_sys_t::PreloadLinked( matroska_segment_t *p_segment )
p_current_segment
->
PreloadLinked
(
);
p_current_segment
->
PreloadLinked
(
);
}
}
bool
demux_sys_
t
::
PreparePlayback
(
)
bool
demux_sys_
c
::
PreparePlayback
(
)
{
{
p_current_segment
->
LoadCues
();
p_current_segment
->
LoadCues
();
f_duration
=
p_current_segment
->
Duration
();
f_duration
=
p_current_segment
->
Duration
();
...
@@ -3563,7 +3569,7 @@ bool demux_sys_t::PreparePlayback( )
...
@@ -3563,7 +3569,7 @@ bool demux_sys_t::PreparePlayback( )
return
p_current_segment
->
Select
(
*
title
);
return
p_current_segment
->
Select
(
*
title
);
}
}
bool
matroska_segment_
t
::
CompareSegmentUIDs
(
const
matroska_segment_t
*
p_item_a
,
const
matroska_segment_t
*
p_item_b
)
bool
matroska_segment_
c
::
CompareSegmentUIDs
(
const
matroska_segment_c
*
p_item_a
,
const
matroska_segment_c
*
p_item_b
)
{
{
EbmlBinary
*
p_itema
=
(
EbmlBinary
*
)(
&
p_item_a
->
segment_uid
);
EbmlBinary
*
p_itema
=
(
EbmlBinary
*
)(
&
p_item_a
->
segment_uid
);
if
(
*
p_itema
==
p_item_b
->
prev_segment_uid
)
if
(
*
p_itema
==
p_item_b
->
prev_segment_uid
)
...
@@ -3579,7 +3585,7 @@ bool matroska_segment_t::CompareSegmentUIDs( const matroska_segment_t * p_item_a
...
@@ -3579,7 +3585,7 @@ bool matroska_segment_t::CompareSegmentUIDs( const matroska_segment_t * p_item_a
return
false
;
return
false
;
}
}
bool
matroska_segment_
t
::
Preload
(
)
bool
matroska_segment_
c
::
Preload
(
)
{
{
if
(
b_preloaded
)
if
(
b_preloaded
)
return
false
;
return
false
;
...
@@ -3643,7 +3649,7 @@ bool matroska_segment_t::Preload( )
...
@@ -3643,7 +3649,7 @@ bool matroska_segment_t::Preload( )
return
true
;
return
true
;
}
}
matroska_segment_
t
*
demux_sys_t
::
FindSegment
(
const
EbmlBinary
&
uid
)
const
matroska_segment_
c
*
demux_sys_c
::
FindSegment
(
const
EbmlBinary
&
uid
)
const
{
{
for
(
size_t
i
=
0
;
i
<
opened_segments
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
opened_segments
.
size
();
i
++
)
{
{
...
@@ -3653,19 +3659,19 @@ matroska_segment_t *demux_sys_t::FindSegment( const EbmlBinary & uid ) const
...
@@ -3653,19 +3659,19 @@ matroska_segment_t *demux_sys_t::FindSegment( const EbmlBinary & uid ) const
return
NULL
;
return
NULL
;
}
}
void
virtual_segment_
t
::
Sort
()
void
virtual_segment_
c
::
Sort
()
{
{
// keep the current segment index
// keep the current segment index
matroska_segment_
t
*
p_segment
=
linked_segments
[
i_current_segment
];
matroska_segment_
c
*
p_segment
=
linked_segments
[
i_current_segment
];
std
::
sort
(
linked_segments
.
begin
(),
linked_segments
.
end
(),
matroska_segment_
t
::
CompareSegmentUIDs
);
std
::
sort
(
linked_segments
.
begin
(),
linked_segments
.
end
(),
matroska_segment_
c
::
CompareSegmentUIDs
);
for
(
i_current_segment
=
0
;
i_current_segment
<
linked_segments
.
size
();
i_current_segment
++
)
for
(
i_current_segment
=
0
;
i_current_segment
<
linked_segments
.
size
();
i_current_segment
++
)
if
(
linked_segments
[
i_current_segment
]
==
p_segment
)
if
(
linked_segments
[
i_current_segment
]
==
p_segment
)
break
;
break
;
}
}
size_t
virtual_segment_
t
::
AddSegment
(
matroska_segment_t
*
p_segment
)
size_t
virtual_segment_
c
::
AddSegment
(
matroska_segment_c
*
p_segment
)
{
{
size_t
i
;
size_t
i
;
// check if it's not already in here
// check if it's not already in here
...
@@ -3693,7 +3699,7 @@ size_t virtual_segment_t::AddSegment( matroska_segment_t *p_segment )
...
@@ -3693,7 +3699,7 @@ size_t virtual_segment_t::AddSegment( matroska_segment_t *p_segment )
return
0
;
return
0
;
}
}
void
virtual_segment_
t
::
PreloadLinked
(
)
void
virtual_segment_
c
::
PreloadLinked
(
)
{
{
for
(
size_t
i
=
0
;
i
<
linked_segments
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
linked_segments
.
size
();
i
++
)
{
{
...
@@ -3702,13 +3708,13 @@ void virtual_segment_t::PreloadLinked( )
...
@@ -3702,13 +3708,13 @@ void virtual_segment_t::PreloadLinked( )
i_current_edition
=
linked_segments
[
0
]
->
i_default_edition
;
i_current_edition
=
linked_segments
[
0
]
->
i_default_edition
;
}
}
mtime_t
virtual_segment_
t
::
Duration
()
const
mtime_t
virtual_segment_
c
::
Duration
()
const
{
{
mtime_t
i_duration
;
mtime_t
i_duration
;
if
(
linked_segments
.
size
()
==
0
)
if
(
linked_segments
.
size
()
==
0
)
i_duration
=
0
;
i_duration
=
0
;
else
{
else
{
matroska_segment_
t
*
p_last_segment
=
linked_segments
[
linked_segments
.
size
()
-
1
];
matroska_segment_
c
*
p_last_segment
=
linked_segments
[
linked_segments
.
size
()
-
1
];
// p_last_segment->ParseCluster( );
// p_last_segment->ParseCluster( );
i_duration
=
p_last_segment
->
i_start_time
/
1000
+
p_last_segment
->
i_duration
;
i_duration
=
p_last_segment
->
i_start_time
/
1000
+
p_last_segment
->
i_duration
;
...
@@ -3716,7 +3722,7 @@ mtime_t virtual_segment_t::Duration() const
...
@@ -3716,7 +3722,7 @@ mtime_t virtual_segment_t::Duration() const
return
i_duration
;
return
i_duration
;
}
}
void
virtual_segment_
t
::
LoadCues
(
)
void
virtual_segment_
c
::
LoadCues
(
)
{
{
for
(
size_t
i
=
0
;
i
<
linked_segments
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
linked_segments
.
size
();
i
++
)
{
{
...
@@ -3724,7 +3730,7 @@ void virtual_segment_t::LoadCues( )
...
@@ -3724,7 +3730,7 @@ void virtual_segment_t::LoadCues( )
}
}
}
}
void
virtual_segment_
t
::
AppendUID
(
const
EbmlBinary
&
UID
)
void
virtual_segment_
c
::
AppendUID
(
const
EbmlBinary
&
UID
)
{
{
if
(
UID
.
GetBuffer
()
==
NULL
)
if
(
UID
.
GetBuffer
()
==
NULL
)
return
;
return
;
...
@@ -3737,7 +3743,7 @@ void virtual_segment_t::AppendUID( const EbmlBinary & UID )
...
@@ -3737,7 +3743,7 @@ void virtual_segment_t::AppendUID( const EbmlBinary & UID )
linked_uids
.
push_back
(
*
(
KaxSegmentUID
*
)(
&
UID
)
);
linked_uids
.
push_back
(
*
(
KaxSegmentUID
*
)(
&
UID
)
);
}
}
void
matroska_segment_
t
::
Seek
(
mtime_t
i_date
,
mtime_t
i_time_offset
)
void
matroska_segment_
c
::
Seek
(
mtime_t
i_date
,
mtime_t
i_time_offset
)
{
{
KaxBlock
*
block
;
KaxBlock
*
block
;
int
i_track_skipping
;
int
i_track_skipping
;
...
@@ -3841,9 +3847,9 @@ void matroska_segment_t::Seek( mtime_t i_date, mtime_t i_time_offset )
...
@@ -3841,9 +3847,9 @@ void matroska_segment_t::Seek( mtime_t i_date, mtime_t i_time_offset )
#undef tk
#undef tk
}
}
void
virtual_segment_
t
::
Seek
(
demux_t
&
demuxer
,
mtime_t
i_date
,
mtime_t
i_time_offset
,
const
chapter_item_t
*
psz_chapter
)
void
virtual_segment_
c
::
Seek
(
demux_t
&
demuxer
,
mtime_t
i_date
,
mtime_t
i_time_offset
,
const
chapter_item_c
*
psz_chapter
)
{
{
demux_sys_
t
*
p_sys
=
demuxer
.
p_sys
;
demux_sys_
c
*
p_sys
=
demuxer
.
p_sys
;
size_t
i
;
size_t
i
;
// find the actual time for an ordered edition
// find the actual time for an ordered edition
...
@@ -3884,7 +3890,7 @@ void virtual_segment_t::Seek( demux_t & demuxer, mtime_t i_date, mtime_t i_time_
...
@@ -3884,7 +3890,7 @@ void virtual_segment_t::Seek( demux_t & demuxer, mtime_t i_date, mtime_t i_time_
linked_segments
[
i
]
->
Seek
(
i_date
,
i_time_offset
);
linked_segments
[
i
]
->
Seek
(
i_date
,
i_time_offset
);
}
}
void
chapter_codec_cmds_
t
::
AddCommand
(
const
KaxChapterProcessCommand
&
command
)
void
chapter_codec_cmds_
c
::
AddCommand
(
const
KaxChapterProcessCommand
&
command
)
{
{
size_t
i
;
size_t
i
;
...
@@ -3913,10 +3919,10 @@ void chapter_codec_cmds_t::AddCommand( const KaxChapterProcessCommand & command
...
@@ -3913,10 +3919,10 @@ void chapter_codec_cmds_t::AddCommand( const KaxChapterProcessCommand & command
during_cmds
.
push_back
(
*
p_data
);
during_cmds
.
push_back
(
*
p_data
);
break
;
break
;
case
1
:
case
1
:
during
_cmds
.
push_back
(
*
p_data
);
enter
_cmds
.
push_back
(
*
p_data
);
break
;
break
;
case
2
:
case
2
:
during
_cmds
.
push_back
(
*
p_data
);
leave
_cmds
.
push_back
(
*
p_data
);
break
;
break
;
default:
default:
delete
p_data
;
delete
p_data
;
...
@@ -3925,12 +3931,12 @@ void chapter_codec_cmds_t::AddCommand( const KaxChapterProcessCommand & command
...
@@ -3925,12 +3931,12 @@ void chapter_codec_cmds_t::AddCommand( const KaxChapterProcessCommand & command
}
}
}
}
bool
chapter_item_
t
::
Enter
()
const
bool
chapter_item_
c
::
Enter
()
const
{
{
return
true
;
return
true
;
}
}
bool
chapter_item_
t
::
Leave
()
const
bool
chapter_item_
c
::
Leave
()
const
{
{
return
true
;
return
true
;
}
}
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