Matroska seems to stupidly store dts instead of pts for real video codec.
authorLaurent Aimar <fenrir@videolan.org>
Sat, 28 Mar 2009 16:49:52 +0000 (17:49 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Sat, 28 Mar 2009 16:50:55 +0000 (17:50 +0100)
modules/demux/mkv/matroska_segment.cpp
modules/demux/mkv/matroska_segment_parse.cpp
modules/demux/mkv/mkv.cpp
modules/demux/mkv/mkv.hpp

index 6002db2..984e078 100644 (file)
@@ -664,6 +664,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
                     memcpy( tracks[i_track]->fmt.p_extra, &p_bih[1], tracks[i_track]->fmt.i_extra );
                 }
             }
+            p_tk->b_dts_only = true;
         }
         else if( !strcmp( tracks[i_track]->psz_codec, "V_MPEG1" ) ||
                  !strcmp( tracks[i_track]->psz_codec, "V_MPEG2" ) )
@@ -760,6 +761,7 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
                     memcpy( p_fmt->p_extra, &p_tk->p_extra_data[26], p_fmt->i_extra );
                 }
             }
+            p_tk->b_dts_only = true;
         }
         else if( !strncmp( tracks[i_track]->psz_codec, "V_DIRAC", 7 ) )
         {
index 8933f34..fb1b233 100644 (file)
@@ -184,6 +184,7 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
     tk->i_extra_data = 0;
     tk->p_extra_data = NULL;
     tk->psz_codec = NULL;
+    tk->b_dts_only = false;
     tk->i_default_duration = 0;
     tk->f_timecodescale = 1.0;
 
index 2e6ae65..371386f 100644 (file)
@@ -578,9 +578,8 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simp
         }
         else
         {
-            if( !strcmp( tk->psz_codec, "V_MS/VFW/FOURCC" ) )
+            if( tk->b_dts_only )
             {
-                // in VFW we have no idea about B frames
                 p_block->i_pts = 0;
                 p_block->i_dts = i_pts;
             }
index 35db8af..c01e5ff 100644 (file)
@@ -194,6 +194,7 @@ typedef struct
     uint8_t      *p_extra_data;
 
     char         *psz_codec;
+    bool         b_dts_only;
 
     uint64_t     i_default_duration;
     float        f_timecodescale;