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;
- (id)init
{
if( _o_sharedInstance)
if( _o_sharedInstance )
{
[self dealloc];
return _o_sharedInstance;
......@@ -120,7 +120,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)toggleRecord
{
intf_thread_t *p_intf = VLCIntf;
if (!p_intf)
if( !p_intf )
return;
input_thread_t * p_input;
......@@ -148,12 +148,12 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
float f_rate;
intf_thread_t *p_intf = VLCIntf;
if (!p_intf)
if( !p_intf )
return 0;
input_thread_t * p_input;
p_input = pl_CurrentInput( p_intf );
if (p_input)
if( p_input )
{
f_rate = var_GetFloat( p_input, "rate" );
vlc_object_release( p_input );
......@@ -189,18 +189,18 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (BOOL)isPlaying
{
intf_thread_t *p_intf = VLCIntf;
if (!p_intf)
if( !p_intf )
return NO;
input_thread_t * p_input = pl_CurrentInput( p_intf );
if (!p_input) return NO;
if( !p_input )
return NO;
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 );
return ((i_state == OPENING_S) || (i_state == PLAYING_S));
return ( ( i_state == OPENING_S ) || ( i_state == PLAYING_S ) );
}
- (int)currentTime
......@@ -208,9 +208,10 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
input_thread_t * p_input = pl_CurrentInput( VLCIntf );
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 );
return (int)( i_currentTime / 1000000 );
......@@ -221,47 +222,49 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
int64_t i64_value = (int64_t)i_value;
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 );
}
- (int)durationOfCurrentPlaylistItem
{
intf_thread_t *p_intf = VLCIntf;
if (!p_intf)
if( !p_intf )
return 0;
input_thread_t * p_input = pl_CurrentInput( p_intf );
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 );
return (int)(i_duration / 1000000);
return (int)( i_duration / 1000000 );
}
- (NSURL*)URLOfCurrentPlaylistItem
{
intf_thread_t *p_intf = VLCIntf;
if (!p_intf)
if( !p_intf )
return nil;
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 );
if (!p_item)
if( !p_item )
{
vlc_object_release( p_input );
return nil;
}
char *psz_uri = input_item_GetURI( p_item );
if (!psz_uri)
if( !psz_uri )
{
vlc_object_release( p_input );
return nil;
......@@ -277,21 +280,22 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (NSString*)nameOfCurrentPlaylistItem
{
intf_thread_t *p_intf = VLCIntf;
if (!p_intf)
if( !p_intf )
return nil;
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 );
if (!p_item)
if( !p_item )
{
vlc_object_release( p_input );
return nil;
}
char *psz_uri = input_item_GetURI( p_item );
if (!psz_uri)
if( !psz_uri )
{
vlc_object_release( p_input );
return nil;
......@@ -307,9 +311,9 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
NSURL * o_url = [NSURL URLWithString: [NSString stringWithUTF8String: 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]];
else
o_name = [o_url absoluteString];
......@@ -373,7 +377,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)shuffle
{
intf_thread_t *p_intf = VLCIntf;
if (!p_intf)
if( !p_intf )
return;
vlc_value_t val;
......@@ -385,7 +389,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
var_Set( p_playlist, "random", val );
if( val.b_bool )
{
if (p_vout)
if( p_vout )
{
vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _( "Random On" ) );
vlc_object_release( p_vout );
......@@ -394,7 +398,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
}
else
{
if (p_vout)
if( p_vout )
{
vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _( "Random Off" ) );
vlc_object_release( p_vout );
......@@ -406,7 +410,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)repeatAll
{
intf_thread_t *p_intf = VLCIntf;
if (!p_intf)
if( !p_intf )
return;
playlist_t * p_playlist = pl_Get( p_intf );
......@@ -417,7 +421,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
config_PutInt( p_playlist, "loop", YES );
vout_thread_t *p_vout = getVout();
if (p_vout)
if( p_vout )
{
vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat All" ) );
vlc_object_release( p_vout );
......@@ -427,7 +431,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)repeatOne
{
intf_thread_t *p_intf = VLCIntf;
if (!p_intf)
if( !p_intf )
return;
playlist_t * p_playlist = pl_Get( p_intf );
......@@ -438,7 +442,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
config_PutInt( p_playlist, "loop", NO );
vout_thread_t *p_vout = getVout();
if (p_vout)
if( p_vout )
{
vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat One" ) );
vlc_object_release( p_vout );
......@@ -448,7 +452,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)repeatOff
{
intf_thread_t *p_intf = VLCIntf;
if (!p_intf)
if( !p_intf )
return;
playlist_t * p_playlist = pl_Get( p_intf );
......@@ -459,7 +463,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
config_PutInt( p_playlist, "loop", NO );
vout_thread_t *p_vout = getVout();
if (p_vout)
if( p_vout )
{
vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat Off" ) );
vlc_object_release( p_vout );
......@@ -469,7 +473,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)displayVolume
{
vout_thread_t *p_vout = getVout();
if (p_vout)
if( p_vout )
{
vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, _( "Volume %d%%" ),
[self volume]*100/AOUT_VOLUME_DEFAULT );
......@@ -480,7 +484,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)volumeUp
{
intf_thread_t *p_intf = VLCIntf;
if (!p_intf)
if( !p_intf )
return;
aout_VolumeUp( pl_Get( p_intf ), 1, NULL );
......@@ -490,7 +494,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)volumeDown
{
intf_thread_t *p_intf = VLCIntf;
if (!p_intf)
if( !p_intf )
return;
aout_VolumeDown( pl_Get( p_intf ), 1, NULL );
......@@ -500,7 +504,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)mute
{
intf_thread_t *p_intf = VLCIntf;
if (!p_intf)
if( !p_intf )
return;
aout_ToggleMute( pl_Get( p_intf ), NULL );
......@@ -522,7 +526,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (BOOL)isMuted
{
intf_thread_t *p_intf = VLCIntf;
if (!p_intf)
if( !p_intf )
return NO;
BOOL b_is_muted = NO;
......@@ -534,7 +538,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (int)volume
{
intf_thread_t *p_intf = VLCIntf;
if (!p_intf)
if( !p_intf )
return 0;
audio_volume_t i_volume = aout_VolumeGet( pl_Get( p_intf ) );
......@@ -545,7 +549,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)setVolume: (int)i_value
{
intf_thread_t *p_intf = VLCIntf;
if (!p_intf)
if( !p_intf )
return;
aout_VolumeSet( pl_Get( p_intf ), i_value );
......@@ -563,7 +567,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
if( o_carried_data )
{
if ([o_desired_type isEqualToString:NSFilenamesPboardType])
if( [o_desired_type isEqualToString:NSFilenamesPboardType] )
{
NSArray *o_array = [NSArray array];
NSArray *o_values = [[o_paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
......@@ -572,11 +576,11 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
input_thread_t * p_input = pl_CurrentInput( VLCIntf );
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 );
vlc_object_release( p_input );
if(!b_returned)
if( !b_returned )
return YES;
}
else if( p_input )
......@@ -621,7 +625,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)toggleFullscreen
{
intf_thread_t *p_intf = VLCIntf;
if (!p_intf)
if( !p_intf )
return;
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