]> git.sesse.net Git - vlc/blobdiff - modules/demux/ogg.c
macosx: Fix controller playlist toggling to use the contentRect and not the window...
[vlc] / modules / demux / ogg.c
index dbd734523b728b5d57dc212bc79506321d02e303..9b86a25fd9eb3adf8a6b48b3bf9289e0ef51ebef 100644 (file)
@@ -1556,18 +1556,19 @@ static void Ogg_ReadAnnodexHeader( vlc_object_t *p_this,
 static uint32_t Ogg_ReadDiracPictureNumber( ogg_packet *p_oggpacket )
 {
     uint32_t u_pos = 4;
-    /* find the picture startcode */
-    while ( (p_oggpacket->packet[u_pos] & 0x08) == 0) {
+    /* protect against falling off the edge */
+    while ( u_pos + 13 < p_oggpacket->bytes ) {
+        /* find the picture startcode */
+        if ( p_oggpacket->packet[u_pos] & 0x08 ) {
+            return GetDWBE( p_oggpacket->packet + u_pos + 9 );
+        }
         /* skip to the next dirac parse unit */
-        u_pos += GetDWBE( p_oggpacket->packet + u_pos + 1 );
-        /* protect against falling off the edge */
-        if ( u_pos > p_oggpacket->bytes )
-             return -1;
+        uint32_t u_npo = GetDWBE( p_oggpacket->packet + u_pos + 1 );
+        if (u_npo == 0)
+            u_npo = 13;
+        u_pos += u_npo;
     }
-
-    uint32_t u_pnum = GetDWBE( p_oggpacket->packet + u_pos + 9 );
-
-    return u_pnum;
+    return -1;
 }
 
 static uint32_t dirac_uint( bs_t *p_bs )
@@ -1627,6 +1628,7 @@ static void Ogg_ReadDiracHeader( logical_stream_t *p_stream,
     static const struct {
         uint32_t u_n /* numerator */, u_d /* denominator */;
     } dirac_frate_tbl[] = { /* table 10.3 */
+        {1,1}, /* this first value is never used */
         {24000,1001}, {24,1}, {25,1}, {30000,1001}, {30,1},
         {50,1}, {60000,1001}, {60,1}, {15000,1001}, {25,2},
     };