浏览代码

Partially update external API and most importantly internal libvlc use to v4

This removes API explicitly deprecated in v3
Felix Paul Kühne 6 年之前
父节点
当前提交
0ef540888e

+ 0 - 6
Headers/Public/VLCMediaDiscoverer.h

@@ -102,12 +102,6 @@ extern NSString *const VLCMediaDiscovererCategory;
 @property (weak, readonly) VLCMediaList *discoveredMedia;
 
 /**
- * localized name of the discovery module if available, otherwise in US English
- * \deprecated Will be removed in the next major release, may return an empty string for binary compatibility
- */
-@property (readonly, copy) NSString *localizedName __attribute__((deprecated));
-
-/**
  * read-only property to check if the discovery service is active
  * \return boolean value
  */

+ 5 - 28
Headers/Public/VLCMediaPlayer.h

@@ -233,12 +233,12 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
 @property (NS_NONATOMIC_IOSONLY) char *videoAspectRatio;
 
 /**
- * Set/Get current crop filter geometry.
- *
- * param: psz_geometry new crop filter geometry (NULL to unset)
- * \return the crop filter geometry or NULL if unset
+ * This function forces a crop ratio on any and all video tracks rendered by
+ * the media player. If the display aspect ratio of a video does not match the
+ * crop ratio, either the top and bottom, or the left and right of the video
+ * will be cut out to fit the crop ratio.
  */
-@property (NS_NONATOMIC_IOSONLY) char *videoCropGeometry;
+- (void)setCropRatioWithNumerator:(unsigned int)numerator denominator:(unsigned int)denominator;
 
 /**
  * Set/Get the current video scaling factor.
@@ -490,12 +490,6 @@ typedef NS_ENUM(unsigned, VLCMediaPlaybackSlaveType)
 - (int)numberOfChaptersForTitle:(int)titleIndex;
 
 /**
- * Chapters of a given title index
- * \deprecated Use chapterDescriptionsOfTitle instead
- */
-- (NSArray *)chaptersForTitleIndex:(int)titleIndex __attribute__((deprecated));
-
-/**
  * dictionary value for the user-facing chapter name
  */
 extern NSString *const VLCChapterDescriptionName;
@@ -532,17 +526,6 @@ extern NSString *const VLCChapterDescriptionDuration;
 @property (readonly) int numberOfTitles;
 
 /**
- * count of titles
- * \deprecated Use numberOfTitles instead
- */
-@property (readonly) NSUInteger countOfTitles __attribute__((deprecated));
-/**
- * array of available titles
- * \deprecated Use titleDescriptions instead
- */
-@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *titles __attribute__((deprecated));
-
-/**
  * dictionary value for the user-facing title name
  */
 extern NSString *const VLCTitleDescriptionName;
@@ -835,12 +818,6 @@ extern NSString *const VLCTitleDescriptionIsMenu;
 @property (NS_NONATOMIC_IOSONLY, getter=isPlaying, readonly) BOOL playing;
 
 /**
- * Playback state flag identifying wheather the stream will play.
- * \return TRUE if the feed is ready for playback, FALSE if otherwise.
- */
-@property (NS_NONATOMIC_IOSONLY, readonly) BOOL willPlay;
-
-/**
  * Playback's current state.
  * \see VLCMediaState
  */

+ 0 - 18
Sources/VLCMediaDiscoverer.m

