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
fa2eb0b5
Commit
fa2eb0b5
authored
Mar 28, 2005
by
Steve Lhomme
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mkv.cpp: compute the correct duration even when some linked segments are missing
parent
1f08a9d3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
5 deletions
+39
-5
modules/demux/mkv.cpp
modules/demux/mkv.cpp
+39
-5
No files found.
modules/demux/mkv.cpp
View file @
fa2eb0b5
...
@@ -385,6 +385,7 @@ public:
...
@@ -385,6 +385,7 @@ public:
,
es
(
estream
)
,
es
(
estream
)
,
i_timescale
(
MKVD_TIMECODESCALE
)
,
i_timescale
(
MKVD_TIMECODESCALE
)
,
f_duration
(
-
1.0
)
,
f_duration
(
-
1.0
)
,
f_start_time
(
0.0
)
,
i_cues_position
(
-
1
)
,
i_cues_position
(
-
1
)
,
i_chapters_position
(
-
1
)
,
i_chapters_position
(
-
1
)
,
i_tags_position
(
-
1
)
,
i_tags_position
(
-
1
)
...
@@ -462,6 +463,7 @@ public:
...
@@ -462,6 +463,7 @@ public:
/* duration of the segment */
/* duration of the segment */
float
f_duration
;
float
f_duration
;
float
f_start_time
;
/* all tracks */
/* all tracks */
std
::
vector
<
mkv_track_t
*>
tracks
;
std
::
vector
<
mkv_track_t
*>
tracks
;
...
@@ -514,6 +516,7 @@ public:
...
@@ -514,6 +516,7 @@ public:
void
ParseTracks
(
EbmlElement
*
tracks
);
void
ParseTracks
(
EbmlElement
*
tracks
);
void
ParseChapterAtom
(
int
i_level
,
EbmlMaster
*
ca
,
chapter_item_t
&
chapters
);
void
ParseChapterAtom
(
int
i_level
,
EbmlMaster
*
ca
,
chapter_item_t
&
chapters
);
void
ParseTrackEntry
(
EbmlMaster
*
m
);
void
ParseTrackEntry
(
EbmlMaster
*
m
);
void
ParseCluster
(
);
void
IndexAppendCluster
(
KaxCluster
*
cluster
);
void
IndexAppendCluster
(
KaxCluster
*
cluster
);
void
LoadCues
(
);
void
LoadCues
(
);
void
LoadTags
(
);
void
LoadTags
(
);
...
@@ -3150,6 +3153,33 @@ void matroska_segment_t::ParseChapters( EbmlElement *chapters )
...
@@ -3150,6 +3153,33 @@ void matroska_segment_t::ParseChapters( EbmlElement *chapters )
}
}
}
}
void
matroska_segment_t
::
ParseCluster
(
)
{
EbmlElement
*
el
;
EbmlMaster
*
m
;
unsigned
int
i
;
int
i_upper_level
=
0
;
/* Master elements */
m
=
static_cast
<
EbmlMaster
*>
(
cluster
);
m
->
Read
(
es
,
cluster
->
Generic
().
Context
,
i_upper_level
,
el
,
true
);
for
(
i
=
0
;
i
<
m
->
ListSize
();
i
++
)
{
EbmlElement
*
l
=
(
*
m
)[
i
];
if
(
MKV_IS_ID
(
l
,
KaxClusterTimecode
)
)
{
KaxClusterTimecode
&
ctc
=
*
(
KaxClusterTimecode
*
)
l
;
cluster
->
InitTimecode
(
uint64
(
ctc
),
i_timescale
);
break
;
}
}
f_start_time
=
cluster
->
GlobalTimecode
()
/
1000000.0
;
}
/*****************************************************************************
/*****************************************************************************
* InformationCreate:
* InformationCreate:
*****************************************************************************/
*****************************************************************************/
...
@@ -3594,10 +3624,14 @@ void virtual_segment_t::PreloadLinked( )
...
@@ -3594,10 +3624,14 @@ void virtual_segment_t::PreloadLinked( )
float
virtual_segment_t
::
Duration
()
const
float
virtual_segment_t
::
Duration
()
const
{
{
float
f_duration
=
0.0
;
float
f_duration
;
for
(
size_t
i
=
0
;
i
<
linked_segments
.
size
();
i
++
)
if
(
linked_segments
.
size
()
==
0
)
{
f_duration
=
0.0
;
f_duration
+=
linked_segments
[
i
]
->
f_duration
;
else
{
matroska_segment_t
*
p_last_segment
=
linked_segments
[
linked_segments
.
size
()
-
1
];
p_last_segment
->
ParseCluster
(
);
f_duration
=
p_last_segment
->
f_start_time
+
p_last_segment
->
f_duration
;
}
}
return
f_duration
;
return
f_duration
;
}
}
...
...
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