Commit e02432e5 authored by Rafaël Carré's avatar Rafaël Carré

Input access locking, part 3 (final).

Enforce access to input_item_t through input_item_{G,S}et*()
Unlock mutexes before calling these functions
Free strings returned by input_item_Get*()

New functions added:

char * input_item_GetURI( input_item_t  * )
void input_item_SetURI( input_item_t * , char * )

mtime_t input_item_GetDuration( input_item_t * )
void input_item_SetDuration( input_item_t * , mtime_t )

to access input_item_t->psz_uri and input_item_t->i_duration
parent 4fa32412
......@@ -138,7 +138,7 @@ static inline void input_ItemCopyOptions( input_item_t *p_parent,
}
}
static inline void input_ItemSetName( input_item_t *p_item, const char *psz_name )
static inline void input_item_SetName( input_item_t *p_item, const char *psz_name )
{
if( p_item->psz_name ) free( p_item->psz_name );
p_item->psz_name = strdup( psz_name );
......@@ -272,6 +272,38 @@ static inline char * input_item_GetName( input_item_t * p_i )
return psz_s;
}
static inline char * input_item_GetURI( input_item_t * p_i )
{
vlc_mutex_lock( &p_i->lock );
char *psz_s = p_i->psz_uri ? strdup( p_i->psz_uri ) : NULL;
vlc_mutex_unlock( &p_i->lock );
return psz_s;
}
static inline void input_item_SetURI( input_item_t * p_i, char * psz_uri )
{
vlc_mutex_lock( &p_i->lock );
if( p_i->psz_uri ) free( p_i->psz_uri );
p_i->psz_uri = strdup( psz_uri );
vlc_mutex_unlock( &p_i->lock );
}
static inline mtime_t input_item_GetDuration( input_item_t * p_i )
{
vlc_mutex_lock( &p_i->lock );
mtime_t i_duration = p_i->i_duration;
vlc_mutex_unlock( &p_i->lock );
return i_duration;
}
static inline void input_item_SetDuration( input_item_t * p_i, mtime_t i_duration )
{
vlc_mutex_lock( &p_i->lock );
p_i->i_duration = i_duration;
vlc_mutex_unlock( &p_i->lock );
return;
}
static inline void input_item_SetPreparsed( input_item_t *p_i, vlc_bool_t preparsed )
{
if( !p_i->p_meta )
......
......@@ -412,9 +412,7 @@ static int GetTracks( access_t *p_access,
}
p_item_in_category = playlist_ItemToNode( p_playlist, p_parent, VLC_FALSE );
vlc_mutex_lock( &p_playlist->object_lock );
playlist_ItemSetName( p_parent, "Audio CD" );
vlc_mutex_unlock( &p_playlist->object_lock );
var_SetInteger( p_playlist, "item-change", p_parent->p_input->i_id );
#ifdef HAVE_LIBCDDB
......@@ -424,9 +422,7 @@ static int GetTracks( access_t *p_access,
if( cddb_disc_get_title( p_sys->p_disc ) )
{
const char *psz_name = cddb_disc_get_title( p_sys->p_disc );
vlc_mutex_lock( &p_playlist->object_lock );
playlist_ItemSetName( p_parent, psz_name );
vlc_mutex_unlock( &p_playlist->object_lock );
var_SetInteger( p_playlist, "item-change",
p_parent->p_input->i_id );
}
......
......@@ -840,7 +840,8 @@ CDDACreatePlaylistItem( const access_t *p_access, cdda_data_t *p_cdda,
psz_mrl, psz_title, (long int) i_mduration / 1000000 );
p_child = playlist_ItemNew( p_playlist, psz_mrl, psz_title );
input_GetItem(p_child->p_input)->i_duration = (mtime_t) i_mduration;
input_item_SetDuration( input_GetItem( p_child->p_input ),
(mtime_t) i_mduration );
free(psz_mrl);
free(psz_title);
......@@ -973,9 +974,10 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
if( p_item )
{
CDDAAddMetaToItem( p_access, p_cdda, p_item, i_track, VLC_FALSE );
p_item->p_input->i_duration = (mtime_t) i_track_frames
* (CLOCK_FREQ / CDIO_CD_FRAMES_PER_SEC);
p_item->p_input->psz_uri = CDDAFormatMRL( p_access, i_track );
input_item_SetDuration( p_item->p_input, (mtime_t) i_track_frames
* (CLOCK_FREQ / CDIO_CD_FRAMES_PER_SEC) );
input_item_SetURI( p_item->p_input,
CDDAFormatMRL( p_access, i_track ) );
}
p_cdda->i_titles = 1;
......@@ -1016,9 +1018,10 @@ CDDAFixupPlaylist( access_t *p_access, cdda_data_t *p_cdda,
p_access->info.i_update |= INPUT_UPDATE_TITLE|INPUT_UPDATE_SIZE;
if( p_item )
{
p_item->p_input->i_duration = (mtime_t)
p_access->info.i_size * (CLOCK_FREQ / CDIO_CD_FRAMES_PER_SEC) ;
p_item->p_input->psz_uri = CDDAFormatMRL( p_access, p_cdda->i_track );
input_item_SetDuration( p_item->p_input, (mtime_t) p_access->info.i_size
* (CLOCK_FREQ / CDIO_CD_FRAMES_PER_SEC) );
input_item_SetURI( p_item->p_input,
CDDAFormatMRL( p_access, p_cdda->i_track ) );
}
}
......
......@@ -335,12 +335,9 @@ connect:
PL_LOCK;
p_input_item = p_playlist->status.p_item->p_input;
vlc_mutex_lock( &p_input_item->lock );
free( p_input_item->psz_uri );
input_item_SetURI( p_input_item, p_sys->psz_location );
free( p_access->psz_path );
p_input_item->psz_uri = strdup( p_sys->psz_location );
p_access->psz_path = strdup( p_sys->psz_location );
vlc_mutex_unlock( &p_input_item->lock );
PL_UNLOCK;
pl_Release( p_access );
......
......@@ -298,12 +298,15 @@ static int Open( vlc_object_t *p_this )
char *psz_txt, *psz_name;
playlist_t *p_playlist = pl_Yield( p_access );
psz_name = strrchr( p_playlist->status.p_item->p_input->psz_uri,
DIRECTORY_SEPARATOR );
char *psz_uri = input_item_GetURI( p_playlist->status.p_item->p_input );
char *psz_newuri = psz_uri;
psz_name = strrchr( psz_newuri, DIRECTORY_SEPARATOR );
if( psz_name != NULL ) psz_name++;
else psz_name = p_playlist->status.p_item->p_input->psz_uri;
else psz_name = psz_newuri;
asprintf( &psz_txt, "path=%s", psz_file_name );
asprintf( &psz_txt, "path=%s", psz_name );
free( psz_uri );
p_sys->p_bonjour = bonjour_start_service( (vlc_object_t *)p_access,
strcmp( p_access->psz_access, "https" )
......
......@@ -113,8 +113,12 @@ static void history_Dump( history_t *p_history )
if( p_item == NULL )
fprintf( stderr, "HISTORY: [%d] NULL\n", i );
else
{
char *psz_uri = input_item_GetURI( p_item );
fprintf( stderr, "HISTORY: [%d] %p (%p->%s)\n", i, p_item,
p_item->psz_uri, p_item->psz_uri );
psz_uri, psz_uri );
free( psz_uri );
}
}
}
......
......@@ -460,13 +460,13 @@ static void FollowAnchor ( intf_thread_t *p_intf )
/* Get new URL */
p_current_item = p_playlist->status.p_item;
char *psz_uri = input_item_GetURI( p_current_item->p_input );
#ifdef CMML_INTF_DEBUG
msg_Dbg( p_intf, "Current playlist item URL is \"%s\"",
p_current_item->input.psz_uri );
msg_Dbg( p_intf, "Current playlist item URL is \"%s\"", psz_uri );
#endif
psz_uri_to_load = XURL_Concat( p_current_item->p_input->psz_uri,
psz_url );
psz_uri_to_load = XURL_Concat( psz_uri, psz_url );
free( psz_uri );
#ifdef CMML_INTF_DEBUG
msg_Dbg( p_intf, "URL to load is \"%s\"", psz_uri_to_load );
......@@ -550,7 +550,9 @@ char *GetTimedURLFromPlaylistItem( intf_thread_t *p_intf,
char *psz_seconds = NULL;
int i_seconds;
psz_url = XURL_GetWithoutFragment( p_current_item->input->psz_uri );
char *psz_uri = input_item_GetURI( p_current_item->p_input );
psz_url = XURL_GetWithoutFragment( psz_uri );
free( psz_uri );
/* Get current time as a string */
if( XURL_IsFileURL( psz_url ) == VLC_TRUE )
......@@ -576,7 +578,7 @@ char *GetTimedURLFromPlaylistItem( intf_thread_t *p_intf,
p = GetTimedURIFragmentForTime; /* unused */
p = GetCurrentTimeInSeconds; /* unused */
return strdup( p_current_item->p_input->psz_uri );
return input_item_GetURI( p_current_item->p_input );
#endif
}
......
......@@ -877,8 +877,7 @@ static int GetInputMeta( input_item_t* p_input,
DBusMessageIter dict, dict_entry, variant;
/* We need the track length to be expressed in seconds
* instead of milliseconds */
dbus_int64_t i_length = (p_input->i_duration / 1000);
dbus_int64_t i_length = ( input_item_GetDuration( p_input ) / 1000 );
const char* ppsz_meta_items[] =
{
......@@ -907,10 +906,13 @@ static int GetInputMeta( input_item_t* p_input,
ADD_VLC_META_STRING( 13, Publisher );
ADD_VLC_META_STRING( 14, EncodedBy );
ADD_VLC_META_STRING( 15, ArtURL );
ADD_VLC_META_STRING( 16, TrackID );
ADD_VLC_META_STRING( 16, TrackID );
vlc_mutex_lock( &p_input->lock );
ADD_META( 17, DBUS_TYPE_INT32, p_input->p_meta->i_status );
ADD_META( 18, DBUS_TYPE_STRING, p_input->psz_uri );
vlc_mutex_unlock( &p_input->lock );
ADD_VLC_META_STRING( 18, URI );
ADD_META( 19, DBUS_TYPE_INT64, i_length );
dbus_message_iter_close_container( args, &dict );
......
......@@ -890,12 +890,16 @@ static void PlayBookmark( intf_thread_t *p_intf, int i_num )
char *psz_bookmark = strdup( val.psz_string );
PL_LOCK;
FOREACH_ARRAY( playlist_item_t *p_item, p_playlist->items )
if( !strcmp( psz_bookmark, p_item->p_input->psz_uri ) )
char *psz_uri = input_item_GetURI( p_item->p_input );
if( !strcmp( psz_bookmark, psz_uri ) )
{
free( psz_uri );
playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, VLC_TRUE,
NULL, p_item );
break;
}
else
free( psz_uri );
FOREACH_END();
PL_UNLOCK;
vlc_object_release( p_playlist );
......@@ -910,10 +914,10 @@ static void SetBookmark( intf_thread_t *p_intf, int i_num )
VLC_VAR_STRING|VLC_VAR_DOINHERIT );
if( p_playlist->status.p_item )
{
config_PutPsz( p_intf, psz_bookmark_name,
p_playlist->status.p_item->p_input->psz_uri);
msg_Info( p_intf, "setting playlist bookmark %i to %s", i_num,
p_playlist->status.p_item->p_input->psz_uri);
char *psz_uri = input_item_GetURI( p_playlist->status.p_item->p_input );
config_PutPsz( p_intf, psz_bookmark_name, psz_uri);
msg_Info( p_intf, "setting playlist bookmark %i to %s", i_num, psz_uri);
free( psz_uri );
config_SaveConfigFile( p_intf, "hotkeys" );
}
pl_Release( p_intf );
......
......@@ -335,8 +335,8 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
p_input = E_(MRLParse)( p_intf, mrl, psz_name );
if( !p_input || !p_input->psz_uri ||
!*p_input->psz_uri )
char *psz_uri = input_item_GetURI( p_input );
if( !p_input || !psz_uri || !*psz_uri )
{
msg_Dbg( p_intf, "invalid requested mrl: %s", mrl );
}
......@@ -347,6 +347,7 @@ void E_(MacroDo)( httpd_file_sys_t *p_args,
VLC_FALSE);
msg_Dbg( p_intf, "requested mrl add: %s", mrl );
}
free( psz_uri );
break;
}
......
......@@ -848,7 +848,8 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars,
p_input = E_(MRLParse)( p_intf, mrl, psz_name );
if( !p_input || !p_input->psz_uri || !*p_input->psz_uri )
char *psz_uri = input_item_GetURI( p_input );
if( !p_input || !psz_uri || !*psz_uri )
{
i_ret = VLC_EGENERIC;
msg_Dbg( p_intf, "invalid requested mrl: %s", mrl );
......@@ -860,6 +861,7 @@ void E_(EvaluateRPN)( intf_thread_t *p_intf, mvar_t *vars,
VLC_FALSE);
msg_Dbg( p_intf, "requested mrl add: %s", mrl );
}
free( psz_uri );
E_(SSPushN)( st, i_ret );
free( mrl );
......
......@@ -420,7 +420,7 @@ void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl,
if( p_node->i_children == -1 )
{
char value[512];
char *psz;
char *psz, psz_utf8;
mvar_t *itm = E_(mvar_New)( name, "set" );
if( p_pl->status.p_item && p_node &&
......@@ -437,12 +437,16 @@ void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl,
sprintf( value, "%d", p_node->i_id );
E_(mvar_AppendNewVar)( itm, "index", value );
psz = E_(FromUTF8)( p_intf, p_node->p_input->psz_name );
psz_utf8 = input_item_GetName( p_node->p_input );
psz = E_(FromUTF8)( p_intf, psz_utf8 );
E_(mvar_AppendNewVar)( itm, "name", psz );
free( psz_utf8 );
free( psz );
psz = E_(FromUTF8)( p_intf, p_node->p_input->psz_uri );
psz_utf8 = input_item_GetURI( p_node->p_input );
psz = E_(FromUTF8)( p_intf, psz_utf8 );
E_(mvar_AppendNewVar)( itm, "uri", psz );
free( psz_utf8 );
free( psz );
sprintf( value, "Item");
......@@ -460,7 +464,8 @@ void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl,
E_(mvar_AppendNewVar)( itm, "ro", "rw" );
}
sprintf( value, "%ld", (long)p_node->p_input->i_duration );
sprintf( value, "%ld",
(long) input_item_GetDuration( p_node->p_input ) );
E_(mvar_AppendNewVar)( itm, "duration", value );
E_(mvar_AppendVar)( s, itm );
......
......@@ -497,8 +497,10 @@ static void Run( intf_thread_t *p_intf )
{
if( !p_input->b_dead || !p_input->b_die )
{
msg_rc( STATUS_CHANGE "( new input: %s )",
input_GetItem(p_input)->psz_uri );
char *psz_uri =
input_item_Get_URI( input_GetItem( p_input ) );
msg_rc( STATUS_CHANGE "( new input: %s )", psz_uri );
free( psz_uri );
msg_rc( STATUS_CHANGE "( audio volume: %d )",
config_GetInt( p_intf, "volume" ));
}
......@@ -1396,8 +1398,10 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
if( p_playlist->p_input )
{
/* Replay the current state of the system. */
msg_rc( STATUS_CHANGE "( new input: %s )",
input_GetItem(p_playlist->p_input)->psz_uri );
char *psz_uri =
input_item_GetURI( input_GetItem( p_playlist->p_input ) );
msg_rc( STATUS_CHANGE "( new input: %s )", psz_uri );
free( psz_uri );
msg_rc( STATUS_CHANGE "( audio volume: %d )",
config_GetInt( p_intf, "volume" ));
......
......@@ -665,13 +665,11 @@ static int Demux( demux_t *p_demux )
}
else if( !strncasecmp( psz_parse, "</ASX", 5 ) )
{
vlc_mutex_lock( &p_current_input->lock );
if( psz_title_asx ) input_item_SetTitle( p_current_input, psz_title_asx );
if( psz_artist_asx ) input_item_SetArtist( p_current_input, psz_artist_asx );
if( psz_copyright_asx ) input_item_SetCopyright( p_current_input, psz_copyright_asx );
if( psz_moreinfo_asx ) input_item_SetURL( p_current_input, psz_moreinfo_asx );
if( psz_abstract_asx ) input_item_SetDescription( p_current_input, psz_abstract_asx );
vlc_mutex_unlock( &p_current_input->lock );
FREENULL( psz_base_asx );
FREENULL( psz_title_asx );
FREENULL( psz_artist_asx );
......
......@@ -155,7 +155,7 @@ static int Demux( demux_t *p_demux )
}
else if( !strcmp( psz_name, "label" ) )
{
input_ItemSetName( p_current_input, psz_value );
input_item_SetName( p_current_input, psz_value );
}
else
{
......
......@@ -229,7 +229,7 @@ static int Demux( demux_t *p_demux )
else if( b_item == VLC_FALSE && b_image == VLC_FALSE
&& !strcmp( psz_elname, "title" ) )
{
input_ItemSetName( p_current_input, psz_text );
input_item_SetName( p_current_input, psz_text );
}
#define ADD_GINFO( info, name ) \
else if( !b_item && !b_image && !strcmp( psz_elname, name ) ) \
......
......@@ -628,7 +628,7 @@ static vlc_bool_t set_item_info SIMPLE_INTERFACE
else if( !strcmp( psz_name, "duration" ) )
{
long i_num = atol( psz_value );
p_input->i_duration = i_num*1000;
input_item_SetDuration( p_input, (mtime_t) i_num*1000 );
}
else if( !strcmp( psz_name, "annotation" ) )
{
......
......@@ -342,13 +342,14 @@ static VLCBookmarks *_o_sharedInstance = nil;
}
msg_Dbg(p_intf, "calling wizard");
char *psz_uri = input_item_GetURI( input_GetItem( p_input ) );
[[[VLCMain sharedInstance] getWizard] initWithExtractValuesFrom:
[[NSNumber numberWithInt:
(pp_bookmarks[i_first]->i_time_offset/1000000)] stringValue]
to: [[NSNumber numberWithInt:
(pp_bookmarks[i_second]->i_time_offset/1000000)] stringValue]
ofItem: [NSString stringWithUTF8String:
input_GetItem(p_input)->psz_uri]];
ofItem: [NSString stringWithUTF8String: psz_uri]];
free( psz_uri );
vlc_object_release( p_input );
msg_Dbg(p_intf, "released input");
}
......
......@@ -303,7 +303,7 @@
else if( [[o_tc identifier] isEqualToString:@"3"] )
{
char psz_duration[MSTRTIME_MAX_SIZE];
mtime_t dur = p_item->p_input->i_duration;
mtime_t dur = input_item_GetDuration( p_item->p_input );
if( dur != -1 )
{
secstotimestr( psz_duration, dur/1000000 );
......
......@@ -187,31 +187,36 @@
/* check whether our item is valid, because we would crash if not */
if(! [self isItemInPlaylist: p_item] ) return;
vlc_mutex_lock( &p_item->p_input->lock );
/* fill uri info */
if( p_item->p_input->psz_uri )
char *psz_uri = input_item_GetURI( p_item->p_input );
if( psz_uri )
{
[o_uri_txt setStringValue:
([NSString stringWithUTF8String:p_item->p_input->psz_uri] == nil ) ?
[NSString stringWithCString:p_item->p_input->psz_uri] :
[NSString stringWithUTF8String:p_item->p_input->psz_uri]];
([NSString stringWithUTF8String:psz_uri] == nil ) ?
[NSString stringWithCString:psz_uri] :
[NSString stringWithUTF8String:psz_uri]];
}
free( psz_uri );
vlc_mutex_unlock( &p_item->p_input->lock );
#define SET( foo, bar ) \
char *psz_##foo = input_item_Get##bar ( p_item->p_input ); \
[set setMeta: psz_##foo forlabel: o_##foo##_txt]; \
free( psz_foo );
/* fill the other fields */
[self setMeta: input_item_GetTitle( p_item->p_input ) forLabel: o_title_txt];
[self setMeta: input_item_GetArtist( p_item->p_input ) forLabel: o_author_txt];
[self setMeta: input_item_GetAlbum( p_item->p_input ) forLabel: o_collection_txt];
[self setMeta: input_item_GetTrackNum( p_item->p_input ) forLabel: o_seqNum_txt];
[self setMeta: input_item_GetGenre( p_item->p_input ) forLabel: o_genre_txt];
[self setMeta: input_item_GetCopyright( p_item->p_input ) forLabel: o_copyright_txt];
[self setMeta: input_item_GetRating( p_item->p_input ) forLabel: o_rating_txt];
[self setMeta: input_item_GetPublisher( p_item->p_input ) forLabel: o_publisher_txt];
[self setMeta: input_item_GetNowPlaying( p_item->p_input ) forLabel: o_nowPlaying_txt];
[self setMeta: input_item_GetLanguage( p_item->p_input ) forLabel: o_language_txt];
[self setMeta: input_item_GetDate( p_item->p_input ) forLabel: o_date_txt];
SET( title, Title );
SET( author, Artist );
SET( collection, Album );
SET( seqNum, TrackNum );
SET( genre, Genre );
SET( copyright, Copyright );
SET( rating, Rating );
SET( publisher, Publisher );
SET( nowPlaying, NowPlaying );
SET( language, Language );
SET( date, Date );
#undef SET
/* reload the advanced table */
[[VLCInfoTreeItem rootItem] refresh];
......@@ -293,12 +298,12 @@
if( [self isItemInPlaylist: p_item] )
{
vlc_mutex_lock( &p_item->p_input->lock );
p_item->p_input->psz_uri = strdup( [[o_uri_txt stringValue] UTF8String] );
p_item->p_input->psz_name = strdup( [[o_title_txt stringValue] UTF8String] );
vlc_mutex_unlock( &p_item->p_input->lock );
input_item_SetArtist( p_item->p_input, [[o_author_txt stringValue] UTF8String] );
input_item_SetName( p_item->p_input,
[[o_title_txt stringValue] UTF8String] );
input_item_SetURI( p_item->p_input,
[[o_uri_txt stringValue] UTF8String] );
input_item_SetArtist( p_item->p_input,
[[o_author_txt stringValue] UTF8String] );
val.b_bool = VLC_TRUE;
var_Set( p_playlist, "intf-change", val );
......
......@@ -285,12 +285,14 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
return;
}
if( input_GetItem(p_input)->psz_name != NULL )
o_title = [NSMutableString stringWithUTF8String:
input_GetItem(p_input)->psz_name];
if( input_GetItem(p_input)->psz_uri != NULL )
o_mrl = [NSMutableString stringWithUTF8String:
input_GetItem(p_input)->psz_uri];
char *psz_name = input_item_GetName( input_GetItem( p_input ) );
char *psz_uri = input_item_GetURI( input_GetItem( p_input ) );
if( psz_name != NULL )
o_title = [NSMutableString stringWithUTF8String: psz_name];
if( psz_uri != NULL )
o_mrl = [NSMutableString stringWithUTF8String: psz_uri];
free( psz_name );
free( psz_uri );
if( o_title == nil )
o_title = o_mrl;
......
......@@ -597,8 +597,10 @@ static VLCWizard *_o_sharedInstance = nil;
if( p_item->i_children <= 0 )
{
char *psz_uri = input_item_GetURI( p_item->p_input );
[tempArray addObject: [NSString stringWithUTF8String:
p_item->p_input->psz_uri]];
psz_uri]];
free( psz_uri );
stop = NO;
}
else
......
......@@ -1206,8 +1206,9 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
vlc_value_t val_list;
/* Source */
mvnprintw( y++, 0, COLS, " Source : %s",
input_GetItem(p_input)->psz_uri );
char *psz_uri = input_item_GetURI( input_GetItem( p_input ) );
mvnprintw( y++, 0, COLS, " Source : %s", psz_uri );
free( psz_uri );
/* State */
var_Get( p_input, "state", &val );
......
......@@ -158,15 +158,18 @@ void MetaPanel::saveMeta()
return;
/* we can write meta data only in a file */
if( ( p_input->i_type == ITEM_TYPE_AFILE ) || \
( p_input->i_type == ITEM_TYPE_VFILE ) )
/* some audio files are detected as video files */
vlc_mutex_lock( &p_input->lock );
int i_type = p_input->i_type;
vlc_mutex_unlock( &p_input->lock );
if( ( i_type == ITEM_TYPE_AFILE ) || ( i_type == ITEM_TYPE_VFILE ) )
{
char *psz_uri = p_input->psz_uri;
char *psz_uri_orig = input_item_GetURI( p_input );
char *psz_uri = psz_uri_orig;
if( !strncmp( psz_uri, "file://", 7 ) )
psz_uri += 7; /* strlen("file://") = 7 */
p_export.psz_file = strndup( psz_uri, PATH_MAX );
free( psz_uri_orig );
}
else
return;
......@@ -239,20 +242,29 @@ void MetaPanel::update( input_item_t *p_item )
/* Name / Title */
psz_meta = input_item_GetTitle( p_item );
char *psz_name = input_item_GetName( p_item );
if( !EMPTY_STR( psz_meta ) )
title_text->setText( qfu( psz_meta ) );
else if( !EMPTY_STR( p_item->psz_name ) )
title_text->setText( qfu( p_item->psz_name ) );
else if( !EMPTY_STR( psz_name ) )
title_text->setText( qfu( psz_name ) );
else title_text->setText( "" );
free( psz_meta );
free( psz_name );
/* URL / URI */
psz_meta = input_item_GetURL( p_item );
if( !EMPTY_STR( psz_meta ) )
{
emit uriSet( QString( psz_meta ) );
else if( !EMPTY_STR( p_item->psz_uri ) )
emit uriSet( QString( p_item->psz_uri ) );
free( psz_meta );
free( psz_meta );
}
else
{
free( psz_meta );
psz_meta = input_item_GetURI( p_item );
if( !EMPTY_STR( psz_meta ) )
emit uriSet( QString( psz_meta ) );
}
/* Other classic though */
UPDATE_META( Artist, artist_text );
......
......@@ -138,6 +138,7 @@ void InputManager::update()
char *psz_artist = input_item_GetArtist( input_GetItem( p_input ) );