From: Pierre d'Herbemont Date: Mon, 21 Dec 2009 08:01:20 +0000 (+0100) Subject: macosx/framework: Change the repeatMode setter to be a property so that it can evenut... X-Git-Tag: 1.1.0-ff~1831 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=15ddcc9c333150b59ad335b22c019312297e68e6;p=vlc macosx/framework: Change the repeatMode setter to be a property so that it can evenutally be used with Bindings. --- diff --git a/projects/macosx/framework/Headers/Public/VLCMediaListPlayer.h b/projects/macosx/framework/Headers/Public/VLCMediaListPlayer.h index 17f3917683..70026c9d1b 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; + +@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 f83af7719a..3fcade78ca 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