@@ -39,7 +39,6 @@ NSString *const VLCMediaDiscovererCategory = @"VLCMediaDiscovererCategory";
 
 @interface VLCMediaDiscoverer ()
 {
-    NSString *_localizedName;
     VLCMediaList *_discoveredMedia;
     libvlc_media_discoverer_t *_mdis;
 
@@ -91,7 +90,6 @@ NSString *const VLCMediaDiscovererCategory = @"VLCMediaDiscovererCategory";
 - (instancetype)initWithName:(NSString *)aServiceName libraryInstance:(VLCLibrary *)libraryInstance
 {
     if (self = [super init]) {
-        _localizedName = nil;
         _discoveredMedia = nil;
         _libVLCBackgroundQueue = dispatch_queue_create("libvlcQueue", DISPATCH_QUEUE_SERIAL);
 
@@ -161,22 +159,6 @@ NSString *const VLCMediaDiscovererCategory = @"VLCMediaDiscovererCategory";
     return _discoveredMedia;
 }
 
-- (NSString *)localizedName
-{
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated"
-    if (_localizedName)
-        return _localizedName;
-
-    char *name = libvlc_media_discoverer_localized_name(_mdis);
-    if (name) {
-        _localizedName = @(name);
-        free(name);
-    }
-    return _localizedName;
-#pragma clang diagnostic pop
-}
-
 - (BOOL)isRunning
 {
     return libvlc_media_discoverer_is_running(_mdis);;

+ 1 - 1
Sources/VLCMediaListPlayer.m

@@ -222,7 +222,7 @@ static void HandleMediaListPlayerStopped(const libvlc_event_t * event, void * se
 - (void)stop
 {
     dispatch_async(_libVLCBackgroundQueue, ^{
-        libvlc_media_list_player_stop(instance);
+        libvlc_media_list_player_stop_async(instance);
     });
 }
 

+ 7 - 75
Sources/VLCMediaPlayer.m

@@ -2,8 +2,8 @@
  * VLCMediaPlayer.m: VLCKit.framework VLCMediaPlayer implementation
  *****************************************************************************
  * Copyright (C) 2007-2009 Pierre d'Herbemont
- * Copyright (C) 2007-2015 VLC authors and VideoLAN
- * Partial Copyright (C) 2009-2017 Felix Paul Kühne
+ * Copyright (C) 2007-2019 VLC authors and VideoLAN
+ * Partial Copyright (C) 2009-2019 Felix Paul Kühne
  * $Id$
  *
  * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
@@ -545,15 +545,9 @@ static void HandleMediaPlayerRecord(const libvlc_event_t * event, void * self)
 #pragma mark -
 #pragma mark Video Crop geometry
 
-- (void)setVideoCropGeometry:(char *)value
+- (void)setCropRatioWithNumerator:(unsigned int)numerator denominator:(unsigned int)denominator
 {
-    libvlc_video_set_crop_geometry(_playerInstance, value);
-}
-
-- (char *)videoCropGeometry
-{
-    char * result = libvlc_video_get_crop_geometry(_playerInstance);
-    return result;
+    libvlc_video_set_crop_ratio(_playerInstance, numerator, denominator);
 }
 
 - (void)setVideoAspectRatio:(char *)value
@@ -701,7 +695,7 @@ static void HandleMediaPlayerRecord(const libvlc_event_t * event, void * self)
 {
     // Time is managed in seconds, while duration is managed in microseconds
     // TODO: Redo VLCTime to provide value numberAsMilliseconds, numberAsMicroseconds, numberAsSeconds, numberAsMinutes, numberAsHours
-    libvlc_media_player_set_time(_playerInstance, value ? [[value value] longLongValue] : 0);
+    libvlc_media_player_set_time(_playerInstance, value ? [[value value] longLongValue] : 0, NO);
 }
 
 - (VLCTime *)time
@@ -740,27 +734,6 @@ static void HandleMediaPlayerRecord(const libvlc_event_t * event, void * self)
     libvlc_media_player_previous_chapter(_playerInstance);
 }
 
-- (NSArray *)chaptersForTitleIndex:(int)title
-{
-    NSInteger count = libvlc_media_player_get_chapter_count(_playerInstance);
-    if (count <= 0)
-        return @[];
-
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated"
-    libvlc_track_description_t *firstTrack = libvlc_video_get_chapter_description(_playerInstance, title);
-    libvlc_track_description_t *currentTrack = firstTrack;
-#pragma clang diagnostic push
-
-    NSMutableArray *tempArray = [NSMutableArray array];
-    for (NSInteger i = 0; i < count ; i++) {
-        [tempArray addObject:@(currentTrack->psz_name)];
-        currentTrack = currentTrack->p_next;
-    }
-    libvlc_track_description_list_release(firstTrack);
-    return [NSArray arrayWithArray:tempArray];
-}
-
 #pragma mark -
 #pragma mark Titles
 
@@ -783,42 +756,6 @@ static void HandleMediaPlayerRecord(const libvlc_event_t * event, void * self)
     return libvlc_media_player_get_title_count(_playerInstance);
 }
 
-- (NSUInteger)countOfTitles
-{
-    NSUInteger result = libvlc_media_player_get_title_count(_playerInstance);
-    return result;
-}
-
-- (NSArray *)titles
-{
-    NSUInteger count = [self countOfTitles];
-    if (count == 0)
-        return [NSArray array];
-
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated"
-    libvlc_track_description_t *firstTrack = libvlc_video_get_title_description(_playerInstance);
-    libvlc_track_description_t *currentTrack = firstTrack;
-#pragma clang diagnostic pop
-
-    if (!currentTrack)
-        return [NSArray array];
-
-    NSMutableArray *tempArray = [NSMutableArray array];
-
-    while (1) {
-        if (currentTrack->psz_name != nil)
-            [tempArray addObject:@(currentTrack->psz_name)];
-        if (currentTrack->p_next)
-            currentTrack = currentTrack->p_next;
-        else
-            break;
-    }
-
-    libvlc_track_description_list_release(firstTrack);
-    return [NSArray arrayWithArray: tempArray];
-}
-
 - (NSArray *)titleDescriptions
 {
     libvlc_title_description_t **titleInfo;
@@ -1118,7 +1055,7 @@ static void HandleMediaPlayerRecord(const libvlc_event_t * event, void * self)
 - (void)stop
 {
     dispatch_async(_libVLCBackgroundQueue, ^{
-        libvlc_media_player_stop(_playerInstance);
+        libvlc_media_player_stop_async(_playerInstance);
     });
 }
 
@@ -1271,11 +1208,6 @@ static void HandleMediaPlayerRecord(const libvlc_event_t * event, void * self)
     return libvlc_media_player_is_playing(_playerInstance);
 }
 
-- (BOOL)willPlay
-{
-    return libvlc_media_player_will_play(_playerInstance);
-}
-
 - (VLCMediaPlayerState)state
 {
     return _cachedState;
@@ -1288,7 +1220,7 @@ static void HandleMediaPlayerRecord(const libvlc_event_t * event, void * self)
 
 - (void)setPosition:(float)newPosition
 {
-    libvlc_media_player_set_position(_playerInstance, newPosition);
+    libvlc_media_player_set_position(_playerInstance, newPosition, NO);
 }
 
 - (BOOL)isSeekable

+ 4 - 4
Sources/VLCMediaThumbnailer.m

@@ -281,16 +281,16 @@ static void display(void *opaque, void *picture)
 
     // Make sure we are getting the right frame
     if (position < self.snapshotPosition && _numberOfReceivedFrames < 2) {
-        libvlc_media_player_set_position(_mp, self.snapshotPosition);
+        libvlc_media_player_set_position(_mp, self.snapshotPosition, YES);
         return;
     }
     if ((length < kStandardStartTime * 2 && _numberOfReceivedFrames < 5) && self.snapshotPosition == kSnapshotPosition) {
-        libvlc_media_player_set_position(_mp, kSnapshotPosition);
+        libvlc_media_player_set_position(_mp, kSnapshotPosition, YES);
         return;
     }
     if ((position <= 0.05 && _numberOfReceivedFrames < 8) && length > 1000) {
         // Arbitrary choice to work around broken files.
-        libvlc_media_player_set_position(_mp, kSnapshotPosition);
+        libvlc_media_player_set_position(_mp, kSnapshotPosition, YES);
         return;
     }
     // it isn't always best what comes first
@@ -332,7 +332,7 @@ static void display(void *opaque, void *picture)
 - (void)stopAsync
 {
     if (_mp) {
-        libvlc_media_player_stop(_mp);
+        libvlc_media_player_stop_async(_mp);
         libvlc_media_player_release(_mp);
         _mp = NULL;
     }

+ 1 - 1
Sources/VLCTranscoder.m

@@ -111,7 +111,7 @@
 {
     if (_p_mp) {
         [self unregisterObserversForMuxWithPlayer:_p_mp];
-        libvlc_media_player_stop( _p_mp );
+        libvlc_media_player_stop_async( _p_mp );
         if (self.delegate && [self.delegate respondsToSelector:@selector(transcode:finishedSucessfully:)]) {
             BOOL success = ![newState isEqualToNumber: @(VLCMediaPlayerStateError)];
             [self.delegate transcode:self finishedSucessfully:success];