vlc | branch: master | Francois Cartegnie <fcvlc...@free.fr> | Tue Mar 13 
16:22:45 2018 +0100| [eb2e9471520ef2b3ba8c105da5d095008dc9b6ce] | committer: 
Francois Cartegnie

demux: mp4: fully check major for f4v

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

 modules/demux/mp4/libmp4.h |  1 +
 modules/demux/mp4/mp4.c    | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index b82961094c..029ea4d052 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -37,6 +37,7 @@ typedef int64_t stime_t;
 #define MAJOR_isml VLC_FOURCC( 'i', 's', 'm', 'l' )
 #define MAJOR_isom VLC_FOURCC( 'i', 's', 'o', 'm' )
 #define MAJOR_qt__ VLC_FOURCC( 'q', 't', ' ', ' ' )
+#define MAJOR_f4v  VLC_FOURCC( 'f', '4', 'v', ' ' ) /* Adobe Flash */
 #define MAJOR_dash VLC_FOURCC( 'd', 'a', 's', 'h' )
 #define MAJOR_mp41 VLC_FOURCC( 'm', 'p', '4', '1' )
 #define MAJOR_avc1 VLC_FOURCC( 'a', 'v', 'c', '1' )
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 7b6ca7b130..e6243d0add 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -685,7 +685,7 @@ static int Open( vlc_object_t * p_this )
     bool      b_enabled_es;
 
     /* A little test to see if it could be a mp4 */
-    if( vlc_stream_Peek( p_demux->s, &p_peek, 11 ) < 11 ) return VLC_EGENERIC;
+    if( vlc_stream_Peek( p_demux->s, &p_peek, 12 ) < 12 ) return VLC_EGENERIC;
 
     switch( VLC_FOURCC( p_peek[4], p_peek[5], p_peek[6], p_peek[7] ) )
     {
@@ -701,10 +701,18 @@ static int Open( vlc_object_t * p_this )
         case VLC_FOURCC( 'p', 'n', 'o', 't' ):
             break;
         case ATOM_ftyp:
-            /* We don't yet support f4v, but avformat does. */
-            if( p_peek[8] == 'f' && p_peek[9] == '4' && p_peek[10] == 'v' )
-                return VLC_EGENERIC;
+        {
+            /* Early handle some brands */
+            switch( VLC_FOURCC(p_peek[8], p_peek[9], p_peek[10], p_peek[11]) )
+            {
+                /* We don't yet support f4v, but avformat does. */
+                case MAJOR_f4v:
+                    return VLC_EGENERIC;
+                default:
+                    break;
+            }
             break;
+        }
          default:
             return VLC_EGENERIC;
     }

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to