VLC_EXPORT( bool, input_item_MetaMatch, ( input_item_t *p_i, vlc_meta_type_t meta_type, const char *psz ) );
VLC_EXPORT( char *, input_item_GetMeta, ( input_item_t *p_i, vlc_meta_type_t meta_type ) );
VLC_EXPORT( char *, input_item_GetName, ( input_item_t * p_i ) );
+VLC_EXPORT( char *, input_item_GetTitleFbName, ( input_item_t * p_i ) );
VLC_EXPORT( char *, input_item_GetURI, ( input_item_t * p_i ) );
VLC_EXPORT( void, input_item_SetURI, ( input_item_t * p_i, const char *psz_uri ));
VLC_EXPORT(mtime_t, input_item_GetDuration, ( input_item_t * p_i ) );
if( [[o_tc identifier] isEqualToString:@"name"] )
{
/* sanity check to prevent the NSString class from crashing */
- char *psz_title = input_item_GetTitle( p_item->p_input );
- if( !EMPTY_STR( psz_title ) )
+ char *psz_title = input_item_GetTitleFbName( p_item->p_input );
+ if( psz_title )
{
o_value = [NSString stringWithUTF8String: psz_title];
+ free( psz_title );
}
- else
- {
- char *psz_name = input_item_GetName( p_item->p_input );
- if( psz_name )
- o_value = [NSString stringWithUTF8String: psz_name];
- free( psz_name );
- }
- free( psz_title );
}
else if( [[o_tc identifier] isEqualToString:@"artist"] )
{
{
char *psz_display;
p_child = p_node->pp_children[k];
- char *psz_name = input_item_GetTitle( p_child->p_input );
- if( !psz_name || !*psz_name )
- {
- free( psz_name );
- psz_name = input_item_GetName( p_child->p_input );
- }
+ char *psz_name = input_item_GetTitleFbName( p_child->p_input );
if( c && *c )
{
free( psz_meta );
/* Name / Title */
- psz_meta = input_item_GetTitle( p_item );
- char *psz_name = input_item_GetName( p_item );
- if( !EMPTY_STR( psz_meta ) )
+ psz_meta = input_item_GetTitleFbName( p_item );
+ if( psz_meta )
+ {
title_text->setText( qfu( psz_meta ) );
- else if( !EMPTY_STR( psz_name ) )
- title_text->setText( qfu( psz_name ) );
- else title_text->setText( "" );
- free( psz_meta );
- free( psz_name );
+ free( psz_meta );
+ }
+ else
+ title_text->setText( "" );
/* URL / URI */
psz_meta = input_item_GetURL( p_item );
* Returned value has to be freed */
static char * psz_column_meta( input_item_t *p_item, uint32_t i_column )
{
- char *psz;
int i_duration;
char psz_duration[MSTRTIME_MAX_SIZE];
switch( i_column )
case COLUMN_NUMBER:
return NULL;
case COLUMN_TITLE:
- psz = input_item_GetTitle( p_item );
- if( !psz )
- psz = input_item_GetName( p_item );
- return psz;
+ return input_item_GetTitleFbName( p_item );
case COLUMN_DURATION:
i_duration = input_item_GetDuration( p_item ) / 1000000;
secstotimestr( psz_duration, i_duration );
QString text;
/* Try to get the Title, then the Name */
- 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 ) );
- }
+ char *psz_name = input_item_GetTitleFbName( input_GetItem( p_input ) );
/* Try to get the nowplaying */
char *psz_nowplaying =
// Saving all common fields
// If the title is empty, use the name
- psz_meta = input_item_GetTitle( p_item );
- if( !psz_meta ) psz_meta = input_item_GetName( p_item );
+ psz_meta = input_item_GetTitleFbName( p_item );
SET( Title, psz_meta );
free( psz_meta );
/* Playing something ... */
input_item_t *p_item = input_GetItem( p_input );
- psz_title = input_item_GetTitle( p_item );
+ psz_title = input_item_GetTitleFbName( p_item );
if( EMPTY_STR( psz_title ) )
{
free( psz_title );
- psz_title = input_item_GetName( input_GetItem( p_input ) );
- if( EMPTY_STR( psz_title ) )
- {
- free( psz_title );
- vlc_object_release( p_input );
- return VLC_SUCCESS;
- }
+ vlc_object_release( p_input );
+ return VLC_SUCCESS;
}
psz_artist = input_item_GetArtist( p_item );
/* Playing something ... */
input_item_t *p_item = input_GetItem( p_input );
- psz_title = input_item_GetTitle( p_item );
+ psz_title = input_item_GetTitleFbName( p_item );
if( EMPTY_STR( psz_title ) )
{
free( psz_title );
- psz_title = input_item_GetName( input_GetItem( p_input ) );
- if( EMPTY_STR( psz_title ) )
- {
- free( psz_title );
- vlc_object_release( p_input );
- return VLC_SUCCESS;
- }
+ vlc_object_release( p_input );
+ return VLC_SUCCESS;
}
psz_artist = input_item_GetArtist( p_item );
/* 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_title = input_item_GetTitleFbName( input_GetItem( p_input ) );
if( !psz_artist ) psz_artist = strdup( "" );
if( !psz_album ) psz_album = strdup( "" );
- 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 );
input_item_t *p_input_item = input_GetItem( p_input );
psz_artist = input_item_GetArtist( p_input_item );
psz_album = input_item_GetAlbum( p_input_item );
- psz_title = input_item_GetTitle( p_input_item );
- if( EMPTY_STR( psz_title ) )
- {
- free( psz_title );
- psz_title = input_item_GetName( p_input_item );
- }
+ psz_title = input_item_GetTitleFbName( p_input_item );
+
if( EMPTY_STR( psz_title ) )
{ /* Not enough metadata ... */
free( psz_title );
return psz;
}
+/* Get the title of a given item or fallback to the name if the title is empty */
+char *input_item_GetTitleFbName( input_item_t *p_item )
+{
+ char *psz_ret;
+ vlc_mutex_lock( &p_item->lock );
+
+ if( !p_item->p_meta )
+ {
+ vlc_mutex_unlock( &p_item->lock );
+ return NULL;
+ }
+
+ const char *psz_meta = vlc_meta_Get( p_item->p_meta, vlc_meta_Title );
+ if( !EMPTY_STR( psz_meta ) )
+ psz_ret = strdup( psz_meta );
+ else
+ psz_ret = p_item->psz_name ? strdup( p_item->psz_name ) : NULL;
+
+ vlc_mutex_unlock( &p_item->lock );
+ return psz_ret;
+}
+
char *input_item_GetName( input_item_t *p_item )
{
vlc_mutex_lock( &p_item->lock );
input_item_GetInfo
input_item_GetMeta
input_item_GetName
+input_item_GetTitleFbName
input_item_GetURI
input_item_HasErrorWhenReading
input_item_IsArtFetched
{
#define META_STRCASECMP_NAME( ) { \
- char *psz_i = input_item_GetTitle( (*(playlist_item_t **)first)->p_input ); \
- char *psz_ismall = input_item_GetTitle( (*(playlist_item_t **)second)->p_input ); \
- if(EMPTY_STR(psz_i)) {free(psz_i); psz_i = input_item_GetName( (*(playlist_item_t **)first)->p_input ); }\
- if(EMPTY_STR(psz_ismall)) {free(psz_ismall); psz_ismall = input_item_GetName( (*(playlist_item_t **)second)->p_input ); }\
+ char *psz_i = input_item_GetTitleFbName( (*(playlist_item_t **)first)->p_input ); \
+ char *psz_ismall = input_item_GetTitleFbName( (*(playlist_item_t **)second)->p_input ); \
if( psz_i != NULL && psz_ismall != NULL ) i_test = strcasecmp( psz_i, psz_ismall ); \
else if ( psz_i == NULL && psz_ismall != NULL ) i_test = 1; \
else if ( psz_ismall == NULL && psz_i != NULL ) i_test = -1; \