vlc | branch: master | Francois Cartegnie <[email protected]> | Sat Apr 11 
17:36:34 2015 +0200| [52ed5f49ac4f96645b611e6c0e733fc37255ad53] | committer: 
Francois Cartegnie

demux: h264: probe non sps nal

first nal from raw h264 dump might not be sps

refs issues/raw-h264/test.h264

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

 modules/demux/mpeg/h264.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/modules/demux/mpeg/h264.c b/modules/demux/mpeg/h264.c
index fa43994..1d2f910 100644
--- a/modules/demux/mpeg/h264.c
+++ b/modules/demux/mpeg/h264.c
@@ -84,9 +84,14 @@ static int Open( vlc_object_t * p_this )
 
     if( stream_Peek( p_demux->s, &p_peek, 5 ) < 5 ) return VLC_EGENERIC;
 
-    if( p_peek[0] != 0x00 || p_peek[1] != 0x00 ||
-        p_peek[2] != 0x00 || p_peek[3] != 0x01 ||
-        (p_peek[4]&0x1F) != 7 ) /* SPS */
+    const uint8_t i_nal_type = p_peek[4] & 0x1F;
+    const uint8_t i_ref_idc = p_peek[4] & 0x60;
+    if( memcmp( p_peek, "\x00\x00\x00\x01", 4 ) ||
+       (p_peek[4] & 0x80) || /* reserved 0 */
+        i_nal_type == 0 || i_nal_type > 12 ||
+       ( !i_ref_idc && (i_nal_type < 6 || i_nal_type == 7 || i_nal_type == 8) 
) ||
+       (  i_ref_idc && (i_nal_type == 6 || i_nal_type >= 9) )
+      )
     {
         if( !p_demux->b_force )
         {

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to