[vlc-commits] MKV: Handle file with no duration or 0 duration

Denis Charmet git at videolan.org
Tue Feb 28 00:26:38 CET 2012


vlc | branch: master | Denis Charmet <typx at dinauz.org> | Tue Feb 28 00:22:14 2012 +0100| [3c5f2a8ccadc870bbce6c58ac6f292886f4899dd] | committer: Jean-Baptiste Kempf

MKV: Handle file with no duration or 0 duration

Close #6137
Fixes issue in http://forum.videolan.org/viewtopic.php?f=14&t=98525

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3c5f2a8ccadc870bbce6c58ac6f292886f4899dd
---

 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 * );



More information about the vlc-commits mailing list