VLC_EXPORT( vlc_event_manager_t *, input_get_event_manager, ( input_thread_t * ) );
+/**
+ * This function allows to split a MRL into access, demux and path part.
+ *
+ * You should not write into access and demux string as they may not point into
+ * the provided buffer.
+ * The buffer provided by psz_dup will be modified.
+ */
+VLC_EXPORT( void, input_SplitMRL, ( const char **ppsz_access, const char **ppsz_demux, char **ppsz_path, char *psz_dup ) );
+
#endif
if( !p_input ) return VLC_EGENERIC;
/* Split uri */
- MRLSplit( psz_dup, &psz_access, &psz_demux, &psz_path );
+ input_SplitMRL( &psz_access, &psz_demux, &psz_path, psz_dup );
msg_Dbg( p_input, "`%s' gives access `%s' demux `%s' path `%s'",
psz_mrl, psz_access, psz_demux, psz_path );
{
const char *psz_a, *psz_d;
psz_buf = strdup( in->p_access->psz_path );
- MRLSplit( psz_buf, &psz_a, &psz_d, &psz_real_path );
+ input_SplitMRL( &psz_a, &psz_d, &psz_real_path, psz_buf );
}
else
{
* MRLSplit: parse the access, demux and url part of the
* Media Resource Locator.
*****************************************************************************/
-void MRLSplit( char *psz_dup, const char **ppsz_access, const char **ppsz_demux,
- char **ppsz_path )
+void input_SplitMRL( const char **ppsz_access, const char **ppsz_demux, char **ppsz_path,
+ char *psz_dup )
{
char *psz_access = NULL;
char *psz_demux = NULL;
}
*ppsz_access = psz_access ? psz_access : (char*)"";
*ppsz_demux = psz_demux ? psz_demux : (char*)"";
- *ppsz_path = psz_path ? psz_path : (char*)"";
+ *ppsz_path = psz_path;
}
static inline bool next(char ** src)
/*****************************************************************************
* input_get_event_manager
*****************************************************************************/
-vlc_event_manager_t *
-input_get_event_manager( input_thread_t *p_input )
+vlc_event_manager_t *input_get_event_manager( input_thread_t *p_input )
{
return &p_input->p->event_manager;
}
char **subtitles_Detect( input_thread_t *, char* path, const char *fname );
int subtitles_Filter( const char *);
-void MRLSplit( char *, const char **, const char **, char ** );
-
static inline void input_ChangeStateWithVarCallback( input_thread_t *p_input, int state, bool callback )
{
const bool changed = p_input->i_state != state;
access_t *p_access;
stream_t *p_res;
- if( !psz_url ) return 0;
+ if( !psz_url )
+ return NULL;
- char psz_dup[strlen (psz_url) + 1];
- strcpy (psz_dup, psz_url);;
- MRLSplit( psz_dup, &psz_access, &psz_demux, &psz_path );
+ char psz_dup[strlen( psz_url ) + 1];
+ strcpy( psz_dup, psz_url );
+ input_SplitMRL( &psz_access, &psz_demux, &psz_path, psz_dup );
/* Now try a real access */
p_access = access_New( p_parent, psz_access, psz_demux, psz_path );