X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fdemux%2Fmjpeg.c;h=c3e77e8f823ac6b983adb798d5fca3178c931361;hb=f1a3e870f73b1238164894b9f47ede0069b02830;hp=cf155931b2d098032c6ca1d68f79c1ea659fed16;hpb=2a7d4c72bd93525af365d7917a2a5c6e3c130ce8;p=vlc diff --git a/modules/demux/mjpeg.c b/modules/demux/mjpeg.c index cf155931b2..c3e77e8f82 100644 --- a/modules/demux/mjpeg.c +++ b/modules/demux/mjpeg.c @@ -27,12 +27,15 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include -#include +#include -#include +#include /***************************************************************************** * Module descriptor @@ -75,7 +78,7 @@ struct demux_sys_t mtime_t i_frame_length; char *psz_separator; int i_frame_size_estimate; - uint8_t *p_peek; + const uint8_t *p_peek; int i_data_peeked; }; @@ -118,7 +121,7 @@ static vlc_bool_t Peek( demux_t *p_demux, vlc_bool_t b_first ) static char* GetLine( demux_t *p_demux, int *p_pos ) { demux_sys_t *p_sys = p_demux->p_sys; - uint8_t *p_buf; + const uint8_t *p_buf; int i_size; int i; char *p_line; @@ -202,7 +205,9 @@ static vlc_bool_t CheckMimeHeader( demux_t *p_demux, int *p_header_size ) *p_header_size = -3; return VLC_FALSE; } - if( NULL == p_sys->psz_separator ) + + /* Read the separator and remember it if not yet stored */ + if( p_sys->psz_separator == NULL ) { p_sys->psz_separator = psz_line; msg_Dbg( p_demux, "Multipart MIME detected, using separator: %s", @@ -217,6 +222,7 @@ static vlc_bool_t CheckMimeHeader( demux_t *p_demux, int *p_header_size ) } free( psz_line ); } + psz_line = GetLine( p_demux, &i_pos ); while( psz_line && *psz_line ) { @@ -298,7 +304,6 @@ static int Open( vlc_object_t * p_this ) int i_size; int b_matched = VLC_FALSE; vlc_value_t val; - char *psz_ext; p_demux->pf_control = Control; p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) ); @@ -340,9 +345,8 @@ static int Open( vlc_object_t * p_this ) /* Check for jpeg file extension */ p_sys->b_still = VLC_FALSE; p_sys->i_still_end = 0; - psz_ext = strrchr( p_demux->psz_path, '.' ); - if( psz_ext && ( !strcasecmp( psz_ext, ".jpeg" ) || - !strcasecmp( psz_ext, ".jpg" ) ) ) + if( demux2_IsPathExtension( p_demux, ".jpeg" ) || + demux2_IsPathExtension( p_demux, ".jpg" ) ) { p_sys->b_still = VLC_TRUE; if( val.f_float)