]> git.sesse.net Git - vlc/commitdiff
MKV: Handle file with no duration or 0 duration
authorDenis Charmet <typx@dinauz.org>
Mon, 27 Feb 2012 23:22:14 +0000 (00:22 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 27 Feb 2012 23:26:26 +0000 (00:26 +0100)
Close #6137
Fixes issue in http://forum.videolan.org/viewtopic.php?f=14&t=98525

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/demux/mkv/matroska_segment_parse.cpp
modules/demux/mkv/mkv.cpp

index 422fad2f42847e14246dfab43e0ef1f088456800..3964674f02fa4fb3211bdb494e24d4cd64e3c4b9 100644 (file)
@@ -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;
 }
 
 
index e8a67ea0dcb0a5bc82b3b2f899f58b2b7c50b563..0c983678198780cc0751fc3503a632203677281c 100644 (file)
@@ -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 * );