}
}
-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 );
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 )
}
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
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 );
}
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);
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;
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 ) );
}
}
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 );
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" )
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 );
+ }
}
}
/* 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 );
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 )
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
}
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[] =
{
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 );
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 );
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 );
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 );
}
VLC_FALSE);
msg_Dbg( p_intf, "requested mrl add: %s", mrl );
}
+ free( psz_uri );
break;
}
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 );
VLC_FALSE);
msg_Dbg( p_intf, "requested mrl add: %s", mrl );
}
+ free( psz_uri );
E_(SSPushN)( st, i_ret );
free( mrl );
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 &&
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");
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 );
{
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" ));
}
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" ));
}
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 );
}
else if( !strcmp( psz_name, "label" ) )
{
- input_ItemSetName( p_current_input, psz_value );
+ input_item_SetName( p_current_input, psz_value );
}
else
{
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 ) ) \
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" ) )
{
}
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");
}
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 );
/* 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];
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 );
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;
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
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 );
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;
/* 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 );
char *psz_artist = input_item_GetArtist( input_GetItem( p_input ) );
if( EMPTY_STR( psz_name ) )
{
+ free( psz_name );
psz_name = input_item_GetName( input_GetItem( p_input ) );
}
if( !EMPTY_STR( psz_nowplaying ) )
ADD_META( p_item, Description );
break;
case VLC_META_ENGINE_DURATION:
- secstotimestr( psz_duration, p_item->p_input->i_duration / 1000000 );
+ secstotimestr( psz_duration,
+ input_item_GetDuration( p_item->p_input ) / 1000000 );
strings.append( QString( psz_duration ) );
break;
case VLC_META_ENGINE_GENRE:
WS_CHILD | WS_VISIBLE | SS_RIGHT,
0, 10, 60, 15, hwnd, NULL, hInst, NULL);
- uri_text = CreateWindow( _T("EDIT"), _FROMMB(p_item->input.psz_uri),
+ char *psz_uri = input_item_GetURI( &p_item->input );
+ uri_text = CreateWindow( _T("EDIT"), _FROMMB(psz_uri),
WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT | ES_AUTOHSCROLL,
70, 10 - 3, rcClient.right - 70 - 10, 15 + 6, hwnd, 0, hInst, 0 );
+ free( psz_uri );
/* Name Textbox */
name_label = CreateWindow( _T("STATIC"), _T("Name:"),
{
int b_state = VLC_FALSE;
- vlc_mutex_lock( &p_item->input.lock );
-
TCHAR psz_name[MAX_PATH];
Edit_GetText( name_text, psz_name, MAX_PATH );
- if( p_item->input.psz_name ) free( p_item->input.psz_name );
- p_item->input.psz_name = strdup( _TOMB(psz_name) );
+ input_item_SetName( &p_item->input, _TOMB( psz_name ) );
TCHAR psz_uri[MAX_PATH];
Edit_GetText( uri_text, psz_uri, MAX_PATH );
- if( p_item->input.psz_uri ) free( p_item->input.psz_uri );
- p_item->input.psz_uri = strdup( _TOMB(psz_uri) );
+ input_item_SetURI( &p_item->input, _TOMB(psz_uri) );
+ vlc_mutex_lock( &p_item->input.lock );
vlc_bool_t b_old_enabled = p_item->b_enabled;
playlist_t * p_playlist = (playlist_t *)
_("General") , _("Author") ) ) );
char psz_duration[MSTRTIME_MAX_SIZE];
- mtime_t dur = p_item->input.i_duration;
+ mtime_t dur = input_item_GetDuration( p_item );
if( dur != -1 ) secstotimestr( psz_duration, dur/1000000 );
else memcpy( psz_duration , "-:--:--", sizeof("-:--:--") );
if( i_first < i_bookmarks && i_second <= i_bookmarks )
{
+ char *psz_uri = input_item_GetURI( input_GetItem( p_input ) );
WizardDialog *p_wizard_dialog = new WizardDialog( p_intf, this,
- input_GetItem(p_input)->psz_uri,
+ psz_uri,
pp_bookmarks[i_first]->i_time_offset/1000000,
pp_bookmarks[i_second]->i_time_offset/1000000 );
+ free( psz_uri );
vlc_object_release( p_input );
if( p_wizard_dialog )
{
/* Rebuild the tree */
Clear();
- uri_text->SetValue( wxU( p_item->psz_uri ) );
- name_text->SetValue( wxU( p_item->psz_name ) );
char *psz_meta;
#define UPDATE_META( meta, widget ) { \
} \
free( psz_meta );
+ UPDATE_META( URI, uri_text );
+ UPDATE_META( Name, name_text );
UPDATE_META( Artist, artist_text );
UPDATE_META( Genre, genre_text );
UPDATE_META( Copyright, copyright_text );
*****************************************************************************/
void ItemInfoDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
{
- vlc_mutex_lock( &p_item->p_input->lock );
- p_item->p_input->psz_name = info_panel->GetName();
- p_item->p_input->psz_uri = info_panel->GetURI();
- vlc_mutex_unlock( &p_item->p_input->lock );
+ input_item_SetName( p_item->p_input, info_panel->GetName() );
+ input_item_SetURI( p_item->p_input, info_panel->GetURI() );
EndModal( wxID_OK );
}
wxString msg;
wxString duration = wxU( "" );
- char *psz_artist;
- psz_artist = input_item_GetArtist( p_item->p_input );
+ char *psz_artist = input_item_GetArtist( p_item->p_input );
+ char *psz_name = input_item_GetName( p_item->p_input );
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 )
{
if( !strcmp( psz_artist, "" ) || p_item->p_input->b_fixed_name == VLC_TRUE )
{
- msg = wxString( wxU( p_item->p_input->psz_name ) ) + duration;
+ msg = wxString( wxU( psz_name ) ) + duration;
}
else
{
msg = wxString(wxU( psz_artist )) + wxT(" - ") +
- wxString(wxU(p_item->p_input->psz_name)) + duration;
+ wxString(wxU(psz_name)) + duration;
}
free( psz_artist );
+ free( psz_name );
treectrl->SetItemText( item , msg );
treectrl->SetItemImage( item, p_item->p_input->i_type );
playlist_item_t * p_item = playlist_ItemGetById( p_playlist, (int)data, VLC_FALSE );
if( p_item )
{
- p_parent->SetMrl( (const char*)p_item->p_input->psz_uri );
+ const char *psz_uri = input_item_GetURI( p_item->p_input );
+ p_parent->SetMrl( psz_uri );
+ free( psz_uri );
}
else
event.Veto();
wxString duration = wxU( "" );
char *psz_artist = input_item_GetArtist( p_item->p_input );
- if( ! psz_artist )
- {
- psz_artist = "";
- }
+ if( !psz_artist )
+ psz_artist = strdup( "" );
+
+ char *psz_name = input_item_GetName( p_item->p_input );
+ if( !psz_name )
+ psz_name = strdup( "" );
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 )
{
if( !strcmp( psz_artist, "" ) || p_item->p_input->b_fixed_name == VLC_TRUE )
{
- msg = wxString( wxU( p_item->p_input->psz_name ) ) + duration;
+ msg = wxString( wxU( psz_name ) ) + duration;
}
else
{
msg = wxString(wxU( psz_artist )) + wxT(" - ") +
- wxString(wxU(p_item->p_input->psz_name)) + duration;
+ wxString(wxU(psz_name)) + duration;
}
free( psz_artist );
+ free( psz_name );
treectrl->SetItemText( item , msg );
treectrl->SetItemImage( item, p_item->p_input->i_type );
int i = 0;
struct stat a;
char psz_filename[MAX_PATH];
- char *psz_dir = strdup( p_item->psz_uri );
+ char *psz_dir = input_item_GetURI( p_item );
char *psz_buf = strrchr( psz_dir, '/' );
if( psz_buf )
{
input_item_t *p_item = input_GetItem( p_input );
if( p_item )
- {
- vlc_mutex_lock( &p_item->lock );
- p_item->i_duration = i_ogg_v_length * 1000000;
- vlc_mutex_unlock( &p_item->lock );
- }
+ input_item_SetDuration( p_item,
+ (mtime_t) i_ogg_v_length * 1000000 );
vlc_object_release( p_input );
}
{
input_item_t *p_item = input_GetItem( p_input );
if( p_item )
- {
- vlc_mutex_lock( &p_item->lock );
- p_item->i_duration = i_ogg_f_length * 1000000;
- vlc_mutex_unlock( &p_item->lock );
- }
+ input_item_SetDuration( p_item,
+ (mtime_t) i_ogg_f_length * 1000000 );
vlc_object_release( p_input );
}
}
{
input_item_t *p_item = input_GetItem( p_input );
if( p_item )
- {
- vlc_mutex_lock( &p_item->lock );
- p_item->i_duration = i_flac_length * 1000000;
- vlc_mutex_unlock( &p_item->lock );
- }
+ input_item_SetDuration( p_item,
+ (mtime_t) i_flac_length * 1000000 );
vlc_object_release( p_input );
}
}
TagLib::ID3v2::TextIdentificationFrame p_frame( p_byte ); \
p_frame.setText( psz_meta ); \
p_id3tag->addFrame( &p_frame ); \
+ free( psz_meta ); \
} \
- else free( psz_meta );
WRITE( Publisher, "TPUB" );
WRITE( Copyright, "TCOP" );
else
psz_trackid = calloc( 1, 1 );
- i_length = input_GetItem(p_input)->i_duration / 1000000;
+ i_length = input_item_GetDuration( input_GetItem( p_input ) ) / 1000000;
vlc_mutex_lock ( &p_sys->lock );
if( psz_artist == NULL ) psz_artist = strdup( "" );
psz_album = input_item_GetAlbum( input_GetItem( p_input ) ) ;
if( psz_album == NULL ) psz_album = strdup( "" );
- psz_title = input_item_GetName( input_GetItem( p_input ) );
- if( psz_title == NULL ) psz_title = strdup( N_("(no title)") );
+ psz_title = input_item_GetTitle( input_GetItem( p_input ) );
+ if( psz_title == NULL )
+ psz_title = input_item_GetName( input_GetItem( p_input ) );
snprintf( psz_tmp, GROWL_MAX_LENGTH, "%s %s %s",
psz_title, psz_artist, psz_album );
free( psz_title );
}
/* Playing something ... */
- psz_artist = input_item_GetArtist( input_GetItem(p_input) );
- psz_album = input_item_GetAlbum( input_GetItem(p_input) );
- psz_title = input_item_GetTitle( input_GetItem(p_input) );
+ psz_artist = input_item_GetArtist( input_GetItem( p_input ) );
+ psz_album = input_item_GetAlbum( input_GetItem( p_input ) );
+ psz_title = input_item_GetTitle( input_GetItem( p_input ) );
if( !psz_artist ) psz_artist = strdup( "" );
if( !psz_album ) psz_artist = strdup( "" );
- if( !strcmp( psz_title, NULL ) )
- psz_title = strdup( N_("(no title)") );
+ if( !psz_title )
+ psz_title = input_item_GetName( input_GetItem( p_input ) );
psz_buf = str_format_meta( p_this, p_intf->p_sys->psz_format );
if( psz_artist == NULL ) psz_artist = strdup( _("no artist") );
psz_album = input_item_GetAlbum( input_GetItem( p_input ) ) ;
if( psz_album == NULL ) psz_album = strdup( _("no album") );
- psz_title = input_item_GetName( input_GetItem( p_input ) );
+ psz_title = input_item_GetTitle( input_GetItem( p_input ) );
+ if( psz_title == NULL )
+ psz_title = input_item_GetName( input_GetItem( p_input ) );
vlc_object_release( p_input );
vlc_object_release( p_playlist );
- if( p_input->i_duration != -1 )
+ mtime_t i_duration = input_item_GetDuration( p_input );
+ if( i_duration != -1 )
{
char psz_durationstr[MSTRTIME_MAX_SIZE];
- secstotimestr( psz_durationstr, p_input->i_duration/1000000 );
+ secstotimestr( psz_durationstr, i_duration / 1000000 );
sprintf( psz_duration, "(%s)", psz_durationstr );
}
else
continue;
}
- assert( p_current->p_input->psz_uri );
-
/* General info */
+
+ char *psz_uri = input_item_GetURI( p_current->p_input );
+
+ assert( psz_uri );
+
char *psz_name = input_item_GetName( p_current->p_input );
- if( psz_name && strcmp( p_current->p_input->psz_uri, psz_name ) )
+ if( psz_name && strcmp( psz_uri, psz_name ) )
{
char *psz_artist = input_item_GetArtist( p_current->p_input );
if( psz_artist == NULL ) psz_artist = strdup( "" );
+ mtime_t i_duration = input_item_GetDuration( p_current->p_input );
if( psz_artist && *psz_artist )
{
/* write EXTINF with artist */
fprintf( p_export->p_file, "#EXTINF:%i,%s - %s\n",
- (int)( p_current->p_input->i_duration/1000000 ),
- psz_artist,
- p_current->p_input->psz_name);
+ (int)( i_duration / 1000000 ), psz_artist, psz_name);
}
else
{
/* write EXTINF without artist */
fprintf( p_export->p_file, "#EXTINF:%i,%s\n",
- (int)( p_current->p_input->i_duration/1000000 ),
- p_current->p_input->psz_name);
+ (int)( i_duration / 1000000 ), psz_name);
}
free( psz_artist );
}
+ free( psz_uri );
free( psz_name );
/* VLC specific options */
+ vlc_mutex_lock( &p_current->p_input->lock );
for( j = 0; j < p_current->p_input->i_options; j++ )
{
fprintf( p_export->p_file, "#EXTVLCOPT:%s\n",
p_current->p_input->ppsz_options[j] + 1 :
p_current->p_input->ppsz_options[j] );
}
+ vlc_mutex_unlock( &p_current->p_input->lock );
- fprintf( p_export->p_file, "%s\n",
- p_current->p_input->psz_uri );
+ fprintf( p_export->p_file, "%s\n", psz_uri );
}
}
{
char *psz;
char *psz_temp;
+ mtime_t i_duration;
if( !p_item ) return;
( *p_i_count )++;
/* -> the location */
- if( p_item->p_input->psz_uri && *p_item->p_input->psz_uri )
+
+ char *psz_uri = input_item_GetURI( p_item->p_input );
+
+ if( psz_uri && *psz_uri )
{
- psz = assertUTF8URI( p_item->p_input->psz_uri );
+ psz = assertUTF8URI( psz_uri );
fprintf( p_file, "\t\t\t<location>%s</location>\n", psz );
free( psz );
}
/* -> the name/title (only if different from uri)*/
- if( p_item->p_input->psz_name &&
- p_item->p_input->psz_uri &&
- strcmp( p_item->p_input->psz_uri, p_item->p_input->psz_name ) )
+ char *psz_name = input_item_GetName( p_item->p_input );
+ if( psz_name && psz_uri && strcmp( psz_uri, psz_name ) )
{
- psz_temp = convert_xml_special_chars( p_item->p_input->psz_name );
+ psz_temp = convert_xml_special_chars( psz_name );
if( *psz_temp )
fprintf( p_file, "\t\t\t<title>%s</title>\n", psz_temp );
free( psz_temp );
}
+ free( psz_name );
+ free( psz_uri );
if( p_item->p_input->p_meta == NULL )
{
xspfexportitem_end:
/* -> the duration */
- if( p_item->p_input->i_duration > 0 )
+ i_duration = input_item_GetDuration( p_item->p_input );
+ if( i_duration > 0 )
{
fprintf( p_file, "\t\t\t<duration>%ld</duration>\n",
- (long)(p_item->p_input->i_duration / 1000) );
+ (long)(i_duration / 1000) );
}
fprintf( p_file, "\t\t</track>\n" );
p_media->i_sdp_id = mdate();
p_media->i_sdp_version = 1;
- p_media->i_length = p_item->i_duration;
+ p_media->i_length = input_item_GetDuration( p_item );
vlc_mutex_lock( &p_item->lock );
msg_Dbg( p_vod, "media has %i declared ES", p_item->i_es );
return VLC_EGENERIC;
}
- p_parent_input = input_GetItem(p_input);
+ p_parent_input = input_GetItem( p_input );
+
+ input_item_SetURI( p_parent_input, p_sdp->psz_uri );
+ input_item_SetName( p_parent_input, p_sdp->psz_sessionname );
vlc_mutex_lock( &p_parent_input->lock );
- FREENULL( p_parent_input->psz_uri );
- p_parent_input->psz_uri = strdup( p_sdp->psz_uri );
- FREENULL( p_parent_input->psz_name );
- p_parent_input->psz_name = strdup( p_sdp->psz_sessionname );
+
p_parent_input->i_type = ITEM_TYPE_NET;
if( p_playlist->status.p_item &&
if( p_input )
{
- char *psz = strrchr( input_GetItem(p_input)->psz_uri, '/' );
+ char *psz_orig = input_item_GetURI( input_GetItem( p_input ) );
+ char *psz = strrchr( psz_orig, '/' );
if( psz )
{
}
else
{
- psz = input_GetItem(p_input)->psz_uri;
+ psz = psz_orig;
}
if( psz && *psz )
{
psz_title = strdup( psz );
}
+ free( psz_orig );
vlc_object_release( p_input );
}
if( p_input )
{
- psz_title = strdup( input_item_GetTitle( input_GetItem( p_input ) ) );
+ psz_title = input_item_GetTitle( input_GetItem( p_input ) );
if( EMPTY_STR( psz_title ) )
{
free( psz_title );
- char *psz = strrchr( input_GetItem(p_input)->psz_uri, '/' );
+ char *psz_orig = input_item_GetURI( input_GetItem( p_input ) );
+ char *psz = strrchr( psz_orig, '/' );
if( psz )
{
}
else
{
- psz = input_GetItem(p_input)->psz_uri;
+ psz = psz_orig;
}
if( psz && *psz )
{
psz_title = strdup( psz );
}
+ free( psz_orig );
}
vlc_object_release( p_input );
}
libvlc_exception_t * p_e )
{
(void)p_e;
- return strdup( p_md->p_input_item->psz_uri );
+ return input_item_GetURI( p_md->p_input_item );
}
/**************************************************************************
for( i_index = 0 ; i_index < i_playlist_size ; i_index++ )
{
- retval->data[i_index] = strdup( ARRAY_VAL(p_playlist->current, i_index)->p_input->psz_uri );
+ retval->data[i_index] = input_item_GetURI( ARRAY_VAL(p_playlist->current, i_index)->p_input );
}
vlc_mutex_unlock( &p_playlist->object_lock );
break;
}
- retval->url = strdup( input_GetItem(p_input)->psz_uri );
+ retval->url = input_item_GetURI( input_GetItem( p_input ) );
/* TIME and LENGTH are in microseconds. We want them in ms */
var_Get( p_input, "time", &val);
var_Change( p_input, "length", VLC_VAR_SETVALUE, &val, NULL );
UpdateItemLength( p_input, val.i_time );
}
- else if( p_input->p->input.p_item->i_duration > 0 )
- { /* fallback: gets length from metadata */
- val.i_time = p_input->p->input.p_item->i_duration;
- var_Change( p_input, "length", VLC_VAR_SETVALUE, &val, NULL );
- UpdateItemLength( p_input, val.i_time );
+ else
+ {
+ val.i_time = input_item_GetDuration( p_input->p->input.p_item );
+ if( val.i_time > 0 )
+ { /* fallback: gets length from metadata */
+ var_Change( p_input, "length", VLC_VAR_SETVALUE, &val, NULL );
+ UpdateItemLength( p_input, val.i_time );
+ }
}
/* Start title/chapter */
*****************************************************************************/
static void UpdateItemLength( input_thread_t *p_input, int64_t i_length )
{
- vlc_mutex_lock( &p_input->p->input.p_item->lock );
- p_input->p->input.p_item->i_duration = i_length;
- vlc_mutex_unlock( &p_input->p->input.p_item->lock );
+ input_item_SetDuration( p_input->p->input.p_item, (mtime_t) i_length );
if( !p_input->b_preparsing )
{
/* Start new one */
p_instance->i_index = i_input_index;
- if( p_instance->item.psz_uri )
- free( p_instance->item.psz_uri );
- p_instance->item.psz_uri = strdup( p_media->cfg.ppsz_input[p_instance->i_index] );
+ input_item_SetURI( &p_instance->item, p_media->cfg.ppsz_input[p_instance->i_index] ) ;
asprintf( &psz_log, _("Media: %s"), p_media->cfg.psz_name );
p_instance->p_input = input_CreateThreadExtended( p_vlm, &p_instance->item, psz_log, p_instance->p_sout );
{
if( psz_name && p_item )
{
- input_ItemSetName( p_item->p_input, psz_name );
+ input_item_SetName( p_item->p_input, psz_name );
return VLC_SUCCESS;
}
return VLC_EGENERIC;
return VLC_SUCCESS;
}
+#define META_STRCASECMP_NAME( i, i_small ) { \
+ char *psz_i = input_item_GetName( pp_items[i]->p_input ); \
+ char *psz_ismall = input_item_GetName( pp_items[i_small]->p_input ); \
+ i_test = strcasecmp( psz_i, psz_ismall ); \
+ free( psz_i ); \
+ free( psz_ismall ); \
+}
+
+
#define DO_META_SORT( node ) { \
char *psz_a = input_item_GetMeta( pp_items[i]->p_input, vlc_meta_##node ); \
char *psz_b = input_item_GetMeta( pp_items[i_small]->p_input, vlc_meta_##node ); \
else if( pp_items[i]->i_children >= 0 && \
pp_items[i_small]->i_children >= 0 ) \
{ \
- i_test = strcasecmp( pp_items[i]->p_input->psz_name, \
- pp_items[i_small]->p_input->psz_name ); \
+ META_STRCASECMP_NAME( i, i_small ) \
} \
/* Both are items */ \
else if( psz_a == NULL && psz_b != NULL ) \
/* No meta, sort by name */ \
else if( psz_a == NULL && psz_b == NULL ) \
{ \
- i_test = strcasecmp( pp_items[i]->p_input->psz_name, \
- pp_items[i_small]->p_input->psz_name ); \
+ META_STRCASECMP_NAME( i, i_small ); \
} \
else \
{ \
if( i_mode == SORT_TITLE )
{
- i_test = strcasecmp( pp_items[i]->p_input->psz_name,
- pp_items[i_small]->p_input->psz_name );
+ META_STRCASECMP_NAME( i, i_small );
}
else if( i_mode == SORT_TITLE_NUMERIC )
{
- i_test = atoi( pp_items[i]->p_input->psz_name ) -
- atoi( pp_items[i_small]->p_input->psz_name );
+ char *psz_i = input_item_GetName( pp_items[i]->p_input );
+ char *psz_ismall =
+ input_item_GetName( pp_items[i_small]->p_input );
+ i_test = atoi( psz_i ) - atoi( psz_ismall );
+ free( psz_i );
+ free( psz_ismall );
}
else if( i_mode == SORT_DURATION )
{
- i_test = pp_items[i]->p_input->i_duration -
- pp_items[i_small]->p_input->i_duration;
+ i_test = input_item_GetDuration( pp_items[i]->p_input ) -
+ input_item_GetDuration( pp_items[i_small]->p_input );
}
else if( i_mode == SORT_ARTIST )
{
if( check ) \
{ \
psz_meta = string; \
- if( string ) \
+ if( psz_meta ) \
{ \
- int len = strlen( psz_meta ); \
+ int len = strlen( string ); \
dst = realloc( dst, \
i_size = i_size + len + 1 ); \
strncpy( d, psz_meta, len+1 ); \
d += len; \
- free( psz_meta ); \
} \
else \
{ \
d++; \
} \
}
+
+/* same than INSERT_STRING, except that string won't be freed */
+#define INSERT_STRING_NO_FREE( check, string ) \
+ if( check && string ) \
+ { \
+ int len = strlen( string ); \
+ dst = realloc( dst, \
+ i_size = i_size + len + 1 ); \
+ strncpy( d, string, len+1 ); \
+ d += len; \
+ free( string ); \
+ } \
+ else \
+ { \
+ *d = '-'; \
+ d++; \
+ }
char *__str_format_meta( vlc_object_t *p_object, const char *string )
{
const char *s = string;
{
vlc_object_yield( p_input );
p_item = input_GetItem(p_input);
- if( p_item )
- vlc_mutex_lock( &p_item->lock );
}
sprintf( dst, string );
lang = strdup( b_empty_if_na ? "" : "-" );
}
INSERT_STRING( 1, lang );
- free( lang );
break;
}
case 't':
{
sprintf( buf, b_empty_if_na ? "" : "-" );
}
- INSERT_STRING( 1, buf );
+ INSERT_STRING_NO_FREE( 1, buf );
break;
case 'C':
if( p_input )
{
sprintf( buf, b_empty_if_na ? "" : "-" );
}
- INSERT_STRING( 1, buf );
+ INSERT_STRING_NO_FREE( 1, buf );
break;
case 'D':
if( p_item )
{
+ mtime_t i_duration = input_item_GetDuration( p_item );
sprintf( buf, "%02d:%02d:%02d",
- (int)(p_item->i_duration/(3600000000)),
- (int)((p_item->i_duration/(60000000))%60),
- (int)((p_item->i_duration/1000000)%60) );
+ (int)(i_duration/(3600000000)),
+ (int)((i_duration/(60000000))%60),
+ (int)((i_duration/1000000)%60) );
}
else
{
sprintf( buf, b_empty_if_na ? "" : "--:--:--" );
}
- INSERT_STRING( 1, buf );
+ INSERT_STRING_NO_FREE( 1, buf );
break;
case 'F':
- INSERT_STRING( p_item, p_item->psz_uri );
+ INSERT_STRING( p_item, input_item_GetURI( p_item ) );
break;
case 'I':
if( p_input )
{
sprintf( buf, b_empty_if_na ? "" : "-" );
}
- INSERT_STRING( 1, buf );
+ INSERT_STRING_NO_FREE( 1, buf );
break;
case 'L':
if( p_item && p_input )
{
+ mtime_t i_duration = input_item_GetDuration( p_item );
+ int64_t i_time = p_input->i_time;
sprintf( buf, "%02d:%02d:%02d",
- (int)((p_item->i_duration-p_input->i_time)/(3600000000)),
- (int)(((p_item->i_duration-p_input->i_time)/(60000000))%60),
- (int)(((p_item->i_duration-p_input->i_time)/1000000)%60) );
+ (int)( ( i_duration - i_time ) / 3600000000 ),
+ (int)( ( ( i_duration - i_time ) / 60000000 ) % 60 ),
+ (int)( ( ( i_duration - i_time ) / 1000000 ) % 60 ) );
}
else
{
sprintf( buf, b_empty_if_na ? "" : "--:--:--" );
}
- INSERT_STRING( 1, buf );
+ INSERT_STRING_NO_FREE( 1, buf );
break;
case 'N':
- INSERT_STRING( p_item, p_item->psz_name );
+ INSERT_STRING( p_item, input_item_GetName( p_item ) );
break;
case 'O':
{
lang = strdup( b_empty_if_na ? "" : "-" );
}
INSERT_STRING( 1, lang );
- free( lang );
break;
}
case 'P':
{
sprintf( buf, b_empty_if_na ? "" : "--.-%%" );
}
- INSERT_STRING( 1, buf );
+ INSERT_STRING_NO_FREE( 1, buf );
break;
case 'R':
if( p_input )
{
sprintf( buf, b_empty_if_na ? "" : "-" );
}
- INSERT_STRING( 1, buf );
+ INSERT_STRING_NO_FREE( 1, buf );
break;
case 'S':
if( p_input )
{
sprintf( buf, b_empty_if_na ? "" : "-" );
}
- INSERT_STRING( 1, buf );
+ INSERT_STRING_NO_FREE( 1, buf );
break;
case 'T':
if( p_input )
{
sprintf( buf, "%02d:%02d:%02d",
- (int)(p_input->i_time/(3600000000)),
- (int)((p_input->i_time/(60000000))%60),
- (int)((p_input->i_time/1000000)%60) );
+ (int)( p_input->i_time / ( 3600000000 ) ),
+ (int)( ( p_input->i_time / ( 60000000 ) ) % 60 ),
+ (int)( ( p_input->i_time / 1000000 ) % 60 ) );
}
else
{
sprintf( buf, b_empty_if_na ? "" : "--:--:--" );
}
- INSERT_STRING( 1, buf );
+ INSERT_STRING_NO_FREE( 1, buf );
break;
case 'U':
INSERT_STRING( p_item, input_item_GetPublisher(p_item) );
audio_volume_t volume;
aout_VolumeGet( p_object, &volume );
snprintf( buf, 10, "%d", volume );
- INSERT_STRING( 1, buf );
+ INSERT_STRING_NO_FREE( 1, buf );
break;
}
case '_':
*d = '\0';
if( p_input )
- {
vlc_object_release( p_input );
- if( p_item )
- vlc_mutex_unlock( &p_item->lock );
- }
return dst;
}
char *psz_nowplaying =
input_item_GetNowPlaying( input_GetItem( p_input ) );
char *psz_artist = input_item_GetArtist( input_GetItem( p_input ) );
- char *psz_name = input_item_GetName( input_GetItem( p_input ) );
+ char *psz_name = input_item_GetTitle( input_GetItem( p_input ) );
+ if( EMPTY_STR( psz_name ) )
+ {
+ free( psz_name );
+ psz_name = input_item_GetName( input_GetItem( p_input ) );
+ }
if( !EMPTY_STR( psz_nowplaying ) )
{
vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN,