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
c53044e0
Commit
c53044e0
authored
May 25, 2005
by
Steve Lhomme
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mkv.cpp: better handling of timecodes when B frames are involved
parent
4a3c6a9f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
7 deletions
+24
-7
modules/demux/mkv.cpp
modules/demux/mkv.cpp
+24
-7
No files found.
modules/demux/mkv.cpp
View file @
c53044e0
...
@@ -1267,6 +1267,7 @@ public:
...
@@ -1267,6 +1267,7 @@ public:
demux_sys_t
(
demux_t
&
demux
)
demux_sys_t
(
demux_t
&
demux
)
:
demuxer
(
demux
)
:
demuxer
(
demux
)
,
i_pts
(
0
)
,
i_pts
(
0
)
,
i_last_dts
(
0
)
,
i_start_pts
(
0
)
,
i_start_pts
(
0
)
,
i_chapter_time
(
0
)
,
i_chapter_time
(
0
)
,
meta
(
NULL
)
,
meta
(
NULL
)
...
@@ -1299,6 +1300,7 @@ public:
...
@@ -1299,6 +1300,7 @@ public:
demux_t
&
demuxer
;
demux_t
&
demuxer
;
mtime_t
i_pts
;
mtime_t
i_pts
;
mtime_t
i_last_dts
;
mtime_t
i_start_pts
;
mtime_t
i_start_pts
;
mtime_t
i_chapter_time
;
mtime_t
i_chapter_time
;
...
@@ -1797,7 +1799,7 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
...
@@ -1797,7 +1799,7 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
msg_Err
(
p_demux
,
"unknown track number=%d"
,
block
->
TrackNum
()
);
msg_Err
(
p_demux
,
"unknown track number=%d"
,
block
->
TrackNum
()
);
return
;
return
;
}
}
if
(
i_pts
<
p_sys
->
i_start_pts
&&
tk
->
fmt
.
i_cat
==
AUDIO_ES
)
if
(
i_pts
+
i_duration
<
p_sys
->
i_start_pts
&&
tk
->
fmt
.
i_cat
==
AUDIO_ES
)
{
{
return
;
/* discard audio packets that shouldn't be rendered */
return
;
/* discard audio packets that shouldn't be rendered */
}
}
...
@@ -1860,6 +1862,7 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
...
@@ -1860,6 +1862,7 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
return
;
return
;
}
}
// TODO implement correct timestamping when B frames are used
// TODO implement correct timestamping when B frames are used
#if 0
if( tk->fmt.i_cat != VIDEO_ES )
if( tk->fmt.i_cat != VIDEO_ES )
{
{
p_block->i_dts = p_block->i_pts = i_pts;
p_block->i_dts = p_block->i_pts = i_pts;
...
@@ -1869,7 +1872,11 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
...
@@ -1869,7 +1872,11 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
p_block->i_pts = i_pts;
p_block->i_pts = i_pts;
p_block->i_dts = p_sys->i_pts;
p_block->i_dts = p_sys->i_pts;
}
}
#else
p_block
->
i_pts
=
i_pts
;
p_block
->
i_dts
=
p_sys
->
i_last_dts
;
#endif
msg_Dbg
(
p_demux
,
"block i_dts: "
I64Fd
" / i_pts: "
I64Fd
,
p_block
->
i_dts
,
p_block
->
i_pts
);
if
(
strcmp
(
tk
->
psz_codec
,
"S_VOBSUB"
)
)
if
(
strcmp
(
tk
->
psz_codec
,
"S_VOBSUB"
)
)
{
{
p_block
->
i_length
=
i_duration
*
1000
;
p_block
->
i_length
=
i_duration
*
1000
;
...
@@ -3138,7 +3145,7 @@ static int Demux( demux_t *p_demux)
...
@@ -3138,7 +3145,7 @@ static int Demux( demux_t *p_demux)
if ( p_chap->i_user_start_time == p_chap->i_user_start_time )
if ( p_chap->i_user_start_time == p_chap->i_user_start_time )
p_vsegment->SelectNext();
p_vsegment->SelectNext();
*/
*/
p_sys
->
i_pts
=
p_chap
->
i_user_end_time
;
p_sys
->
i_
last_dts
=
p_sys
->
i_
pts
=
p_chap
->
i_user_end_time
;
p_sys
->
i_pts
++
;
// trick to avoid staying on segments with no duration and no content
p_sys
->
i_pts
++
;
// trick to avoid staying on segments with no duration and no content
i_return
=
1
;
i_return
=
1
;
...
@@ -3168,20 +3175,30 @@ static int Demux( demux_t *p_demux)
...
@@ -3168,20 +3175,30 @@ static int Demux( demux_t *p_demux)
}
}
}
}
mtime_t
i_pts
,
i_dts
;
mtime_t
i_time
=
block
->
GlobalTimecode
();
mtime_t
i_time
=
block
->
GlobalTimecode
();
if
(
i_block_ref1
!=
0
)
if
(
i_block_ref1
!=
0
)
i_time
+=
min
(
0
,
i_block_ref1
);
i_time
+=
min
(
0
,
i_block_ref1
);
if
(
i_block_ref2
!=
0
)
if
(
i_block_ref2
!=
0
)
i_time
+=
min
(
0
,
i_block_ref2
);
i_time
+=
min
(
0
,
i_block_ref2
);
p_sys
->
i_pts
=
(
p_sys
->
i_chapter_time
+
i_time
)
/
(
mtime_t
)
1000
;
i_pts
=
(
p_sys
->
i_chapter_time
+
block
->
GlobalTimecode
())
/
(
mtime_t
)
1000
;
i_dts
=
(
p_sys
->
i_chapter_time
+
i_time
)
/
(
mtime_t
)
1000
;
if
(
i_dts
!=
i_pts
&&
p_sys
->
i_last_dts
>=
i_dts
)
p_sys
->
i_last_dts
+=
200
;
else
p_sys
->
i_last_dts
=
i_dts
;
p_sys
->
i_pts
=
i_pts
;
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_chapter_time
+
block
->
GlobalTimecode
())
/
(
mtime_t
)
1000
)
>=
p_sys
->
i_start_pts
)
if
(
i_pts
>=
p_sys
->
i_start_pts
)
if
(
p_vsegment
->
UpdateCurrentToChapter
(
*
p_demux
)
)
if
(
p_vsegment
->
UpdateCurrentToChapter
(
*
p_demux
)
)
{
{
i_return
=
1
;
i_return
=
1
;
...
@@ -3207,7 +3224,7 @@ static int Demux( demux_t *p_demux)
...
@@ -3207,7 +3224,7 @@ static int Demux( demux_t *p_demux)
continue
;
continue
;
}
}
BlockDecode
(
p_demux
,
block
,
(
p_sys
->
i_chapter_time
+
block
->
GlobalTimecode
())
/
(
mtime_t
)
1000
,
i_block_duration
);
BlockDecode
(
p_demux
,
block
,
i_pts
,
i_block_duration
);
delete
block
;
delete
block
;
i_block_count
++
;
i_block_count
++
;
...
@@ -5300,7 +5317,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
...
@@ -5300,7 +5317,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_
last_dts
=
sys
.
i_
pts
=
(
sys
.
i_chapter_time
+
block
->
GlobalTimecode
())
/
(
mtime_t
)
1000
;
if
(
i_track
<
tracks
.
size
()
)
if
(
i_track
<
tracks
.
size
()
)
{
{
...
...
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