]> git.sesse.net Git - vlc/commitdiff
VLCKit: Import MobileVLCKit.
authorPierre d'Herbemont <pdherbemont@free.fr>
Mon, 28 Jun 2010 20:29:33 +0000 (22:29 +0200)
committerPierre d'Herbemont <pdherbemont@free.fr>
Sat, 25 Sep 2010 21:08:07 +0000 (23:08 +0200)
25 files changed:
projects/macosx/framework/Headers/Internal/VLCEventManager.h
projects/macosx/framework/Headers/Internal/VLCLibVLCBridging.h
projects/macosx/framework/Headers/Public/MobileVLCKit.h [new file with mode: 0644]
projects/macosx/framework/Headers/Public/VLCAudio.h
projects/macosx/framework/Headers/Public/VLCLibrary.h
projects/macosx/framework/Headers/Public/VLCMedia.h
projects/macosx/framework/Headers/Public/VLCMediaDiscoverer.h
projects/macosx/framework/Headers/Public/VLCMediaList.h
projects/macosx/framework/Headers/Public/VLCMediaPlayer.h
projects/macosx/framework/Headers/Public/VLCMediaThumbnailer.h [new file with mode: 0644]
projects/macosx/framework/Headers/Public/VLCTime.h
projects/macosx/framework/MobileVLCKit.xcodeproj/project.pbxproj [new file with mode: 0644]
projects/macosx/framework/MobileVLCKit/AggregateStaticPlugins.sh [new file with mode: 0755]
projects/macosx/framework/MobileVLCKit/MobileVLCKit.xcconfig [new file with mode: 0644]
projects/macosx/framework/MobileVLCKit_Prefix.pch [new file with mode: 0644]
projects/macosx/framework/Sources/VLCEventManager.m
projects/macosx/framework/Sources/VLCLibrary.m
projects/macosx/framework/Sources/VLCMedia.m
projects/macosx/framework/Sources/VLCMediaDiscoverer.m
projects/macosx/framework/Sources/VLCMediaList.m
projects/macosx/framework/Sources/VLCMediaPlayer.m
projects/macosx/framework/Sources/VLCMediaThumbnailer.m [new file with mode: 0644]
projects/macosx/framework/Sources/VLCTime.m
projects/macosx/framework/VLCKit.xcodeproj/project.pbxproj
projects/macosx/framework/VLC_Prefix.pch

