Commit a8b37fbd authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

VLCKit: Import MobileVLCKit.

parent b3564a7d
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#import <Cocoa/Cocoa.h>
#import <pthread.h> #import <pthread.h>
/** /**
...@@ -30,7 +29,9 @@ ...@@ -30,7 +29,9 @@
*/ */
@interface VLCEventManager : NSObject @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_t dispatcherThread; //< Thread responsible for dispatching messages.
pthread_mutex_t queueLock; //< Queue lock. pthread_mutex_t queueLock; //< Queue lock.
pthread_cond_t signalData; //< Data lock. pthread_cond_t signalData; //< Data lock.
...@@ -46,44 +47,46 @@ ...@@ -46,44 +47,46 @@
/* Operations */ /* Operations */
/** /**
* Sends a message to the target's delegate on the main thread. * 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 * \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 * 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 * when the main thread runs the run loop in one of the common run loop modes (as specified
* in the CFRunLoop documentation). * in the CFRunLoop documentation).
* *
* The receiver is retained until the call is finished. * The receiver is retained until the call is finished.
* \param aTarget The target object who's delegate should receive the specified message. * \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 * \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, * have a significant return value and should take a single argument of type NSNotification,
* or no arguments. * or no arguments.
* *
* See “Selectors” for a description of the SEL type. * 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. * distributed notification center.
*/ */
- (void)callOnMainThreadDelegateOfObject:(id)aTarget - (void)callOnMainThreadDelegateOfObject:(id)aTarget
withDelegateMethod:(SEL)aSelector withDelegateMethod:(SEL)aSelector
withNotificationName:(NSString *)aNotificationName; withNotificationName:(NSString *)aNotificationName;
/** /**
* Sends a message to the target on the main thread. * 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 * \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 * 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 * when the main thread runs the run loop in one of the common run loop modes (as specified
* in the CFRunLoop documentation). * in the CFRunLoop documentation).
* *
* The receiver and arg are retained until the call is finished. * The receiver and arg are retained until the call is finished.
* \param aTarget The target object who should receive the specified message. * \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 * \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, * have a significant return value and should take a single argument of type id,
* or no arguments. * or no arguments.
* *
* See “Selectors” for a description of the SEL type. * 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. * argument.
* distributed notification center. * distributed notification center.
*/ */
- (void)callOnMainThreadObject:(id)aTarget - (void)callOnMainThreadObject:(id)aTarget
withMethod:(SEL)aSelector withMethod:(SEL)aSelector
withArgumentAsObject:(id)arg; withArgumentAsObject:(id)arg;
- (void)cancelCallToObject:(id)target;
@end @end
...@@ -23,7 +23,9 @@ ...@@ -23,7 +23,9 @@
*****************************************************************************/ *****************************************************************************/
#import "VLCLibrary.h" #import "VLCLibrary.h"
#if !TARGET_OS_IPHONE
#import "VLCStreamOutput.h" #import "VLCStreamOutput.h"
#endif
#import "VLCMediaPlayer.h" #import "VLCMediaPlayer.h"
/** /**
...@@ -147,6 +149,8 @@ ...@@ -147,6 +149,8 @@
/** /**
* TODO: Documentation * TODO: Documentation
*/ */
#if !TARGET_OS_IPHONE
@interface VLCStreamOutput (LibVLCBridge) @interface VLCStreamOutput (LibVLCBridge)
- (NSString *)representedLibVLCOptions; - (NSString *)representedLibVLCOptions;
@end @end
#endif
/*
* 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;
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#import <Foundation/Foundation.h>
/* Notification Messages */ /* Notification Messages */
/** /**
* Standard notification messages that are emitted by VLCAudio object. * Standard notification messages that are emitted by VLCAudio object.
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#import <Foundation/Foundation.h>
#import "VLCAudio.h" #import "VLCAudio.h"
#import "VLCMediaList.h" #import "VLCMediaList.h"
#import "VLCMedia.h" #import "VLCMedia.h"
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#import <Foundation/Foundation.h>
#import "VLCMediaList.h" #import "VLCMediaList.h"
#import "VLCTime.h" #import "VLCTime.h"
...@@ -95,6 +96,13 @@ typedef enum VLCMediaState ...@@ -95,6 +96,13 @@ typedef enum VLCMediaState
* \param key The key of the value that was changed. * \param key The key of the value that was changed.
*/ */
- (void)media:(VLCMedia *)aMedia metaValueChangedFrom:(id)oldValue forKey:(NSString *)key; - (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 @end
/** /**
...@@ -116,6 +124,7 @@ typedef enum VLCMediaState ...@@ -116,6 +124,7 @@ typedef enum VLCMediaState
BOOL areOthersMetaFetched; //< Value used to determine of the other meta has been parsed 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 BOOL isArtURLFetched; //< Value used to determine of the other meta has been preparsed
VLCMediaState state; //< Current state of the media VLCMediaState state; //< Current state of the media
BOOL isParsed;
} }
/* Factories */ /* Factories */
...@@ -230,4 +239,97 @@ typedef enum VLCMediaState ...@@ -230,4 +239,97 @@ typedef enum VLCMediaState
*/ */
- (void)setValue:(id)value forMeta:(NSString *)VLCMetaInformation; - (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 @end
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * 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; @class VLCMediaList;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#import <Foundation/Foundation.h>
#import "VLCMedia.h" #import "VLCMedia.h"
/* Notification Messages */ /* Notification Messages */
......
...@@ -24,12 +24,19 @@ ...@@ -24,12 +24,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * 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 "VLCMedia.h"
#import "VLCVideoView.h"
#import "VLCVideoLayer.h"
#import "VLCTime.h" #import "VLCTime.h"
#import "VLCAudio.h" #import "VLCAudio.h"
#if !TARGET_OS_IPHONE
@class VLCVideoView;
@class VLCVideoLayer;
#endif
/* Notification Messages */ /* Notification Messages */
extern NSString * VLCMediaPlayerTimeChanged; extern NSString * VLCMediaPlayerTimeChanged;
extern NSString * VLCMediaPlayerStateChanged; extern NSString * VLCMediaPlayerStateChanged;
...@@ -75,6 +82,7 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state); ...@@ -75,6 +82,7 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
- (void)mediaPlayerStateChanged:(NSNotification *)aNotification; - (void)mediaPlayerStateChanged:(NSNotification *)aNotification;
@end @end
// TODO: Should we use medialist_player or our own flavor of media player? // TODO: Should we use medialist_player or our own flavor of media player?
@interface VLCMediaPlayer : NSObject @interface VLCMediaPlayer : NSObject
{ {
...@@ -89,9 +97,11 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state); ...@@ -89,9 +97,11 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
VLCAudio *audio; VLCAudio *audio;
} }
#if !TARGET_OS_IPHONE
/* Initializers */ /* Initializers */
- (id)initWithVideoView:(VLCVideoView *)aVideoView; - (id)initWithVideoView:(VLCVideoView *)aVideoView;
- (id)initWithVideoLayer:(VLCVideoLayer *)aVideoLayer; - (id)initWithVideoLayer:(VLCVideoLayer *)aVideoLayer;
#endif
/* Properties */ /* Properties */
- (void)setDelegate:(id)value; - (void)setDelegate:(id)value;
...@@ -100,8 +110,10 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state); ...@@ -100,8 +110,10 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
/* Video View Options */ /* Video View Options */
// TODO: Should be it's own object? // TODO: Should be it's own object?
#if !TARGET_OS_IPHONE
- (void)setVideoView:(VLCVideoView *)aVideoView; - (void)setVideoView:(VLCVideoView *)aVideoView;
- (void)setVideoLayer:(VLCVideoLayer *)aVideoLayer; - (void)setVideoLayer:(VLCVideoLayer *)aVideoLayer;
#endif
@property (retain) id drawable; /* The videoView or videoLayer */ @property (retain) id drawable; /* The videoView or videoLayer */
...@@ -135,7 +147,7 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state); ...@@ -135,7 +147,7 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
@property (readonly) VLCAudio * audio; @property (readonly) VLCAudio * audio;
/* Video Information */ /* Video Information */
- (NSSize)videoSize; - (CGSize)videoSize;
- (BOOL)hasVideoOut; - (BOOL)hasVideoOut;
- (float)framesPerSecond; - (float)framesPerSecond;
......
//
// 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
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#import <Foundation/Foundation.h>
/** /**
* Provides an object to define VLCMedia's time. * Provides an object to define VLCMedia's time.
*/ */
......
#!/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
//
// 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)
//
// 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>
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
#import "VLCLibrary.h" #import "VLCLibrary.h"
#import "VLCLibVLCBridging.h" #import "VLCLibVLCBridging.h"
#if TARGET_OS_IPHONE
# include "vlc-plugins.h"
#endif
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
...@@ -49,19 +53,24 @@ static VLCLibrary * sharedLibrary = nil; ...@@ -49,19 +53,24 @@ static VLCLibrary * sharedLibrary = nil;
{ {
if (self = [super init]) if (self = [super init])
{ {
NSArray *vlcParams = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"VLCParams"]; NSArray *vlcParams = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"VLCParams"];
if (!vlcParams) { if (!vlcParams) {
NSMutableArray *defaultParams = [NSMutableArray array]; 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:@"--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:@"--no-sout-keep"];
[defaultParams addObject:@"--vout=macosx"]; // Select Mac OS X video output [defaultParams addObject:@"--vout=macosx"]; // Select Mac OS X video output
[defaultParams addObject:@"--text-renderer=quartztext"]; // our CoreText-based renderer [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 [defaultParams addObject:@"--extraintf=macosx_dialog_provider"]; // Some extra dialog (login, progress) may come up from here
#endif
vlcParams = defaultParams; vlcParams = defaultParams;
} }
...@@ -73,7 +82,12 @@ static VLCLibrary * sharedLibrary = nil; ...@@ -73,7 +82,12 @@ static VLCLibrary * sharedLibrary = nil;
lib_vlc_params[paramNum] = [vlcParam cStringUsingEncoding:NSASCIIStringEncoding]; lib_vlc_params[paramNum] = [vlcParam cStringUsingEncoding:NSASCIIStringEncoding];
paramNum++; 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"); NSAssert(instance, @"libvlc failed to initialize");
} }
return self; return self;
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#import <Cocoa/Cocoa.h>
#import "VLCMediaDiscoverer.h" #import "VLCMediaDiscoverer.h"
#import "VLCLibrary.h" #import "VLCLibrary.h"
#import "VLCLibVLCBridging.h" #import "VLCLibVLCBridging.h"
...@@ -101,25 +100,13 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use ...@@ -101,25 +100,13 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use
return self; 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 - (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]; [localizedName release];
[discoveredMedia release]; [discoveredMedia release];
libvlc_media_discoverer_release( mdis ); libvlc_media_discoverer_release( mdis );
......
...@@ -97,25 +97,13 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -97,25 +97,13 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
return self; 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 - (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 // Release allocated memory
delegate = nil; delegate = nil;
...@@ -132,7 +120,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -132,7 +120,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
{ {
[content appendFormat:@"%@\n", [self mediaAtIndex: i]]; [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 - (void)lock
......
...@@ -29,16 +29,20 @@ ...@@ -29,16 +29,20 @@
#import "VLCMediaPlayer.h" #import "VLCMediaPlayer.h"
#import "VLCEventManager.h" #import "VLCEventManager.h"
#import "VLCLibVLCBridging.h" #import "VLCLibVLCBridging.h"
#import "VLCVideoView.h" #if !TARGET_OS_IPHONE
# import "VLCVideoView.h"
#endif
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#if !TARGET_OS_IPHONE
/* prevent system sleep */ /* prevent system sleep */
#import <CoreServices/CoreServices.h> # import <CoreServices/CoreServices.h>
/* FIXME: Ugly hack! */ /* FIXME: Ugly hack! */
#ifdef __x86_64__ # ifdef __x86_64__
#import <CoreServices/../Frameworks/OSServices.framework/Headers/Power.h> # import <CoreServices/../Frameworks/OSServices.framework/Headers/Power.h>
# endif
#endif #endif
#include <vlc/vlc.h> #include <vlc/vlc.h>
...@@ -180,6 +184,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s ...@@ -180,6 +184,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
return [self initWithDrawable:nil]; return [self initWithDrawable:nil];
} }
#if !TARGET_OS_IPHONE
- (id)initWithVideoView:(VLCVideoView *)aVideoView - (id)initWithVideoView:(VLCVideoView *)aVideoView
{ {
return [self initWithDrawable: aVideoView]; return [self initWithDrawable: aVideoView];
...@@ -189,26 +194,15 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s ...@@ -189,26 +194,15 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
{ {
return [self initWithDrawable: aVideoLayer]; return [self initWithDrawable: aVideoLayer];
} }
#endif
- (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];
}
}
- (void)dealloc - (void)dealloc
{ {
NSAssert(libvlc_media_player_get_state(instance) == libvlc_Stopped, @"You released the media player before ensuring that it is stopped"); 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 // 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? // TODO: Should we tell the delegate that we're shutting down?
delegate = nil; delegate = nil;
...@@ -240,6 +234,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s ...@@ -240,6 +234,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
return delegate; return delegate;
} }
#if !TARGET_OS_IPHONE
- (void)setVideoView:(VLCVideoView *)aVideoView - (void)setVideoView:(VLCVideoView *)aVideoView
{ {
[self setDrawable: aVideoView]; [self setDrawable: aVideoView];
...@@ -249,6 +244,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s ...@@ -249,6 +244,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
{ {
[self setDrawable: aVideoLayer]; [self setDrawable: aVideoLayer];
} }
#endif
- (void)setDrawable:(id)aDrawable - (void)setDrawable:(id)aDrawable
{ {
...@@ -352,13 +348,13 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s ...@@ -352,13 +348,13 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
return libvlc_media_player_get_rate(instance); return libvlc_media_player_get_rate(instance);
} }
- (NSSize)videoSize - (CGSize)videoSize
{ {
unsigned height = 0, width = 0; unsigned height = 0, width = 0;
int failure = libvlc_video_get_size(instance, 0, &width, &height); int failure = libvlc_video_get_size(instance, 0, &width, &height);
if (failure) if (failure)
[[NSException exceptionWithName:@"Can't get video size" reason:@"No video output" userInfo:nil] raise]; [[NSException exceptionWithName:@"Can't get video size" reason:@"No video output" userInfo:nil] raise];
return NSMakeSize(width, height); return CGSizeMake(width, height);
} }
- (BOOL)hasVideoOut - (BOOL)hasVideoOut
...@@ -773,15 +769,19 @@ static const VLCMediaPlayerState libvlc_to_local_state[] = ...@@ -773,15 +769,19 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
[self didChangeValueForKey:@"time"]; [self didChangeValueForKey:@"time"];
} }
#if !TARGET_OS_IPHONE
- (void)delaySleep - (void)delaySleep
{ {
UpdateSystemActivity(UsrActivity); UpdateSystemActivity(UsrActivity);
} }
#endif
- (void)mediaPlayerPositionChanged:(NSNumber *)newPosition - (void)mediaPlayerPositionChanged:(NSNumber *)newPosition
{ {
#if !TARGET_OS_IPHONE
// This seems to be the most relevant place to delay sleeping and screen saver. // This seems to be the most relevant place to delay sleeping and screen saver.
[self delaySleep]; [self delaySleep];
#endif
[self willChangeValueForKey:@"position"]; [self willChangeValueForKey:@"position"];
position = [newPosition floatValue]; position = [newPosition floatValue];
......
//
// 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
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#import <VLCTime.h> #import "VLCTime.h"
@implementation VLCTime @implementation VLCTime
/* Factories */ /* Factories */
......
...@@ -83,10 +83,12 @@ ...@@ -83,10 +83,12 @@
632A0EC40D38392E00AFC99B /* VLCStreamOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 632A0EC20D38392E00AFC99B /* VLCStreamOutput.m */; }; 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, ); }; }; 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 */; }; 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, ); }; }; 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, ); }; }; 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 */; }; 637D5ADC0CF6F2720073EA45 /* VLCMediaDiscoverer.m in Sources */ = {isa = PBXBuildFile; fileRef = 637D5ADB0CF6F2720073EA45 /* VLCMediaDiscoverer.m */; };
6384FD080D0DBA20005EB1F7 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6384FD070D0DBA20005EB1F7 /* QuartzCore.framework */; }; 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 */; }; 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
A7A0CEA40D2EF13000F2C039 /* VLCVideoCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A0CEA20D2EF13000F2C039 /* VLCVideoCommon.h */; }; A7A0CEA40D2EF13000F2C039 /* VLCVideoCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A0CEA20D2EF13000F2C039 /* VLCVideoCommon.h */; };
A7A0CEA50D2EF13000F2C039 /* VLCVideoCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = A7A0CEA30D2EF13000F2C039 /* VLCVideoCommon.m */; }; A7A0CEA50D2EF13000F2C039 /* VLCVideoCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = A7A0CEA30D2EF13000F2C039 /* VLCVideoCommon.m */; };
...@@ -173,12 +175,17 @@ ...@@ -173,12 +175,17 @@
632A0EC10D38392E00AFC99B /* VLCStreamOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCStreamOutput.h; path = Public/VLCStreamOutput.h; sourceTree = "<group>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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; }; 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>"; }; 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>"; }; A7A0CEA30D2EF13000F2C039 /* VLCVideoCommon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCVideoCommon.m; sourceTree = "<group>"; };
...@@ -247,6 +254,8 @@ ...@@ -247,6 +254,8 @@
089C1665FE841158C02AAC07 /* Resources */, 089C1665FE841158C02AAC07 /* Resources */,
0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */,
034768DFFF38A50411DB9C8B /* Products */, 034768DFFF38A50411DB9C8B /* Products */,
63D88C56124E9A5100F65FA0 /* Quartz.framework */,
63D88CA9124E9A8200F65FA0 /* ApplicationServices.framework */,
); );
name = VLC; name = VLC;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -281,6 +290,7 @@ ...@@ -281,6 +290,7 @@
EF78BD410CAEEFF600354E6E /* VLCMediaList.m */, EF78BD410CAEEFF600354E6E /* VLCMediaList.m */,
63014A781042ACE100534090 /* VLCMediaListPlayer.m */, 63014A781042ACE100534090 /* VLCMediaListPlayer.m */,
EF8BB8CF0CAFA8D80038A613 /* VLCMediaPlayer.m */, EF8BB8CF0CAFA8D80038A613 /* VLCMediaPlayer.m */,
636E974C11E8DCF1002FE8A9 /* VLCMediaThumbnailer.m */,
EF78BD400CAEEFF600354E6E /* VLCMediaLibrary.m */, EF78BD400CAEEFF600354E6E /* VLCMediaLibrary.m */,
A7A0CEA30D2EF13000F2C039 /* VLCVideoCommon.m */, A7A0CEA30D2EF13000F2C039 /* VLCVideoCommon.m */,
6341FCB00D2C0936002A97B7 /* VLCVideoLayer.m */, 6341FCB00D2C0936002A97B7 /* VLCVideoLayer.m */,
...@@ -342,6 +352,7 @@ ...@@ -342,6 +352,7 @@
637CFB960D2D281900A041B6 /* Internal */ = { 637CFB960D2D281900A041B6 /* Internal */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
63D88D92124E9BF600F65FA0 /* VLCMediaThumbnailer.h */,
EFD551DC0CC6DD720074CEE1 /* VLCLibVLCBridging.h */, EFD551DC0CC6DD720074CEE1 /* VLCLibVLCBridging.h */,
EF78BD0D0CAEEEC300354E6E /* VLCEventManager.h */, EF78BD0D0CAEEEC300354E6E /* VLCEventManager.h */,
A7A0CEA20D2EF13000F2C039 /* VLCVideoCommon.h */, A7A0CEA20D2EF13000F2C039 /* VLCVideoCommon.h */,
...@@ -378,6 +389,7 @@ ...@@ -378,6 +389,7 @@
EF6BC9110DA1932F00DD37EF /* Public */ = { EF6BC9110DA1932F00DD37EF /* Public */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
634117B911D9344400FA3A70 /* MobileVLCKit.h */,
EF78BD120CAEEEE700354E6E /* VLCKit.h */, EF78BD120CAEEEE700354E6E /* VLCKit.h */,
637CFB930D2D280800A041B6 /* VLCLibrary.h */, 637CFB930D2D280800A041B6 /* VLCLibrary.h */,
EF78BD130CAEEEE700354E6E /* VLCMedia.h */, EF78BD130CAEEEE700354E6E /* VLCMedia.h */,
...@@ -433,6 +445,7 @@ ...@@ -433,6 +445,7 @@
63014B7E1042E64A00534090 /* VLCMediaListPlayer.h in Headers */, 63014B7E1042E64A00534090 /* VLCMediaListPlayer.h in Headers */,
6309994B110FC791005F46AE /* VLCExtension.h in Headers */, 6309994B110FC791005F46AE /* VLCExtension.h in Headers */,
6309994C110FC791005F46AE /* VLCExtensionsManager.h in Headers */, 6309994C110FC791005F46AE /* VLCExtensionsManager.h in Headers */,
63D88D93124E9BF600F65FA0 /* VLCMediaThumbnailer.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -467,7 +480,14 @@ ...@@ -467,7 +480,14 @@
isa = PBXProject; isa = PBXProject;
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "VLCKit" */; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "VLCKit" */;
compatibilityVersion = "Xcode 3.1"; compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1; hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 0867D691FE84028FC02AAC07 /* VLC */; mainGroup = 0867D691FE84028FC02AAC07 /* VLC */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = ""; projectDirPath = "";
...@@ -612,6 +632,7 @@ ...@@ -612,6 +632,7 @@
63014A7A1042ACE100534090 /* VLCMediaListPlayer.m in Sources */, 63014A7A1042ACE100534090 /* VLCMediaListPlayer.m in Sources */,
63098FDC110E7159005F46AE /* VLCExtensionsManager.m in Sources */, 63098FDC110E7159005F46AE /* VLCExtensionsManager.m in Sources */,
63099116110F0EC3005F46AE /* VLCExtension.m in Sources */, 63099116110F0EC3005F46AE /* VLCExtension.m in Sources */,
636E974E11E8DCF1002FE8A9 /* VLCMediaThumbnailer.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
......
...@@ -3,8 +3,16 @@ ...@@ -3,8 +3,16 @@
// //
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
# define IPHONE_OS
#endif
#ifdef __OBJC__ #ifdef __OBJC__
#import <Cocoa/Cocoa.h> # ifndef IPHONE_OS
# import <Cocoa/Cocoa.h>
# else
# import <UIKit/UIKit.h>
# endif
#endif #endif
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment