[vlc-devel] commit: macosx: Simplify the title update code. (Pierre d'Herbemont )
git version control
git at videolan.org
Sat Jul 12 17:34:12 CEST 2008
vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Sat Jul 12 14:43:02 2008 +0200| [1af1638ef3992f54af90c19abb30cd8907942dba]
macosx: Simplify the title update code.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1af1638ef3992f54af90c19abb30cd8907942dba
---
modules/gui/macosx/vout.m | 34 +++++++++++++++-------------------
1 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/modules/gui/macosx/vout.m b/modules/gui/macosx/vout.m
index 4161a2a..1c3f3a3 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 )
More information about the vlc-devel
mailing list