[vlc-devel] commit: macosx/framework: Change the repeatMode setter to be a property so that it can evenutally be used with Bindings . (Pierre d'Herbemont )

git version control git at videolan.org
Mon Dec 21 09:02:44 CET 2009


vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Mon Dec 21 09:01:20 2009 +0100| [15ddcc9c333150b59ad335b22c019312297e68e6] | committer: Pierre d'Herbemont 

macosx/framework: Change the repeatMode setter to be a property so that it can evenutally be used with Bindings.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=15ddcc9c333150b59ad335b22c019312297e68e6
---

 .../framework/Headers/Public/VLCMediaListPlayer.h  |   18 +++++++++--
 .../macosx/framework/Sources/VLCMediaListPlayer.m  |   32 ++++++++++---------
 2 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/projects/macosx/framework/Headers/Public/VLCMediaListPlayer.h b/projects/macosx/framework/Headers/Public/VLCMediaListPlayer.h
index 17f3917..70026c9 100644
--- a/projects/macosx/framework/Headers/Public/VLCMediaListPlayer.h
+++ b/projects/macosx/framework/Headers/Public/VLCMediaListPlayer.h
@@ -26,11 +26,23 @@
 
 @class VLCMedia, VLCMediaPlayer, VLCMediaList;
 
+/**
+ * VLCRepeatMode
+ * (don't repeat anything, repeat one, repeat all)
+ */
+enum VLCRepeatMode {
+    VLCDoNotRepeat,
+    VLCRepeatCurrentItem,
+    VLCRepeatAllItems
+};
+typedef int VLCRepeatMode;
+
 @interface VLCMediaListPlayer : NSObject {
     void *instance;
     VLCMedia *_rootMedia;
     VLCMediaPlayer *_mediaPlayer;
     VLCMediaList *_mediaList;
+    VLCRepeatMode _repeatMode;
 }
 
 @property (readwrite, retain) VLCMediaList *mediaList;
@@ -53,10 +65,10 @@
 
 /**
  * Playmode selection (don't repeat anything, repeat one, repeat all)
+ * See VLCRepeatMode.
  */
-- (void)doNotRepeatAnyItem;
-- (void)repeatCurrentItem;
-- (void)repeatAllItems;
+
+ at property (readwrite) VLCRepeatMode repeatMode;
 
 /**
  * media must be in the current media list.
diff --git a/projects/macosx/framework/Sources/VLCMediaListPlayer.m b/projects/macosx/framework/Sources/VLCMediaListPlayer.m
index f83af77..3fcade7 100644
--- a/projects/macosx/framework/Sources/VLCMediaListPlayer.m
+++ b/projects/macosx/framework/Sources/VLCMediaListPlayer.m
@@ -131,27 +131,29 @@
     catch_exception(&ex);
 }
 
-- (void)doNotRepeatAnyItem;
+- (void)setRepeatMode:(VLCRepeatMode)repeatMode
 {
     libvlc_exception_t ex;
     libvlc_exception_init(&ex);
-    libvlc_media_list_player_set_playback_mode(instance, libvlc_playback_mode_default, &ex);
-    catch_exception(&ex);
-}
-
-- (void)repeatCurrentItem
-{
-    libvlc_exception_t ex;
-    libvlc_exception_init(&ex);
-    libvlc_media_list_player_set_playback_mode(instance, libvlc_playback_mode_repeat, &ex);
+    switch (repeatMode) {
+        case VLCRepeatAllItems:
+            libvlc_media_list_player_set_playback_mode(instance, libvlc_playback_mode_default, &ex);
+            break;
+        case VLCDoNotRepeat:
+            libvlc_media_list_player_set_playback_mode(instance, libvlc_playback_mode_default, &ex);
+            break;
+        case VLCRepeatCurrentItem:
+            libvlc_media_list_player_set_playback_mode(instance, libvlc_playback_mode_repeat, &ex);
+            break;
+        default:
+            break;
+    }
     catch_exception(&ex);
+    _repeatMode = repeatMode;
 }
 
-- (void)repeatAllItems
+- (VLCRepeatMode)repeatMode
 {
-    libvlc_exception_t ex;
-    libvlc_exception_init(&ex);
-    libvlc_media_list_player_set_playback_mode(instance, libvlc_playback_mode_loop, &ex);
-    catch_exception(&ex);
+    return _repeatMode;
 }
 @end




More information about the vlc-devel mailing list