static void UpdateItemLength( input_thread_t *, int64_t i_length, vlc_bool_t );
-static void ParseOption( input_thread_t *p_input, const char *psz_option );
-
static void DecodeUrl( char * );
static void MRLSections( input_thread_t *, char *, int *, int *, int *, int *);
vlc_mutex_lock( &p_item->lock );
for( i = 0; i < p_item->i_options; i++ )
{
- ParseOption( p_input, p_item->ppsz_options[i] );
+ var_OptionParse( p_input, p_item->ppsz_options[i] );
}
vlc_mutex_unlock( &p_item->lock );
}
else if( !strncmp( psz_start, "time=", 5 ) )
{
- p_seekpoint->i_time_offset = atoll(psz_start + 5) * 1000000;
+ p_seekpoint->i_time_offset = atoll(psz_start + 5) *
+ 1000000;
}
psz_start = psz_end + 1;
}
}
/* Remove 'Now playing' info as it is probably outdated */
- input_Control( p_input, INPUT_DEL_INFO, _("Meta-information"),
- VLC_META_NOW_PLAYING );
+ input_Control( p_input, INPUT_DEL_INFO, _(VLC_META_INFO_CAT),
+ VLC_META_NOW_PLAYING ); /* ? Don't translate as it might has been copied ? */
return p_input;
}
/* Allocate descriptor */
p_input = Create( p_parent, p_item, NULL, VLC_TRUE );
+ p_input->i_flags |= OBJECT_FLAGS_NODBG;
+ p_input->i_flags |= OBJECT_FLAGS_NOINTERACT;
/* Now we can attach our new input */
vlc_object_attach( p_input, p_parent );
/* Clean up master */
InputSourceClean( p_input, &p_input->input );
- /* Kill access and demux */
- if( p_input->input.p_access ) p_input->input.p_access->b_die = VLC_TRUE;
- if( p_input->input.p_demux ) p_input->input.p_access->b_die = VLC_TRUE;
-
/* Unload all modules */
if( p_input->p_es_out ) input_EsOutDelete( p_input->p_es_out );
{
/* Prepare statistics */
counter_t *p_counter;
- stats_Create( p_input, "read_bytes", VLC_VAR_INTEGER, STATS_COUNTER );
- stats_Create( p_input, "read_packets", VLC_VAR_INTEGER, STATS_COUNTER );
- stats_Create( p_input, "demux_read", VLC_VAR_INTEGER, STATS_COUNTER );
- stats_Create( p_input, "input_bitrate", VLC_VAR_FLOAT,
- STATS_DERIVATIVE );
- stats_Create( p_input, "demux_bitrate", VLC_VAR_FLOAT,
- STATS_DERIVATIVE );
+ stats_Create( p_input, "read_bytes", STATS_READ_BYTES,
+ VLC_VAR_INTEGER, STATS_COUNTER );
+ stats_Create( p_input, "read_packets", STATS_READ_PACKETS,
+ VLC_VAR_INTEGER, STATS_COUNTER );
+ stats_Create( p_input, "demux_read", STATS_DEMUX_READ,
+ VLC_VAR_INTEGER, STATS_COUNTER );
+ stats_Create( p_input, "input_bitrate", STATS_INPUT_BITRATE,
+ VLC_VAR_FLOAT, STATS_DERIVATIVE );
+ stats_Create( p_input, "demux_bitrate", STATS_DEMUX_BITRATE,
+ VLC_VAR_FLOAT, STATS_DERIVATIVE );
+
p_counter = stats_CounterGet( p_input, p_input->i_object_id,
- "input_bitrate" );
+ STATS_INPUT_BITRATE );
if( p_counter ) p_counter->update_interval = 1000000;
p_counter = stats_CounterGet( p_input, p_input->i_object_id,
- "demux_bitrate" );
+ STATS_DEMUX_BITRATE );
if( p_counter ) p_counter->update_interval = 1000000;
- stats_Create( p_input, "played_abuffers", VLC_VAR_INTEGER, STATS_COUNTER );
- stats_Create( p_input, "lost_abuffers", VLC_VAR_INTEGER, STATS_COUNTER );
+ stats_Create( p_input, "played_abuffers", STATS_PLAYED_ABUFFERS,
+ VLC_VAR_INTEGER, STATS_COUNTER );
+ stats_Create( p_input, "lost_abuffers", STATS_LOST_ABUFFERS,
+ VLC_VAR_INTEGER, STATS_COUNTER );
/* handle sout */
psz = var_GetString( p_input, "sout" );
es_out_Control( p_input->p_es_out, ES_OUT_SET_ACTIVE, VLC_FALSE );
es_out_Control( p_input->p_es_out, ES_OUT_SET_MODE, ES_OUT_MODE_NONE );
+ var_Create( p_input, "bit-rate", VLC_VAR_INTEGER );
+ var_Create( p_input, "sample-rate", VLC_VAR_INTEGER );
+
if( InputSourceInit( p_input, &p_input->input,
p_input->input.p_item->psz_uri, NULL, b_quick ) )
{
{
input_EsOutDiscontinuity( p_input->p_es_out, VLC_FALSE );
es_out_Control( p_input->p_es_out, ES_OUT_RESET_PCR );
-
+
access2_Control( p_access, ACCESS_SET_TITLE, i_title );
stream_AccessReset( p_input->input.p_stream );
}
{
input_EsOutDiscontinuity( p_input->p_es_out, VLC_FALSE );
es_out_Control( p_input->p_es_out, ES_OUT_RESET_PCR );
-
+
demux2_Control( p_demux, DEMUX_SET_SEEKPOINT, i_seekpoint );
}
}
{
input_EsOutDiscontinuity( p_input->p_es_out, VLC_FALSE );
es_out_Control( p_input->p_es_out, ES_OUT_RESET_PCR );
-
- access2_Control( p_access, ACCESS_SET_SEEKPOINT, i_seekpoint );
+
+ access2_Control( p_access, ACCESS_SET_SEEKPOINT,
+ i_seekpoint );
stream_AccessReset( p_input->input.p_stream );
}
}
msg_Dbg( p_input, " - '%s' = '%s'",
_(p_meta->name[i]), p_meta->value[i] );
- if( !strcmp(p_meta->name[i], VLC_META_TITLE) && p_meta->value[i] &&
+ if( !strcmp(p_meta->name[i], _(VLC_META_TITLE)) && p_meta->value[i] &&
!p_input->input.p_item->b_fixed_name )
input_Control( p_input, INPUT_SET_NAME, p_meta->value[i] );
- if( !strcmp( p_meta->name[i], VLC_META_AUTHOR ) )
+ if( !strcmp( p_meta->name[i], _(VLC_META_AUTHOR) ) )
input_Control( p_input, INPUT_ADD_INFO, _("General"),
- _("Author"), p_meta->value[i] );
+ _(VLC_META_AUTHOR), p_meta->value[i] );
- input_Control( p_input, INPUT_ADD_INFO, _("Meta-information"),
+ input_Control( p_input, INPUT_ADD_INFO, _(VLC_META_INFO_CAT),
_(p_meta->name[i]), "%s", p_meta->value[i] );
}
static input_source_t *InputSourceNew( input_thread_t *p_input )
{
input_source_t *in = (input_source_t*) malloc( sizeof( input_source_t ) );
-
+
if( !in )
{
msg_Err( p_input, "out of memory for new input source" );
{
psz_demux = psz_var_demux;
- msg_Dbg( p_input, "Enforce demux ` %s'", psz_demux );
+ msg_Dbg( p_input, "enforced demux ` %s'", psz_demux );
}
else if( psz_var_demux )
{
else
{
psz_path = psz_mrl;
- msg_Dbg( p_input, "trying to preparse %s", psz_path );
+ msg_Dbg( p_input, "trying to pre-parse %s", psz_path );
psz_demux = strdup( "" );
psz_access = strdup( "file" );
}
if( psz_dup ) free( psz_dup );
psz_dup = strdup( psz_mrl );
psz_access = "";
- psz_demux = "";
+ if( psz_forced_demux && *psz_forced_demux )
+ {
+ psz_demux = psz_forced_demux;
+ }
+ else psz_demux = "";
psz_path = psz_dup;
in->p_access = access2_New( p_input,
{
int64_t i_time;
int i;
-
+
if( demux2_Control( p_input->input.p_demux, DEMUX_GET_TIME, &i_time ) )
{
msg_Err( p_input, "demux doesn't like DEMUX_GET_TIME" );
#define GET_META( c, s ) \
var_Get( p_input, (s), &val ); \
if( *val.psz_string ) \
- vlc_meta_Add( p_meta, c, val.psz_string ); \
+ vlc_meta_Add( p_meta, _(c), val.psz_string ); \
free( val.psz_string )
GET_META( VLC_META_TITLE, "meta-title" );
if( dup ) free( dup );
}
-/*****************************************************************************
- * ParseOption: parses the options for the input
- *****************************************************************************
- * This function parses the input (config) options and creates their associated
- * object variables.
- * Options are of the form "[no[-]]foo[=bar]" where foo is the option name and
- * bar is the value of the option.
- *****************************************************************************/
-static void ParseOption( input_thread_t *p_input, const char *psz_option )
-{
- char *psz_name = (char *)psz_option;
- char *psz_value = strchr( psz_option, '=' );
- int i_name_len, i_type;
- vlc_bool_t b_isno = VLC_FALSE;
- vlc_value_t val;
-
- if( psz_value ) i_name_len = psz_value - psz_option;
- else i_name_len = strlen( psz_option );
-
- /* It's too much of an hassle to remove the ':' when we parse
- * the cmd line :) */
- if( i_name_len && *psz_name == ':' )
- {
- psz_name++;
- i_name_len--;
- }
-
- if( i_name_len == 0 ) return;
-
- psz_name = strndup( psz_name, i_name_len );
- if( psz_value ) psz_value++;
-
- /* FIXME: :programs should be handled generically */
- if( !strcmp( psz_name, "programs" ) )
- i_type = VLC_VAR_LIST;
- else
- i_type = config_GetType( p_input, psz_name );
-
- if( !i_type && !psz_value )
- {
- /* check for "no-foo" or "nofoo" */
- if( !strncmp( psz_name, "no-", 3 ) )
- {
- memmove( psz_name, psz_name + 3, strlen(psz_name) + 1 - 3 );
- }
- else if( !strncmp( psz_name, "no", 2 ) )
- {
- memmove( psz_name, psz_name + 2, strlen(psz_name) + 1 - 2 );
- }
- else goto cleanup; /* Option doesn't exist */
-
- b_isno = VLC_TRUE;
- i_type = config_GetType( p_input, psz_name );
-
- if( !i_type ) goto cleanup; /* Option doesn't exist */
- }
- else if( !i_type ) goto cleanup; /* Option doesn't exist */
-
- if( ( i_type != VLC_VAR_BOOL ) &&
- ( !psz_value || !*psz_value ) ) goto cleanup; /* Invalid value */
-
- /* Create the variable in the input object.
- * Children of the input object will be able to retreive this value
- * thanks to the inheritance property of the object variables. */
- var_Create( p_input, psz_name, i_type );
-
- switch( i_type )
- {
- case VLC_VAR_BOOL:
- val.b_bool = !b_isno;
- break;
-
- case VLC_VAR_INTEGER:
- val.i_int = strtol( psz_value, NULL, 0 );
- break;
-
- case VLC_VAR_FLOAT:
- val.f_float = atof( psz_value );
- break;
-
- case VLC_VAR_STRING:
- case VLC_VAR_MODULE:
- case VLC_VAR_FILE:
- case VLC_VAR_DIRECTORY:
- val.psz_string = psz_value;
- break;
-
- case VLC_VAR_LIST:
- {
- char *psz_orig, *psz_var;
- vlc_list_t *p_list = malloc(sizeof(vlc_list_t));
- val.p_list = p_list;
- p_list->i_count = 0;
-
- psz_var = psz_orig = strdup(psz_value);
- while( psz_var && *psz_var )
- {
- char *psz_item = psz_var;
- vlc_value_t val2;
- while( *psz_var && *psz_var != ',' ) psz_var++;
- if( *psz_var == ',' )
- {
- *psz_var = '\0';
- psz_var++;
- }
- val2.i_int = strtol( psz_item, NULL, 0 );
- INSERT_ELEM( p_list->p_values, p_list->i_count,
- p_list->i_count, val2 );
- /* p_list->i_count is incremented twice by INSERT_ELEM */
- p_list->i_count--;
- INSERT_ELEM( p_list->pi_types, p_list->i_count,
- p_list->i_count, VLC_VAR_INTEGER );
- }
- if( psz_orig ) free( psz_orig );
- break;
- }
-
- default:
- goto cleanup;
- break;
- }
-
- var_Set( p_input, psz_name, val );
-
- msg_Dbg( p_input, "set input option: %s to %s", psz_name,
- psz_value ? psz_value : ( val.b_bool ? "true" : "false") );
-
- cleanup:
- if( psz_name ) free( psz_name );
- return;
-}
-
/*****************************************************************************
* MRLSplit: parse the access, demux and url part of the
* Media Resource Locator.