Browse Source

osx/framework: extended API to cover titles, fps, playback modes and some convienience chapter functionality

Additionally, updated some copyright information.
Felix Paul Kühne 15 years ago
parent
commit
c2ac43ade6

+ 0 - 2
Headers/Public/VLCAudio.h

@@ -22,8 +22,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#import <Cocoa/Cocoa.h>
-
 /* Notification Messages */
 /**
  * Standard notification messages that are emitted by VLCAudio object.

+ 0 - 1
Headers/Public/VLCLibrary.h

@@ -22,7 +22,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#import <Cocoa/Cocoa.h>
 #import "VLCAudio.h"
 #import "VLCMediaList.h"
 #import "VLCMedia.h"

+ 0 - 1
Headers/Public/VLCMedia.h

@@ -22,7 +22,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#import <Cocoa/Cocoa.h>
 #import "VLCMediaList.h"
 #import "VLCTime.h"
 

+ 0 - 1
Headers/Public/VLCMediaDiscoverer.h

@@ -22,7 +22,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#import <Cocoa/Cocoa.h>
 #import <VLCKit/VLCMediaList.h>
 
 @class VLCMediaList;

+ 0 - 1
Headers/Public/VLCMediaLibrary.h

@@ -22,7 +22,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#import <Cocoa/Cocoa.h>
 #import "VLCMediaList.h"
 
 @class VLCMediaList;

+ 32 - 7
Headers/Public/VLCMediaListPlayer.h

@@ -1,10 +1,28 @@
-//
-//  VLCMediaListPlayer.h
-//  VLCKit
-//
-//  Created by Pierre d'Herbemont on 8/24/09.
-//  Copyright 2009 __MyCompanyName__. All rights reserved.
-//
+/*****************************************************************************
+ * VLCMediaListPlayer.m: VLCKit.framework VLCMediaListPlayer implementation
+ *****************************************************************************
+ * Copyright (C) 2009 Pierre d'Herbemont
+ * Partial Copyright (C) 2009 Felix Paul Kühne
+ * Copyright (C) 2009 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
+ *          Felix Paul Kühne <fkuehne # videolan.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
 
 @class VLCMedia, VLCMediaPlayer, VLCMediaList;
 
@@ -34,6 +52,13 @@
 - (void)stop;
 
 /**
+ * Playmode selection (don't repeat anything, repeat one, repeat all)
+ */
+- (void)doNotRepeatAnyItem;
+- (void)repeatCurrentItem;
+- (void)repeatAllItems;
+
+/**
  * media must be in the current media list.
  */
 - (void)playMedia:(VLCMedia *)media;

+ 9 - 3
Headers/Public/VLCMediaPlayer.h

@@ -1,11 +1,13 @@
 /*****************************************************************************
  * VLCMediaPlayer.h: VLCKit.framework VLCMediaPlayer header
  *****************************************************************************
- * Copyright (C) 2007 Pierre d'Herbemont
- * Copyright (C) 2007 the VideoLAN team
+ * Copyright (C) 2007-2009 Pierre d'Herbemont
+ * Copyright (C) 2007-2009 the VideoLAN team
+ * Partial Copyright (C) 2009 Felix Paul Kühne
  * $Id$
  *
  * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
+ *          Felix Paul Kühne <fkuehne # videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,7 +24,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#import <Cocoa/Cocoa.h>
 #import "VLCMedia.h"
 #import "VLCVideoView.h"
 #import "VLCVideoLayer.h"
@@ -155,11 +156,16 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
 - (VLCTime *)time;
 
 @property (readonly) VLCTime *remainingTime;
+@property (readonly) int fps;
 
 - (void)setChapter:(int)value;
 - (int)chapter;
 - (int)countOfChapters;
 
+- (void)setTitle:(int)value;
+- (int)title;
+- (int)countOfTitles;
+
 /* Audio Options */
 - (void)setAudioTrack:(int)value;
 - (int)audioTrack;

+ 0 - 2
Headers/Public/VLCServicesDiscoverer.h

