[vlc-commits] macosx/media source: expose preparsing of media within a tree
Felix Paul Kühne
git at videolan.org
Mon Apr 29 19:26:52 CEST 2019
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Mon Apr 22 20:25:53 2019 +0200| [9f38aeb6fb3a080583746c4f85604b57a8f294de] | committer: Felix Paul Kühne
macosx/media source: expose preparsing of media within a tree
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9f38aeb6fb3a080583746c4f85604b57a8f294de
---
modules/gui/macosx/library/VLCInputItem.h | 1 +
modules/gui/macosx/library/VLCInputItem.m | 28 +++++++++-------------
modules/gui/macosx/media-source/VLCMediaSource.h | 5 +++-
modules/gui/macosx/media-source/VLCMediaSource.m | 9 ++++++-
.../macosx/media-source/VLCMediaSourceProvider.m | 2 +-
5 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/modules/gui/macosx/library/VLCInputItem.h b/modules/gui/macosx/library/VLCInputItem.h
index 2e41b742b4..8554dd793e 100644
--- a/modules/gui/macosx/library/VLCInputItem.h
+++ b/modules/gui/macosx/library/VLCInputItem.h
@@ -32,6 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithInputItem:(struct input_item_t *)p_inputItem;
+ at property (readonly) struct input_item_t *vlcInputItem;
@property (readonly) NSString *name;
@property (readonly) NSString *MRL;
@property (readonly) vlc_tick_t duration;
diff --git a/modules/gui/macosx/library/VLCInputItem.m b/modules/gui/macosx/library/VLCInputItem.m
index 500617dbd5..9f998ec2f4 100644
--- a/modules/gui/macosx/library/VLCInputItem.m
+++ b/modules/gui/macosx/library/VLCInputItem.m
@@ -24,57 +24,51 @@
#import "extensions/NSString+Helpers.h"
- at interface VLCInputItem()
-{
- struct input_item_t *_p_inputItem;
-}
- at end
-
@implementation VLCInputItem
- (instancetype)initWithInputItem:(struct input_item_t *)p_inputItem
{
self = [super init];
if (self && p_inputItem != NULL) {
- _p_inputItem = p_inputItem;
- input_item_Hold(_p_inputItem);
+ _vlcInputItem = p_inputItem;
+ input_item_Hold(_vlcInputItem);
}
return self;
}
- (void)dealloc
{
- input_item_Release(_p_inputItem);
+ input_item_Release(_vlcInputItem);
}
- (NSString *)name
{
- if (_p_inputItem) {
- return toNSStr(_p_inputItem->psz_name);
+ if (_vlcInputItem) {
+ return toNSStr(_vlcInputItem->psz_name);
}
return @"";
}
- (NSString *)MRL
{
- if (_p_inputItem) {
- return toNSStr(_p_inputItem->psz_uri);
+ if (_vlcInputItem) {
+ return toNSStr(_vlcInputItem->psz_uri);
}
return @"";
}
- (vlc_tick_t)duration
{
- if (_p_inputItem) {
- return _p_inputItem->i_duration;
+ if (_vlcInputItem) {
+ return _vlcInputItem->i_duration;
}
return -1;
}
- (enum input_item_type_e)inputType
{
- if (_p_inputItem) {
- return _p_inputItem->i_type;
+ if (_vlcInputItem) {
+ return _vlcInputItem->i_type;
}
return ITEM_TYPE_UNKNOWN;
}
diff --git a/modules/gui/macosx/media-source/VLCMediaSource.h b/modules/gui/macosx/media-source/VLCMediaSource.h
index fa1874e4da..f40368959b 100644
--- a/modules/gui/macosx/media-source/VLCMediaSource.h
+++ b/modules/gui/macosx/media-source/VLCMediaSource.h
@@ -24,6 +24,7 @@
#import <vlc_media_source.h>
+ at class VLCInputItem;
@class VLCInputNode;
NS_ASSUME_NONNULL_BEGIN
@@ -34,7 +35,9 @@ extern NSString *VLCMediaSourceChildrenRemoved;
@interface VLCMediaSource : NSObject
-- (instancetype)initWithMediaSource:(vlc_media_source_t *)p_mediaSource;
+- (instancetype)initWithMediaSource:(vlc_media_source_t *)p_mediaSource andLibVLCInstance:(libvlc_int_t *)p_libvlcInstance;
+
+- (void)preparseInputItemWithinTree:(VLCInputItem *)inputItem;
@property (readonly) NSString *mediaSourceDescription;
@property (readonly) VLCInputNode *rootNode;
diff --git a/modules/gui/macosx/media-source/VLCMediaSource.m b/modules/gui/macosx/media-source/VLCMediaSource.m
index ad191fb744..a7a1615465 100644
--- a/modules/gui/macosx/media-source/VLCMediaSource.m
+++ b/modules/gui/macosx/media-source/VLCMediaSource.m
@@ -28,6 +28,7 @@
@interface VLCMediaSource ()
{
+ libvlc_int_t *_p_libvlcInstance;
vlc_media_source_t *_p_mediaSource;
vlc_media_tree_listener_id *_p_treeListenerID;
}
@@ -79,10 +80,11 @@ static const struct vlc_media_tree_callbacks treeCallbacks = {
@implementation VLCMediaSource
-- (instancetype)initWithMediaSource:(vlc_media_source_t *)p_mediaSource
+- (instancetype)initWithMediaSource:(vlc_media_source_t *)p_mediaSource andLibVLCInstance:(libvlc_int_t *)p_libvlcInstance
{
self = [super init];
if (self && p_mediaSource != NULL) {
+ _p_libvlcInstance = p_libvlcInstance;
_p_mediaSource = p_mediaSource;
vlc_media_source_Hold(_p_mediaSource);
_p_treeListenerID = vlc_media_tree_AddListener(_p_mediaSource->tree,
@@ -104,6 +106,11 @@ static const struct vlc_media_tree_callbacks treeCallbacks = {
}
}
+- (void)preparseInputItemWithinTree:(VLCInputItem *)inputItem
+{
+ vlc_media_tree_Preparse(_p_mediaSource->tree, _p_libvlcInstance, inputItem.vlcInputItem);
+}
+
- (NSString *)mediaSourceDescription
{
if (_p_mediaSource != NULL) {
diff --git a/modules/gui/macosx/media-source/VLCMediaSourceProvider.m b/modules/gui/macosx/media-source/VLCMediaSourceProvider.m
index 2c4442ad7c..1b3ae2efd6 100644
--- a/modules/gui/macosx/media-source/VLCMediaSourceProvider.m
+++ b/modules/gui/macosx/media-source/VLCMediaSourceProvider.m
@@ -52,7 +52,7 @@
continue;
}
- VLCMediaSource *mediaSource = [[VLCMediaSource alloc] initWithMediaSource:p_mediaSource];
+ VLCMediaSource *mediaSource = [[VLCMediaSource alloc] initWithMediaSource:p_mediaSource andLibVLCInstance:p_libvlcInstance];
[mutableArray addObject:mediaSource];
}
More information about the vlc-commits
mailing list