Commit 64799361 authored by David Fuhrmann's avatar David Fuhrmann Committed by Felix Paul Kühne

macosx: unify code style for CoreInteraction.m

(cherry picked from commit 8e6070daf4506090d0ab52dec97d3ca567ed0791)
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent f7f95865
...@@ -47,7 +47,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -47,7 +47,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (id)init - (id)init
{ {
if( _o_sharedInstance) if( _o_sharedInstance )
{ {
[self dealloc]; [self dealloc];
return _o_sharedInstance; return _o_sharedInstance;
...@@ -120,7 +120,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -120,7 +120,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)toggleRecord - (void)toggleRecord
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if (!p_intf) if( !p_intf )
return; return;
input_thread_t * p_input; input_thread_t * p_input;
...@@ -148,12 +148,12 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -148,12 +148,12 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
float f_rate; float f_rate;
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if (!p_intf) if( !p_intf )
return 0; return 0;
input_thread_t * p_input; input_thread_t * p_input;
p_input = pl_CurrentInput( p_intf ); p_input = pl_CurrentInput( p_intf );
if (p_input) if( p_input )
{ {
f_rate = var_GetFloat( p_input, "rate" ); f_rate = var_GetFloat( p_input, "rate" );
vlc_object_release( p_input ); vlc_object_release( p_input );
...@@ -189,18 +189,18 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -189,18 +189,18 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (BOOL)isPlaying - (BOOL)isPlaying
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if (!p_intf) if( !p_intf )
return NO; return NO;
input_thread_t * p_input = pl_CurrentInput( p_intf ); input_thread_t * p_input = pl_CurrentInput( p_intf );
if( !p_input )
if (!p_input) return NO; return NO;
input_state_e i_state = ERROR_S; input_state_e i_state = ERROR_S;
input_Control( p_input, INPUT_GET_STATE, &i_state); input_Control( p_input, INPUT_GET_STATE, &i_state );
vlc_object_release( p_input ); vlc_object_release( p_input );
return ((i_state == OPENING_S) || (i_state == PLAYING_S)); return ( ( i_state == OPENING_S ) || ( i_state == PLAYING_S ) );
} }
- (int)currentTime - (int)currentTime
...@@ -208,9 +208,10 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -208,9 +208,10 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
input_thread_t * p_input = pl_CurrentInput( VLCIntf ); input_thread_t * p_input = pl_CurrentInput( VLCIntf );
int64_t i_currentTime = -1; int64_t i_currentTime = -1;
if (!p_input) return i_currentTime; if( !p_input )
return i_currentTime;
input_Control( p_input, INPUT_GET_TIME, &i_currentTime); input_Control( p_input, INPUT_GET_TIME, &i_currentTime );
vlc_object_release( p_input ); vlc_object_release( p_input );
return (int)( i_currentTime / 1000000 ); return (int)( i_currentTime / 1000000 );
...@@ -221,47 +222,49 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -221,47 +222,49 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
int64_t i64_value = (int64_t)i_value; int64_t i64_value = (int64_t)i_value;
input_thread_t * p_input = pl_CurrentInput( VLCIntf ); input_thread_t * p_input = pl_CurrentInput( VLCIntf );
if (!p_input) return; if ( !p_input )
return;
input_Control( p_input, INPUT_SET_TIME, (int64_t)(i64_value * 1000000)); input_Control( p_input, INPUT_SET_TIME, (int64_t)(i64_value * 1000000) );
vlc_object_release( p_input ); vlc_object_release( p_input );
} }
- (int)durationOfCurrentPlaylistItem - (int)durationOfCurrentPlaylistItem
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if (!p_intf) if( !p_intf )
return 0; return 0;
input_thread_t * p_input = pl_CurrentInput( p_intf ); input_thread_t * p_input = pl_CurrentInput( p_intf );
int64_t i_duration = -1; int64_t i_duration = -1;
if (!p_input) return i_duration; if( !p_input )
return i_duration;
input_Control( p_input, INPUT_GET_LENGTH, &i_duration );
input_Control( p_input, INPUT_GET_LENGTH, &i_duration);
vlc_object_release( p_input ); vlc_object_release( p_input );
return (int)(i_duration / 1000000); return (int)( i_duration / 1000000 );
} }
- (NSURL*)URLOfCurrentPlaylistItem - (NSURL*)URLOfCurrentPlaylistItem
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if (!p_intf) if( !p_intf )
return nil; return nil;
input_thread_t *p_input = pl_CurrentInput( p_intf ); input_thread_t *p_input = pl_CurrentInput( p_intf );
if (!p_input) return nil; if( !p_input )
return nil;
input_item_t *p_item = input_GetItem( p_input ); input_item_t *p_item = input_GetItem( p_input );
if (!p_item) if( !p_item )
{ {
vlc_object_release( p_input ); vlc_object_release( p_input );
return nil; return nil;
} }
char *psz_uri = input_item_GetURI( p_item ); char *psz_uri = input_item_GetURI( p_item );
if (!psz_uri) if( !psz_uri )
{ {
vlc_object_release( p_input ); vlc_object_release( p_input );
return nil; return nil;
...@@ -277,21 +280,22 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -277,21 +280,22 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (NSString*)nameOfCurrentPlaylistItem - (NSString*)nameOfCurrentPlaylistItem
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if (!p_intf) if( !p_intf )
return nil; return nil;
input_thread_t *p_input = pl_CurrentInput( p_intf ); input_thread_t *p_input = pl_CurrentInput( p_intf );
if (!p_input) return nil; if( !p_input )
return nil;
input_item_t *p_item = input_GetItem( p_input ); input_item_t *p_item = input_GetItem( p_input );
if (!p_item) if( !p_item )
{ {
vlc_object_release( p_input ); vlc_object_release( p_input );
return nil; return nil;
} }
char *psz_uri = input_item_GetURI( p_item ); char *psz_uri = input_item_GetURI( p_item );
if (!psz_uri) if( !psz_uri )
{ {
vlc_object_release( p_input ); vlc_object_release( p_input );
return nil; return nil;
...@@ -307,9 +311,9 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -307,9 +311,9 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
NSURL * o_url = [NSURL URLWithString: [NSString stringWithUTF8String: psz_uri]]; NSURL * o_url = [NSURL URLWithString: [NSString stringWithUTF8String: psz_uri]];
free( psz_uri ); free( psz_uri );
if ([o_name isEqualToString:@""]) if( [o_name isEqualToString:@""] )
{ {
if ([o_url isFileURL]) if( [o_url isFileURL] )
o_name = [[NSFileManager defaultManager] displayNameAtPath: [o_url path]]; o_name = [[NSFileManager defaultManager] displayNameAtPath: [o_url path]];
else else
o_name = [o_url absoluteString]; o_name = [o_url absoluteString];
...@@ -373,7 +377,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -373,7 +377,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)shuffle - (void)shuffle
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if (!p_intf) if( !p_intf )
return; return;
vlc_value_t val; vlc_value_t val;
...@@ -385,7 +389,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -385,7 +389,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
var_Set( p_playlist, "random", val ); var_Set( p_playlist, "random", val );
if( val.b_bool ) if( val.b_bool )
{ {
if (p_vout) if( p_vout )
{ {
vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _( "Random On" ) ); vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _( "Random On" ) );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
...@@ -394,7 +398,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -394,7 +398,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
} }
else else
{ {
if (p_vout) if( p_vout )
{ {
vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _( "Random Off" ) ); vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _( "Random Off" ) );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
...@@ -406,7 +410,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -406,7 +410,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)repeatAll - (void)repeatAll
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if (!p_intf) if( !p_intf )
return; return;
playlist_t * p_playlist = pl_Get( p_intf ); playlist_t * p_playlist = pl_Get( p_intf );
...@@ -417,7 +421,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -417,7 +421,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
config_PutInt( p_playlist, "loop", YES ); config_PutInt( p_playlist, "loop", YES );
vout_thread_t *p_vout = getVout(); vout_thread_t *p_vout = getVout();
if (p_vout) if( p_vout )
{ {
vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat All" ) ); vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat All" ) );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
...@@ -427,7 +431,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -427,7 +431,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)repeatOne - (void)repeatOne
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if (!p_intf) if( !p_intf )
return; return;
playlist_t * p_playlist = pl_Get( p_intf ); playlist_t * p_playlist = pl_Get( p_intf );
...@@ -438,7 +442,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -438,7 +442,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
config_PutInt( p_playlist, "loop", NO ); config_PutInt( p_playlist, "loop", NO );
vout_thread_t *p_vout = getVout(); vout_thread_t *p_vout = getVout();
if (p_vout) if( p_vout )
{ {
vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat One" ) ); vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat One" ) );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
...@@ -448,7 +452,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -448,7 +452,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)repeatOff - (void)repeatOff
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if (!p_intf) if( !p_intf )
return; return;
playlist_t * p_playlist = pl_Get( p_intf ); playlist_t * p_playlist = pl_Get( p_intf );
...@@ -459,7 +463,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -459,7 +463,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
config_PutInt( p_playlist, "loop", NO ); config_PutInt( p_playlist, "loop", NO );
vout_thread_t *p_vout = getVout(); vout_thread_t *p_vout = getVout();
if (p_vout) if( p_vout )
{ {
vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat Off" ) ); vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat Off" ) );
vlc_object_release( p_vout ); vlc_object_release( p_vout );
...@@ -469,7 +473,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -469,7 +473,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)displayVolume - (void)displayVolume
{ {
vout_thread_t *p_vout = getVout(); vout_thread_t *p_vout = getVout();
if (p_vout) if( p_vout )
{ {
vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, _( "Volume %d%%" ), vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, _( "Volume %d%%" ),
[self volume]*100/AOUT_VOLUME_DEFAULT ); [self volume]*100/AOUT_VOLUME_DEFAULT );
...@@ -480,7 +484,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -480,7 +484,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)volumeUp - (void)volumeUp
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if (!p_intf) if( !p_intf )
return; return;
aout_VolumeUp( pl_Get( p_intf ), 1, NULL ); aout_VolumeUp( pl_Get( p_intf ), 1, NULL );
...@@ -490,7 +494,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -490,7 +494,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)volumeDown - (void)volumeDown
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if (!p_intf) if( !p_intf )
return; return;
aout_VolumeDown( pl_Get( p_intf ), 1, NULL ); aout_VolumeDown( pl_Get( p_intf ), 1, NULL );
...@@ -500,7 +504,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -500,7 +504,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)mute - (void)mute
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if (!p_intf) if( !p_intf )
return; return;
aout_ToggleMute( pl_Get( p_intf ), NULL ); aout_ToggleMute( pl_Get( p_intf ), NULL );
...@@ -522,7 +526,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -522,7 +526,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (BOOL)isMuted - (BOOL)isMuted
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if (!p_intf) if( !p_intf )
return NO; return NO;
BOOL b_is_muted = NO; BOOL b_is_muted = NO;
...@@ -534,7 +538,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -534,7 +538,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (int)volume - (int)volume
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if (!p_intf) if( !p_intf )
return 0; return 0;
audio_volume_t i_volume = aout_VolumeGet( pl_Get( p_intf ) ); audio_volume_t i_volume = aout_VolumeGet( pl_Get( p_intf ) );
...@@ -545,7 +549,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -545,7 +549,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)setVolume: (int)i_value - (void)setVolume: (int)i_value
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if (!p_intf) if( !p_intf )
return; return;
aout_VolumeSet( pl_Get( p_intf ), i_value ); aout_VolumeSet( pl_Get( p_intf ), i_value );
...@@ -563,7 +567,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -563,7 +567,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
if( o_carried_data ) if( o_carried_data )
{ {
if ([o_desired_type isEqualToString:NSFilenamesPboardType]) if( [o_desired_type isEqualToString:NSFilenamesPboardType] )
{ {
NSArray *o_array = [NSArray array]; NSArray *o_array = [NSArray array];
NSArray *o_values = [[o_paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; NSArray *o_values = [[o_paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
...@@ -572,11 +576,11 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -572,11 +576,11 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
input_thread_t * p_input = pl_CurrentInput( VLCIntf ); input_thread_t * p_input = pl_CurrentInput( VLCIntf );
BOOL b_returned = NO; BOOL b_returned = NO;
if (count == 1 && p_input) if( count == 1 && p_input )
{ {
b_returned = input_AddSubtitle( p_input, make_URI([[o_values objectAtIndex:0] UTF8String], NULL), true ); b_returned = input_AddSubtitle( p_input, make_URI([[o_values objectAtIndex:0] UTF8String], NULL), true );
vlc_object_release( p_input ); vlc_object_release( p_input );
if(!b_returned) if( !b_returned )
return YES; return YES;
} }
else if( p_input ) else if( p_input )
...@@ -621,7 +625,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -621,7 +625,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)toggleFullscreen - (void)toggleFullscreen
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if (!p_intf) if( !p_intf )
return; return;
var_ToggleBool( pl_Get( p_intf ), "fullscreen" ); var_ToggleBool( pl_Get( p_intf ), "fullscreen" );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment