]> git.sesse.net Git - vlc/commitdiff
M-JPEG: fix MJPEG demux to be able to read VLC MPJPEG streams
authorJean-Philippe Andre <jpeg@via.ecp.fr>
Sat, 7 Mar 2009 08:06:35 +0000 (16:06 +0800)
committerJean-Philippe Andre <jpeg@via.ecp.fr>
Sat, 7 Mar 2009 08:06:35 +0000 (16:06 +0800)
That's clearly a hack but at least it works.

modules/demux/mjpeg.c

index fff153f4bca26e411b6b86fad50767669a571707..f8127e677c232c4c9b729ff267767fcfe72b2faf 100644 (file)
@@ -185,18 +185,19 @@ static bool CheckMimeHeader( demux_t *p_demux, int *p_header_size )
         *p_header_size = -1;
         return false;
     }
-    if( p_sys->i_data_peeked < 3)
+    if( p_sys->i_data_peeked < 5)
     {
         msg_Err( p_demux, "data shortage" );
         *p_header_size = -2;
         return false;
     }
-    if( strncmp( (char *)p_sys->p_peek, "--", 2 ) )
+    if( strncmp( (char *)p_sys->p_peek, "--", 2 ) != 0
+        && strncmp( (char *)p_sys->p_peek, "\r\n--", 4 ) != 0 )
     {
         *p_header_size = 0;
         return false;
     }
-    i_pos = 2;
+    i_pos = *p_sys->p_peek == '-' ? 2 : 4;
     psz_line = GetLine( p_demux, &i_pos );
     if( NULL == psz_line )
     {