[vlc-devel] [PATCH] dvdnav: improve stream probing

Petri Hintukainen phintuka at gmail.com
Sun Dec 20 11:04:07 CET 2015


First sectors of DVD are filled with zeros.
Checking boot sector avoids seeking when probing "regular" media files.
---
 modules/access/dvdnav.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index 270007d..48856e2 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -403,6 +403,19 @@ bailout:
  *****************************************************************************/
 static int StreamProbeDVD( stream_t *s )
 {
+    /* first sector should be filled with zeros */
+    size_t i_peek;
+    const uint8_t *p_peek;
+    i_peek = stream_Peek( s, &p_peek, 2048 );
+    if( i_peek < 512 ) {
+        return VLC_EGENERIC;
+    }
+    while (i_peek > 0) {
+        if (p_peek[ --i_peek ]) {
+            return VLC_EGENERIC;
+        }
+    }
+
     /* ISO 9660 volume descriptor */
     char iso_dsc[6];
     if( stream_Seek( s, 0x8000 + 1 ) != VLC_SUCCESS
-- 
2.5.0



More information about the vlc-devel mailing list