@@ -22,8 +22,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#import <Cocoa/Cocoa.h>
-
 @interface VLCServicesDiscoverer : NSObject
 {
     NSArray * services;

+ 0 - 2
Headers/Public/VLCStreamOutput.h

@@ -22,8 +22,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#import <Cocoa/Cocoa.h>
-
 extern NSString * VLCDefaultStreamOutputRTSP;
 extern NSString * VLCDefaultStreamOutputRTP;
 extern NSString * VLCDefaultStreamOutputRTP;

+ 0 - 1
Headers/Public/VLCStreamSession.h

@@ -22,7 +22,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#import <Cocoa/Cocoa.h>
 #import <VLCKit/VLCStreamOutput.h>
 #import <VLCKit/VLCMediaPlayer.h>
 #import <VLCKit/VLCMedia.h>

+ 0 - 2
Headers/Public/VLCTime.h

@@ -22,8 +22,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#import <Cocoa/Cocoa.h>
-
 /**
  * Provides an object to define VLCMedia's time.
  */

+ 0 - 1
Headers/Public/VLCVideoView.h

@@ -22,7 +22,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#import <Cocoa/Cocoa.h>
 #import <QuartzCore/QuartzCore.h>
 
 @interface VLCVideoView : NSView

+ 52 - 10
Sources/VLCMediaListPlayer.m

@@ -1,10 +1,28 @@
-//
-//  VLCMediaListPlayer.m
-//  VLCKit
-//
-//  Created by Pierre d'Herbemont on 8/24/09.
-//  Copyright 2009 __MyCompanyName__. All rights reserved.
-//
+/*****************************************************************************
+ * VLCMediaListPlayer.m: VLCKit.framework VLCMediaListPlayer implementation
+ *****************************************************************************
+ * Copyright (C) 2009 Pierre d'Herbemont
+ * Partial Copyright (C) 2009 Felix Paul Kühne
+ * Copyright (C) 2009 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
+ *          Felix Paul Kühne <fkuehne # videolan.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
 
 #import "VLCMediaListPlayer.h"
 #import "VLCMedia.h"
@@ -94,7 +112,7 @@
     libvlc_exception_t ex;
     libvlc_exception_init(&ex);
     libvlc_media_list_player_play_item(instance, [media libVLCMediaDescriptor], &ex);
-    catch_exception(&ex);    
+    catch_exception(&ex);
 }
 
 - (void)play
@@ -102,7 +120,7 @@
     libvlc_exception_t ex;
     libvlc_exception_init(&ex);
     libvlc_media_list_player_play(instance, &ex);
-    catch_exception(&ex);    
+    catch_exception(&ex);
 }
 
 - (void)stop
@@ -110,6 +128,30 @@
     libvlc_exception_t ex;
     libvlc_exception_init(&ex);
     libvlc_media_list_player_stop(instance, &ex);
-    catch_exception(&ex);        
+    catch_exception(&ex);
+}
+
+- (void)doNotRepeatAnyItem;
+{
+    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);
+    catch_exception(&ex);
+}
+
+- (void)repeatAllItems
+{
+    libvlc_exception_t ex;
+    libvlc_exception_init(&ex);
+    libvlc_media_list_player_set_playback_mode(instance, libvlc_playback_mode_loop, &ex);
+    catch_exception(&ex);
 }
 @end

+ 59 - 3
Sources/VLCMediaPlayer.m

@@ -1,12 +1,14 @@
 /*****************************************************************************
  * VLCMediaPlayer.m: VLCKit.framework VLCMediaPlayer implementation
  *****************************************************************************
- * Copyright (C) 2007 Pierre d'Herbemont
- * Copyright (C) 2007 the VideoLAN team
+ * Copyright (C) 2007-2009 Pierre d'Herbemont
+ * Copyright (C) 2007-2009 the VideoLAN team
+ * Partial Copyright (C) 2009 Felix Paul Kühne
  * $Id$
  *
  * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
  *          Faustion Osuna <enrique.osuna # gmail.com>
+ *          Felix Paul Kühne <fkuehne # videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -399,9 +401,21 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
     return [VLCTime timeWithNumber:[NSNumber numberWithDouble:-remaining]];
 }
 
+- (int)fps
+{
+    libvlc_exception_t ex;
+    libvlc_exception_init( &ex );
+    int result = libvlc_media_player_get_fps( instance, &ex );
+    catch_exception( &ex );
+    return result;
+}
+
 - (void)setChapter:(int)value;
 {
-    libvlc_media_player_set_chapter( instance, value, NULL );
+    libvlc_exception_t ex;
+    libvlc_exception_init( &ex );
+    libvlc_media_player_set_chapter( instance, value, &ex );
+    catch_exception( &ex );
 }
 
 - (int)chapter
@@ -422,6 +436,48 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
     return result;
 }
 
+- (void)nextChapter
+{
+    libvlc_exception_t ex;
+    libvlc_exception_init( &ex );
+    libvlc_media_player_next_chapter( instance, &ex );
+    catch_exception( &ex );
+}
+
+- (void)previousChapter
+{
+    libvlc_exception_t ex;
+    libvlc_exception_init( &ex );
+    libvlc_media_player_previous_chapter( instance, &ex );
+    catch_exception( &ex );
+}
+
+- (void)setTitle:(int)value
+{
+    libvlc_exception_t ex;
+    libvlc_exception_init( &ex );
+    libvlc_media_player_set_title( instance, value, &ex );
+    catch_exception( &ex );
+}
+
+- (int)title
+{
+    libvlc_exception_t ex;
+    libvlc_exception_init( &ex );
+    int result = libvlc_media_player_get_title( instance, &ex );
+    catch_exception( &ex );
+    return result;
+}
+
+- (int)countOfTitles
+{
+    libvlc_exception_t ex;
+    libvlc_exception_init( &ex );
+    int result = libvlc_media_player_get_title_count( instance, &ex );
+    catch_exception( &ex );
+    return result;
+}
+
 - (void)setAudioTrack:(int)value
 {
     libvlc_audio_set_track( instance, value, NULL );