index a7a06d204f94840f7ae81858cb32dbc0617d1516..71b5cba91ef10f3579a86dd5be19112dda995433 100644 (file)
@@ -22,7 +22,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#import <Cocoa/Cocoa.h>
 #import <pthread.h>
 
 /**
@@ -30,7 +29,9 @@
  */
 @interface VLCEventManager : NSObject
 {
-    NSMutableArray * messageQueue;      //< Holds a queue of messages.
+    NSMutableArray *messageQueue;      //< Holds a queue of messages.
+    NSMutableArray *pendingMessagesOnMainThread;   //< Holds the message that are being posted on main thread.
+    NSLock          *pendingMessagesLock;
     pthread_t        dispatcherThread;  //< Thread responsible for dispatching messages.
     pthread_mutex_t  queueLock;         //< Queue lock.
     pthread_cond_t   signalData;        //< Data lock.
 /* Operations */
 /**
  * Sends a message to the target's delegate on the main thread.
- * \discussion The main thread is the one in which the main run loop is run, which usually 
- * means the one in which the NSApplication object receives events. The method is performed 
- * when the main thread runs the run loop in one of the common run loop modes (as specified 
+ * \discussion The main thread is the one in which the main run loop is run, which usually
+ * means the one in which the NSApplication object receives events. The method is performed
+ * when the main thread runs the run loop in one of the common run loop modes (as specified
  * in the CFRunLoop documentation).
  *
  * The receiver is retained until the call is finished.
  * \param aTarget The target object who's delegate should receive the specified message.
- * \param aSelector A selector that identifies the method to invoke. The method should not 
- * have a significant return value and should take a single argument of type NSNotification, 
+ * \param aSelector A selector that identifies the method to invoke. The method should not
+ * have a significant return value and should take a single argument of type NSNotification,
  * or no arguments.
  *
  * See “Selectors” for a description of the SEL type.
- * \param aNotificiationName The name of the notification that should be sent to the 
+ * \param aNotificiationName The name of the notification that should be sent to the
  * distributed notification center.
  */
-- (void)callOnMainThreadDelegateOfObject:(id)aTarget 
-                      withDelegateMethod:(SEL)aSelector 
+- (void)callOnMainThreadDelegateOfObject:(id)aTarget
+                      withDelegateMethod:(SEL)aSelector
                     withNotificationName:(NSString *)aNotificationName;
 
 /**
  * Sends a message to the target on the main thread.
- * \discussion The main thread is the one in which the main run loop is run, which usually 
- * means the one in which the NSApplication object receives events. The method is performed 
- * when the main thread runs the run loop in one of the common run loop modes (as specified 
+ * \discussion The main thread is the one in which the main run loop is run, which usually
+ * means the one in which the NSApplication object receives events. The method is performed
+ * when the main thread runs the run loop in one of the common run loop modes (as specified
  * in the CFRunLoop documentation).
  *
  * The receiver and arg are retained until the call is finished.
  * \param aTarget The target object who should receive the specified message.
- * \param aSelector A selector that identifies the method to invoke. The method should not 
- * have a significant return value and should take a single argument of type id, 
+ * \param aSelector A selector that identifies the method to invoke. The method should not
+ * have a significant return value and should take a single argument of type id,
  * or no arguments.
  *
  * See “Selectors” for a description of the SEL type.
- * \param arg The argument to pass in the message.  Pass nil if the method does not take an 
+ * \param arg The argument to pass in the message.  Pass nil if the method does not take an
  * argument.
  * distributed notification center.
  */
-- (void)callOnMainThreadObject:(id)aTarget 
-                    withMethod:(SEL)aSelector 
+- (void)callOnMainThreadObject:(id)aTarget
+                    withMethod:(SEL)aSelector
           withArgumentAsObject:(id)arg;
+
+- (void)cancelCallToObject:(id)target;
 @end
index f9653aceaa24a3bf727477ebf67ab95df265ae53..c26a0195e178ba47edf1af9c6a5235e700e66eb7 100644 (file)
@@ -23,7 +23,9 @@
 *****************************************************************************/
 
 #import "VLCLibrary.h"
+#if !TARGET_OS_IPHONE
 #import "VLCStreamOutput.h"
+#endif
 #import "VLCMediaPlayer.h"
 
 /**
 /**
  * TODO: Documentation
  */
+#if !TARGET_OS_IPHONE
 @interface VLCStreamOutput (LibVLCBridge)
 - (NSString *)representedLibVLCOptions;
 @end
+#endif
diff --git a/projects/macosx/framework/Headers/Public/MobileVLCKit.h b/projects/macosx/framework/Headers/Public/MobileVLCKit.h
new file mode 100644 (file)
index 0000000..1364628
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ *  MobileVLCKit.h
+ *  VLCKit
+ *
+ *  Created by Pierre d'Herbemont on 6/28/10.
+ *  Copyright 2010 __MyCompanyName__. All rights reserved.
+ *
+ */
+
+#import <MobileVLCKit/VLCLibrary.h>
+#import <MobileVLCKit/VLCMedia.h>
+#import <MobileVLCKit/VLCMediaList.h>
+#import <MobileVLCKit/VLCMediaPlayer.h>
+#import <MobileVLCKit/VLCMediaDiscoverer.h>
+#import <MobileVLCKit/VLCTime.h>
+#import <MobileVLCKit/VLCAudio.h>
+
+@class VLCMedia;
+@class VLCMediaLibrary;
+@class VLCMediaList;
+@class VLCTime;
+@class VLCVideoView;
+@class VLCAudio;
index a44bd387a63175d79dd2b864ccb1b14c861ef642..7ab2e9512d3f1d1f3c3a9e30758beb4f3bd063a3 100644 (file)
@@ -22,6 +22,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#import <Foundation/Foundation.h>
+
 /* Notification Messages */
 /**
  * Standard notification messages that are emitted by VLCAudio object.
index bc8852e39b63c85fda100315d4cc95ca0c1424f6..bef46bdf9f3dd6331e5b8e1a79457af31b6f4df6 100644 (file)
@@ -22,6 +22,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#import <Foundation/Foundation.h>
 #import "VLCAudio.h"
 #import "VLCMediaList.h"
 #import "VLCMedia.h"
index d75503a6b54770c6b4b310d49d413af9b6cd230c..52954fbb296404a90fb7c61a13bc645117a16caf 100644 (file)
@@ -22,6 +22,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#import <Foundation/Foundation.h>
 #import "VLCMediaList.h"
 #import "VLCTime.h"
 
@@ -95,6 +96,13 @@ typedef enum VLCMediaState
  * \param key The key of the value that was changed.
  */
 - (void)media:(VLCMedia *)aMedia metaValueChangedFrom:(id)oldValue forKey:(NSString *)key;
+
+/**
+ * Delegate method called whenever the media was parsed.
+ * \param aMedia The media resource whose meta data has been changed.
+ */
+
+- (void)mediaDidFinishParsing:(VLCMedia *)aMedia;
 @end
 
 /**
@@ -116,6 +124,7 @@ typedef enum VLCMediaState
     BOOL                  areOthersMetaFetched; //< Value used to determine of the other meta has been parsed
     BOOL                  isArtURLFetched;   //< Value used to determine of the other meta has been preparsed
     VLCMediaState         state;             //< Current state of the media
+    BOOL                  isParsed;
 }
 
 /* Factories */
@@ -230,4 +239,97 @@ typedef enum VLCMediaState
  */
 - (void)setValue:(id)value forMeta:(NSString *)VLCMetaInformation;
 
+
+/**
+ * Tracks information NSDictionary Possible Keys
+ */
+
+/**
+ * \returns a NSNumber
+ */
+extern NSString *VLCMediaTracksInformationCodec;
+
+/**
+ * \returns a NSNumber
+ */
+extern NSString *VLCMediaTracksInformationId;
+/**
+ * \returns a NSString
+ * \see VLCMediaTracksInformationTypeAudio
+ * \see VLCMediaTracksInformationTypeVideo
+ * \see VLCMediaTracksInformationTypeText
+ * \see VLCMediaTracksInformationTypeUnknown
+ */
+extern NSString *VLCMediaTracksInformationType;
+
+/**
+ * \returns a NSNumber
+ */
+extern NSString *VLCMediaTracksInformationCodecProfile;
+/**
+ * \returns a NSNumber
+ */
+extern NSString *VLCMediaTracksInformationCodecLevel;
+
+/**
+ * \returns the audio channels number as NSNumber
+ */
+extern NSString *VLCMediaTracksInformationAudioChannelsNumber;
+/**
+ * \returns the audio rate as NSNumber
+ */
+extern NSString *VLCMediaTracksInformationAudioRate;
+
+/**
+ * \returns the height as NSNumber
+ */
+extern NSString *VLCMediaTracksInformationVideoHeight;
+/**
+ * \returns the width as NSNumber
+ */
+extern NSString *VLCMediaTracksInformationVideoWidth;
+
+/**
+ * Tracks information NSDictionary values for
+ * VLCMediaTracksInformationType
+ */
+extern NSString *VLCMediaTracksInformationTypeAudio;
+extern NSString *VLCMediaTracksInformationTypeVideo;
+extern NSString *VLCMediaTracksInformationTypeText;
+extern NSString *VLCMediaTracksInformationTypeUnknown;
+
+
+/**
+ * Returns the tracks information.
+ *
+ * This is an array of NSDictionary representing each track.
+ * It can contains the following keys:
+ *
+ * \see VLCMediaTracksInformationCodec
+ * \see VLCMediaTracksInformationId
+ * \see VLCMediaTracksInformationType
+ *
+ * \see VLCMediaTracksInformationCodecProfile
+ * \see VLCMediaTracksInformationCodecLevel
+ *
+ * \see VLCMediaTracksInformationAudioChannelsNumber
+ * \see VLCMediaTracksInformationAudioRate
+ *
+ * \see VLCMediaTracksInformationVideoHeight
+ * \see VLCMediaTracksInformationVideoWidth
+ */
+
+- (NSArray *)tracksInformation;
+
+/**
+ * Start asynchronously to parse the media.
+ * This will attempt to fetch the meta data and tracks information.
+ *
+ * This is automatically done when an accessor requiring parsing
+ * is called.
+ *
+ * \see -[VLCMediaDelegate mediaDidFinishParsing:]
+ */
+- (void)parse;
+
 @end
index 378441a734e8c7ec55d9a4ecc8d938c732c1ea30..a5887b8591e7e3f47e17cbafb2fda413f345dcbf 100644 (file)
@@ -22,7 +22,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#import <VLCKit/VLCMediaList.h>
+#import <Foundation/Foundation.h>
+#import "VLCMediaList.h"
 
 @class VLCMediaList;
 
index 196257d386e882e445f06d2cb11aee0afb73cf70..3d47692e180be69579d497a620ea43e2f2494a5b 100644 (file)
@@ -22,6 +22,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#import <Foundation/Foundation.h>
 #import "VLCMedia.h"
 
 /* Notification Messages */
index e3669eac2accd99777256c4b0cd0a663668f0868..1b519c929c57a1313aa590662866fd5506f6ae77 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#import <Foundation/Foundation.h>
+#if TARGET_OS_IPHONE
+# import <CoreGraphics/CoreGraphics.h>
+#endif
 #import "VLCMedia.h"
-#import "VLCVideoView.h"
-#import "VLCVideoLayer.h"
 #import "VLCTime.h"
 #import "VLCAudio.h"
 
+#if !TARGET_OS_IPHONE
+@class VLCVideoView;
+@class VLCVideoLayer;
+#endif
+
 /* Notification Messages */
 extern NSString * VLCMediaPlayerTimeChanged;
 extern NSString * VLCMediaPlayerStateChanged;
@@ -75,6 +82,7 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
 - (void)mediaPlayerStateChanged:(NSNotification *)aNotification;
 @end
 
+
 // TODO: Should we use medialist_player or our own flavor of media player?
 @interface VLCMediaPlayer : NSObject
 {
@@ -89,9 +97,11 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
     VLCAudio *audio;
 }
 
+#if !TARGET_OS_IPHONE
 /* Initializers */
 - (id)initWithVideoView:(VLCVideoView *)aVideoView;
 - (id)initWithVideoLayer:(VLCVideoLayer *)aVideoLayer;
+#endif
 
 /* Properties */
 - (void)setDelegate:(id)value;
@@ -100,8 +110,10 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
 /* Video View Options */
 // TODO: Should be it's own object?
 
+#if !TARGET_OS_IPHONE
 - (void)setVideoView:(VLCVideoView *)aVideoView;
 - (void)setVideoLayer:(VLCVideoLayer *)aVideoLayer;
+#endif
 
 @property (retain) id drawable; /* The videoView or videoLayer */
 
@@ -135,7 +147,7 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
 @property (readonly) VLCAudio * audio;
 
 /* Video Information */
-- (NSSize)videoSize;
+- (CGSize)videoSize;
 - (BOOL)hasVideoOut;
 - (float)framesPerSecond;
 
diff --git a/projects/macosx/framework/Headers/Public/VLCMediaThumbnailer.h b/projects/macosx/framework/Headers/Public/VLCMediaThumbnailer.h
new file mode 100644 (file)
index 0000000..e27c344
--- /dev/null
@@ -0,0 +1,56 @@
+//
+//  VLCMediaThumbnailer.h
+//  VLCKit
+//
+//  Created by Pierre d'Herbemont on 7/10/10.
+//  Copyright 2010 __MyCompanyName__. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#if TARGET_OS_IPHONE
+# import <CoreGraphics/CoreGraphics.h>
+#endif
+
+@class VLCMedia;
+@protocol VLCMediaThumbnailerDelegate;
+
+@interface VLCMediaThumbnailer : NSObject {
+    id<VLCMediaThumbnailerDelegate> _delegate;
+    VLCMedia *_media;
+    void *_mp;
+    CGImageRef _thumbnail;
+    void *_data;
+    NSTimer *_parsingTimeoutTimer;
+
+    CGFloat _thumbnailHeight,_thumbnailWidth;
+    CGFloat _effectiveThumbnailHeight,_effectiveThumbnailWidth;
+}
+
++ (VLCMediaThumbnailer *)thumbnailerWithMedia:(VLCMedia *)media andDelegate:(id<VLCMediaThumbnailerDelegate>)delegate;
+- (void)fetchThumbnail;
+
+@property (readwrite, assign) id<VLCMediaThumbnailerDelegate> delegate;
+@property (readwrite, retain) VLCMedia *media;
+@property (readwrite, assign) CGImageRef thumbnail;
+
+/**
+ * Thumbnail Height
+ * You shouldn't change this after -fetchThumbnail
+ * has been called.
+ * @return thumbnail height. Default value 240.
+ */
+@property (readwrite, assign) CGFloat thumbnailHeight;
+
+/**
+ * Thumbnail Width
+ * You shouldn't change this after -fetchThumbnail
+ * has been called.
+ * @return thumbnail height. Default value 320
+ */
+@property (readwrite, assign) CGFloat thumbnailWidth;
+@end
+
+@protocol VLCMediaThumbnailerDelegate
+@required
+- (void)mediaThumbnailer:(VLCMediaThumbnailer *)mediaThumbnailer didFinishThumbnail:(CGImageRef)thumbnail;
+@end
index 1be0c82b360d1ea51d20c2dfed68b0c2811241b3..7d22297a188cf98641554f2f62abd6466c3a4014 100644 (file)
@@ -22,6 +22,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#import <Foundation/Foundation.h>
+
 /**
  * Provides an object to define VLCMedia's time.
  */
diff --git a/projects/macosx/framework/MobileVLCKit.xcodeproj/project.pbxproj b/projects/macosx/framework/MobileVLCKit.xcodeproj/project.pbxproj
new file mode 100644 (file)
index 0000000..31bf769
--- /dev/null
@@ -0,0 +1,382 @@
+// !$*UTF8*$!
+{
+       archiveVersion = 1;
+       classes = {
+       };
+       objectVersion = 45;
+       objects = {
+
+/* Begin PBXAggregateTarget section */
+               7A5ECAF911DE917B00F66AF3 /* Aggregate static plugins */ = {
+                       isa = PBXAggregateTarget;
+                       buildConfigurationList = 7A5ECB1011DE919F00F66AF3 /* Build configuration list for PBXAggregateTarget "Aggregate static plugins" */;
+                       buildPhases = (
+                               7A5ECAF811DE917B00F66AF3 /* Aggregate static plugins script */,
+                       );
+                       dependencies = (
+                       );
+                       name = "Aggregate static plugins";
+                       productName = "Aggregate static plugins";
+               };
+/* End PBXAggregateTarget section */
+
+/* Begin PBXBuildFile section */
+               6360B0E211E7F0C000EAD790 /* VLCMediaDiscoverer.m in Sources */ = {isa = PBXBuildFile; fileRef = 6360B0E111E7F0C000EAD790 /* VLCMediaDiscoverer.m */; };
+               6360B10611E7F27300EAD790 /* VLCMediaDiscoverer.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 6360B0E311E7F0D300EAD790 /* VLCMediaDiscoverer.h */; };
+               636E975811EBC67A002FE8A9 /* VLCMediaThumbnailer.m in Sources */ = {isa = PBXBuildFile; fileRef = 636E975711EBC67A002FE8A9 /* VLCMediaThumbnailer.m */; };
+               636E979111EBC97C002FE8A9 /* VLCMediaThumbnailer.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 636E979011EBC96D002FE8A9 /* VLCMediaThumbnailer.h */; };
+               7A5ECACB11DE8F7300F66AF3 /* VLCEventManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A5ECAC411DE8F7300F66AF3 /* VLCEventManager.m */; };
+               7A5ECACC11DE8F7300F66AF3 /* VLCLibrary.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A5ECAC511DE8F7300F66AF3 /* VLCLibrary.m */; };
+               7A5ECACD11DE8F7300F66AF3 /* VLCMedia.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A5ECAC611DE8F7300F66AF3 /* VLCMedia.m */; };
+               7A5ECACE11DE8F7300F66AF3 /* VLCMediaList.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A5ECAC711DE8F7300F66AF3 /* VLCMediaList.m */; };
+               7A5ECACF11DE8F7300F66AF3 /* VLCMediaPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A5ECAC811DE8F7300F66AF3 /* VLCMediaPlayer.m */; };
+               7A5ECAD011DE8F7300F66AF3 /* VLCTime.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A5ECAC911DE8F7300F66AF3 /* VLCTime.m */; };
+               7A5ECAD111DE8F7300F66AF3 /* VLCAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A5ECACA11DE8F7300F66AF3 /* VLCAudio.m */; };
+               7A5ECB5511DE961700F66AF3 /* VLCLibrary.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 7A5ECAD411DE8FAB00F66AF3 /* VLCLibrary.h */; };
+               7A5ECB5611DE961700F66AF3 /* VLCMedia.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 7A5ECAD511DE8FAB00F66AF3 /* VLCMedia.h */; };
+               7A5ECB5711DE961700F66AF3 /* VLCMediaList.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 7A5ECAD611DE8FAB00F66AF3 /* VLCMediaList.h */; };
+               7A5ECB5811DE961700F66AF3 /* VLCMediaPlayer.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 7A5ECAD711DE8FAB00F66AF3 /* VLCMediaPlayer.h */; };
+               7A5ECB5911DE961700F66AF3 /* VLCTime.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 7A5ECAD811DE8FAB00F66AF3 /* VLCTime.h */; };
+               7A5ECB5A11DE961700F66AF3 /* VLCAudio.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 7A5ECAD911DE8FAB00F66AF3 /* VLCAudio.h */; };
+               7A5ECB9E11DE975A00F66AF3 /* MobileVLCKit.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 7A5ECB9D11DE975700F66AF3 /* MobileVLCKit.h */; };
+               AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+               7A5ECB6211DE961B00F66AF3 /* Copy Headers */ = {
+                       isa = PBXCopyFilesBuildPhase;
+                       buildActionMask = 2147483647;
+                       dstPath = include/MobileVLCKit;
+                       dstSubfolderSpec = 16;
+                       files = (
+                               7A5ECB9E11DE975A00F66AF3 /* MobileVLCKit.h in Copy Headers */,
+                               7A5ECB5511DE961700F66AF3 /* VLCLibrary.h in Copy Headers */,
+                               7A5ECB5611DE961700F66AF3 /* VLCMedia.h in Copy Headers */,
+                               636E979111EBC97C002FE8A9 /* VLCMediaThumbnailer.h in Copy Headers */,
+                               7A5ECB5711DE961700F66AF3 /* VLCMediaList.h in Copy Headers */,
+                               7A5ECB5811DE961700F66AF3 /* VLCMediaPlayer.h in Copy Headers */,
+                               6360B10611E7F27300EAD790 /* VLCMediaDiscoverer.h in Copy Headers */,
+                               7A5ECB5911DE961700F66AF3 /* VLCTime.h in Copy Headers */,
+                               7A5ECB5A11DE961700F66AF3 /* VLCAudio.h in Copy Headers */,
+                       );
+                       name = "Copy Headers";
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+               6360B0E111E7F0C000EAD790 /* VLCMediaDiscoverer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCMediaDiscoverer.m; path = Sources/VLCMediaDiscoverer.m; sourceTree = "<group>"; };
+               6360B0E311E7F0D300EAD790 /* VLCMediaDiscoverer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCMediaDiscoverer.h; path = Headers/Public/VLCMediaDiscoverer.h; sourceTree = "<group>"; };
+               636E975711EBC67A002FE8A9 /* VLCMediaThumbnailer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCMediaThumbnailer.m; path = Sources/VLCMediaThumbnailer.m; sourceTree = "<group>"; };
+               636E979011EBC96D002FE8A9 /* VLCMediaThumbnailer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCMediaThumbnailer.h; path = Headers/Public/VLCMediaThumbnailer.h; sourceTree = "<group>"; };
+               7A5ECAC411DE8F7300F66AF3 /* VLCEventManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCEventManager.m; path = Sources/VLCEventManager.m; sourceTree = "<group>"; };
+               7A5ECAC511DE8F7300F66AF3 /* VLCLibrary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCLibrary.m; path = Sources/VLCLibrary.m; sourceTree = "<group>"; };
+               7A5ECAC611DE8F7300F66AF3 /* VLCMedia.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCMedia.m; path = Sources/VLCMedia.m; sourceTree = "<group>"; };
+               7A5ECAC711DE8F7300F66AF3 /* VLCMediaList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCMediaList.m; path = Sources/VLCMediaList.m; sourceTree = "<group>"; };
+               7A5ECAC811DE8F7300F66AF3 /* VLCMediaPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCMediaPlayer.m; path = Sources/VLCMediaPlayer.m; sourceTree = "<group>"; };
+               7A5ECAC911DE8F7300F66AF3 /* VLCTime.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCTime.m; path = Sources/VLCTime.m; sourceTree = "<group>"; };
+               7A5ECACA11DE8F7300F66AF3 /* VLCAudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCAudio.m; path = Sources/VLCAudio.m; sourceTree = "<group>"; };
+               7A5ECAD411DE8FAB00F66AF3 /* VLCLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCLibrary.h; path = Headers/Public/VLCLibrary.h; sourceTree = "<group>"; };
+               7A5ECAD511DE8FAB00F66AF3 /* VLCMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCMedia.h; path = Headers/Public/VLCMedia.h; sourceTree = "<group>"; };
+               7A5ECAD611DE8FAB00F66AF3 /* VLCMediaList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCMediaList.h; path = Headers/Public/VLCMediaList.h; sourceTree = "<group>"; };
+               7A5ECAD711DE8FAB00F66AF3 /* VLCMediaPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCMediaPlayer.h; path = Headers/Public/VLCMediaPlayer.h; sourceTree = "<group>"; };
+               7A5ECAD811DE8FAB00F66AF3 /* VLCTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCTime.h; path = Headers/Public/VLCTime.h; sourceTree = "<group>"; };
+               7A5ECAD911DE8FAB00F66AF3 /* VLCAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCAudio.h; path = Headers/Public/VLCAudio.h; sourceTree = "<group>"; };
+               7A5ECAE411DE8FEF00F66AF3 /* VLCLibVLCBridging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCLibVLCBridging.h; path = Headers/Internal/VLCLibVLCBridging.h; sourceTree = "<group>"; };
+               7A5ECAE511DE8FEF00F66AF3 /* VLCEventManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCEventManager.h; path = Headers/Internal/VLCEventManager.h; sourceTree = "<group>"; };
+               7A5ECB3311DE948C00F66AF3 /* MobileVLCKit.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = MobileVLCKit.xcconfig; path = MobileVLCKit/MobileVLCKit.xcconfig; sourceTree = "<group>"; };
+               7A5ECB3411DE94D600F66AF3 /* vlc-plugins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "vlc-plugins.h"; path = "MobileVLCKit/vlc-plugins.h"; sourceTree = "<group>"; };
+               7A5ECB9D11DE975700F66AF3 /* MobileVLCKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MobileVLCKit.h; path = Headers/Public/MobileVLCKit.h; sourceTree = "<group>"; };
+               7A5ECBAC11DE987400F66AF3 /* AggregateStaticPlugins.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = AggregateStaticPlugins.sh; path = MobileVLCKit/AggregateStaticPlugins.sh; sourceTree = "<group>"; };
+               AA747D9E0F9514B9006C5449 /* MobileVLCKit_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MobileVLCKit_Prefix.pch; sourceTree = SOURCE_ROOT; };
+               AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+               D2AAC07E0554694100DB518D /* libMobileVLCKit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMobileVLCKit.a; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+               D2AAC07C0554694100DB518D /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+               034768DFFF38A50411DB9C8B /* Products */ = {
+                       isa = PBXGroup;
+                       children = (
+                               D2AAC07E0554694100DB518D /* libMobileVLCKit.a */,
+                       );
+                       name = Products;
+                       sourceTree = "<group>";
+               };
+               0867D691FE84028FC02AAC07 /* MobileVLCKit */ = {
+                       isa = PBXGroup;
+                       children = (
+                               7A5ECAE211DE8FD200F66AF3 /* Headers */,
+                               08FB77AEFE84172EC02AAC07 /* Sources */,
+                               32C88DFF0371C24200C91783 /* Other Sources */,
+                               0867D69AFE84028FC02AAC07 /* Frameworks */,
+                               034768DFFF38A50411DB9C8B /* Products */,
+                       );
+                       name = MobileVLCKit;
+                       sourceTree = "<group>";
+               };
+               0867D69AFE84028FC02AAC07 /* Frameworks */ = {
+                       isa = PBXGroup;
+                       children = (
+                               AACBBE490F95108600F1A2B1 /* Foundation.framework */,
+                       );
+                       name = Frameworks;
+                       sourceTree = "<group>";
+               };
+               08FB77AEFE84172EC02AAC07 /* Sources */ = {
+                       isa = PBXGroup;
+                       children = (
+                               7A5ECAC411DE8F7300F66AF3 /* VLCEventManager.m */,
+                               7A5ECAC511DE8F7300F66AF3 /* VLCLibrary.m */,
+                               7A5ECAC611DE8F7300F66AF3 /* VLCMedia.m */,
+                               7A5ECAC711DE8F7300F66AF3 /* VLCMediaList.m */,
+                               7A5ECAC811DE8F7300F66AF3 /* VLCMediaPlayer.m */,
+                               636E975711EBC67A002FE8A9 /* VLCMediaThumbnailer.m */,
+                               6360B0E111E7F0C000EAD790 /* VLCMediaDiscoverer.m */,
+                               7A5ECAC911DE8F7300F66AF3 /* VLCTime.m */,
+                               7A5ECACA11DE8F7300F66AF3 /* VLCAudio.m */,
+                       );
+                       name = Sources;
+                       sourceTree = "<group>";
+               };
+               32C88DFF0371C24200C91783 /* Other Sources */ = {
+                       isa = PBXGroup;
+                       children = (
+                               7A5ECBAC11DE987400F66AF3 /* AggregateStaticPlugins.sh */,
+                               7A5ECB3311DE948C00F66AF3 /* MobileVLCKit.xcconfig */,
+                               AA747D9E0F9514B9006C5449 /* MobileVLCKit_Prefix.pch */,
+                       );
+                       name = "Other Sources";
+                       sourceTree = "<group>";
+               };
+               7A5ECAE211DE8FD200F66AF3 /* Headers */ = {
+                       isa = PBXGroup;
+                       children = (
+                               7A5ECB9D11DE975700F66AF3 /* MobileVLCKit.h */,
+                               7A5ECAE311DE8FDF00F66AF3 /* Internal */,
+                               7A5ECAD411DE8FAB00F66AF3 /* VLCLibrary.h */,
+                               7A5ECAD511DE8FAB00F66AF3 /* VLCMedia.h */,
+                               636E979011EBC96D002FE8A9 /* VLCMediaThumbnailer.h */,
+                               7A5ECAD611DE8FAB00F66AF3 /* VLCMediaList.h */,
+                               7A5ECAD711DE8FAB00F66AF3 /* VLCMediaPlayer.h */,
+                               6360B0E311E7F0D300EAD790 /* VLCMediaDiscoverer.h */,
+                               7A5ECAD811DE8FAB00F66AF3 /* VLCTime.h */,
+                               7A5ECAD911DE8FAB00F66AF3 /* VLCAudio.h */,
+                       );
+                       name = Headers;
+                       sourceTree = "<group>";
+               };
+               7A5ECAE311DE8FDF00F66AF3 /* Internal */ = {
+                       isa = PBXGroup;
+                       children = (
+                               7A5ECB3411DE94D600F66AF3 /* vlc-plugins.h */,
+                               7A5ECAE411DE8FEF00F66AF3 /* VLCLibVLCBridging.h */,
+                               7A5ECAE511DE8FEF00F66AF3 /* VLCEventManager.h */,
+                       );
+                       name = Internal;
+                       sourceTree = "<group>";
+               };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+               D2AAC07D0554694100DB518D /* MobileVLCKit */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "MobileVLCKit" */;
+                       buildPhases = (
+                               D2AAC07B0554694100DB518D /* Sources */,
+                               7A5ECB6211DE961B00F66AF3 /* Copy Headers */,
+                               D2AAC07C0554694100DB518D /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = MobileVLCKit;
+                       productName = MobileVLCKit;
+                       productReference = D2AAC07E0554694100DB518D /* libMobileVLCKit.a */;
+                       productType = "com.apple.product-type.library.static";
+               };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+               0867D690FE84028FC02AAC07 /* Project object */ = {
+                       isa = PBXProject;
+                       buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "MobileVLCKit" */;
+                       compatibilityVersion = "Xcode 3.1";
+                       hasScannedForEncodings = 1;
+                       mainGroup = 0867D691FE84028FC02AAC07 /* MobileVLCKit */;
+                       productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
+                       projectDirPath = "";
+                       projectRoot = "";
+                       targets = (
+                               D2AAC07D0554694100DB518D /* MobileVLCKit */,
+                               7A5ECAF911DE917B00F66AF3 /* Aggregate static plugins */,
+                       );
+               };
+/* End PBXProject section */
+
+/* Begin PBXShellScriptBuildPhase section */
+               7A5ECAF811DE917B00F66AF3 /* Aggregate static plugins script */ = {
+                       isa = PBXShellScriptBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       inputPaths = (
+                       );
+                       name = "Aggregate static plugins script";
+                       outputPaths = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+                       shellPath = /bin/sh;
+                       shellScript = "/bin/sh ${SRCROOT}/MobileVLCKit/AggregateStaticPlugins.sh\nexit 0\n";
+               };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+               D2AAC07B0554694100DB518D /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               7A5ECACB11DE8F7300F66AF3 /* VLCEventManager.m in Sources */,
+                               7A5ECACC11DE8F7300F66AF3 /* VLCLibrary.m in Sources */,
+                               7A5ECACD11DE8F7300F66AF3 /* VLCMedia.m in Sources */,
+                               7A5ECACE11DE8F7300F66AF3 /* VLCMediaList.m in Sources */,
+                               7A5ECACF11DE8F7300F66AF3 /* VLCMediaPlayer.m in Sources */,
+                               7A5ECAD011DE8F7300F66AF3 /* VLCTime.m in Sources */,
+                               7A5ECAD111DE8F7300F66AF3 /* VLCAudio.m in Sources */,
+                               6360B0E211E7F0C000EAD790 /* VLCMediaDiscoverer.m in Sources */,
+                               636E975811EBC67A002FE8A9 /* VLCMediaThumbnailer.m in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+               1DEB921F08733DC00010E9CD /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 7A5ECB3311DE948C00F66AF3 /* MobileVLCKit.xcconfig */;
+                       buildSettings = {
+                               ALWAYS_SEARCH_USER_PATHS = NO;
+                               ARCHS = armv7;
+                               COPY_PHASE_STRIP = NO;
+                               DSTROOT = /tmp/MobileVLCKit.dst;
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_ENABLE_FIX_AND_CONTINUE = YES;
+                               GCC_MODEL_TUNING = G5;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               GCC_PRECOMPILE_PREFIX_HEADER = YES;
+                               GCC_PREFIX_HEADER = MobileVLCKit_Prefix.pch;
+                               HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../include";
+                               INSTALL_PATH = /usr/local/lib;
+                               PRODUCT_NAME = MobileVLCKit;
+                       };
+                       name = Debug;
+               };
+               1DEB922008733DC00010E9CD /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       baseConfigurationReference = 7A5ECB3311DE948C00F66AF3 /* MobileVLCKit.xcconfig */;
+                       buildSettings = {
+                               ALWAYS_SEARCH_USER_PATHS = NO;
+                               ARCHS = armv7;
+                               DSTROOT = /tmp/MobileVLCKit.dst;
+                               GCC_MODEL_TUNING = G5;
+                               GCC_PRECOMPILE_PREFIX_HEADER = YES;
+                               GCC_PREFIX_HEADER = MobileVLCKit_Prefix.pch;
+                               HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../include";
+                               INSTALL_PATH = /usr/local/lib;
+                               PRODUCT_NAME = MobileVLCKit;
+                       };
+                       name = Release;
+               };
+               1DEB922308733DC00010E9CD /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+                               GCC_C_LANGUAGE_STANDARD = c99;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_UNUSED_VARIABLE = YES;
+                               OTHER_LDFLAGS = "-ObjC";
+                               PREBINDING = NO;
+                               SDKROOT = iphoneos3.2;
+                       };
+                       name = Debug;
+               };
+               1DEB922408733DC00010E9CD /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+                               GCC_C_LANGUAGE_STANDARD = c99;
+                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_UNUSED_VARIABLE = YES;
+                               OTHER_LDFLAGS = "-ObjC";
+                               PREBINDING = NO;
+                               SDKROOT = iphoneos3.2;
+                       };
+                       name = Release;
+               };
+               7A5ECAFA11DE917B00F66AF3 /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               PRODUCT_NAME = "Aggregate static plugins";
+                       };
+                       name = Debug;
+               };
+               7A5ECAFB11DE917B00F66AF3 /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+                               GCC_ENABLE_FIX_AND_CONTINUE = NO;
+                               PRODUCT_NAME = "Aggregate static plugins";
+                               ZERO_LINK = NO;
+                       };
+                       name = Release;
+               };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+               1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "MobileVLCKit" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1DEB921F08733DC00010E9CD /* Debug */,
+                               1DEB922008733DC00010E9CD /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "MobileVLCKit" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               1DEB922308733DC00010E9CD /* Debug */,
+                               1DEB922408733DC00010E9CD /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+               7A5ECB1011DE919F00F66AF3 /* Build configuration list for PBXAggregateTarget "Aggregate static plugins" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               7A5ECAFA11DE917B00F66AF3 /* Debug */,
+                               7A5ECAFB11DE917B00F66AF3 /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
+/* End XCConfigurationList section */
+       };
+       rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
+}
diff --git a/projects/macosx/framework/MobileVLCKit/AggregateStaticPlugins.sh b/projects/macosx/framework/MobileVLCKit/AggregateStaticPlugins.sh
new file mode 100755 (executable)
index 0000000..2605094
--- /dev/null
@@ -0,0 +1,230 @@
+#!/bin/sh
+
+# Pre-Compile.sh
+# MobileVLC
+#
+# Created by Pierre d'Herbemont on 6/27/10.
+# Copyright 2010 __MyCompanyName__. All rights reserved.
+
+
+
+plugins+="access/access_attachment "
+plugins+="access/access_avio "
+plugins+="access/access_bd "
+plugins+="access/access_ftp "
+plugins+="access/access_http "
+plugins+="access/access_imem "
+plugins+="access/access_mmap "
+plugins+="access/access_mms "
+plugins+="access/access_tcp "
+plugins+="access/access_udp "
+plugins+="access/filesystem "
+plugins+="access/rtp "
+plugins+="access/zip "
+plugins+="access_output/access_output_dummy "
+plugins+="access_output/access_output_file "
+plugins+="access_output/access_output_http "
+plugins+="access_output/access_output_livehttp "
+plugins+="access_output/access_output_udp "
+plugins+="audio_filter/a52tospdif "
+plugins+="audio_filter/audio_format "
+plugins+="audio_filter/audiobargraph_a "
+plugins+="audio_filter/bandlimited_resampler "
+plugins+="audio_filter/chorus_flanger "
+plugins+="audio_filter/converter_fixed "
+plugins+="audio_filter/dolby_surround_decoder "
+plugins+="audio_filter/dtstospdif "
+plugins+="audio_filter/equalizer "
+plugins+="audio_filter/headphone_channel_mixer "
+plugins+="audio_filter/mono "
+plugins+="audio_filter/normvol "
+plugins+="audio_filter/param_eq "
+plugins+="audio_filter/scaletempo "
+plugins+="audio_filter/simple_channel_mixer "
+plugins+="audio_filter/trivial_channel_mixer "
+plugins+="audio_filter/ugly_resampler "
+plugins+="audio_mixer/float32_mixer "
+plugins+="audio_mixer/spdif_mixer "
+plugins+="audio_mixer/trivial_mixer "
+plugins+="audio_output/aout_file "
+plugins+="audio_output/audioqueue "
+plugins+="codec/a52 "
+plugins+="codec/adpcm "
+plugins+="codec/aes3 "
+plugins+="codec/araw "
+plugins+="codec/avcodec "
+plugins+="codec/cc "
+plugins+="codec/cdg "
+plugins+="codec/cvdsub "
+plugins+="codec/dts "
+plugins+="codec/dvbsub "
+plugins+="codec/invmem "
+plugins+="codec/faad "
+plugins+="codec/lpcm "
+plugins+="codec/mpeg_audio "
+plugins+="codec/rawvideo "
+plugins+="codec/spudec "
+plugins+="codec/subsdec "
+plugins+="codec/subsusf "
+plugins+="codec/svcdsub "
+plugins+="codec/t140 "
+plugins+="codec/telx "
+plugins+="demux/aiff "
+plugins+="demux/asf "
+plugins+="demux/au "
+plugins+="demux/avformat "
+plugins+="demux/avi "
+plugins+="demux/demux_cdg "
+plugins+="demux/demuxdump "
+plugins+="demux/dirac "
+plugins+="demux/es "
+plugins+="demux/flacsys "
+plugins+="demux/h264 "
+plugins+="demux/image "
+plugins+="demux/live555 "
+plugins+="demux/mjpeg "
+plugins+="demux/mp4 "
+plugins+="demux/mpgv "
+plugins+="demux/nsc "
+plugins+="demux/nsv "
+plugins+="demux/nuv "
+plugins+="demux/playlist "
+plugins+="demux/ps "
+plugins+="demux/pva "
+plugins+="demux/rawaud "
+plugins+="demux/rawdv "
+plugins+="demux/rawvid "
+plugins+="demux/real "
+plugins+="demux/smf "
+plugins+="demux/subtitle "
+plugins+="demux/tta "
+plugins+="demux/ty "
+plugins+="demux/ts "
+plugins+="demux/vc1 "
+plugins+="demux/vobsub "
+plugins+="demux/voc "
+plugins+="demux/wav "
+plugins+="demux/xa "
+plugins+="meta_engine/folder "
+plugins+="misc/audioscrobbler "
+plugins+="misc/dummy "
+plugins+="misc/export "
+plugins+="misc/logger "
+plugins+="misc/quartztext "
+plugins+="misc/sqlite "
+plugins+="misc/stats "
+plugins+="misc/vod_rtsp "
+plugins+="misc/xtag "
+plugins+="mux/mux_asf "
+plugins+="mux/mux_avi "
+plugins+="mux/mux_dummy "
+plugins+="mux/mux_mp4 "
+plugins+="mux/mux_mpjpeg "
+plugins+="mux/mux_ps "
+plugins+="mux/mux_wav "
+plugins+="packetizer/packetizer_copy "
+plugins+="packetizer/packetizer_dirac "
+plugins+="packetizer/packetizer_flac "
+plugins+="packetizer/packetizer_h264 "
+plugins+="packetizer/packetizer_mlp "
+plugins+="packetizer/packetizer_mpeg4audio "
+plugins+="packetizer/packetizer_mpeg4video "
+plugins+="packetizer/packetizer_mpegvideo "
+plugins+="packetizer/packetizer_vc1 "
+plugins+="services_discovery/mediadirs "
+plugins+="services_discovery/podcast "
+plugins+="services_discovery/sap "
+plugins+="stream_filter/decomp "
+plugins+="stream_filter/stream_filter_record "
+plugins+="stream_out/stream_out_autodel "
+plugins+="stream_out/stream_out_bridge "
+plugins+="stream_out/stream_out_description "
+plugins+="stream_out/stream_out_display "
+plugins+="stream_out/stream_out_dummy "
+plugins+="stream_out/stream_out_duplicate "
+plugins+="stream_out/stream_out_es "
+plugins+="stream_out/stream_out_gather "
+plugins+="stream_out/stream_out_mosaic_bridge "
+plugins+="stream_out/stream_out_record "
+plugins+="stream_out/stream_out_rtp "
+plugins+="stream_out/stream_out_smem "
+plugins+="stream_out/stream_out_standard "
+plugins+="stream_out/stream_out_transcode "
+plugins+="video_chroma/grey_yuv "
+plugins+="video_chroma/i420_rgb "
+plugins+="video_chroma/i420_yuy2 "
+plugins+="video_chroma/i422_i420 "
+plugins+="video_chroma/i422_yuy2 "
+plugins+="video_chroma/yuy2_i420 "
+plugins+="video_chroma/yuy2_i422 "
+plugins+="video_filter/adjust "
+plugins+="video_filter/alphamask "
+plugins+="video_filter/audiobargraph_v "
+plugins+="video_filter/ball "
+plugins+="video_filter/blend "
+plugins+="video_filter/blendbench "
+plugins+="video_filter/bluescreen "
+plugins+="video_filter/canvas "
+plugins+="video_filter/chain "
+plugins+="video_filter/clone "
+plugins+="video_filter/colorthres "
+plugins+="video_filter/croppadd "
+plugins+="video_filter/deinterlace "
+plugins+="video_filter/dynamicoverlay "
+plugins+="video_filter/erase "
+plugins+="video_filter/extract "
+plugins+="video_filter/gaussianblur "
+plugins+="video_filter/gradfun "
+plugins+="video_filter/gradient "
+plugins+="video_filter/grain "
+plugins+="video_filter/invert "
+plugins+="video_filter/logo "
+plugins+="video_filter/magnify "
+plugins+="video_filter/marq "
+plugins+="video_filter/mirror "
+plugins+="video_filter/mosaic "
+plugins+="video_filter/motionblur "
+plugins+="video_filter/motiondetect "
+plugins+="video_filter/noise "
+plugins+="video_filter/psychedelic "
+plugins+="video_filter/puzzle "
+plugins+="video_filter/ripple "
+plugins+="video_filter/rotate "
+plugins+="video_filter/rss "
+plugins+="video_filter/rv32 "
+plugins+="video_filter/scale "
+plugins+="video_filter/scene "
+plugins+="video_filter/sharpen "
+plugins+="video_filter/swscale "
+plugins+="video_filter/wall "
+plugins+="video_filter/wave "
+plugins+="video_filter/yuvp "
+plugins+="video_output/vmem "
+plugins+="video_output/vout_ios "
+plugins+="video_output/yuv "
+
+pushd `dirname $0` > /dev/null
+PROJECT_DIR=`pwd`
+popd > /dev/null
+
+VLC_SRC_DIR="$PROJECT_DIR/../../../.."
+
+VLC_CONTRIB_DIR="$VLC_SRC_DIR/extras/contrib/hosts/\$(VLC_ARCH)-apple-darwin10/ios"
+
+echo -ne "// This file is autogenerated by $(basename $0)\n\n" > $PROJECT_DIR/vlc-plugins.h
+echo -ne "// This file is autogenerated by $(basename $0)\n\n" > $PROJECT_DIR/vlc-plugins.xcconfig
+
+LDFLAGS=""
+DEFINITION=""
+BUILTINS="const void *vlc_builtins_modules[] = {\n"
+for i in $plugins; do
+    dir=`dirname $i`
+    name=`basename $i`
+    LDFLAGS+="\$(VLC_INSTALL_DIR)/lib/vlc/plugins/${dir}/lib${name}_plugin.a "
+    DEFINITION+="vlc_declare_plugin(${name});\n"
+    BUILTINS+="    vlc_plugin(${name}),\n"
+done;
+BUILTINS+="    NULL\n"
+BUILTINS+="};\n"
+echo -ne "VLC_PLUGINS_LDFLAGS=$LDFLAGS" >> $PROJECT_DIR/vlc-plugins.xcconfig
+echo -ne "$DEFINITION\n$BUILTINS" >> $PROJECT_DIR/vlc-plugins.h
diff --git a/projects/macosx/framework/MobileVLCKit/MobileVLCKit.xcconfig b/projects/macosx/framework/MobileVLCKit/MobileVLCKit.xcconfig
new file mode 100644 (file)
index 0000000..20300d1
--- /dev/null
@@ -0,0 +1,28 @@
+//
+//  vlc.xcconfig
+//  VLC
+//
+//  Created by Pierre d'Herbemont on 6/26/10.
+//  Copyright 2010 __MyCompanyName__. All rights reserved.
+//
+
+
+VLC_SRC_DIR=$(PROJECT_DIR)/../../..
+VLC_ARCH[sdk=iphonesimulator*]=i686
+VLC_ARCH[sdk=iphoneos*]=arm
+VLC_PLATFORM[sdk=iphonesimulator*]=Simulator
+VLC_PLATFORM[sdk=iphoneos*]=OS
+VLC_INSTALL_DIR=$(VLC_SRC_DIR)/install-ios-$(VLC_PLATFORM)
+
+//OTHER_CFLAGS= -ObjC -all_load
+
+#include "vlc-plugins.xcconfig"
+
+VLC_CONTRIB_DIR=$VLC_SRC_DIR/extras/contrib/hosts/$(VLC_ARCH)-apple-darwin10/ios
+AVCODEC=${VLC_CONTRIB_DIR}/lib/libavcore.a $(VLC_CONTRIB_DIR)/lib/libavutil.a ${VLC_CONTRIB_DIR}/lib/libavcodec.a $(VLC_CONTRIB_DIR)/lib/libavformat.a $(VLC_CONTRIB_DIR)/lib/libswscale.a
+LIVE555=$(VLC_CONTRIB_DIR)/lib/libBasicUsageEnvironment.a $(VLC_CONTRIB_DIR)/lib/libUsageEnvironment.a $(VLC_CONTRIB_DIR)/lib/libliveMedia.a $(VLC_CONTRIB_DIR)/lib/libgroupsock.a
+DVBPSI=$(VLC_CONTRIB_DIR)/lib/libdvbpsi.a
+LUA=//$(VLC_CONTRIB_DIR)/lib/liblua.a
+FAAD=$(VLC_CONTRIB_DIR)/lib/libfaad.a
+
+OTHER_LIBTOOLFLAGS=$(AVCODEC) $(LIVE555) $(DVBPSI) $(LUA) $(FAAD) $(VLC_INSTALL_DIR)/lib/libvlc.a $(VLC_INSTALL_DIR)/lib/libvlccore.a $(VLC_PLUGINS_LDFLAGS)
diff --git a/projects/macosx/framework/MobileVLCKit_Prefix.pch b/projects/macosx/framework/MobileVLCKit_Prefix.pch
new file mode 100644 (file)
index 0000000..da4f4dc
--- /dev/null
@@ -0,0 +1,9 @@
+//
+// Prefix header for all source files of the 'CocoaTouchStaticLibrary' target in the 'CocoaTouchStaticLibrary' project.
+//
+
+#ifdef __OBJC__
+    #import <Foundation/Foundation.h>
+    #import <UIKit/UIKit.h>
+#endif
+#import <vlc/vlc.h>
index b810b24686d9c6b00060094f4c52efb38ae7a18e..4239899e6367387d588983103c8a5d496a222b3e 100644 (file)
@@ -56,6 +56,10 @@ typedef struct {
 - (pthread_cond_t *)signalData;
 - (pthread_mutex_t *)queueLock;
 - (NSMutableArray *)messageQueue;
+- (NSMutableArray *)pendingMessagesOnMainThread;
+- (NSLock *)pendingMessagesLock;
+
+- (void)addMessageToHandleOnMainThread:(NSData *)messageAsData;
 @end
 
 /**
@@ -65,7 +69,7 @@ typedef struct {
 static void * EventDispatcherMainLoop(void * user_data)
 {
     VLCEventManager * self = user_data;
-    
+
     for(;;)
     {
         NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
@@ -78,11 +82,11 @@ static void * EventDispatcherMainLoop(void * user_data)
 
         /* Wait for some data */
 
-        pthread_mutex_lock( [self queueLock] );
+        pthread_mutex_lock([self queueLock]);
         /* Wait until we have something on the queue */
-        while( [[self messageQueue] count] <= 0 )
+        while( [[self messageQueue] count] <= 0)
         {
-            pthread_cond_wait( [self signalData], [self queueLock] );
+            pthread_cond_wait([self signalData], [self queueLock]);
         }
 
         //if( [[self messageQueue] count] % 100 == 0 || [[self messageQueue] count] < 100 )
@@ -92,7 +96,7 @@ static void * EventDispatcherMainLoop(void * user_data)
         dataMessage = [[[self messageQueue] lastObject] retain];    // Released in 'call'
         [[self messageQueue] removeLastObject];
         message = (message_t *)[dataMessage bytes];
-        
+
         /* Remove duplicate notifications. */
         if( message->type == VLCNotification )
         {
@@ -103,7 +107,6 @@ static void * EventDispatcherMainLoop(void * user_data)
                     message_newer->target == message->target &&
                    [message_newer->u.name isEqualToString:message->u.name] )
                 {
-                    [message_newer->target release];
                     [message_newer->u.name release];
                     [[self messageQueue] removeObjectAtIndex:i];
                 }
@@ -114,21 +117,20 @@ static void * EventDispatcherMainLoop(void * user_data)
             NSMutableArray * newArg = nil;
 
             /* Collapse messages that takes array arg by sending one bigger array */
-            for( i = [[self messageQueue] count]-1; i >= 0; i-- )
+            for(i = [[self messageQueue] count] - 1; i >= 0; i--)
             {
                 message_newer = (message_t *)[(NSData *)[[self messageQueue] objectAtIndex: i] bytes];
-                ifmessage_newer->type == VLCObjectMethodWithArrayArg &&
-                    message_newer->target == message->target && 
-                    message_newer->sel == message->sel )
+                if (message_newer->type == VLCObjectMethodWithArrayArg &&
+                    message_newer->target == message->target &&
+                    message_newer->sel == message->sel)
                 {
-                    if(!newArg)
+                    if (!newArg)
                     {
                         newArg = [NSMutableArray arrayWithArray:message->u.object];
                         [message->u.object release];
                     }
-                    
+
                     [newArg addObjectsFromArray:message_newer->u.object];
-                    [message_newer->target release];
                     [message_newer->u.object release];
                     [[self messageQueue] removeObjectAtIndex:i];
                 }
@@ -139,19 +141,22 @@ static void * EventDispatcherMainLoop(void * user_data)
                 else if( message_newer->target == message->target )
                     break;
             }
