[vlc-commits] dvdnav: improve stream probing

Petri Hintukainen git at videolan.org
Mon Dec 21 13:33:22 CET 2015


vlc | branch: master | Petri Hintukainen <phintuka at gmail.com> | Sun Dec 20 12:04:07 2015 +0200| [35396aee0eb6eb7a4529bc8bb42ab5908df9c23c] | committer: Jean-Baptiste Kempf

dvdnav: improve stream probing

First sectors of DVD are filled with zeros.
Checking boot sector avoids seeking when probing "regular" media files.

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

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

 modules/access/dvdnav.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index 270007d..2422e39 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



More information about the vlc-commits mailing list