Commit 45d4010f authored by Felix Paul Kühne's avatar Felix Paul Kühne

Media List Player: adapt to libvlc 3.0 API

parent 39b34319
......@@ -101,6 +101,7 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
- (instancetype)initWithVideoLayer:(VLCVideoLayer *)aVideoLayer;
#endif
- (instancetype)initWithOptions:(NSArray *)options;
- (instancetype)initWithLibVLCInstance:(void *)playerInstance andLibrary:(VLCLibrary *)library;
/* Video View Options */
// TODO: Should be it's own object?
......
......@@ -29,6 +29,7 @@
#import "VLCMediaPlayer.h"
#import "VLCMediaList.h"
#import "VLCLibVLCBridging.h"
#import "VLCLibrary.h"
@interface VLCMediaListPlayer () {
void *instance;
......@@ -43,14 +44,17 @@
- (instancetype)initWithOptions:(NSArray *)options
{
if (self = [super init]) {
_mediaPlayer = [[VLCMediaPlayer alloc] initWithOptions:options];
instance = libvlc_media_list_player_new([_mediaPlayer.libraryInstance instance]);
libvlc_media_list_player_set_media_player(instance, [_mediaPlayer libVLCMediaPlayer]);
}
return self;
if (self = [super init]) {
VLCLibrary *library;
if (options != nil) {
library = [[VLCLibrary alloc] initWithOptions:options];
} else
library = [VLCLibrary sharedLibrary];
instance = libvlc_media_list_player_new([library instance]);
_mediaPlayer = [[VLCMediaPlayer alloc] initWithLibVLCInstance:libvlc_media_list_player_get_media_player(instance) andLibrary:library];
}
return self;
}
- (instancetype)init
......
......@@ -147,7 +147,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
// TODO: Documentation
@interface VLCMediaPlayer (Private)
- (id)initWithDrawable:(id)aDrawable options:(NSArray *)options;
- (instancetype)initWithDrawable:(id)aDrawable options:(NSArray *)options;
- (void)registerObservers;
- (void)unregisterObservers;
......@@ -203,6 +203,25 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
return [self initWithDrawable:nil options:nil];
}
- (instancetype)initWithLibVLCInstance:(void *)playerInstance andLibrary:(VLCLibrary *)library
{
if (self = [super init]) {
_cachedTime = [VLCTime nullTime];
_cachedRemainingTime = [VLCTime nullTime];
_position = 0.0f;
_cachedState = VLCMediaPlayerStateStopped;
_privateLibrary = library;
libvlc_retain([_privateLibrary instance]);
_playerInstance = playerInstance;
libvlc_media_player_retain(_playerInstance);
[self registerObservers];
}
return self;
}
#if !TARGET_OS_IPHONE
- (instancetype)initWithVideoView:(VLCVideoView *)aVideoView
{
......@@ -1155,7 +1174,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
@end
@implementation VLCMediaPlayer (Private)
- (id)initWithDrawable:(id)aDrawable options:(NSArray *)options
- (instancetype)initWithDrawable:(id)aDrawable options:(NSArray *)options
{
if (self = [super init]) {
_cachedTime = [VLCTime nullTime];
......
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