Selaa lähdekoodia

public headers: internalize implementation details. no functional changes

Felix Paul Kühne 10 vuotta sitten
vanhempi
commit
66f1be0099

+ 1 - 4
Headers/Public/VLCAudio.h

@@ -2,7 +2,7 @@
  * VLCAudio.h: VLCKit.framework VLCAudio header
  *****************************************************************************
  * Copyright (C) 2007 Faustino E. Osuna
- * Copyright (C) 2007 VLC authors and VideoLAN
+ * Copyright (C) 2007, 2014 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Faustino E. Osuna <enrique.osuna # gmail.com>
@@ -36,9 +36,6 @@ extern NSString *const VLCMediaPlayerVolumeChanged;
  * TODO: Documentation VLCAudio
  */
 @interface VLCAudio : NSObject
-{
-    void *instance;
-}
 
 /* Properties */
 - (void)setMute:(BOOL)value;

+ 2 - 4
Headers/Public/VLCExtension.h

@@ -1,7 +1,7 @@
 /*****************************************************************************
  * VLCKit: VLCExtensions
  *****************************************************************************
- * Copyright (C) 2010-2012 Pierre d'Herbemont and VideoLAN
+ * Copyright (C) 2010-2014 Pierre d'Herbemont and VideoLAN
  *
  * Authors: Pierre d'Herbemont
  *
@@ -23,9 +23,7 @@
 #import <Cocoa/Cocoa.h>
 
 
-@interface VLCExtension : NSObject {
-    struct extension_t *_instance;
-}
+@interface VLCExtension : NSObject
 
 - (instancetype)initWithInstance:(struct extension_t *)instance NS_DESIGNATED_INITIALIZER; // FIXME: Should be internal
 @property (NS_NONATOMIC_IOSONLY, readonly) struct extension_t *instance; // FIXME: Should be internal

+ 4 - 7
Headers/Public/VLCExtensionsManager.h

@@ -1,7 +1,7 @@
 /*****************************************************************************
  * VLCKit: VLCExtensionsManager
  *****************************************************************************
- * Copyright (C) 2010-2012 Pierre d'Herbemont and VideoLAN
+ * Copyright (C) 2010-2014 Pierre d'Herbemont and VideoLAN
  *
  * Authors: Pierre d'Herbemont
  *
@@ -25,15 +25,12 @@
 @class VLCExtension;
 @class VLCMediaPlayer;
 
-@interface VLCExtensionsManager : NSObject {
-    void *instance;
-    NSMutableArray *_extensions;
-    VLCMediaPlayer *_player;
-    void *_previousInput;
-}
+@interface VLCExtensionsManager : NSObject
+
 + (VLCExtensionsManager *)sharedManager;
 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *extensions;
 - (void)runExtension:(VLCExtension *)extension;
 
 @property (readwrite, strong) VLCMediaPlayer *mediaPlayer;
+
 @end

+ 1 - 7
Headers/Public/VLCMediaDiscoverer.h

@@ -2,7 +2,7 @@
  * VLCMediaDiscoverer.h: VLCKit.framework VLCMediaDiscoverer header
  *****************************************************************************
  * Copyright (C) 2007 Pierre d'Herbemont
- * Copyright (C) 2007 VLC authors and VideoLAN
+ * Copyright (C) 2007, 2014 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
@@ -31,12 +31,6 @@
  * TODO: Documentation VLCMediaDiscoverer
  */
 @interface VLCMediaDiscoverer : NSObject
-{
-    NSString * localizedName;       //< TODO: Documentation VLCMediaDiscoverer.localizedName
-    VLCMediaList * discoveredMedia; //< TODO: Documentation VLCMediaDiscoverer.discoveredMedia
-    void * mdis;                    //< TODO: Documentation VLCMediaDiscoverer.mdis
-    BOOL running;                   //< TODO: Documentation VLCMediaDiscoverer.running
-}
 
 /**
  * Maintains a list of available media discoverers.  This list is populated as new media

+ 1 - 4
Headers/Public/VLCMediaLibrary.h

@@ -2,7 +2,7 @@
  * VLCMediaLibrary.h: VLCKit.framework VLCMediaDiscoverer header
  *****************************************************************************
  * Copyright (C) 2007 Pierre d'Herbemont
- * Copyright (C) 2007 VLC authors and VideoLAN
+ * Copyright (C) 2007, 2014 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
@@ -30,9 +30,6 @@
  * TODO: Documentation
  */
 @interface VLCMediaLibrary : NSObject