-            
-            if( newArg )
+
+            if (newArg)
                 message->u.object = [newArg retain];
         }
-        
-        pthread_mutex_unlock( [self queueLock] );
+
+        [self addMessageToHandleOnMainThread:dataMessage];
+
+        pthread_mutex_unlock([self queueLock]);
+
 
         if( message->type == VLCNotification )
-            [self performSelectorOnMainThread:@selector(callDelegateOfObjectAndSendNotificationWithArgs:) 
+            [self performSelectorOnMainThread:@selector(callDelegateOfObjectAndSendNotificationWithArgs:)
                                    withObject:dataMessage
                                 waitUntilDone: NO];
         else
-            [self performSelectorOnMainThread:@selector(callObjectMethodWithArgs:) 
+            [self performSelectorOnMainThread:@selector(callObjectMethodWithArgs:)
                                    withObject:dataMessage
                                 waitUntilDone: YES];
 
@@ -163,13 +168,11 @@ static void * EventDispatcherMainLoop(void * user_data)
 @implementation VLCEventManager
 + (id)sharedManager
 {
-    static VLCEventManager * defaultManager = NULL;
-    
+    static VLCEventManager *defaultManager = NULL;
+
     /* We do want a lock here to avoid leaks */
-    if ( !defaultManager )
-    {
+    if (!defaultManager)
         defaultManager = [[VLCEventManager alloc] init];
-    }
 
     return defaultManager;
 }
@@ -181,7 +184,7 @@ static void * EventDispatcherMainLoop(void * user_data)
 
 - (id)init
 {
-    if( self = [super init] )
+    if(self = [super init])
     {
         if(![NSThread isMultiThreaded])
         {
@@ -189,102 +192,167 @@ static void * EventDispatcherMainLoop(void * user_data)
             NSAssert([NSThread isMultiThreaded], @"Can't put Cocoa in multithreaded mode");
         }
 
-        pthread_mutex_init( &queueLock, NULL );
-        pthread_cond_init( &signalData, NULL );
-        pthread_create( &dispatcherThread, NULL, EventDispatcherMainLoop, self );
+        pthread_mutex_init(&queueLock, NULL);
+        pthread_cond_init(&signalData, NULL);
+        pthread_create(&dispatcherThread, NULL, EventDispatcherMainLoop, self);
         messageQueue = [[NSMutableArray alloc] initWithCapacity:10];
+        pendingMessagesOnMainThread = [[NSMutableArray alloc] initWithCapacity:10];
+        pendingMessagesLock = [[NSLock alloc] init];
     }
     return self;
 }
 
 - (void)dealloc
 {
-    pthread_kill( dispatcherThread, SIGKILL );
-    pthread_join( dispatcherThread, NULL );
+    pthread_kill(dispatcherThread, SIGKILL);
+    pthread_join(dispatcherThread, NULL);
 
     [messageQueue release];
+    [pendingMessagesOnMainThread release];
     [super dealloc];
 }
 
-- (void)callOnMainThreadDelegateOfObject:(id)aTarget withDelegateMethod:(SEL)aSelector withNotificationName: (NSString *)aNotificationName
+- (void)callOnMainThreadDelegateOfObject:(id)aTarget withDelegateMethod:(SEL)aSelector withNotificationName:(NSString *)aNotificationName
 {
     /* Don't send on main thread before this gets sorted out */
     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
-    
-    message_t message = 
-    { 
-        [aTarget retain], 
-        aSelector, 
-        [aNotificationName retain], 
-        VLCNotification 
+
+    message_t message =
+    {
+        aTarget,
+        aSelector,
+        [aNotificationName retain],
+        VLCNotification
     };
 
     if( [NSThread isMainThread] )
     {
-        [self callDelegateOfObjectAndSendNotificationWithArgs:[[NSData dataWithBytes:&message length:sizeof(message_t)] retain] /* released in the call */];
-    } 
-    else 
+        NSData *message = [NSData dataWithBytes:&message length:sizeof(message_t)];
+        [self addMessageToHandleOnMainThread:message];
+        [self callDelegateOfObjectAndSendNotificationWithArgs:[message retain] /* released in the call */];
+    }
+    else
     {
-        pthread_mutex_lock( [self queueLock] );
+        pthread_mutex_lock([self queueLock]);
         [[self messageQueue] insertObject:[NSData dataWithBytes:&message length:sizeof(message_t)] atIndex:0];
-        pthread_cond_signal( [self signalData] );
-        pthread_mutex_unlock( [self queueLock] );
+        pthread_cond_signal([self signalData]);
+        pthread_mutex_unlock([self queueLock]);
     }
-    
+
     [pool drain];
 }
 
-- (void)callOnMainThreadObject:(id)aTarget withMethod:(SEL)aSelector withArgumentAsObject: (id)arg
+- (void)callOnMainThreadObject:(id)aTarget withMethod:(SEL)aSelector withArgumentAsObject:(id)arg
 {
     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
-    message_t message = 
-    { 
-        [aTarget retain], 
-        aSelector, 
-        [arg retain], 
-        [arg isKindOfClass:[NSArray class]] ? VLCObjectMethodWithArrayArg : VLCObjectMethodWithObjectArg 
+    message_t message =
+    {
+        aTarget,
+        aSelector,
+        [arg retain],
+        [arg isKindOfClass:[NSArray class]] ? VLCObjectMethodWithArrayArg : VLCObjectMethodWithObjectArg
     };
 
-    pthread_mutex_lock( [self queueLock] );
+    pthread_mutex_lock([self queueLock]);
     [[self messageQueue] insertObject:[NSData dataWithBytes:&message length:sizeof(message_t)] atIndex:0];
-    pthread_cond_signal( [self signalData] );
-    pthread_mutex_unlock( [self queueLock] );
-    
+    pthread_cond_signal([self signalData]);
+    pthread_mutex_unlock([self queueLock]);
+
     [pool drain];
 }
+
+- (void)cancelCallToObject:(id)target
+{
+
+    // Remove all queued message
+    pthread_mutex_lock([self queueLock]);
+    [pendingMessagesLock lock];
+
+    NSMutableArray *queue = [self messageQueue];
+    for (int i = [queue count] - 1; i >= 0; i--) {
+        NSData *data = [queue objectAtIndex:i];
+        message_t *message = (message_t *)[data bytes];
+        if (message->target == target) {
+            [queue removeObjectAtIndex:i];
+        }
+    }
+
+    // Remove all pending messages
+    NSMutableArray *messages = pendingMessagesOnMainThread;
+    for (int i = [messages count] - 1; i >= 0; i--) {
+        NSData *data = [messages objectAtIndex:i];
+        message_t *message = (message_t *)[data bytes];
+
+        if (message->target == target) {
+            [messages removeObjectAtIndex:i];
+
+        }
+    }
+
+    [pendingMessagesLock unlock];
+    pthread_mutex_unlock([self queueLock]);
+
+}
 @end
 
 @implementation VLCEventManager (Private)
+
+- (void)addMessageToHandleOnMainThread:(NSData *)messageAsData
+{
+    [pendingMessagesLock lock];
+    [pendingMessagesOnMainThread addObject:messageAsData];
+    [pendingMessagesLock unlock];
+
+}
+
+- (BOOL)markMessageHandledOnMainThreadIfExists:(NSData *)messageAsData
+{
+    [pendingMessagesLock lock];
+    BOOL cancelled = ![pendingMessagesOnMainThread containsObject:messageAsData];
+    if (!cancelled)
+        [pendingMessagesOnMainThread removeObject:messageAsData];
+    [pendingMessagesLock unlock];
+
+    return !cancelled;
+}
+
 - (void)callDelegateOfObjectAndSendNotificationWithArgs:(NSData*)data
 {
     message_t * message = (message_t *)[data bytes];
 
-    [self callDelegateOfObject:message->target withDelegateMethod:message->sel withNotificationName:message->u.name];
+    // Check that we were not cancelled, ie, target was released
+    if ([self markMessageHandledOnMainThreadIfExists:data]) {
+        [self callDelegateOfObject:message->target withDelegateMethod:message->sel withNotificationName:message->u.name];
+    }
+
     [message->u.name release];
-    [message->target release];
     [data release];
 }
 
 - (void)callObjectMethodWithArgs:(NSData*)data
 {
     message_t * message = (message_t *)[data bytes];
-    void (*method)(id, SEL, id) = (void (*)(id, SEL, id))[message->target methodForSelector: message->sel];
 
-    method( message->target, message->sel, message->u.object);
+    // Check that we were not cancelled
+    if ([self markMessageHandledOnMainThreadIfExists:data]) {
+        void (*method)(id, SEL, id) = (void (*)(id, SEL, id))[message->target methodForSelector: message->sel];
+        method(message->target, message->sel, message->u.object);
+    }
+
     [message->u.object release];
-    [message->target release];
     [data release];
 }
 
-- (void)callDelegateOfObject:(id) aTarget withDelegateMethod:(SEL)aSelector withNotificationName: (NSString *)aNotificationName
+- (void)callDelegateOfObject:(id)aTarget withDelegateMethod:(SEL)aSelector withNotificationName:(NSString *)aNotificationName
 {
     [[NSNotificationCenter defaultCenter] postNotification: [NSNotification notificationWithName:aNotificationName object:aTarget]];
-    
-    if (![aTarget delegate] || ![[aTarget delegate] respondsToSelector:aSelector])
+
+    id delegate = [aTarget delegate];
+    if (!delegate || ![delegate respondsToSelector:aSelector])
         return;
-    
+
     void (*method)(id, SEL, id) = (void (*)(id, SEL, id))[[aTarget delegate] methodForSelector: aSelector];
-    method( [aTarget delegate], aSelector, [NSNotification notificationWithName:aNotificationName object:aTarget]);
+    method([aTarget delegate], aSelector, [NSNotification notificationWithName:aNotificationName object:aTarget]);
 }
 
 - (NSMutableArray *)messageQueue
@@ -292,6 +360,17 @@ static void * EventDispatcherMainLoop(void * user_data)
     return messageQueue;
 }
 
+- (NSMutableArray *)pendingMessagesOnMainThread
+{
+    return pendingMessagesOnMainThread;
+}
+
+- (NSLock *)pendingMessagesLock
+{
+    return pendingMessagesLock;
+}
+
+
 - (pthread_cond_t *)signalData
 {
     return &signalData;
index aadbc979eabe3d77b71166ba2863dfaa42a8cc5d..c7ef7e726378fbb3f17cb2292b52d13a5c2f567c 100644 (file)
 #import "VLCLibrary.h"
 #import "VLCLibVLCBridging.h"
 
+#if TARGET_OS_IPHONE
+# include "vlc-plugins.h"
+#endif
+
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
@@ -49,19 +53,24 @@ static VLCLibrary * sharedLibrary = nil;
 {
     if (self = [super init])
     {
-
         NSArray *vlcParams = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"VLCParams"];
         if (!vlcParams) {
             NSMutableArray *defaultParams = [NSMutableArray array];
+            [defaultParams addObject:@"--play-and-pause"];                          // We want every movie to pause instead of stopping at eof
+            [defaultParams addObject:@"--no-color"];                                // Don't use color in output (Xcode doesn't show it)
+            [defaultParams addObject:@"--no-media-library"];                        // We don't need the media library
             [defaultParams addObject:@"--no-video-title-show"];                     // Don't show the title on overlay when starting to play
+            [defaultParams addObject:@"--verbose=-1"];                               // Let's not wreck the logs
+#if TARGET_OS_IPHONE
+            [defaultParams addObject:@"--ignore-config"];                           // We don't need the config
+//            [defaultParams addObject:@"--ffmpeg-fast"];                             // Let's disable this as it is error-prone
+            [defaultParams addObject:@"--ffmpeg-skiploopfilter=all"];
+#else
             [defaultParams addObject:@"--no-sout-keep"];
             [defaultParams addObject:@"--vout=macosx"];                             // Select Mac OS X video output
             [defaultParams addObject:@"--text-renderer=quartztext"];                // our CoreText-based renderer
-            [defaultParams addObject:@"--verbose=-1"];                              // Don't polute the stdio log
-            [defaultParams addObject:@"--no-color"];                                // Don't use color in output (Xcode doesn't show it)
-            [defaultParams addObject:@"--no-media-library"];                        // We don't need the media library
-            [defaultParams addObject:@"--play-and-pause"];                          // We want every movie to pause instead of stopping at eof
             [defaultParams addObject:@"--extraintf=macosx_dialog_provider"];        // Some extra dialog (login, progress) may come up from here
+#endif
             vlcParams = defaultParams;
         }
 
@@ -73,7 +82,12 @@ static VLCLibrary * sharedLibrary = nil;
             lib_vlc_params[paramNum] = [vlcParam cStringUsingEncoding:NSASCIIStringEncoding];
             paramNum++;
         }
-        instance = (void *)libvlc_new( sizeof(lib_vlc_params)/sizeof(lib_vlc_params[0]), lib_vlc_params);
+        unsigned argc = sizeof(lib_vlc_params)/sizeof(lib_vlc_params[0]);
+#if TARGET_OS_IPHONE
+        instance = libvlc_new_with_builtins(argc, lib_vlc_params, vlc_builtins_modules);
+#else
+        instance = libvlc_new(argc, lib_vlc_params);
+#endif
         NSAssert(instance, @"libvlc failed to initialize");
     }
     return self;
index 6295611433eb624e2266de7c780ffc8ce7aa15c7..5f6fec57881cf3337ec1829c4e689a672eb86cf7 100644 (file)
@@ -73,10 +73,15 @@ NSString * VLCMediaMetaChanged              = @"VLCMediaMetaChanged";
 
 /* Operations */
 - (void)fetchMetaInformationFromLibVLCWithType:(NSString*)metaType;
+#if !TARGET_OS_IPHONE
 - (void)fetchMetaInformationForArtWorkWithURL:(NSString *)anURL;
 - (void)setArtwork:(NSImage *)art;
+#endif
+
+- (void)parseIfNeeded;
 
 /* Callback Methods */
+- (void)parsedChanged:(NSNumber *)isParsedAsNumber;
 - (void)metaChanged:(NSString *)metaType;
 - (void)subItemAdded;
 - (void)setStateAsNumber:(NSNumber *)newStateAsNumber;
@@ -149,6 +154,16 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
     [pool drain];
 }
 
+static void HandleMediaParsedChanged(const libvlc_event_t * event, void * self)
+{
+    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+    [[VLCEventManager sharedManager] callOnMainThreadObject:self
+                                                 withMethod:@selector(parsedChanged:)
+                                       withArgumentAsObject:[NSNumber numberWithBool:event->u.media_parsed_changed.new_status]];
+    [pool release];
+}
+
+
 /******************************************************************************
  * Implementation
  */
@@ -218,27 +233,16 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
     libvlc_media_set_meta(p_md, metaName, [value UTF8String]);
 }
 
