[vlc-commits] OSX GUI: store the interface pointer to avoid multiple accesses.
Rafaël Carré
git at videolan.org
Thu Feb 16 01:02:56 CET 2012
vlc/vlc-2.0 | branch: master | Rafaël Carré <funman at videolan.org> | Wed Feb 15 14:35:13 2012 -0500| [a9ae88b7e6f4f756626d83ca2dfe4ec25fe97d38] | committer: 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 a8a01ed0307bca22db3f63a4af679da60e266327)
Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=a9ae88b7e6f4f756626d83ca2dfe4ec25fe97d38
---
modules/gui/macosx/CoreInteraction.m | 78 ++++++++++++++++++++++------------
1 files changed, 51 insertions(+), 27 deletions(-)
diff --git a/modules/gui/macosx/CoreInteraction.m b/modules/gui/macosx/CoreInteraction.m
index d552f79..d120ddc 100644
--- a/modules/gui/macosx/CoreInteraction.m
+++ b/modules/gui/macosx/CoreInteraction.m
@@ -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
More information about the vlc-commits
mailing list