-{
-    void * mlib;
-}
 
 /* Factories */
 + (VLCMediaLibrary*)sharedMediaLibrary;

+ 2 - 4
Headers/Public/VLCStreamOutput.h

@@ -2,7 +2,7 @@
  * VLCStreamOutput.h: VLCKit.framework VLCStreamOutput header
  *****************************************************************************
  * Copyright (C) 2008 Pierre d'Herbemont
- * Copyright (C) 2008 VLC authors and VideoLAN
+ * Copyright (C) 2008, 2014 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
@@ -26,9 +26,7 @@ extern NSString * VLCDefaultStreamOutputRTSP;
 extern NSString * VLCDefaultStreamOutputRTP;
 extern NSString * VLCDefaultStreamOutputRTP;
 
-@interface VLCStreamOutput : NSObject {
-    NSMutableDictionary * options;
-}
+@interface VLCStreamOutput : NSObject
 
 - (instancetype)initWithOptionDictionary:(NSDictionary *)dictionary NS_DESIGNATED_INITIALIZER;
 + (instancetype)streamOutputWithOptionDictionary:(NSDictionary *)dictionary;

+ 9 - 3
Sources/VLCAudio.m

@@ -2,7 +2,7 @@
  * VLCAudio.m: VLCKit.framework VLCAudio implementation
  *****************************************************************************
  * Copyright (C) 2007 Faustino E. Osuna
- * Copyright (C) 2007 VLC authors and VideoLAN
+ * Copyright (C) 2007, 2014 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Faustino E. Osuna <enrique.osuna # gmail.com>
@@ -29,6 +29,12 @@
 #define VOLUME_MAX                 200
 #define VOLUME_MIN                 0
 
+@interface VLCAudio ()
+{
+    void *_instance;
+}
+@end
+
 /* Notification Messages */
 NSString *const VLCMediaPlayerVolumeChanged = @"VLCMediaPlayerVolumeChanged";
 
@@ -42,7 +48,7 @@ NSString *const VLCMediaPlayerVolumeChanged = @"VLCMediaPlayerVolumeChanged";
  */
 - (libvlc_media_player_t *)instance
 {
-    return instance;
+    return _instance;
 }
 
 - (instancetype)init
@@ -55,7 +61,7 @@ NSString *const VLCMediaPlayerVolumeChanged = @"VLCMediaPlayerVolumeChanged";
     self = [super init];
     if (!self)
         return nil;
-    instance = [mediaPlayer libVLCMediaPlayer];
+    _instance = [mediaPlayer libVLCMediaPlayer];
     libvlc_media_player_retain([self instance]);
     return self;
 }

+ 7 - 1
Sources/VLCExtension.m