-- (void)release
-{
-    @synchronized(self)
-    {
-        if([self retainCount] <= 1)
-        {
-            /* We must make sure we won't receive new event after an upcoming dealloc
-             * We also may receive a -retain in some event callback that may occcur
-             * Before libvlc_event_detach. So this can't happen in dealloc */
-            libvlc_event_manager_t * p_em = libvlc_media_event_manager(p_md);
-            libvlc_event_detach(p_em, libvlc_MediaMetaChanged,     HandleMediaMetaChanged,     self);
-            libvlc_event_detach(p_em, libvlc_MediaDurationChanged, HandleMediaDurationChanged, self);
-            libvlc_event_detach(p_em, libvlc_MediaStateChanged,    HandleMediaStateChanged,    self);
-            libvlc_event_detach(p_em, libvlc_MediaSubItemAdded,    HandleMediaSubItemAdded,    self);
-        }
-        [super release];
-    }
-}
-
 - (void)dealloc
 {
+    libvlc_event_manager_t * p_em = libvlc_media_event_manager(p_md);
+    libvlc_event_detach(p_em, libvlc_MediaMetaChanged,     HandleMediaMetaChanged,     self);
+    libvlc_event_detach(p_em, libvlc_MediaDurationChanged, HandleMediaDurationChanged, self);
+    libvlc_event_detach(p_em, libvlc_MediaStateChanged,    HandleMediaStateChanged,    self);
+    libvlc_event_detach(p_em, libvlc_MediaSubItemAdded,    HandleMediaSubItemAdded,    self);
+    libvlc_event_detach(p_em, libvlc_MediaParsedChanged,   HandleMediaParsedChanged,    self);
+    [[VLCEventManager sharedManager] cancelCallToObject:self];
+
     // Testing to see if the pointer exists is not required, if the pointer is null
     // then the release message is not sent to it.
     delegate = nil;
@@ -255,7 +259,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
 - (NSString *)description
 {
     NSString * result = [metaDictionary objectForKey:VLCMetaInformationTitle];
-    return [NSString stringWithFormat:@"<%@ %p> %@", [self className], self, (result ? result : [url absoluteString])];
+    return [NSString stringWithFormat:@"<%@ %p> %@", [self class], self, (result ? result : [url absoluteString])];
 }
 
 - (NSComparisonResult)compare:(VLCMedia *)media
@@ -291,11 +295,11 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
 
     if (!length)
     {
-        // Force preparsing of this item.
-        [self length];
+        // Force parsing of this item.
+        [self parseIfNeeded];
 
         // wait until we are preparsed
-        while (!length && ![self isParsed] && [aDate timeIntervalSinceNow] > 0)
+        while (!length && !libvlc_media_is_parsed(p_md) && [aDate timeIntervalSinceNow] > 0)
         {
             usleep( thread_sleep );
         }
@@ -312,9 +316,82 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
 
 - (BOOL)isParsed
 {
-    return libvlc_media_is_parsed( p_md );
+    return isParsed;
+}
+
+- (void)parse
+{
+    libvlc_media_parse_async(p_md);
+}
+
+NSString *VLCMediaTracksInformationCodec = @"codec"; // NSNumber
+NSString *VLCMediaTracksInformationId    = @"id";    // NSNumber
+NSString *VLCMediaTracksInformationType  = @"type";  // NSString
+
+NSString *VLCMediaTracksInformationTypeAudio    = @"audio";
+NSString *VLCMediaTracksInformationTypeVideo    = @"video";
+NSString *VLCMediaTracksInformationTypeText     = @"text";
+NSString *VLCMediaTracksInformationTypeUnknown  = @"unknown";
+
+NSString *VLCMediaTracksInformationCodecProfile  = @"profile"; // NSNumber
+NSString *VLCMediaTracksInformationCodecLevel    = @"level";   // NSNumber
+
+NSString *VLCMediaTracksInformationAudioChannelsNumber = @"channelsNumber"; // NSNumber
+NSString *VLCMediaTracksInformationAudioRate           = @"rate";           // NSNumber
+
+NSString *VLCMediaTracksInformationVideoHeight = @"height"; // NSNumber
+NSString *VLCMediaTracksInformationVideoWidth  = @"width";  // NSNumber
+
+- (NSArray *)tracksInformation
+{
+    // Trigger parsing if needed
+    [self parseIfNeeded];
+
+    libvlc_media_track_info_t *tracksInfo;
+    int count = libvlc_media_get_tracks_info(p_md, &tracksInfo);
+    NSMutableArray *array = [NSMutableArray array];
+    for (int i = 0; i < count; i++) {
+        NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+                                           [NSNumber numberWithUnsignedInt:tracksInfo[i].i_codec], VLCMediaTracksInformationCodec,
+                                           [NSNumber numberWithInt:tracksInfo[i].i_id],            VLCMediaTracksInformationId,
+                                           [NSNumber numberWithInt:tracksInfo[i].i_profile],       VLCMediaTracksInformationCodecProfile,
+                                           [NSNumber numberWithInt:tracksInfo[i].i_level],         VLCMediaTracksInformationCodecLevel,
+                                           nil];
+
+        NSString *type;
+        switch (tracksInfo[i].i_type) {
+            case libvlc_track_audio:
+                type = VLCMediaTracksInformationTypeAudio;
+                NSNumber *level = [NSNumber numberWithUnsignedInt:tracksInfo[i].u.audio.i_channels];
+                NSNumber *rate =  [NSNumber numberWithUnsignedInt:tracksInfo[i].u.audio.i_rate];
+                [dictionary setObject:level forKey:VLCMediaTracksInformationAudioChannelsNumber];
+                [dictionary setObject:rate  forKey:VLCMediaTracksInformationAudioRate];
+                break;
+            case libvlc_track_video:
+                type = VLCMediaTracksInformationTypeVideo;
+                NSNumber *width =  [NSNumber numberWithUnsignedInt:tracksInfo[i].u.video.i_width];
+                NSNumber *height = [NSNumber numberWithUnsignedInt:tracksInfo[i].u.video.i_height];
+                [dictionary setObject:width  forKey:VLCMediaTracksInformationVideoWidth];
+                [dictionary setObject:height forKey:VLCMediaTracksInformationVideoHeight];
+                break;
+            case libvlc_track_text:
+                type = VLCMediaTracksInformationTypeText;
+                [dictionary setObject:VLCMediaTracksInformationTypeText forKey:VLCMediaTracksInformationType];
+                break;
+            case libvlc_track_unknown:
+            default:
+                type = VLCMediaTracksInformationTypeUnknown;
+                break;
+        }
+        [dictionary setValue:type forKey:VLCMediaTracksInformationType];
+
+        [array addObject:dictionary];
+    }
+    free(tracksInfo);
+    return array;
 }
 
+
 @synthesize url;
 @synthesize subitems;
 @synthesize metaDictionary;
@@ -444,6 +521,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
     libvlc_event_attach(p_em, libvlc_MediaDurationChanged, HandleMediaDurationChanged, self);
     libvlc_event_attach(p_em, libvlc_MediaStateChanged,    HandleMediaStateChanged,    self);
     libvlc_event_attach(p_em, libvlc_MediaSubItemAdded,    HandleMediaSubItemAdded,    self);
+    libvlc_event_attach(p_em, libvlc_MediaParsedChanged,   HandleMediaParsedChanged,   self);
 
     libvlc_media_list_t * p_mlist = libvlc_media_subitems( p_md );
 
@@ -455,6 +533,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
         libvlc_media_list_release( p_mlist );
     }
 
