From 1af1638ef3992f54af90c19abb30cd8907942dba Mon Sep 17 00:00:00 2001 From: Pierre d'Herbemont Date: Sat, 12 Jul 2008 14:43:02 +0200 Subject: [PATCH] macosx: Simplify the title update code. --- modules/gui/macosx/vout.m | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/modules/gui/macosx/vout.m b/modules/gui/macosx/vout.m index 4161a2a2a8..1c3f3a3683 100644 --- a/modules/gui/macosx/vout.m +++ b/modules/gui/macosx/vout.m @@ -274,35 +274,31 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, NSString * o_title = nil; NSMutableString * o_mrl = nil; input_thread_t * p_input; + char * psz_title; - if( p_vout == NULL ) - { - return; - } + if( !p_vout ) return; p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT ); - if( p_input == NULL ) - { - return; - } + if( !p_input ) return; + + input_item_t * p_item = input_GetItem( p_input ); + + psz_title = input_item_GetNowPlaying ( p_item ); + if( !psz_title ) + psz_title = input_item_GetName( p_item ); - char *psz_nowPlaying = input_item_GetNowPlaying ( input_GetItem( p_input ) ); - char *psz_name = input_item_GetName( input_GetItem( p_input ) ); - char *psz_uri = input_item_GetURI( input_GetItem( p_input ) ); - if( psz_nowPlaying != NULL ) - o_title = [NSString stringWithUTF8String: psz_nowPlaying]; - else if( psz_name != NULL ) - o_title = [NSString stringWithUTF8String: psz_name]; + if( psz_title ) + o_title = [NSString stringWithUTF8String: psz_title]; - if( psz_uri != NULL ) + char *psz_uri = input_item_GetURI( p_item ); + if( psz_uri ) o_mrl = [NSMutableString stringWithUTF8String: psz_uri]; - free( psz_nowPlaying ); - free( psz_name ); + free( psz_title ); free( psz_uri ); - if( o_title == nil ) + if( !o_title ) o_title = o_mrl; if( o_mrl != nil ) -- 2.39.5