@@ -1,7 +1,7 @@
 /*****************************************************************************
  * VLCKit: VLCExtensions
  *****************************************************************************
- * Copyright (C) 2010-2012 Pierre d'Herbemont and VideoLAN
+ * Copyright (C) 2010-2012, 2014 Pierre d'Herbemont and VideoLAN
  *
  * Authors: Pierre d'Herbemont
  *
@@ -23,6 +23,12 @@
 #import "VLCExtension.h"
 #import <vlc_extensions.h>
 
+@interface VLCExtension ()
+{
+    struct extension_t *_instance;
+}
+@end
+
 @implementation VLCExtension
 - (NSString *)description
 {

+ 9 - 1
Sources/VLCExtensionsManager.m

@@ -1,7 +1,7 @@
 /*****************************************************************************
  * VLCKit: VLCExtensionsManager
  *****************************************************************************
- * Copyright (C) 2010-2012 Pierre d'Herbemont and VideoLAN
+ * Copyright (C) 2010-2012, 2014 Pierre d'Herbemont and VideoLAN
  *
  * Authors: Pierre d'Herbemont
  *
@@ -56,6 +56,14 @@ static vlc_object_t *libvlc_get_vlc_instance(libvlc_instance_t *instance)
 
 #define _instance ((extensions_manager_t *)instance)
 
+@interface VLCExtensionsManager ()
+{
+    void *instance;
+    NSMutableArray *_extensions;
+    VLCMediaPlayer *_player;
+    void *_previousInput;
+}
+@end
 
 @implementation VLCExtensionsManager
 

+ 31 - 22
Sources/VLCMediaDiscoverer.m

@@ -2,7 +2,7 @@
  * VLCMediaDiscoverer.m: VLCKit.framework VLCMediaDiscoverer implementation
  *****************************************************************************
  * Copyright (C) 2007 Pierre d'Herbemont
- * Copyright (C) 2007 VLC authors and VideoLAN
+ * Copyright (C) 2007, 2014 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
@@ -29,6 +29,15 @@
 
 #include <vlc/libvlc.h>
 
+@interface VLCMediaDiscoverer ()
+{
+    NSString * _localizedName;
+    VLCMediaList * _discoveredMedia;
+    void * _mdis;
+    BOOL _running;
+}
+@end
+
 static NSArray * availableMediaDiscoverer = nil;     // Global list of media discoverers
 
 /**
@@ -88,32 +97,32 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use
 - (instancetype)initWithName:(NSString *)aServiceName
 {
     if (self = [super init]) {
-        localizedName = nil;
-        discoveredMedia = nil;
+        _localizedName = nil;
+        _discoveredMedia = nil;
 
         _privateLibrary = [VLCLibrary sharedLibrary];
         libvlc_retain([_privateLibrary instance]);
 
-        mdis = libvlc_media_discoverer_new_from_name([_privateLibrary instance],
+        _mdis = libvlc_media_discoverer_new_from_name([_privateLibrary instance],
                                                      [aServiceName UTF8String]);
-        NSAssert(mdis, @"No such media discoverer");
-        libvlc_event_manager_t * p_em = libvlc_media_discoverer_event_manager(mdis);
+        NSAssert(_mdis, @"No such media discoverer");
+        libvlc_event_manager_t * p_em = libvlc_media_discoverer_event_manager(_mdis);
         libvlc_event_attach(p_em, libvlc_MediaDiscovererStarted, HandleMediaDiscovererStarted, (__bridge void *)(self));
         libvlc_event_attach(p_em, libvlc_MediaDiscovererEnded,   HandleMediaDiscovererEnded,   (__bridge void *)(self));
 
-        running = libvlc_media_discoverer_is_running(mdis);
+        _running = libvlc_media_discoverer_is_running(_mdis);
     }
     return self;
 }
 
 - (void)dealloc
 {
-    libvlc_event_manager_t *em = libvlc_media_list_event_manager(mdis);
+    libvlc_event_manager_t *em = libvlc_media_list_event_manager(_mdis);
     libvlc_event_detach(em, libvlc_MediaDiscovererStarted, HandleMediaDiscovererStarted, (__bridge void *)(self));
     libvlc_event_detach(em, libvlc_MediaDiscovererEnded,   HandleMediaDiscovererEnded,   (__bridge void *)(self));
     [[VLCEventManager sharedManager] cancelCallToObject:self];
 
-    libvlc_media_discoverer_release( mdis );
+    libvlc_media_discoverer_release( _mdis );
 
     libvlc_release(_privateLibrary.instance);
 
@@ -121,46 +130,46 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use
 
 - (VLCMediaList *) discoveredMedia
 {
-    if (discoveredMedia)
-        return discoveredMedia;
+    if (_discoveredMedia)
+        return _discoveredMedia;
 
-    libvlc_media_list_t * p_mlist = libvlc_media_discoverer_media_list( mdis );
+    libvlc_media_list_t * p_mlist = libvlc_media_discoverer_media_list( _mdis );
     VLCMediaList * ret = [VLCMediaList mediaListWithLibVLCMediaList:p_mlist];
     libvlc_media_list_release( p_mlist );
 
-    discoveredMedia = ret;
-    return discoveredMedia;
+    _discoveredMedia = ret;
+    return _discoveredMedia;
 }
 
 - (NSString *)localizedName
 {
-    if (localizedName)
-        return localizedName;
+    if (_localizedName)
+        return _localizedName;
 
-    char * name = libvlc_media_discoverer_localized_name( mdis );
+    char * name = libvlc_media_discoverer_localized_name( _mdis );
     if (name) {
-        localizedName = @(name);
+        _localizedName = @(name);
         free( name );
     }
-    return localizedName;
+    return _localizedName;
 }
 
 - (BOOL)isRunning
 {
-    return running;
+    return _running;
 }
 
 - (void)_mediaDiscovererStarted
 {
     [self willChangeValueForKey:@"running"];
-    running = YES;
+    _running = YES;
     [self didChangeValueForKey:@"running"];
 }
 
 - (void)_mediaDiscovererEnded
 {
     [self willChangeValueForKey:@"running"];
-    running = NO;
+    _running = NO;
     [self didChangeValueForKey:@"running"];
 }
 @end

+ 10 - 6
Sources/VLCMediaLibrary.m

@@ -2,7 +2,7 @@
  * VLCMediaLibrary.m: VLCKit.framework VLCMediaLibrary implementation
  *****************************************************************************
  * Copyright (C) 2007 Pierre d'Herbemont
- * Copyright (C) 2007 VLC authors and VideoLAN
+ * Copyright (C) 2007, 2014 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
@@ -31,6 +31,10 @@
 
 @interface VLCMediaLibrary ()
 
+{
+    void *_mlib;
+}
+
 @property (nonatomic) dispatch_once_t once;
 @property (nonatomic, readwrite, strong) VLCMediaList * allMedia;
 
@@ -53,22 +57,22 @@
 - (instancetype)init
 {
     if (self = [super init]) {
-        mlib = libvlc_media_library_new( [VLCLibrary sharedInstance]);
-        libvlc_media_library_load( mlib );
+        _mlib = libvlc_media_library_new( [VLCLibrary sharedInstance]);
+        libvlc_media_library_load( _mlib );
     }
     return self;
 }
 
 - (void)dealloc
 {
-    libvlc_media_library_release(mlib);
-    mlib = nil;     // make sure that the pointer is dead
+    libvlc_media_library_release(_mlib);
+    _mlib = nil;     // make sure that the pointer is dead
 }
 
 - (VLCMediaList *)allMedia
 {
     dispatch_once(&_once, ^{
-        libvlc_media_list_t * p_mlist = libvlc_media_library_media_list( mlib );
+        libvlc_media_list_t * p_mlist = libvlc_media_library_media_list( _mlib );
         _allMedia = [VLCMediaList mediaListWithLibVLCMediaList:p_mlist];
         libvlc_media_list_release(p_mlist);
     });

+ 13 - 8
Sources/VLCStreamOutput.m

@@ -2,7 +2,7 @@
  * VLCStreamOutput.m: VLCKit.framework VLCStreamOutput implementation
  *****************************************************************************
  * Copyright (C) 2008 Pierre d'Herbemont
- * Copyright (C) 2008 VLC authors and VideoLAN
+ * Copyright (C) 2008, 2014 VLC authors and VideoLAN
  * Copyright (C) 2012 Brendon Justin
  * $Id$
  *
@@ -27,13 +27,18 @@
 #import "VLCStreamOutput.h"
 #import "VLCLibVLCBridging.h"
 
+@interface VLCStreamOutput ()
+{
+    NSMutableDictionary *_options;
+}
+@end
+
 @implementation VLCStreamOutput
 - (instancetype)initWithOptionDictionary:(NSDictionary *)dictionary
 {
-    if( self = [super init] )
-    {
-        options = [dictionary mutableCopy];
-    }
+    if (self = [super init])
+        _options = [dictionary mutableCopy];
+
     return self;
 }
 - (NSString *)description
@@ -137,7 +142,7 @@
     NSString * representedOptions;
     NSMutableArray * subOptions = [NSMutableArray array];
     NSMutableArray * optionsAsArray = [NSMutableArray array];
-    NSDictionary * transcodingOptions = options[@"transcodingOptions"];
+    NSDictionary * transcodingOptions = _options[@"transcodingOptions"];
     if( transcodingOptions )
     {
         NSString * videoCodec = transcodingOptions[@"videoCodec"];
@@ -170,7 +175,7 @@
         [subOptions removeAllObjects];
     }
 
-    NSDictionary * outputOptions = options[@"outputOptions"];
+    NSDictionary * outputOptions = _options[@"outputOptions"];
     if( outputOptions )
     {
         NSString * muxer = outputOptions[@"muxer"];
@@ -189,7 +194,7 @@
         [subOptions removeAllObjects];
     }
 
-    NSDictionary * rtpOptions = options[@"rtpOptions"];
+    NSDictionary * rtpOptions = _options[@"rtpOptions"];
     if( rtpOptions )
     {
         NSString * muxer = rtpOptions[@"muxer"];