+    isParsed = libvlc_media_is_parsed(p_md);
     state = LibVLCStateToMediaState(libvlc_media_get_state( p_md ));
 }
 
@@ -479,6 +558,7 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
     }
 }
 
+#if !TARGET_OS_IPHONE
 - (void)fetchMetaInformationForArtWorkWithURL:(NSString *)anURL
 {
     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
@@ -488,7 +568,6 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
     {
         // Go ahead and load up the art work
         NSURL * artUrl = [NSURL URLWithString:[anURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
-
         // Don't attempt to fetch artwork from remote. Core will do that alone
         if ([artUrl isFileURL])
             art  = [[[NSImage alloc] initWithContentsOfURL:artUrl] autorelease];
@@ -510,6 +589,13 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
 
     [metaDictionary setObject:art forKey:@"artwork"];
 }
+#endif
+
+- (void)parseIfNeeded
+{
+    if (![self isParsed])
+        [self parse];
+}
 
 - (void)metaChanged:(NSString *)metaType
 {
@@ -531,11 +617,48 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
     libvlc_media_list_release( p_mlist );
 }
 
+- (void)parsedChanged:(NSNumber *)isParsedAsNumber
+{
+    [self willChangeValueForKey:@"parsed"];
+    isParsed = [isParsedAsNumber boolValue];
+    [self didChangeValueForKey:@"parsed"];
+
+    // FIXME: Probably don't even call this if there is no delegate.
+    if (!delegate || !isParsed)
+        return;
+
+    if ([delegate respondsToSelector:@selector(mediaDidFinishParsing:)]) {
+        [delegate mediaDidFinishParsing:self];
+    }
+}
+
 - (void)setStateAsNumber:(NSNumber *)newStateAsNumber
 {
     [self setState: [newStateAsNumber intValue]];
 }
 
+#if TARGET_OS_IPHONE
+- (NSDictionary *)metaDictionary
+{
+    if (!areOthersMetaFetched) {
+        areOthersMetaFetched = YES;
+        /* Force VLCMetaInformationTitle, that will trigger preparsing
+         * And all the other meta will be added through the libvlc event system */
+        [self fetchMetaInformationFromLibVLCWithType: VLCMetaInformationTitle];
+
+    }
+    if (!isArtURLFetched)
+    {
+        isArtURLFetched = YES;
+        /* Force isArtURLFetched, that will trigger artwork download eventually
+         * And all the other meta will be added through the libvlc event system */
+        [self fetchMetaInformationFromLibVLCWithType: VLCMetaInformationArtworkURL];
+    }
+    return metaDictionary;
+}
+
+#else
+
 - (id)valueForKeyPath:(NSString *)keyPath
 {
     if( !isArtFetched && [keyPath isEqualToString:@"metaDictionary.artwork"])
@@ -559,9 +682,9 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
          * And all the other meta will be added through the libvlc event system */
         [self fetchMetaInformationFromLibVLCWithType: VLCMetaInformationArtworkURL];
     }
-
     return [super valueForKeyPath:keyPath];
 }
+#endif
 @end
 
 /******************************************************************************
index 162435e1aca8298323a49cb18fb4b253d03e2f9b..6d5d75a4dd491294bee1e70d5167d73f9727da24 100644 (file)
@@ -22,7 +22,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#import <Cocoa/Cocoa.h>
 #import "VLCMediaDiscoverer.h"
 #import "VLCLibrary.h"
 #import "VLCLibVLCBridging.h"
@@ -101,25 +100,13 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use
     return self;
 }
 
-- (void)release
-{
-    @synchronized(self)
-    {
-        if([self retainCount] <= 1)
-        {
-            /* We must make sure we won't receive new event after an upcoming dealloc
-             * We also may receive a -retain in some event callback that may occcur
-             * Before libvlc_event_detach. So this can't happen in dealloc */
-            libvlc_event_manager_t * p_em = libvlc_media_list_event_manager(mdis);
-            libvlc_event_detach(p_em, libvlc_MediaDiscovererStarted, HandleMediaDiscovererStarted, self);
-            libvlc_event_detach(p_em, libvlc_MediaDiscovererEnded,   HandleMediaDiscovererEnded,   self);
-        }
-        [super release];
-    }
-}
-
 - (void)dealloc
 {
+    libvlc_event_manager_t *em = libvlc_media_list_event_manager(mdis);
+    libvlc_event_detach(em, libvlc_MediaDiscovererStarted, HandleMediaDiscovererStarted, self);
+    libvlc_event_detach(em, libvlc_MediaDiscovererEnded,   HandleMediaDiscovererEnded,   self);
+    [[VLCEventManager sharedManager] cancelCallToObject:self];
+
     [localizedName release];
     [discoveredMedia release];
     libvlc_media_discoverer_release( mdis );
index 847ad44bdf745ab51841d2782badeab5413069d5..120b172f47c08343a95fdd67989249f30644db60 100644 (file)
@@ -97,25 +97,13 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
     return self;
 }
 
