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

MacOSX/Framework: Merge Enrique Osuna's work on the Framework.

parent d812dbea
......@@ -26,18 +26,22 @@
#import <pthread.h>
/* This object is here to ensure safe inter thread communication */
@interface VLCEventManager : NSObject
{
NSMutableArray * messageQueue;
pthread_t dispatcherThread;
pthread_mutex_t queueLock;
pthread_cond_t signalData;
NSMutableArray *messageQueue;
pthread_t dispatcherThread;
pthread_mutex_t queueLock;
pthread_cond_t signalData;
}
/* Return the default manager */
+ (id)sharedManager;
- (void)callOnMainThreadDelegateOfObject:(id)aTarget withDelegateMethod:(SEL)aSelector withNotificationName:(NSString *)aNotificationName;
- (void)callOnMainThreadObject:(id)aTarget withMethod:(SEL)aSelector withArgumentAsObject: (id)arg;
- (void)callOnMainThreadDelegateOfObject:(id)aTarget
withDelegateMethod:(SEL)aSelector
withNotificationName:(NSString *)aNotificationName;
- (void)callOnMainThreadObject:(id)aTarget
withMethod:(SEL)aSelector
withArgumentAsObject:(id)arg;
@end
/*****************************************************************************
* VLCLibVLCbridging.h: VLC.framework VLCLibVLCBridging header
*****************************************************************************
* Copyright (C) 2007 Pierre d'Herbemont
* Copyright (C) 2007 the VideoLAN team
* $Id: VLCEventManager.h 21564 2007-08-29 21:09:27Z pdherbemont $
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
// TODO: Documentation
@interface VLCMediaList (LibVLCBridging)
+ (id)medialistWithLibVLCMediaList:(void *)p_new_mlist;
- (id)initWithLibVLCMediaList:(void *)p_new_mlist;
- (void *)libVLCMediaList;
@end
/**
* Bridges functionality between libvlc and VLCMedia implementation.
*/
@interface VLCMedia (LibVLCBridging)
/* Object Factory */
/**
* Manufactures new object wrapped around specified media descriptor.
* \param md LibVLC media descriptor pointer.
* \return Newly created media instance using specified descriptor.
*/
+ (id)mediaWithLibVLCMediaDescriptor:(void *)md;
/**
* Initializes new object wrapped around specified media descriptor.
* \param md LibVLC media descriptor pointer.
* \return Newly created media instance using specified descriptor.
*/
- (id)initWithLibVLCMediaDescriptor:(void *)md;
/**
* Returns the receiver's internal media descriptor pointer.
* \return The receiver's internal media descriptor pointer.
*/
- (void *)libVLCMediaDescriptor;
@end
// TODO: Documentation
@interface VLCMedia (VLCMediaPlayerBridging)
- (void)setLength:(VLCTime *)value;
@end
// TODO: Documentation
@interface VLCLibrary (VLCAudioBridging)
- (void)setAudio:(VLCAudio *)value;
@end
......@@ -22,47 +22,36 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
#import "VLCAudio.h"
#import "VLCMediaList.h"
#import "VLCMedia.h"
#include <vlc/libvlc.h>
#include <vlc/libvlc_structures.h>
#import <VLC/VLCPlaylist.h>
/*
* VLCLibrary object
*/
@interface VLCLibrary : NSObject
+ (libvlc_instance_t *)sharedInstance;
@end
@class VLCAudio;
/*
* Utility function
* VLCLibrary object. Internal use only.
*/
#define quit_on_exception( ex ) __quit_on_exception( ex, __FUNCTION__, __FILE__, __LINE__ )
static inline void __quit_on_exception( libvlc_exception_t * ex, const char * function, const char * file, int line_number )
// TODO: Documentation
@interface VLCLibrary : NSObject
{
if (libvlc_exception_raised( ex ))
{
/* XXX: localization */
NSRunCriticalAlertPanel( @"Error", [NSString stringWithFormat:@"libvlc has thrown us an error: %s (%s:%d %s)", libvlc_exception_get_message(ex), file, line_number, function], @"Quit", nil, nil );
exit( ex->i_code );
}
void *instance;
VLCAudio *audio;
}
/*
* LibVLCBridging category
*/
/* Factories */
+ (VLCLibrary *)sharedLibrary;
+ (void *)sharedInstance;
@interface VLCPlaylist (LibVLCBridging)
+ (id) playlistWithLibVLCMediaList: (libvlc_media_list_t *)p_new_mlist;
- (libvlc_media_list_t *) libVLCMediaList;
@end
/* Properties */
- (void *)instance;
- (VLCAudio *)audio;
@interface VLCMedia (LibVLCBridging)
- (id) initWithLibVLCMediaDescriptor: (libvlc_media_descriptor_t *)p_md;
+ (id) mediaWithLibVLCMediaDescriptor: (libvlc_media_descriptor_t *)p_md;
- (libvlc_media_descriptor_t *) libVLCMediaDescriptor;
@end
/*
* Utility function
*/
// TODO: Figure out a better way to raise error messages
#define quit_on_exception( ex ) __quit_on_exception( (void*)(ex), __FUNCTION__, __FILE__, __LINE__ )
extern void __quit_on_exception( void* e, const char *function, const char *file, int line_number );
\ No newline at end of file
......@@ -25,15 +25,16 @@
#ifndef VLC_FRAMEWORK_VLC_H
#define VLC_FRAMEWORK_VLC_H
typedef void * _opaque_ptr;
#import <VLC/VLCMedia.h>
#import <VLC/VLCMediaDiscoverer.h>
#import <VLC/VLCMediaLibrary.h>
#import <VLC/VLCPlaylist.h>
#import <VLC/VLCPlaylistDataSource.h>
#import <VLC/VLCServicesDiscoverer.h>
#import <VLC/VLCMediaList.h>
#import <VLC/VLCTime.h>
#import <VLC/VLCVideoView.h>
@class VLCMedia;
@class VLCMediaLibrary;
@class VLCMediaList;
@class VLCTime;
@class VLCVideoView;
#endif /* VLC_FRAMEWORK_VLC_H */
/*****************************************************************************
* VLCAudio.h: VLC.framework VLCAudio header
*****************************************************************************
* Copyright (C) 2007 Faustino E. Osuna
* Copyright (C) 2007 the VideoLAN team
* $Id$
*
* Authors: Faustino E. Osuna <enrique.osuna # gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
#import "VLCLibrary.h"
/* Notification Messages */
/**
* Standard notification messages that are emitted by VLCMedia object.
*/
extern NSString *VLCMediaPlayerVolumeChanged;
@class VLCLibrary;
// TODO: Documentation
@interface VLCAudio : NSObject
{
VLCLibrary *library; //< Library to control audio for
}
/* Initializers */
- (id)initWithLibrary:(VLCLibrary *)library;
/* Properties */
- (void)setMute:(BOOL)value;
- (BOOL)isMuted;
- (void)setVolume:(int)value;
- (int)volume;
@end
/*****************************************************************************
* VLCMedia.h: VLC.framework VLCMedia header
*****************************************************************************
* Copyright (C) 2007 Pierre d'Herbemont
* Copyright (C) 2007 the VideoLAN team
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
#import "VLCMediaList.h"
#import "VLCTime.h"
/* Meta Dictionary Keys */
/**
* Standard dictionary keys for retreiving meta data.
*/
extern NSString *VLCMetaInformationTitle; /* NSString */
extern NSString *VLCMetaInformationArtist; /* NSString */
extern NSString *VLCMetaInformationTitle; /* NSString */
extern NSString *VLCMetaInformationArtist; /* NSString */
extern NSString *VLCMetaInformationGenre; /* NSString */
extern NSString *VLCMetaInformationCopyright; /* NSString */
extern NSString *VLCMetaInformationAlbum; /* NSString */
extern NSString *VLCMetaInformationTrackNumber; /* NSString */
extern NSString *VLCMetaInformationDescription; /* NSString */
extern NSString *VLCMetaInformationRating; /* NSString */
extern NSString *VLCMetaInformationDate; /* NSString */
extern NSString *VLCMetaInformationSetting; /* NSString */
extern NSString *VLCMetaInformationURL; /* NSString */
extern NSString *VLCMetaInformationLanguage; /* NSString */
extern NSString *VLCMetaInformationNowPlaying; /* NSString */
extern NSString *VLCMetaInformationPublisher; /* NSString */
extern NSString *VLCMetaInformationEncodedBy; /* NSString */
extern NSString *VLCMetaInformationArtworkURL; /* NSString */
extern NSString *VLCMetaInformationArtwork; /* NSImage */
extern NSString *VLCMetaInformationTrackID; /* NSString */
/* Notification Messages */
/**
* Available notification messages.
*/
extern NSString *VLCMediaMetaChanged; //< Notification message for when the media's meta data has changed
// Forward declarations, supresses compiler error messages
@class VLCMediaList;
@class VLCMedia;
/**
* Informal protocol declaration for VLCMedia delegates. Allows data changes to be
* trapped.
*/
@protocol VLCMediaDelegate
// TODO: SubItemAdded/SubItemRemoved implementation. Not sure if we really want to implement this.
///**
// * Delegate method called whenever a sub item has been added to the specified VLCMedia.
// * \param aMedia The media resource that has received the new sub item.
// * \param childMedia The new sub item added.
// * \param index Location of the new subitem in the aMedia's sublist.
// */
// - (void)media:(VLCMedia *)media addedSubItem:(VLCMedia *)childMedia atIndex:(int)index;
///**
// * Delegate method called whenever a sub item has been removed from the specified VLCMedia.
// * \param aMedia The media resource that has had a sub item removed from.
// * \param childMedia The sub item removed.
// * \param index The previous location of the recently removed sub item.
// */
// - (void)media:(VLCMedia *)aMedia removedSubItem:(VLCMedia *)childMedia atIndex:(int)index;
/**
* Delegate method called whenever the meta has changed for the receiver.
* \param aMedia The media resource whose meta data has been changed.
* \param oldValue The old meta data value.
* \param key The key of the value that was changed.
*/
- (void)media:(VLCMedia *)aMedia metaValueChangedFrom:(id)oldValue forKey:(NSString *)key;
@end
/**
* Defines files and streams as a managed object. Each media object can be
* administered seperately. VLCMediaPlayer or VLCMediaControl must be used
* to execute the appropriate playback functions.
* \see VLCMediaPlayer
* \see VLCMediaControl
*/
@interface VLCMedia : NSObject
{
void *p_md; //< Internal media descriptor instance
NSString *url; //< URL for this media resource
VLCMediaList *subitems; //< Sub list of items
VLCTime *length; //< Duration of the media
NSMutableDictionary *metaDictionary; //< Meta data storage
id delegate; //< Delegate object
BOOL preparsed; //< Value used to determine of the file has been preparsed
}
/* Object Factories */
/**
* Manufactures a new VLCMedia object using the URL specified. Will return nil if
* the specified URL references a directory that does not comply with DVD file
* structure.
* \param anURL URL to media to be accessed.
* \return A new VLCMedia object, only if there were no errors. This object
* will be automatically released.
* \see initWithMediaURL
*/
+ (id)mediaWithURL:(NSString *)anURL;
/* Initializers */
/**
* Initializes a new VLCMedia object to use the specified URL. Will return nil if
* the specified URL references a directory that does not comply with DVD file
* structure.
* \param anURL URL to media to be accessed.
* \return A new VLCMedia object, only if there were no errors.
*/
- (id)initWithURL:(NSString *)anURL;
/**
* Returns an NSComparisonResult value that indicates the lexical ordering of
* the receiver and a given meda.
* \param media The media with which to compare with the receiver.
* \return NSOrderedAscending if the URL of the receiver precedes media in
* lexical ordering, NSOrderedSame if the URL of the receiver and media are
* equivalent in lexical value, and NSOrderedDescending if the URL of the
* receiver follows media. If media is nil, returns NSOrderedDescending.
*/
- (NSComparisonResult)compare:(VLCMedia *)media;
/* Properties */
/**
* Sets the receiver's delegate.
* \param delegate The delegate for the receiver.
*/
- (void)setDelegate:(id)delegate;
/**
* Returns the receiver's delegate
* \return The receiver's delegate
*/
- (id)delegate;
/**
* Returns a VLCTime object describing the length of the media resource.
* \return The length of the media resource.
*/
- (VLCTime *)length;
/**
* Returns a VLCTime object describing the length of the media resource,
* however, this is a blocking operation and will wait until the preparsing is
* completed before returning anything.
* \param aDate Time for operation to wait until, if there are no results
* before specified date then nil is returned.
* \return The length of the media resource, nil if it couldn't wait for it.
*/
- (VLCTime *)lengthWaitUntilDate:(NSDate *)aDate;
- (BOOL)isPreparsed;
/**
* Returns the URL for the receiver's media resource.
* \return The URL for the receiver's media resource.
*/
- (NSString *)url;
/**
* Returns the receiver's sub list.
* \return The receiver's sub list.
*/
- (VLCMediaList *)subitems;
/**
* Returns the receiver's meta data as a NSDictionary object.
* \return The receiver's meta data as a NSDictionary object.
*/
- (NSDictionary *)metaDictionary;
@end
\ No newline at end of file
......@@ -23,20 +23,19 @@
*****************************************************************************/
#import <Cocoa/Cocoa.h>
#import <VLC/VLCPlaylist.h>
#import "VLCMediaList.h"
@class VLCPlaylist;
@class VLCMediaList;
@interface VLCMediaLibrary : NSObject
{
VLCPlaylist * allMedia;
void * mlib;
void *mlib;
VLCMediaList *allMedia;
}
+ (id)sharedMediaLibrary;
- (VLCPlaylist *)allMedia;
- (NSArray *) playlists;
- (VLCMediaList *)allMedia;
- (NSArray *)playlists;
@end
/*****************************************************************************
* VLCMedia.h: VLC.framework VLCMedia header
* VLCMediaList.h: VLC.framework VLCMediaList header
*****************************************************************************
* Copyright (C) 2007 Pierre d'Herbemont
* Copyright (C) 2007 the VideoLAN team
* $Id$
* $Id: VLCMediaList.h 21564 2007-08-29 21:09:27Z pdherbemont $
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
*
......@@ -22,35 +22,47 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
#import <VLC/VLCPlaylist.h>
#import "VLCMedia.h"
/* Meta */
extern NSString * VLCMetaInformationTitle; /* Associated to an NSString */
extern NSString * VLCMetaInformationAuthor; /* Associated to an NSString */
extern NSString * VLCMetaInformationArtwork; /* Associated to an NSImage */
/* Notification Messages */
extern NSString *VLCMediaListItemAdded;
extern NSString *VLCMediaListItemDeleted;
/* Notification */
extern NSString * VLCMediaSubItemAdded;
@class VLCMedia;
@class VLCMediaList;
@class VLCPlaylist;
// TODO: Documentation
@protocol VLCMediaListDelegate
@interface VLCMedia : NSObject
- (void)mediaList:(VLCMediaList *) mediaAdded:(VLCMedia *)media atIndex:(int)index;
- (void)mediaList:(VLCMediaList *) mediaRemovedAtIndex:(int)index;
@end
// TODO: Documentation
@interface VLCMediaList : NSObject
{
void * md;
NSString * url;
VLCPlaylist *subitems;
NSMutableDictionary *metaInformation;
void *p_mlist; //< Internal instance of media list
id delegate; //< Delegate object
}
- (id)initWithURL:(NSString *)anURL;
+ (id)mediaWithURL:(NSString *)anURL;
/* Properties */
- (void)setDelegate:(id)value;
- (id)delegate;
- (void) dealloc;
/* Operations */
- (void)lock;
- (void)unlock;
- (NSString *)url;
- (VLCPlaylist *)subitems;
- (int)addMedia:(VLCMedia *)media;
- (void)insertMedia:(VLCMedia *)media atIndex:(int)index;
- (void)removeMediaAtIndex:(int)index;
- (VLCMedia *)mediaAtIndex:(int)index;
- (int)indexOfMedia:(VLCMedia *)media;
- (int)count;
/* Returns a dictionary with corresponding object associated with a meta */
- (NSDictionary *)metaInformation;
@end
- (NSArray *)sublists; // I don't see why this would be useful
//- (VLCMediaList *)flatPlaylist; // nore this one
//- (VLCMedia *)providerMedia; // I have no clue what this does
@end
\ No newline at end of file
/*****************************************************************************
* VLCMediaPlayer.h: VLC.framework VLCMediaPlayer header
*****************************************************************************
* Copyright (C) 2007 Pierre d'Herbemont
* Copyright (C) 2007 the VideoLAN team
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
#import "VLCMedia.h"
/* Notification Messages */
extern NSString *VLCMediaPlayerTimeChanged;
extern NSString *VLCMediaPlayerStateChanged;
// TODO: Documentation
typedef enum VLCMediaPlayerState
{
VLCMediaPlayerStateStopped, //< Player has stopped
VLCMediaPlayerStateOpening, //< Stream is opening
VLCMediaPlayerStateBuffering, //< Stream is buffering
VLCMediaPlayerStateEnded, //< Stream has ended
VLCMediaPlayerStateError, //< Player has generated an error
VLCMediaPlayerStatePlaying, //< Stream is playing
VLCMediaPlayerStatePaused //< Stream is paused
} VLCMediaPlayerState;
extern NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state);
/**
* Formal protocol declaration for playback delegates. Allows playback messages
* to be trapped by delegated objects.
*/
@protocol VLCMediaPlayerDelegate
- (void)mediaPlayerTimeChanged:(NSNotification *)aNotification;
- (void)mediaPlayerStateChanged:(NSNotification *)aNotification;
@end
// TODO: Should we use medialist_player or our own flavor of media player?
@interface VLCMediaPlayer : NSObject
{
id delegate; //< Object delegate
VLCVideoView *videoView;//< NSView instance where media is rendered to
void *instance; // Internal
VLCMedia *media; //< Current media being played
}
/* Initializers */
- (id)initWithVideoView:(VLCVideoView *)aVideoView;
/* Properties */
- (void)setDelegate:(id)value;
- (id)delegate;
/* Video View Options */
// TODO: Should be it's own object?
// TODO: use VLCVideoView instead of NSView
- (void)setVideoView:(VLCVideoView *)value;
- (VLCVideoView *)videoView;
- (void)setFullscreen:(BOOL)value;
- (BOOL)fullscreen;
- (void)setVideoAspectRatio:(char *)value;
- (char *)videoAspectRatio;
- (void)setVideoSubTitles:(int)value;
- (int)videoSubTitles;
- (void)setVideoCropGeometry:(char *)value;
- (char *)videoCropGeometry;
- (void)setVideoTeleText:(int)value;
- (int)videoTeleText;
- (void)setRate:(int)value;
- (int)rate;
/* Video Information */
- (NSSize)videoSize;
- (BOOL)hasVideoOut;
- (float)framesPerSecond;
/**
* Sets the current position (or time) of the feed.
* \param value New time to set the current position to. If time is [VLCTime nullTime], 0 is assumed.
*/
- (void)setTime:(VLCTime *)value;
/**
* Returns the current position (or time) of the feed.
* \return VLCTIme object with current time.
*/
- (VLCTime *)time;
/* Audio Options */
- (void)setAudioTrack:(int)value;
- (int)audioTrack;
- (void)setAudioChannel:(int)value;
- (int)audioChannel;
/* Media Options */
- (void)setMedia:(VLCMedia *)value;
- (VLCMedia *)media;
/* Playback Operations */
/**
* Plays a media resource using the currently selected media controller (or
* default controller. If feed was paused then the feed resumes at the position
* it was paused in.
* \return A Boolean determining whether the stream was played or not.
*/
- (BOOL)play;
/**
* Toggle's the pause state of the feed.
*/
- (void)pause;
/**
* Fast forwards through the feed at the standard 1x rate.
*/
//- (void)fastForward;
/**
* Fast forwards through the feed at the rate specified.
* \param rate Rate at which the feed should be fast forwarded.
*/
//- (void)fastForwardAtRate:(int)rate;
/**
* Rewinds through the feed at the standard 1x rate.
*/
//- (void)rewind;
/**
* Rewinds through the feed at the rate specified.
* \param rate Rate at which the feed should be fast rewound.
*/
//- (void)rewindAtRate:(int)rate;
/* Playback Information */
/**
* Playback state flag identifying that the stream is currently playing.
* \return TRUE if the feed is playing, FALSE if otherwise.
*/
- (BOOL)isPlaying;
/**
* Playback state flag identifying wheather the stream will play.
* \return TRUE if the feed is ready for playback, FALSE if otherwise.
*/