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

macosx/framework: Export VLCExtensionsManager and VLCExtension.

This enables usage of vlc extension in Lunettes.
parent 0726443c
//
// VLCExtension.h
// VLCKit
//
// Created by Pierre d'Herbemont on 1/26/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface VLCExtension : NSObject {
struct extension_t *_instance;
}
- (id)initWithInstance:(struct extension_t *)instance; // FIXME: Should be internal
- (struct extension_t *)instance; // FIXME: Should be internal
- (NSString *)name;
- (NSString *)title;
@end
//
// VLCExtensionsManager.h
// VLCKit
//
// Created by Pierre d'Herbemont on 1/26/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@class VLCExtension;
@interface VLCExtensionsManager : NSObject {
void *instance;
}
+ (VLCExtensionsManager *)sharedManager;
- (NSArray *)extensions;
- (void)runExtension:(VLCExtension *)extension;
@end
//
// VLCExtension.m
// VLCKit
//
// Created by Pierre d'Herbemont on 1/26/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import "VLCExtension.h"
#import <vlc_extensions.h>
@implementation VLCExtension
- (NSString *)description
{
return [NSString stringWithFormat:@"VLC Extension %@", [self name]];
}
- (id)initWithInstance:(struct extension_t *)instance
{
self = [super init];
if (!self)
return nil;
_instance = instance;
return self;
}
- (struct extension_t *)instance
{
return _instance;
}
- (NSString *)name
{
return [NSString stringWithUTF8String:_instance->psz_name];
}
- (NSString *)title
{
return [NSString stringWithUTF8String:_instance->psz_title];
}
@end
//
// VLCExtensionsManager.m
// VLCKit
//
// Created by Pierre d'Herbemont on 1/26/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import "VLCExtensionsManager.h"
#import "VLCExtension.h"
#import "VLCLibrary.h"
#import "VLCLibVLCBridging.h"
#import <vlc_extensions.h>
#define _instance ((extensions_manager_t *)instance)
static int DialogCallback( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val,
void *param )
{
VLCExtensionsManager *self = param;
assert(self);
assert(new_val.p_address);
extension_dialog_t *dialog = new_val.p_address;
NSLog(@"dialog callback");
return VLC_SUCCESS;
}
@implementation VLCExtensionsManager
static VLCExtensionsManager *sharedManager = nil;
+ (VLCExtensionsManager *)sharedManager
{
if (!sharedManager)
{
/* Initialize a shared instance */
sharedManager = [[self alloc] init];
}
return sharedManager;
}
- (void)dealloc
{
vlc_object_t *libvlc = libvlc_get_vlc_instance([VLCLibrary sharedInstance]);
var_DelCallback(libvlc, "dialog-extension", DialogCallback, NULL);
vlc_object_release(libvlc);
module_unneed(_instance, _instance->p_module);
vlc_object_release(_instance);
[super dealloc];
}
- (NSArray *)extensions
{
if (!instance)
{
vlc_object_t *libvlc = libvlc_get_vlc_instance([VLCLibrary sharedInstance]);
instance = vlc_object_create(libvlc, sizeof(extensions_manager_t));
if (!_instance)
{
vlc_object_release(libvlc);
return nil;
}
vlc_object_attach(_instance, libvlc);
_instance->p_module = module_need(_instance, "extension", NULL, false);
NSAssert(_instance->p_module, @"Unable to load extensions module");
var_Create(libvlc, "dialog-extension", VLC_VAR_ADDRESS);
var_AddCallback(libvlc, "dialog-extension", DialogCallback, self);
vlc_object_release(libvlc);
}
NSMutableArray *array = [NSMutableArray array];
extension_t *ext;
FOREACH_ARRAY(ext, _instance->extensions)
VLCExtension *extension = [[VLCExtension alloc] initWithInstance:ext];
[array addObject:extension];
[extension release];
FOREACH_END()
return array;
}
- (void)runExtension:(VLCExtension *)extension
{
extension_t *ext = [extension instance];
NSLog(@"extension_TriggerOnly = %d", extension_TriggerOnly(_instance, ext));
NSLog(@"extension_IsActivated = %d", extension_IsActivated(_instance, ext));
if(extension_TriggerOnly(_instance, ext))
extension_Trigger(_instance, ext);
else
{
if(!extension_IsActivated(_instance, ext))
extension_Activate(_instance, ext);
}
}
@end
...@@ -64,6 +64,10 @@ ...@@ -64,6 +64,10 @@
63014B7E1042E64A00534090 /* VLCMediaListPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 63014B7D1042E64A00534090 /* VLCMediaListPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 63014B7E1042E64A00534090 /* VLCMediaListPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 63014B7D1042E64A00534090 /* VLCMediaListPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
6303C43A0CF45CAE0000ECC8 /* VLCMediaListAspect.m in Sources */ = {isa = PBXBuildFile; fileRef = 6303C4390CF45CAE0000ECC8 /* VLCMediaListAspect.m */; }; 6303C43A0CF45CAE0000ECC8 /* VLCMediaListAspect.m in Sources */ = {isa = PBXBuildFile; fileRef = 6303C4390CF45CAE0000ECC8 /* VLCMediaListAspect.m */; };
6303C43C0CF45CC30000ECC8 /* VLCMediaListAspect.h in Headers */ = {isa = PBXBuildFile; fileRef = 6303C43B0CF45CC30000ECC8 /* VLCMediaListAspect.h */; settings = {ATTRIBUTES = (Public, ); }; }; 6303C43C0CF45CC30000ECC8 /* VLCMediaListAspect.h in Headers */ = {isa = PBXBuildFile; fileRef = 6303C43B0CF45CC30000ECC8 /* VLCMediaListAspect.h */; settings = {ATTRIBUTES = (Public, ); }; };
63098FDC110E7159005F46AE /* VLCExtensionsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 63098FDA110E7159005F46AE /* VLCExtensionsManager.m */; };
63099116110F0EC3005F46AE /* VLCExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 63099114110F0EC3005F46AE /* VLCExtension.m */; };
6309994B110FC791005F46AE /* VLCExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 63099949110FC791005F46AE /* VLCExtension.h */; settings = {ATTRIBUTES = (Public, ); }; };
6309994C110FC791005F46AE /* VLCExtensionsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6309994A110FC791005F46AE /* VLCExtensionsManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
632A0E850D3835C400AFC99B /* VLCStreamSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 632A0E830D3835C400AFC99B /* VLCStreamSession.h */; settings = {ATTRIBUTES = (Public, ); }; }; 632A0E850D3835C400AFC99B /* VLCStreamSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 632A0E830D3835C400AFC99B /* VLCStreamSession.h */; settings = {ATTRIBUTES = (Public, ); }; };
632A0E860D3835C400AFC99B /* VLCStreamSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 632A0E840D3835C400AFC99B /* VLCStreamSession.m */; }; 632A0E860D3835C400AFC99B /* VLCStreamSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 632A0E840D3835C400AFC99B /* VLCStreamSession.m */; };
632A0EC30D38392E00AFC99B /* VLCStreamOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 632A0EC10D38392E00AFC99B /* VLCStreamOutput.h */; settings = {ATTRIBUTES = (Public, ); }; }; 632A0EC30D38392E00AFC99B /* VLCStreamOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 632A0EC10D38392E00AFC99B /* VLCStreamOutput.h */; settings = {ATTRIBUTES = (Public, ); }; };
...@@ -139,6 +143,10 @@ ...@@ -139,6 +143,10 @@
63030CC70CCA652C0088ECD1 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; name = Info.plist; path = Resources/Info.plist; sourceTree = "<group>"; }; 63030CC70CCA652C0088ECD1 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; name = Info.plist; path = Resources/Info.plist; sourceTree = "<group>"; };
6303C4390CF45CAE0000ECC8 /* VLCMediaListAspect.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCMediaListAspect.m; sourceTree = "<group>"; }; 6303C4390CF45CAE0000ECC8 /* VLCMediaListAspect.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCMediaListAspect.m; sourceTree = "<group>"; };
6303C43B0CF45CC30000ECC8 /* VLCMediaListAspect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCMediaListAspect.h; path = Public/VLCMediaListAspect.h; sourceTree = "<group>"; }; 6303C43B0CF45CC30000ECC8 /* VLCMediaListAspect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCMediaListAspect.h; path = Public/VLCMediaListAspect.h; sourceTree = "<group>"; };
63098FDA110E7159005F46AE /* VLCExtensionsManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCExtensionsManager.m; sourceTree = "<group>"; };
63099114110F0EC3005F46AE /* VLCExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCExtension.m; sourceTree = "<group>"; };
63099949110FC791005F46AE /* VLCExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCExtension.h; path = Public/VLCExtension.h; sourceTree = "<group>"; };
6309994A110FC791005F46AE /* VLCExtensionsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCExtensionsManager.h; path = Public/VLCExtensionsManager.h; sourceTree = "<group>"; };
632A0E830D3835C400AFC99B /* VLCStreamSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCStreamSession.h; path = Public/VLCStreamSession.h; sourceTree = "<group>"; }; 632A0E830D3835C400AFC99B /* VLCStreamSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCStreamSession.h; path = Public/VLCStreamSession.h; sourceTree = "<group>"; };
632A0E840D3835C400AFC99B /* VLCStreamSession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCStreamSession.m; sourceTree = "<group>"; }; 632A0E840D3835C400AFC99B /* VLCStreamSession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCStreamSession.m; sourceTree = "<group>"; };
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>"; };
...@@ -247,6 +255,8 @@ ...@@ -247,6 +255,8 @@
EF78BD450CAEEFF600354E6E /* VLCVideoView.m */, EF78BD450CAEEFF600354E6E /* VLCVideoView.m */,
EF78BD440CAEEFF600354E6E /* VLCTime.m */, EF78BD440CAEEFF600354E6E /* VLCTime.m */,
EF73118F0CB5797B009473B4 /* VLCAudio.m */, EF73118F0CB5797B009473B4 /* VLCAudio.m */,
63098FDA110E7159005F46AE /* VLCExtensionsManager.m */,
63099114110F0EC3005F46AE /* VLCExtension.m */,
632A0F7B0D38F78500AFC99B /* Stream */, 632A0F7B0D38F78500AFC99B /* Stream */,
); );
path = Sources; path = Sources;
...@@ -330,6 +340,8 @@ ...@@ -330,6 +340,8 @@
EF78BD1A0CAEEEE700354E6E /* VLCVideoView.h */, EF78BD1A0CAEEEE700354E6E /* VLCVideoView.h */,
EF78BD190CAEEEE700354E6E /* VLCTime.h */, EF78BD190CAEEEE700354E6E /* VLCTime.h */,
EF73118E0CB5797B009473B4 /* VLCAudio.h */, EF73118E0CB5797B009473B4 /* VLCAudio.h */,
63099949110FC791005F46AE /* VLCExtension.h */,
6309994A110FC791005F46AE /* VLCExtensionsManager.h */,
632A0F7C0D38F79200AFC99B /* Stream */, 632A0F7C0D38F79200AFC99B /* Stream */,
); );
name = Public; name = Public;
...@@ -369,6 +381,8 @@ ...@@ -369,6 +381,8 @@
632A0E850D3835C400AFC99B /* VLCStreamSession.h in Headers */, 632A0E850D3835C400AFC99B /* VLCStreamSession.h in Headers */,
632A0EC30D38392E00AFC99B /* VLCStreamOutput.h in Headers */, 632A0EC30D38392E00AFC99B /* VLCStreamOutput.h in Headers */,
63014B7E1042E64A00534090 /* VLCMediaListPlayer.h in Headers */, 63014B7E1042E64A00534090 /* VLCMediaListPlayer.h in Headers */,
6309994B110FC791005F46AE /* VLCExtension.h in Headers */,
6309994C110FC791005F46AE /* VLCExtensionsManager.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -567,6 +581,8 @@ ...@@ -567,6 +581,8 @@
632A0E860D3835C400AFC99B /* VLCStreamSession.m in Sources */, 632A0E860D3835C400AFC99B /* VLCStreamSession.m in Sources */,
632A0EC40D38392E00AFC99B /* VLCStreamOutput.m in Sources */, 632A0EC40D38392E00AFC99B /* VLCStreamOutput.m in Sources */,
63014A7A1042ACE100534090 /* VLCMediaListPlayer.m in Sources */, 63014A7A1042ACE100534090 /* VLCMediaListPlayer.m in Sources */,
63098FDC110E7159005F46AE /* VLCExtensionsManager.m in Sources */,
63099116110F0EC3005F46AE /* VLCExtension.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -624,6 +640,7 @@ ...@@ -624,6 +640,7 @@
LIBRARY_SEARCH_PATHS = "$(VLC_FRAMEWORK)/lib"; LIBRARY_SEARCH_PATHS = "$(VLC_FRAMEWORK)/lib";
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"-lvlccore",
"-single_module", "-single_module",
"-read_only_relocs", "-read_only_relocs",
suppress, suppress,
......
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