Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
78d2cf9c
Commit
78d2cf9c
authored
Feb 24, 2005
by
Steve Lhomme
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mkv.cpp: add more code to support ordered chapters
parent
88ba995a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
6 deletions
+66
-6
modules/demux/mkv.cpp
modules/demux/mkv.cpp
+66
-6
No files found.
modules/demux/mkv.cpp
View file @
78d2cf9c
...
@@ -316,10 +316,21 @@ typedef struct
...
@@ -316,10 +316,21 @@ typedef struct
class
chapter_item_t
class
chapter_item_t
{
{
public:
public:
chapter_item_t
()
:
i_start_time
(
0
)
,
i_end_time
(
-
1
)
,
i_user_start_time
(
-
1
)
,
i_user_end_time
(
-
1
)
,
i_current_sub_chapter
(
-
1
)
,
i_seekpoint_num
(
-
1
)
{}
int64_t
RefreshChapters
(
bool
b_ordered
,
int64_t
i_prev_user_time
);
int64_t
i_start_time
,
i_end_time
;
int64_t
i_start_time
,
i_end_time
;
int64_t
i_
absolute_start
_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_t
>
sub_chapters
;
int
i_current_sub_chapter
;
int
i_current_sub_chapter
;
int
i_seekpoint_num
;
int
i_seekpoint_num
;
};
};
...
@@ -330,6 +341,8 @@ public:
...
@@ -330,6 +341,8 @@ public:
:
i_uid
(
-
1
)
:
i_uid
(
-
1
)
,
b_ordered
(
false
)
,
b_ordered
(
false
)
{}
{}
void
RefreshChapters
();
std
::
vector
<
chapter_item_t
>
chapters
;
std
::
vector
<
chapter_item_t
>
chapters
;
int64_t
i_uid
;
int64_t
i_uid
;
...
@@ -1601,7 +1614,6 @@ static int Demux( demux_t *p_demux)
...
@@ -1601,7 +1614,6 @@ static int Demux( demux_t *p_demux)
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
mtime_t
i_start_pts
;
mtime_t
i_start_pts
;
int
i_block_count
=
0
;
int
i_block_count
=
0
;
int
i_chapter
;
KaxBlock
*
block
;
KaxBlock
*
block
;
int64_t
i_block_duration
;
int64_t
i_block_duration
;
...
@@ -2847,15 +2859,15 @@ static void ParseChapters( demux_t *p_demux, EbmlElement *chapters )
...
@@ -2847,15 +2859,15 @@ static void ParseChapters( demux_t *p_demux, EbmlElement *chapters )
}
}
else
if
(
MKV_IS_ID
(
l
,
KaxEditionUID
)
)
else
if
(
MKV_IS_ID
(
l
,
KaxEditionUID
)
)
{
{
edition
.
i_uid
=
uint64
(
*
static_cast
<
KaxEditionUID
*>
(
l
));
edition
.
i_uid
=
uint64
(
*
static_cast
<
KaxEditionUID
*>
(
l
));
}
}
else
if
(
MKV_IS_ID
(
l
,
KaxEditionFlagOrdered
)
)
else
if
(
MKV_IS_ID
(
l
,
KaxEditionFlagOrdered
)
)
{
{
edition
.
b_ordered
=
uint8
(
*
static_cast
<
KaxEditionFlagOrdered
*>
(
l
))
!=
0
;
edition
.
b_ordered
=
uint8
(
*
static_cast
<
KaxEditionFlagOrdered
*>
(
l
))
!=
0
;
}
}
else
if
(
MKV_IS_ID
(
l
,
KaxEditionFlagDefault
)
)
else
if
(
MKV_IS_ID
(
l
,
KaxEditionFlagDefault
)
)
{
{
if
(
uint8
(
*
static_cast
<
KaxEditionFlagDefault
*>
(
l
))
!=
0
)
if
(
uint8
(
*
static_cast
<
KaxEditionFlagDefault
*>
(
l
))
!=
0
)
p_sys
->
i_current_edition
=
p_sys
->
editions
.
size
();
p_sys
->
i_current_edition
=
p_sys
->
editions
.
size
();
}
}
else
else
...
@@ -2871,6 +2883,11 @@ static void ParseChapters( demux_t *p_demux, EbmlElement *chapters )
...
@@ -2871,6 +2883,11 @@ static void ParseChapters( demux_t *p_demux, EbmlElement *chapters )
}
}
}
}
for
(
i
=
0
;
i
<
p_sys
->
editions
.
size
();
i
++
)
{
p_sys
->
editions
[
i
].
RefreshChapters
();
}
p_sys
->
i_current_edition
=
i_default_edition
;
p_sys
->
i_current_edition
=
i_default_edition
;
if
(
p_sys
->
editions
[
i_default_edition
].
b_ordered
)
if
(
p_sys
->
editions
[
i_default_edition
].
b_ordered
)
...
@@ -3006,3 +3023,46 @@ static char * UTF8ToStr( const UTFstring &u )
...
@@ -3006,3 +3023,46 @@ static char * UTF8ToStr( const UTFstring &u )
return
dst
;
return
dst
;
}
}
void
chapter_edition_t
::
RefreshChapters
()
{
int64_t
i_prev_user_time
=
0
;
std
::
vector
<
chapter_item_t
>::
iterator
index
=
chapters
.
begin
();
while
(
index
!=
chapters
.
end
()
)
{
i_prev_user_time
=
(
*
index
).
RefreshChapters
(
b_ordered
,
i_prev_user_time
);
index
++
;
}
}
int64_t
chapter_item_t
::
RefreshChapters
(
bool
b_ordered
,
int64_t
i_prev_user_time
)
{
int64_t
i_user_time
=
i_prev_user_time
;
// first the sub-chapters, and then ourself
std
::
vector
<
chapter_item_t
>::
iterator
index
=
sub_chapters
.
begin
();
while
(
index
!=
sub_chapters
.
end
()
)
{
i_user_time
=
(
*
index
).
RefreshChapters
(
b_ordered
,
i_user_time
);
index
++
;
}
if
(
b_ordered
)
{
i_user_start_time
=
i_prev_user_time
;
if
(
i_end_time
!=
-
1
&&
i_user_time
==
i_prev_user_time
)
{
i_user_end_time
=
i_user_start_time
-
i_start_time
+
i_end_time
;
}
else
{
i_user_end_time
=
i_user_start_time
;
}
}
else
{
i_user_start_time
=
i_start_time
;
i_user_end_time
=
i_end_time
;
}
return
i_user_end_time
;
}
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