static void ParseOption( input_thread_t *p_input, const char *psz_option );
static void DecodeUrl( char * );
-static void MRLSplit( input_thread_t *, char *, char **, char **, char ** );
static void MRLSections( input_thread_t *, char *, int *, int *, int *, int *);
static input_source_t *InputSourceNew( input_thread_t *);
free( val.psz_string );
}
+ /* Remove 'Now playing' info as it is probably outdated */
+ input_Control( p_input, INPUT_DEL_INFO, _("Meta-information"),
+ VLC_META_NOW_PLAYING );
+
/* Now we can attach our new input */
vlc_object_attach( p_input, p_parent );
int i_es_out_mode;
int i, i_delay;
- /* Initialize optional stream output. (before access/demuxer) */
+ /* Initialize optional stream output. (before access/demuxer)
+ * XXX: we add a special case if the uri starts by vlc.
+ * else 'vlc in.file --sout "" vlc:quit' cannot work (the output will
+ * be destroyed in case of a file).
+ * (this will break playing of file starting by 'vlc:' but I don't
+ * want to add more logic, just force file by file:// or code it ;)
+ */
if( !b_quick )
{
psz = var_GetString( p_input, "sout" );
- if( *psz )
+ if( *psz && strncasecmp( p_input->input.p_item->psz_uri, "vlc:", 4 ) )
{
p_input->p_sout = sout_NewInstance( p_input, psz );
if( p_input->p_sout == NULL )
{
p_input->b_out_pace_control = VLC_TRUE;
}
+
+ if( p_input->b_can_pace_control && p_input->b_out_pace_control )
+ {
+ /* We don't want a high input priority here or we'll
+ * end-up sucking up all the CPU time */
+ vlc_thread_set_priority( p_input, VLC_THREAD_PRIORITY_LOW );
+ }
+
msg_Dbg( p_input, "starting in %s mode",
p_input->b_out_pace_control ? "asynch" : "synch" );
}
if( !b_quick )
{
- msg_Dbg( p_input, "`%s' sucessfully opened",
+ msg_Dbg( p_input, "`%s' successfully opened",
p_input->input.p_item->psz_uri );
}
{
demux_t *p_demux = p_input->input.p_demux;
int i_seekpoint;
- mtime_t i_input_time;
- mtime_t i_seekpoint_time;
+ int64_t i_input_time;
+ int64_t i_seekpoint_time;
if( i_type == INPUT_CONTROL_SET_SEEKPOINT_PREV )
{
i_seekpoint = p_demux->info.i_seekpoint;
i_seekpoint_time = p_input->input.title[p_demux->info.i_title]->seekpoint[i_seekpoint]->i_time_offset;
- if ( i_seekpoint_time != -1 )
+ if( i_seekpoint_time >= 0 &&
+ !demux2_Control( p_demux,
+ DEMUX_GET_TIME, &i_input_time ) )
{
- demux2_Control( p_demux, INPUT_GET_TIME, &i_input_time );
if ( i_input_time < i_seekpoint_time + 3000000 )
i_seekpoint--;
}
}
else if( p_input->input.i_title > 0 )
{
+ demux_t *p_demux = p_input->input.p_demux;
access_t *p_access = p_input->input.p_access;
int i_seekpoint;
- mtime_t i_input_time;
- mtime_t i_seekpoint_time;
+ int64_t i_input_time;
+ int64_t i_seekpoint_time;
if( i_type == INPUT_CONTROL_SET_SEEKPOINT_PREV )
{
i_seekpoint = p_access->info.i_seekpoint;
i_seekpoint_time = p_input->input.title[p_access->info.i_title]->seekpoint[i_seekpoint]->i_time_offset;
- if ( i_seekpoint_time != -1 )
+ if( i_seekpoint_time >= 0 &&
+ demux2_Control( p_demux,
+ DEMUX_GET_TIME, &i_input_time ) )
{
- access2_Control( p_access, INPUT_GET_TIME, &i_input_time );
if ( i_input_time < i_seekpoint_time + 3000000 )
i_seekpoint--;
}
char *psz_access;
char *psz_demux;
char *psz_path;
+ char *psz_tmp;
+ char *psz;
vlc_value_t val;
/* Split uri */
if( !b_quick )
{
- MRLSplit( p_input, psz_dup, &psz_access, &psz_demux, &psz_path );
+ MRLSplit( VLC_OBJECT(p_input), psz_dup,
+ &psz_access, &psz_demux, &psz_path );
msg_Dbg( p_input, "`%s' gives access `%s' demux `%s' path `%s'",
psz_mrl, psz_access, psz_demux, psz_path );
goto error;
}
+ /* */
+ psz_tmp = psz = var_GetString( p_input, "access-filter" );
+ while( psz && *psz )
+ {
+ access_t *p_access = in->p_access;
+ char *end = strchr( psz, ':' );
+
+ if( end )
+ *end++ = '\0';
+
+ in->p_access = access2_FilterNew( in->p_access, psz );
+ if( in->p_access == NULL )
+ {
+ in->p_access = p_access;
+ msg_Warn( p_input, "failed to insert access filter %s",
+ psz );
+ }
+
+ psz = end;
+ }
+ free( psz_tmp );
+
/* Get infos from access */
if( !b_quick )
{
demux2_Delete( in->p_demux );
if( in->p_stream )
- stream_AccessDelete( in->p_stream );
+ stream_Delete( in->p_stream );
if( in->p_access )
access2_Delete( in->p_access );
demux2_Delete( in->p_demux );
if( in->p_stream )
- stream_AccessDelete( in->p_stream );
+ stream_Delete( in->p_stream );
if( in->p_access )
access2_Delete( in->p_access );
* MRLSplit: parse the access, demux and url part of the
* Media Resource Locator.
*****************************************************************************/
-static void MRLSplit( input_thread_t *p_input, char *psz_dup,
- char **ppsz_access, char **ppsz_demux, char **ppsz_path )
+void MRLSplit( vlc_object_t *p_input, char *psz_dup,
+ char **ppsz_access, char **ppsz_demux, char **ppsz_path )
{
char *psz_access = NULL;
char *psz_demux = NULL;
/***********************************************************************
* Info management functions
***********************************************************************/
+/**
+ * Get a info item from a given category in a given input item.
+ *
+ * \param p_i The input item to get info from
+ * \param psz_cat String representing the category for the info
+ * \param psz_name String representing the name of the desired info
+ * \return A pointer to the string with the given info if found, or an
+ * empty string otherwise. The caller should free the returned
+ * pointer.
+ */
char *vlc_input_item_GetInfo( input_item_t *p_i,
const char *psz_cat,
const char *psz_name )
{
if( !strcmp( p_cat->pp_infos[j]->psz_name, psz_name ) )
{
+ char *psz_ret = strdup( p_cat->pp_infos[j]->psz_value );
vlc_mutex_unlock( &p_i->lock );
- return strdup( p_cat->pp_infos[j]->psz_value );
+ return psz_ret;
}
}
}