-- (void)release
-{
-    @synchronized(self)
-    {
-        if([self retainCount] <= 1)
-        {
-            /* We must make sure we won't receive new event after an upcoming dealloc
-             * We also may receive a -retain in some event callback that may occcur
-             * Before libvlc_event_detach. So this can't happen in dealloc */
-            libvlc_event_manager_t * p_em = libvlc_media_list_event_manager(p_mlist);
-            libvlc_event_detach(p_em, libvlc_MediaListItemDeleted, HandleMediaListItemDeleted, self);
-            libvlc_event_detach(p_em, libvlc_MediaListItemAdded,   HandleMediaListItemAdded,   self);
-        }
-        [super release];
-    }
-}
-
 - (void)dealloc
 {
+    libvlc_event_manager_t *em = libvlc_media_list_event_manager(p_mlist);
+    libvlc_event_detach(em, libvlc_MediaListItemDeleted, HandleMediaListItemDeleted, self);
+    libvlc_event_detach(em, libvlc_MediaListItemAdded,   HandleMediaListItemAdded,   self);
+    [[VLCEventManager sharedManager] cancelCallToObject:self];
+
     // Release allocated memory
     delegate = nil;
 
@@ -132,7 +120,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
     {
         [content appendFormat:@"%@\n", [self mediaAtIndex: i]];
     }
-    return [NSString stringWithFormat:@"<%@ %p> {\n%@}", [self className], self, content];
+    return [NSString stringWithFormat:@"<%@ %p> {\n%@}", [self class], self, content];
 }
 
 - (void)lock
