]> git.sesse.net Git - vlc/blobdiff - modules/demux/ps.h
Atmo: remove misleading comment about vlc_object_find()
[vlc] / modules / demux / ps.h
index ae778d6914c26e15352cedea03a71a271a4a33a7..23bcead383d21d336d2dc56f617c85c762d5d93a 100644 (file)
@@ -112,11 +112,11 @@ static inline int ps_track_fill( ps_track_t *tk, ps_psm_t *p_psm, int i_id )
         }
         else if( ( i_id&0xff ) == 0x70 )
         {
-            es_format_Init( &tk->fmt, SPU_ES, VLC_FOURCC('o','g','t',' ') );
+            es_format_Init( &tk->fmt, SPU_ES, VLC_CODEC_OGT );
         }
         else if( ( i_id&0xfc ) == 0x00 )
         {
-            es_format_Init( &tk->fmt, SPU_ES, VLC_FOURCC('c','v','d',' ') );
+            es_format_Init( &tk->fmt, SPU_ES, VLC_CODEC_CVD );
         }
         else if( ( i_id&0xff ) == 0x10 )
         {
@@ -299,23 +299,24 @@ static inline int ps_pkt_id( block_t *p_pkt )
     return p_pkt->p_buffer[3];
 }
 
-/* return the size of the next packet
- * You need to give him at least 14 bytes (and it need to start as a
- * valid packet) It does not handle less than 6 bytes */
+/* return the size of the next packet */
 static inline int ps_pkt_size( const uint8_t *p, int i_peek )
 {
-    assert( i_peek >= 6 );
-    if( p[3] == 0xb9 && i_peek >= 4 )
+    if( unlikely(i_peek < 4) )
+    {
+        return -1;
+    }
+    else if( p[3] == 0xb9 )
     {
         return 4;
     }
     else if( p[3] == 0xba )
     {
-        if( (p[4] >> 6) == 0x01 && i_peek >= 14 )
+        if( i_peek >= 14 && (p[4] >> 6) == 0x01 )
         {
             return 14 + (p[13]&0x07);
         }
-        else if( (p[4] >> 4) == 0x02 && i_peek >= 12 )
+        else if( i_peek >= 12 && (p[4] >> 4) == 0x02 )
         {
             return 12;
         }