[vlc-commits] macosx: move code from CoreInteraction to the AppleScript class, since it was the only client using it
Felix Paul Kühne
git at videolan.org
Fri Aug 24 12:32:25 CEST 2012
vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Fri Aug 24 11:47:58 2012 +0200| [49256c8d588ba22258ae8dbf3d4328f8fffa593b] | committer: Felix Paul Kühne
macosx: move code from CoreInteraction to the AppleScript class, since it was the only client using it
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=49256c8d588ba22258ae8dbf3d4328f8fffa593b
---
modules/gui/macosx/CoreInteraction.h | 3 ---
modules/gui/macosx/CoreInteraction.m | 43 ----------------------------------
modules/gui/macosx/applescript.m | 37 +++++++++++++++++++++++++----
3 files changed, 33 insertions(+), 50 deletions(-)
diff --git a/modules/gui/macosx/CoreInteraction.h b/modules/gui/macosx/CoreInteraction.h
index abe0d86..2865e55 100644
--- a/modules/gui/macosx/CoreInteraction.h
+++ b/modules/gui/macosx/CoreInteraction.h
@@ -41,9 +41,6 @@
- (int)playbackRate;
- (void)next;
- (void)previous;
-- (BOOL)isPlaying;
-- (int)currentTime;
-- (void)setCurrentTime:(int)i_value;
- (int)durationOfCurrentPlaylistItem;
- (NSURL*)URLOfCurrentPlaylistItem;
- (NSString*)nameOfCurrentPlaylistItem;
diff --git a/modules/gui/macosx/CoreInteraction.m b/modules/gui/macosx/CoreInteraction.m
index 9c82083..e88105b 100644
--- a/modules/gui/macosx/CoreInteraction.m
+++ b/modules/gui/macosx/CoreInteraction.m
@@ -187,49 +187,6 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
var_SetInteger( VLCIntf->p_libvlc, "key-action", ACTIONID_NEXT );
}
-- (BOOL)isPlaying
-{
- intf_thread_t *p_intf = VLCIntf;
- if( !p_intf )
- return NO;
-
- input_thread_t * p_input = pl_CurrentInput( p_intf );
- if( !p_input )
- return NO;
-
- input_state_e i_state = ERROR_S;
- input_Control( p_input, INPUT_GET_STATE, &i_state );
- vlc_object_release( p_input );
-
- return ( ( i_state == OPENING_S ) || ( i_state == PLAYING_S ) );
-}
-
-- (int)currentTime
-{
- input_thread_t * p_input = pl_CurrentInput( VLCIntf );
- int64_t i_currentTime = -1;
-
- if( !p_input )
- return i_currentTime;
-
- input_Control( p_input, INPUT_GET_TIME, &i_currentTime );
- vlc_object_release( p_input );
-
- return (int)( i_currentTime / 1000000 );
-}
-
-- (void)setCurrentTime:(int)i_value
-{
- int64_t i64_value = (int64_t)i_value;
- input_thread_t * p_input = pl_CurrentInput( VLCIntf );
-
- if ( !p_input )
- return;
-
- 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;
diff --git a/modules/gui/macosx/applescript.m b/modules/gui/macosx/applescript.m
index 5b4d392..e9f4b6e 100644
--- a/modules/gui/macosx/applescript.m
+++ b/modules/gui/macosx/applescript.m
@@ -224,7 +224,19 @@
}
- (BOOL) playing {
- return [[VLCCoreInteraction sharedInstance] isPlaying];
+ intf_thread_t *p_intf = VLCIntf;
+ if( !p_intf )
+ return NO;
+
+ input_thread_t * p_input = pl_CurrentInput( p_intf );
+ if( !p_input )
+ return NO;
+
+ input_state_e i_state = ERROR_S;
+ input_Control( p_input, INPUT_GET_STATE, &i_state );
+ vlc_object_release( p_input );
+
+ return ( ( i_state == OPENING_S ) || ( i_state == PLAYING_S ) );
}
- (int) audioVolume {
@@ -236,12 +248,29 @@
}
- (int) currentTime {
- return [[VLCCoreInteraction sharedInstance] currentTime];
+ input_thread_t * p_input = pl_CurrentInput( VLCIntf );
+ int64_t i_currentTime = -1;
+
+ if( !p_input )
+ return i_currentTime;
+
+ input_Control( p_input, INPUT_GET_TIME, &i_currentTime );
+ vlc_object_release( p_input );
+
+ return (int)( i_currentTime / 1000000 );
}
- (void) setCurrentTime: (int) i_currentTime {
- if (i_currentTime)
- [[VLCCoreInteraction sharedInstance] setCurrentTime:i_currentTime];
+ if (i_currentTime) {
+ int64_t i64_value = (int64_t)i_currentTime;
+ input_thread_t * p_input = pl_CurrentInput( VLCIntf );
+
+ if ( !p_input )
+ return;
+
+ input_Control( p_input, INPUT_SET_TIME, (int64_t)(i64_value * 1000000) );
+ vlc_object_release( p_input );
+ }
}
#pragma mark -
More information about the vlc-commits
mailing list