/*****************************************************************************
* Preamble
*****************************************************************************/
-#include <stdlib.h> /* malloc(), free() */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <vlc/vlc.h>
-#include <vlc/input.h>
+#include <vlc_demux.h>
-#include <codecs.h>
+#include <vlc_codecs.h>
/*****************************************************************************
* Module descriptor
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;
};
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;
*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",
msg_Warn( p_demux, "separator %s does not match %s", psz_line,
p_sys->psz_separator );
}
+ free( psz_line );
}
- free( psz_line );
+
psz_line = GetLine( p_demux, &i_pos );
while( psz_line && *psz_line )
{
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 ) );
/* 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)
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
- if( p_sys->psz_separator )
- {
- free( p_sys->psz_separator );
- }
+ free( p_sys->psz_separator );
free( p_sys );
}