index a50333b1eef0bb1addeea92eadd7b57983ce1db8..2912aa378b3b2baff157e2829d5b6292969fbf90 100644 (file)
 #import "VLCMediaPlayer.h"
 #import "VLCEventManager.h"
 #import "VLCLibVLCBridging.h"
-#import "VLCVideoView.h"
+#if !TARGET_OS_IPHONE
+# import "VLCVideoView.h"
+#endif
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
+#if !TARGET_OS_IPHONE
 /* prevent system sleep */
-#import <CoreServices/CoreServices.h>
+# import <CoreServices/CoreServices.h>
 /* FIXME: Ugly hack! */
-#ifdef __x86_64__
-#import <CoreServices/../Frameworks/OSServices.framework/Headers/Power.h>
+# ifdef __x86_64__
+#  import <CoreServices/../Frameworks/OSServices.framework/Headers/Power.h>
+# endif
 #endif
 
 #include <vlc/vlc.h>
@@ -180,6 +184,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
     return [self initWithDrawable:nil];
 }
 
+#if !TARGET_OS_IPHONE
 - (id)initWithVideoView:(VLCVideoView *)aVideoView
 {
     return [self initWithDrawable: aVideoView];
@@ -189,26 +194,15 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
 {
     return [self initWithDrawable: aVideoLayer];
 }
-
-- (void)release
-{
-    @synchronized(self)
-    {
-        if([self retainCount] <= 1)
-        {
-            /* We must make sure we won't receive new event after an upcoming dealloc
-             * We also may receive a -retain in some event callback that may occcur
-             * Before libvlc_event_detach. So this can't happen in dealloc */
-            [self unregisterObservers];
-        }
-        [super release];
-    }
-}
+#endif
 
 - (void)dealloc
 {
     NSAssert(libvlc_media_player_get_state(instance) == libvlc_Stopped, @"You released the media player before ensuring that it is stopped");
 
+    [self unregisterObservers];
+    [[VLCEventManager sharedManager] cancelCallToObject:self];
+
     // Always get rid of the delegate first so we can stop sending messages to it
     // TODO: Should we tell the delegate that we're shutting down?
     delegate = nil;
@@ -240,6 +234,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
     return delegate;
 }
 
+#if !TARGET_OS_IPHONE
 - (void)setVideoView:(VLCVideoView *)aVideoView
 {
     [self setDrawable: aVideoView];
@@ -249,6 +244,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
 {
     [self setDrawable: aVideoLayer];
 }
+#endif
 
 - (void)setDrawable:(id)aDrawable
 {
@@ -352,13 +348,13 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
     return libvlc_media_player_get_rate(instance);
 }
 
-- (NSSize)videoSize
+- (CGSize)videoSize
 {
     unsigned height = 0, width = 0;
     int failure = libvlc_video_get_size(instance, 0, &width, &height);
     if (failure)
         [[NSException exceptionWithName:@"Can't get video size" reason:@"No video output" userInfo:nil] raise];
-    return NSMakeSize(width, height);
+    return CGSizeMake(width, height);
 }
 
 - (BOOL)hasVideoOut
@@ -773,15 +769,19 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
     [self didChangeValueForKey:@"time"];
 }
 
+#if !TARGET_OS_IPHONE
 - (void)delaySleep
 {
     UpdateSystemActivity(UsrActivity);
 }
+#endif
 
 - (void)mediaPlayerPositionChanged:(NSNumber *)newPosition
 {
+#if !TARGET_OS_IPHONE
     // This seems to be the most relevant place to delay sleeping and screen saver.
     [self delaySleep];
+#endif
 
     [self willChangeValueForKey:@"position"];
     position = [newPosition floatValue];
diff --git a/projects/macosx/framework/Sources/VLCMediaThumbnailer.m b/projects/macosx/framework/Sources/VLCMediaThumbnailer.m
new file mode 100644 (file)
index 0000000..71ad3d1
--- /dev/null
@@ -0,0 +1,235 @@
+//
+//  VLCMediaThumbnailer.m
+//  VLCKit
+//
+//  Created by Pierre d'Herbemont on 7/10/10.
+//  Copyright 2010 __MyCompanyName__. All rights reserved.
+//
+
+#import <vlc/vlc.h>
+
+#import "VLCMediaThumbnailer.h"
+#import "VLCLibVLCBridging.h"
+
+
+@interface VLCMediaThumbnailer ()
+- (void)didFetchThumbnail;
+- (void)notifyDelegate;
+- (void)fetchThumbnail;
+- (void)startFetchingThumbnail;
+@property (readonly, assign) void *dataPointer;
+@end
+
+static void *lock(void *opaque, void **pixels)
+{
+    VLCMediaThumbnailer *thumbnailer = opaque;
+
+    *pixels = [thumbnailer dataPointer];
+    assert(*pixels);
+    return NULL;
+}
+
+static const size_t kDefaultImageWidth = 320;
+static const size_t kDefaultImageHeight = 240;
+static const float kSnapshotPosition = 0.5;
+
+void unlock(void *opaque, void *picture, void *const *p_pixels)
+{
+    VLCMediaThumbnailer *thumbnailer = opaque;
+    assert(!picture);
+
+    assert([thumbnailer dataPointer] == *p_pixels);
+
+    // We may already have a thumbnail if we are receiving picture after the first one.
+    // Just ignore.
+    if ([thumbnailer thumbnail])
+        return;
+
+    [thumbnailer performSelectorOnMainThread:@selector(didFetchThumbnail) withObject:nil waitUntilDone:YES];
+}
+
+void display(void *opaque, void *picture)
+{
+}
+
+@implementation VLCMediaThumbnailer
+@synthesize media=_media;
+@synthesize delegate=_delegate;
+@synthesize thumbnail=_thumbnail;
+@synthesize dataPointer=_data;
+@synthesize thumbnailWidth=_thumbnailWidth;
+@synthesize thumbnailHeight=_thumbnailHeight;
+
++ (VLCMediaThumbnailer *)thumbnailerWithMedia:(VLCMedia *)media andDelegate:(id<VLCMediaThumbnailerDelegate>)delegate
+{
+    id obj = [[[self class] alloc] init];
+    [obj setMedia:media];
+    [obj setDelegate:delegate];
+    return [obj autorelease];
+}
+
+- (void)dealloc
+{
+    NSAssert(!_data, @"Data not released");
+    NSAssert(!_mp, @"Not properly retained");
+    if (_thumbnail)
+        CGImageRelease(_thumbnail);
+    [_media release];
+    [super dealloc];
+}
+
+
+- (void)fetchThumbnail
+{
+    NSAssert(!_data, @"We are already fetching a thumbnail");
+
+    [self retain]; // Balanced in -notifyDelegate
+
+    if (![_media isParsed]) {
+        [_media addObserver:self forKeyPath:@"parsed" options:0 context:NULL];
+        [_media parse];
+        NSAssert(!_parsingTimeoutTimer, @"We already have a timer around");
+        _parsingTimeoutTimer = [[NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(mediaParsingTimedOut) userInfo:nil repeats:NO] retain];
+        return;
+    }
+
+    [self startFetchingThumbnail];
+}
+
+
+- (void)startFetchingThumbnail
+{
+    NSArray *tracks = [_media tracksInformation];
+
+    // Find the video track
+    NSDictionary *videoTrack = nil;
+    for (NSDictionary *track in tracks) {
+        NSString *type = [track objectForKey:VLCMediaTracksInformationType];
+        if ([type isEqualToString:VLCMediaTracksInformationTypeVideo]) {
+            videoTrack = track;
+            break;
+        }
+    }
+
+    unsigned imageWidth = _thumbnailWidth > 0 ? _thumbnailWidth : kDefaultImageWidth;
+    unsigned imageHeight = _thumbnailHeight > 0 ? _thumbnailHeight : kDefaultImageHeight;
+
+    if (!videoTrack)
+        NSLog(@"WARNING: Can't find video track info, still attempting to thumbnail in doubt");
+    else {
+        int videoHeight = [[videoTrack objectForKey:VLCMediaTracksInformationVideoHeight] intValue];
+        int videoWidth = [[videoTrack objectForKey:VLCMediaTracksInformationVideoWidth] intValue];
+
+        // Constraining to the aspect ratio of the video.
+        double ratio;
+        if ((double)imageWidth / imageHeight < (double)videoWidth / videoHeight)
+            ratio = (double)imageHeight / videoHeight;
+        else
+            ratio = (double)imageWidth / videoWidth;
+
+        int newWidth = round(videoWidth * ratio);
+        int newHeight = round(videoHeight * ratio);
+        NSLog(@"video %dx%d from %dx%d or %dx%d", newWidth, newHeight, videoWidth, videoHeight, imageWidth, imageHeight);
+        imageWidth = newWidth > 0 ? newWidth : imageWidth;
+        imageHeight = newHeight > 0 ? newHeight : imageHeight;
+    }
+
+    _effectiveThumbnailHeight = imageHeight;
+    _effectiveThumbnailWidth = imageWidth;
+
+    _data = calloc(1, imageWidth * imageHeight * 4);
+    NSAssert(_data, @"Can't create data");
+
+    NSAssert(!_mp, @"We are already fetching a thumbnail");
+    _mp = libvlc_media_player_new([VLCLibrary sharedInstance]);
+
+    libvlc_media_add_option([_media libVLCMediaDescriptor], "no-audio");
+
+    libvlc_media_player_set_media(_mp, [_media libVLCMediaDescriptor]);
+    libvlc_video_set_format(_mp, "RGBA", imageWidth, imageHeight, 4 * imageWidth);
+    libvlc_video_set_callbacks(_mp, lock, unlock, display, self);
+    libvlc_media_player_play(_mp);
+    libvlc_media_player_set_position(_mp, kSnapshotPosition);
+}
+
+- (void)mediaParsingTimedOut
+{
+    NSLog(@"WARNING: media thumbnailer media parsing timed out");
+    [_media removeObserver:self forKeyPath:@"parsed"];
+
+    [self startFetchingThumbnail];
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+    if (object == _media && [keyPath isEqualToString:@"parsed"]) {
+        if ([_media isParsed]) {
+            [_parsingTimeoutTimer invalidate];
+            [_parsingTimeoutTimer release];
+            _parsingTimeoutTimer = nil;
+            [_media removeObserver:self forKeyPath:@"parsed"];
+            [self startFetchingThumbnail];
+        }
+        return;
+    }
+    return [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
+}
+
+- (void)didFetchThumbnail
+{
+    // The video thread is blocking on us. Beware not to do too much work.
+
+    // Make sure we are getting the right frame
+    if (libvlc_media_player_get_position(_mp) < kSnapshotPosition &&
+        // Arbitrary choice to work around broken files.
+        libvlc_media_player_get_length(_mp) > 1000)
+        return;
+
+    NSAssert(_data, @"We have no data");
+    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
+    const CGFloat width = _effectiveThumbnailWidth;
+    const CGFloat height = _effectiveThumbnailHeight;
+    const CGFloat pitch = 4 * width;
+    CGContextRef bitmap = CGBitmapContextCreate(_data,
+                                 width,
+                                 height,
+                                 8,
+                                 pitch,
+                                 colorSpace,
+                                 kCGImageAlphaNoneSkipLast);
+
+    CGColorSpaceRelease(colorSpace);
+    NSAssert(bitmap, @"Can't create bitmap");
+
+    // Create the thumbnail image
+    //NSAssert(!_thumbnail, @"We already have a thumbnail");
+    if (_thumbnail)
+        CGImageRelease(_thumbnail);
+    _thumbnail = CGBitmapContextCreateImage(bitmap);
+
+    // Put a new context there.
+    CGContextRelease(bitmap);
+
+    // Make sure we don't block the video thread now
+    [self performSelector:@selector(notifyDelegate) withObject:nil afterDelay:0];
+}
+
+- (void)notifyDelegate
+{
+    // Stop the media player
+    NSAssert(_mp, @"We have already destroyed mp");
+    libvlc_media_player_stop(_mp);
+    libvlc_media_player_release(_mp);
+    _mp = NULL;
+
+    // Now release data
+    free(_data);
+    _data = NULL;
+
+    // Call delegate
+    [_delegate mediaThumbnailer:self didFinishThumbnail:_thumbnail];
+
+    [self release]; // Balancing -fetchThumbnail
+}
+
+@end
index 47c4b62231471ef87a425c0c8899f325e5aeda3b..25c65934a56ddaeade541c3f3b23f15f541e8adb 100644 (file)
@@ -22,7 +22,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#import <VLCTime.h>
+#import "VLCTime.h"
 
 @implementation VLCTime
 /* Factories */
index 1f431e3650697f703b61661f2c7f855df528b5cf..eb660c14d51c8ebd7a6d78068086d5c2363d769e 100644 (file)
                632A0EC40D38392E00AFC99B /* VLCStreamOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 632A0EC20D38392E00AFC99B /* VLCStreamOutput.m */; };
                6341FCAF0D2C0929002A97B7 /* VLCVideoLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 6341FCAE0D2C0929002A97B7 /* VLCVideoLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
                6341FCB10D2C0936002A97B7 /* VLCVideoLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 6341FCB00D2C0936002A97B7 /* VLCVideoLayer.m */; };
+               636E974E11E8DCF1002FE8A9 /* VLCMediaThumbnailer.m in Sources */ = {isa = PBXBuildFile; fileRef = 636E974C11E8DCF1002FE8A9 /* VLCMediaThumbnailer.m */; };
                637CFB940D2D280900A041B6 /* VLCLibrary.h in Headers */ = {isa = PBXBuildFile; fileRef = 637CFB930D2D280800A041B6 /* VLCLibrary.h */; settings = {ATTRIBUTES = (Public, ); }; };
                637D5ABD0CF6F2650073EA45 /* VLCMediaDiscoverer.h in Headers */ = {isa = PBXBuildFile; fileRef = 637D5ABC0CF6F2650073EA45 /* VLCMediaDiscoverer.h */; settings = {ATTRIBUTES = (Public, ); }; };
                637D5ADC0CF6F2720073EA45 /* VLCMediaDiscoverer.m in Sources */ = {isa = PBXBuildFile; fileRef = 637D5ADB0CF6F2720073EA45 /* VLCMediaDiscoverer.m */; };
                6384FD080D0DBA20005EB1F7 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6384FD070D0DBA20005EB1F7 /* QuartzCore.framework */; };
