[vlc-devel] [PATCH] Handle files with a 0 duration or no duration

Denis Charmet typx at dinauz.org
Tue Feb 28 00:30:17 CET 2012


Fix #6137
---
 modules/demux/mkv/matroska_segment_parse.cpp |    1 +
 modules/demux/mkv/mkv.cpp                    |   10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 422fad2..3964674 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -840,6 +840,7 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
 
     double f_dur = double(i_duration) * double(i_timescale) / 1000000.0;
     i_duration = mtime_t(f_dur);
+    if( !i_duration ) i_duration = -1;
 }
 
 
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index e8a67ea..0c98367 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -331,9 +331,13 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             return VLC_SUCCESS;
 
         case DEMUX_SET_POSITION:
-            f = (double)va_arg( args, double );
-            Seek( p_demux, -1, f, NULL );
-            return VLC_SUCCESS;
+            if( p_sys->f_duration > 0.0 )
+            {
+                f = (double)va_arg( args, double );
+                Seek( p_demux, -1, f, NULL );
+                return VLC_SUCCESS;
+            }
+            return VLC_EGENERIC;
 
         case DEMUX_GET_TIME:
             pi64 = (int64_t*)va_arg( args, int64_t * );
-- 
1.7.8.3




More information about the vlc-devel mailing list