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
f95fc88f
Commit
f95fc88f
authored
May 22, 2005
by
Steve Lhomme
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mkv.cpp: try to improve timecode and references handling
parent
3be1d2d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
18 deletions
+22
-18
modules/demux/mkv.cpp
modules/demux/mkv.cpp
+22
-18
No files found.
modules/demux/mkv.cpp
View file @
f95fc88f
...
@@ -1616,8 +1616,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
...
@@ -1616,8 +1616,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
int
matroska_segment_c
::
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
=
0
;
*
pi_ref2
=
-
1
;
*
pi_ref2
=
0
;
for
(
;;
)
for
(
;;
)
{
{
...
@@ -1637,7 +1637,7 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, int64_t *pi_ref1, int64
...
@@ -1637,7 +1637,7 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, int64_t *pi_ref1, int64
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
;
idx
.
i_time
=
(
*
pp_block
).
GlobalTimecode
()
/
(
mtime_t
)
1000
;
idx
.
b_key
=
*
pi_ref1
==
-
1
?
VLC_TRUE
:
VLC_FALSE
;
idx
.
b_key
=
*
pi_ref1
==
0
?
VLC_TRUE
:
VLC_FALSE
;
}
}
#undef idx
#undef idx
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
...
@@ -1728,13 +1728,13 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, int64_t *pi_ref1, int64
...
@@ -1728,13 +1728,13 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, int64_t *pi_ref1, int64
KaxReferenceBlock
&
ref
=
*
(
KaxReferenceBlock
*
)
el
;
KaxReferenceBlock
&
ref
=
*
(
KaxReferenceBlock
*
)
el
;
ref
.
ReadData
(
es
.
I_O
()
);
ref
.
ReadData
(
es
.
I_O
()
);
if
(
*
pi_ref1
==
-
1
)
if
(
*
pi_ref1
==
0
)
{
{
*
pi_ref1
=
int64
(
ref
);
*
pi_ref1
=
int64
(
ref
)
*
cluster
->
GlobalTimecodeScale
()
;
}
}
else
else
{
{
*
pi_ref2
=
int64
(
ref
);
*
pi_ref2
=
int64
(
ref
)
*
cluster
->
GlobalTimecodeScale
()
;
}
}
}
}
else
if
(
MKV_IS_ID
(
el
,
KaxClusterSilentTrackNumber
)
)
else
if
(
MKV_IS_ID
(
el
,
KaxClusterSilentTrackNumber
)
)
...
@@ -1866,8 +1866,8 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
...
@@ -1866,8 +1866,8 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
}
}
else
else
{
{
p_block
->
i_
d
ts
=
i_pts
;
p_block
->
i_
p
ts
=
i_pts
;
p_block
->
i_
pts
=
0
;
p_block
->
i_
dts
=
p_sys
->
i_pts
;
}
}
if
(
strcmp
(
tk
->
psz_codec
,
"S_VOBSUB"
)
)
if
(
strcmp
(
tk
->
psz_codec
,
"S_VOBSUB"
)
)
...
@@ -3168,14 +3168,20 @@ static int Demux( demux_t *p_demux)
...
@@ -3168,14 +3168,20 @@ static int Demux( demux_t *p_demux)
}
}
}
}
p_sys
->
i_pts
=
p_sys
->
i_chapter_time
+
block
->
GlobalTimecode
()
/
(
mtime_t
)
1000
;
mtime_t
i_time
=
block
->
GlobalTimecode
();
if
(
i_block_ref1
!=
0
)
i_time
+=
min
(
0
,
i_block_ref1
);
if
(
i_block_ref2
!=
0
)
i_time
+=
min
(
0
,
i_block_ref2
);
p_sys
->
i_pts
=
(
p_sys
->
i_chapter_time
+
i_time
)
/
(
mtime_t
)
1000
;
if
(
p_sys
->
i_pts
>=
p_sys
->
i_start_pts
)
if
(
p_sys
->
i_pts
>=
p_sys
->
i_start_pts
)
{
{
es_out_Control
(
p_demux
->
out
,
ES_OUT_SET_PCR
,
p_sys
->
i_pts
);
es_out_Control
(
p_demux
->
out
,
ES_OUT_SET_PCR
,
p_sys
->
i_pts
);
}
}
if
(
p_sys
->
i_pts
>=
p_sys
->
i_start_pts
)
if
(
(
(
p_sys
->
i_chapter_time
+
block
->
GlobalTimecode
())
/
(
mtime_t
)
1000
)
>=
p_sys
->
i_start_pts
)
if
(
p_vsegment
->
UpdateCurrentToChapter
(
*
p_demux
)
)
if
(
p_vsegment
->
UpdateCurrentToChapter
(
*
p_demux
)
)
{
{
i_return
=
1
;
i_return
=
1
;
...
@@ -3201,7 +3207,7 @@ static int Demux( demux_t *p_demux)
...
@@ -3201,7 +3207,7 @@ static int Demux( demux_t *p_demux)
continue
;
continue
;
}
}
BlockDecode
(
p_demux
,
block
,
p_sys
->
i_pts
,
i_block_duration
);
BlockDecode
(
p_demux
,
block
,
(
p_sys
->
i_chapter_time
+
block
->
GlobalTimecode
())
/
(
mtime_t
)
1000
,
i_block_duration
);
delete
block
;
delete
block
;
i_block_count
++
;
i_block_count
++
;
...
@@ -4060,6 +4066,9 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
...
@@ -4060,6 +4066,9 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
msg_Dbg
(
&
sys
.
demuxer
,
"| | | + Track Video"
);
msg_Dbg
(
&
sys
.
demuxer
,
"| | | + Track Video"
);
tk
->
f_fps
=
0.0
;
tk
->
f_fps
=
0.0
;
tk
->
fmt
.
video
.
i_frame_rate_base
=
(
unsigned
int
)(
tk
->
i_default_duration
/
1000
);
tk
->
fmt
.
video
.
i_frame_rate
=
1000000
;
for
(
j
=
0
;
j
<
tkv
->
ListSize
();
j
++
)
for
(
j
=
0
;
j
<
tkv
->
ListSize
();
j
++
)
{
{
EbmlElement
*
l
=
(
*
tkv
)[
j
];
EbmlElement
*
l
=
(
*
tkv
)[
j
];
...
@@ -4137,11 +4146,6 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
...
@@ -4137,11 +4146,6 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
}
}
if
(
tk
->
fmt
.
video
.
i_visible_height
&&
tk
->
fmt
.
video
.
i_visible_width
)
if
(
tk
->
fmt
.
video
.
i_visible_height
&&
tk
->
fmt
.
video
.
i_visible_width
)
tk
->
fmt
.
video
.
i_aspect
=
VOUT_ASPECT_FACTOR
*
tk
->
fmt
.
video
.
i_visible_width
/
tk
->
fmt
.
video
.
i_visible_height
;
tk
->
fmt
.
video
.
i_aspect
=
VOUT_ASPECT_FACTOR
*
tk
->
fmt
.
video
.
i_visible_width
/
tk
->
fmt
.
video
.
i_visible_height
;
if
(
tk
->
f_fps
)
{
tk
->
fmt
.
video
.
i_frame_rate
=
(
unsigned
int
)(
tk
->
f_fps
*
1001
);
tk
->
fmt
.
video
.
i_frame_rate_base
=
1001
;
}
}
}
else
if
(
MKV_IS_ID
(
l
,
KaxTrackAudio
)
)
else
if
(
MKV_IS_ID
(
l
,
KaxTrackAudio
)
)
{
{
...
@@ -5296,7 +5300,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
...
@@ -5296,7 +5300,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
}
}
}
}
sys
.
i_pts
=
sys
.
i_chapter_time
+
block
->
GlobalTimecode
(
)
/
(
mtime_t
)
1000
;
sys
.
i_pts
=
(
sys
.
i_chapter_time
+
block
->
GlobalTimecode
()
)
/
(
mtime_t
)
1000
;
if
(
i_track
<
tracks
.
size
()
)
if
(
i_track
<
tracks
.
size
()
)
{
{
...
@@ -5307,7 +5311,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
...
@@ -5307,7 +5311,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
}
}
else
if
(
tracks
[
i_track
]
->
fmt
.
i_cat
==
VIDEO_ES
)
else
if
(
tracks
[
i_track
]
->
fmt
.
i_cat
==
VIDEO_ES
)
{
{
if
(
i_block_ref1
==
-
1
&&
tracks
[
i_track
]
->
b_search_keyframe
)
if
(
i_block_ref1
==
0
&&
tracks
[
i_track
]
->
b_search_keyframe
)
{
{
tracks
[
i_track
]
->
b_search_keyframe
=
VLC_FALSE
;
tracks
[
i_track
]
->
b_search_keyframe
=
VLC_FALSE
;
i_track_skipping
--
;
i_track_skipping
--
;
...
...
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