[vlc-devel] commit: M-JPEG: fix MJPEG demux to be able to read VLC MPJPEG streams ( Jean-Philippe Andre )

git version control git at videolan.org
Sat Mar 7 09:27:12 CET 2009


vlc | branch: master | Jean-Philippe Andre <jpeg at via.ecp.fr> | Sat Mar  7 16:06:35 2009 +0800| [eeaad0a83446cb80b85e0d2c8565d9566cb6016c] | committer: Jean-Philippe Andre 

M-JPEG: fix MJPEG demux to be able to read VLC MPJPEG streams

That's clearly a hack but at least it works.

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

 modules/demux/mjpeg.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/demux/mjpeg.c b/modules/demux/mjpeg.c
index fff153f..f8127e6 100644
--- a/modules/demux/mjpeg.c
+++ b/modules/demux/mjpeg.c
@@ -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 )
     {




More information about the vlc-devel mailing list