[vlc-commits] MKV: set the I frame flag when we know it's a keyframe
Steve Lhomme
git at videolan.org
Fri Feb 27 11:56:52 CET 2015
vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Fri Feb 27 11:08:03 2015 +0100| [1ae37b27f4c6f6a4fc3d17abe8a81c07f791f1b3] | committer: Jean-Baptiste Kempf
MKV: set the I frame flag when we know it's a keyframe
Move the comment about the DTS availability where it's used
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1ae37b27f4c6f6a4fc3d17abe8a81c07f791f1b3
---
modules/demux/mkv/mkv.cpp | 13 +++++++------
modules/demux/mkv/mkv.hpp | 3 ++-
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 2d2a12a..7b8abb1 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -486,7 +486,8 @@ static void Seek( demux_t *p_demux, mtime_t i_date, double f_percent, virtual_ch
/* Needed by matroska_segment::Seek() and Seek */
void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock,
- mtime_t i_pts, mtime_t i_duration, bool f_mandatory )
+ mtime_t i_pts, mtime_t i_duration, bool b_key_picture,
+ bool b_discardable_picture )
{
demux_sys_t *p_sys = p_demux->p_sys;
matroska_segment_c *p_segment = p_sys->p_current_segment->CurrentSegment();
@@ -554,13 +555,10 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
if( simpleblock != NULL )
{
data = &simpleblock->GetBuffer(i_frame);
- // condition when the DTS is correct (keyframe or B frame == NOT P frame)
- f_mandatory = simpleblock->IsDiscardable() || simpleblock->IsKeyframe();
}
else
{
data = &block->GetBuffer(i_frame);
- // condition when the DTS is correct (keyframe or B frame == NOT P frame)
}
frame_size += data->Size();
if( !data->Buffer() || data->Size() > frame_size || frame_size > block_size )
@@ -633,6 +631,8 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
break;
}
+ if ( b_key_picture )
+ p_block->i_flags |= BLOCK_FLAG_TYPE_I;
if( tk->fmt.i_cat != VIDEO_ES )
{
@@ -669,7 +669,8 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
else
{
p_block->i_pts = i_pts;
- if ( f_mandatory )
+ // condition when the DTS is correct (keyframe or B frame == NOT P frame)
+ if ( b_key_picture || b_discardable_picture )
p_block->i_dts = p_block->i_pts;
else
p_block->i_dts = min( i_pts, tk->i_last_dts + ( mtime_t )( tk->i_default_duration / 1000 ) );
@@ -806,7 +807,7 @@ static int Demux( demux_t *p_demux)
break;
}
- BlockDecode( p_demux, block, simpleblock, p_sys->i_pts, i_block_duration, b_key_picture || b_discardable_picture );
+ BlockDecode( p_demux, block, simpleblock, p_sys->i_pts, i_block_duration, b_key_picture, b_discardable_picture );
delete block;
diff --git a/modules/demux/mkv/mkv.hpp b/modules/demux/mkv/mkv.hpp
index 392b9e7..9cf6ccd 100644
--- a/modules/demux/mkv/mkv.hpp
+++ b/modules/demux/mkv/mkv.hpp
@@ -123,7 +123,8 @@ using namespace LIBMATROSKA_NAMESPACE;
using namespace std;
void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock,
- mtime_t i_pts, mtime_t i_duration, bool f_mandatory );
+ mtime_t i_pts, mtime_t i_duration, bool b_key_picture,
+ bool b_discardable_picture );
class attachment_c
{
More information about the vlc-commits
mailing list