Commit a9ae88b7 authored by Rafaël Carré's avatar Rafaël Carré Committed by Felix Paul Kühne

OSX GUI: store the interface pointer to avoid multiple accesses.

It saves quite a bit of CPU time over when VLCIntf is accessed several times.
(cherry picked from commit a8a01ed0)
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent cb8e90f3
......@@ -118,8 +118,10 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)toggleRecord
{
intf_thread_t *p_intf = VLCIntf;
input_thread_t * p_input;
p_input = pl_CurrentInput( VLCIntf );
p_input = pl_CurrentInput( p_intf );
if( p_input )
{
var_ToggleBool( p_input, "record" );
......@@ -142,8 +144,10 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
{
float f_rate;
intf_thread_t *p_intf = VLCIntf;
input_thread_t * p_input;
p_input = pl_CurrentInput( VLCIntf );
p_input = pl_CurrentInput( p_intf );
if (p_input)
{
f_rate = var_GetFloat( p_input, "rate" );
......@@ -179,7 +183,9 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (BOOL)isPlaying
{
input_thread_t * p_input = pl_CurrentInput( VLCIntf );
intf_thread_t *p_intf = VLCIntf;
input_thread_t * p_input = pl_CurrentInput( p_intf );
if (!p_input) return NO;
......@@ -216,7 +222,9 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (int)durationOfCurrentPlaylistItem
{
input_thread_t * p_input = pl_CurrentInput( VLCIntf );
intf_thread_t *p_intf = VLCIntf;
input_thread_t * p_input = pl_CurrentInput( p_intf );
int64_t i_duration = -1;
if (!p_input) return i_duration;
......@@ -229,7 +237,9 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (NSURL*)URLOfCurrentPlaylistItem
{
input_thread_t *p_input = pl_CurrentInput( VLCIntf );
intf_thread_t *p_intf = VLCIntf;
input_thread_t *p_input = pl_CurrentInput( p_intf );
if (!p_input) return nil;
input_item_t *p_item = input_GetItem( p_input );
......@@ -255,7 +265,9 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (NSString*)nameOfCurrentPlaylistItem
{
input_thread_t *p_input = pl_CurrentInput( VLCIntf );
intf_thread_t *p_intf = VLCIntf;
input_thread_t *p_input = pl_CurrentInput( p_intf );
if (!p_input) return nil;
input_item_t *p_item = input_GetItem( p_input );
......@@ -347,8 +359,10 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)shuffle
{
intf_thread_t *p_intf = VLCIntf;
vlc_value_t val;
playlist_t * p_playlist = pl_Get( VLCIntf );
playlist_t * p_playlist = pl_Get( p_intf );
vout_thread_t *p_vout = getVout();
var_Get( p_playlist, "random", &val );
......@@ -376,7 +390,9 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)repeatAll
{
playlist_t * p_playlist = pl_Get( VLCIntf );
intf_thread_t *p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get( p_intf );
var_SetBool( p_playlist, "repeat", NO );
var_SetBool( p_playlist, "loop", YES );
......@@ -393,7 +409,9 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)repeatOne
{
playlist_t * p_playlist = pl_Get( VLCIntf );
intf_thread_t *p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get( p_intf );
var_SetBool( p_playlist, "repeat", YES );
var_SetBool( p_playlist, "loop", NO );
......@@ -410,7 +428,9 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)repeatOff
{
playlist_t * p_playlist = pl_Get( VLCIntf );
intf_thread_t *p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get( p_intf );
var_SetBool( p_playlist, "repeat", NO );
var_SetBool( p_playlist, "loop", NO );
......@@ -427,46 +447,49 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)volumeUp
{
playlist_t * p_playlist = pl_Get( VLCIntf );
aout_VolumeUp( p_playlist, 1, NULL );
intf_thread_t *p_intf = VLCIntf;
aout_VolumeUp( pl_Get( p_intf ), 1, NULL );
}
- (void)volumeDown
{
playlist_t * p_playlist = pl_Get( VLCIntf );
aout_VolumeDown( p_playlist, 1, NULL );
intf_thread_t *p_intf = VLCIntf;
aout_VolumeDown( pl_Get( p_intf ), 1, NULL );
}
- (void)mute
{
playlist_t * p_playlist = pl_Get( VLCIntf );
aout_ToggleMute( p_playlist, NULL );
intf_thread_t *p_intf = VLCIntf;
aout_ToggleMute( pl_Get( p_intf ), NULL );
}
- (BOOL)isMuted
{
playlist_t * p_playlist = pl_Get( VLCIntf );
intf_thread_t *p_intf = VLCIntf;
BOOL b_is_muted = NO;
b_is_muted = aout_IsMuted( VLC_OBJECT(p_playlist) );
b_is_muted = aout_IsMuted( VLC_OBJECT(pl_Get( p_intf )) );
return b_is_muted;
}
- (int)volume
{
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get( VLCIntf );
audio_volume_t i_volume = aout_VolumeGet( p_playlist );
intf_thread_t *p_intf = VLCIntf;
audio_volume_t i_volume = aout_VolumeGet( pl_Get( p_intf ) );
return (int)i_volume;
}
- (void)setVolume: (int)i_value
{
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get( VLCIntf );
intf_thread_t *p_intf = VLCIntf;
aout_VolumeSet( p_playlist, i_value );
aout_VolumeSet( pl_Get( p_intf ), i_value );
}
#pragma mark -
......@@ -484,8 +507,9 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)toggleFullscreen
{
playlist_t * p_playlist = pl_Get( VLCIntf );
var_ToggleBool( p_playlist, "fullscreen" );
intf_thread_t *p_intf = VLCIntf;
var_ToggleBool( pl_Get( p_intf ), "fullscreen" );
}
@end
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