+               63D88D93124E9BF600F65FA0 /* VLCMediaThumbnailer.h in Headers */ = {isa = PBXBuildFile; fileRef = 63D88D92124E9BF600F65FA0 /* VLCMediaThumbnailer.h */; };
                8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
                A7A0CEA40D2EF13000F2C039 /* VLCVideoCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A0CEA20D2EF13000F2C039 /* VLCVideoCommon.h */; };
                A7A0CEA50D2EF13000F2C039 /* VLCVideoCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = A7A0CEA30D2EF13000F2C039 /* VLCVideoCommon.m */; };
                632A0EC10D38392E00AFC99B /* VLCStreamOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCStreamOutput.h; path = Public/VLCStreamOutput.h; sourceTree = "<group>"; };
                632A0EC20D38392E00AFC99B /* VLCStreamOutput.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCStreamOutput.m; sourceTree = "<group>"; };
                633753FF10ECE1C60072A0D9 /* Configure.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = Configure.sh; sourceTree = "<group>"; };
+               634117B911D9344400FA3A70 /* MobileVLCKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MobileVLCKit.h; path = Public/MobileVLCKit.h; sourceTree = "<group>"; };
                6341FCAE0D2C0929002A97B7 /* VLCVideoLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCVideoLayer.h; path = Public/VLCVideoLayer.h; sourceTree = "<group>"; };
                6341FCB00D2C0936002A97B7 /* VLCVideoLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCVideoLayer.m; sourceTree = "<group>"; };
+               636E974C11E8DCF1002FE8A9 /* VLCMediaThumbnailer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCMediaThumbnailer.m; sourceTree = "<group>"; };
                637CFB930D2D280800A041B6 /* VLCLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCLibrary.h; path = Public/VLCLibrary.h; sourceTree = "<group>"; };
                637D5ABC0CF6F2650073EA45 /* VLCMediaDiscoverer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = VLCMediaDiscoverer.h; path = Public/VLCMediaDiscoverer.h; sourceTree = "<group>"; };
                637D5ADB0CF6F2720073EA45 /* VLCMediaDiscoverer.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = VLCMediaDiscoverer.m; sourceTree = "<group>"; };
                6384FD070D0DBA20005EB1F7 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
+               63D88C56124E9A5100F65FA0 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; };
+               63D88CA9124E9A8200F65FA0 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = System/Library/Frameworks/ApplicationServices.framework; sourceTree = SDKROOT; };
+               63D88D92124E9BF600F65FA0 /* VLCMediaThumbnailer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCMediaThumbnailer.h; path = Public/VLCMediaThumbnailer.h; sourceTree = "<group>"; };
                8DC2EF5B0486A6940098B216 /* VLCKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = VLCKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
                A7A0CEA20D2EF13000F2C039 /* VLCVideoCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCVideoCommon.h; path = Internal/VLCVideoCommon.h; sourceTree = "<group>"; };
                A7A0CEA30D2EF13000F2C039 /* VLCVideoCommon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCVideoCommon.m; sourceTree = "<group>"; };
                                089C1665FE841158C02AAC07 /* Resources */,
                                0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */,
                                034768DFFF38A50411DB9C8B /* Products */,
+                               63D88C56124E9A5100F65FA0 /* Quartz.framework */,
+                               63D88CA9124E9A8200F65FA0 /* ApplicationServices.framework */,
                        );
                        name = VLC;
                        sourceTree = "<group>";
                                EF78BD410CAEEFF600354E6E /* VLCMediaList.m */,
                                63014A781042ACE100534090 /* VLCMediaListPlayer.m */,
                                EF8BB8CF0CAFA8D80038A613 /* VLCMediaPlayer.m */,
+                               636E974C11E8DCF1002FE8A9 /* VLCMediaThumbnailer.m */,
                                EF78BD400CAEEFF600354E6E /* VLCMediaLibrary.m */,
                                A7A0CEA30D2EF13000F2C039 /* VLCVideoCommon.m */,
                                6341FCB00D2C0936002A97B7 /* VLCVideoLayer.m */,
                637CFB960D2D281900A041B6 /* Internal */ = {
                        isa = PBXGroup;
                        children = (
+                               63D88D92124E9BF600F65FA0 /* VLCMediaThumbnailer.h */,
                                EFD551DC0CC6DD720074CEE1 /* VLCLibVLCBridging.h */,
                                EF78BD0D0CAEEEC300354E6E /* VLCEventManager.h */,
                                A7A0CEA20D2EF13000F2C039 /* VLCVideoCommon.h */,
                EF6BC9110DA1932F00DD37EF /* Public */ = {
                        isa = PBXGroup;
                        children = (
+                               634117B911D9344400FA3A70 /* MobileVLCKit.h */,
                                EF78BD120CAEEEE700354E6E /* VLCKit.h */,
                                637CFB930D2D280800A041B6 /* VLCLibrary.h */,
                                EF78BD130CAEEEE700354E6E /* VLCMedia.h */,
                                63014B7E1042E64A00534090 /* VLCMediaListPlayer.h in Headers */,
                                6309994B110FC791005F46AE /* VLCExtension.h in Headers */,
                                6309994C110FC791005F46AE /* VLCExtensionsManager.h in Headers */,
+                               63D88D93124E9BF600F65FA0 /* VLCMediaThumbnailer.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        isa = PBXProject;
                        buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "VLCKit" */;
                        compatibilityVersion = "Xcode 3.1";
+                       developmentRegion = English;
                        hasScannedForEncodings = 1;
+                       knownRegions = (
+                               English,
+                               Japanese,
+                               French,
+                               German,
+                       );
                        mainGroup = 0867D691FE84028FC02AAC07 /* VLC */;
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
                                63014A7A1042ACE100534090 /* VLCMediaListPlayer.m in Sources */,
                                63098FDC110E7159005F46AE /* VLCExtensionsManager.m in Sources */,
                                63099116110F0EC3005F46AE /* VLCExtension.m in Sources */,
+                               636E974E11E8DCF1002FE8A9 /* VLCMediaThumbnailer.m in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index ca028e04d924d85029f7582ca05b8c0f239bb71d..4ed8b7340368ec77415721046806412b06b68291 100644 (file)
@@ -3,8 +3,16 @@
 //
 
 
+#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
+# define IPHONE_OS
+#endif
+
 #ifdef __OBJC__
-    #import <Cocoa/Cocoa.h>
+# ifndef IPHONE_OS
+#  import <Cocoa/Cocoa.h>
+# else
+#  import <UIKit/UIKit.h>
+# endif
 #endif
 
 #ifdef HAVE_CONFIG_H