]> git.sesse.net Git - vlc/commitdiff
libvlc: Make sure calling get_duration() triggers preparsing and returns -1 if durati...
authorPierre d'Herbemont <pdherbemont@free.fr>
Sat, 16 Jan 2010 14:41:43 +0000 (15:41 +0100)
committerPierre d'Herbemont <pdherbemont@free.fr>
Sat, 16 Jan 2010 17:26:08 +0000 (18:26 +0100)
src/control/media.c

index 940e420a1338c5a9105179e254a66f7b71955510..abd19f5646d2babf88c465c4ff48f7ea61d250a1 100644 (file)
@@ -592,6 +592,11 @@ libvlc_media_get_duration( libvlc_media_t * p_md, libvlc_exception_t *p_e )
         return -1;
     }
 
+    preparse_if_needed( p_md );
+
+    if (!input_item_IsPreparsed( p_md->p_input_item ))
+        return -1;
+
     return input_item_GetDuration( p_md->p_input_item ) / 1000;
 }