Bladeren bron

media player: add selector to query for the number of chapters, rename previous title count selector

Felix Paul Kühne 10 jaren geleden
bovenliggende
commit
2cb98b1512
3 gewijzigde bestanden met toevoegingen van 17 en 4 verwijderingen
  1. 3 1
      Headers/Public/VLCMediaPlayer.h
  2. 4 3
      NEWS
  3. 10 0
      Sources/VLCMediaPlayer.m

+ 3 - 1
Headers/Public/VLCMediaPlayer.h

@@ -358,6 +358,7 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
 @property (readwrite) int currentChapterIndex;
 - (void)previousChapter;
 - (void)nextChapter;
+- (int)numberOfChaptersForTitle:(int)titleIndex;
 - (NSArray *)chaptersForTitleIndex:(int)titleIndex __attribute__((deprecated));
 
 extern NSString *const VLCChapterDescriptionName;
@@ -378,7 +379,8 @@ extern NSString *const VLCChapterDescriptionDuration;
  * \return NSNotFound if none is set.
  */
 @property (readwrite) int currentTitleIndex;
-@property (readonly) NSUInteger countOfTitles;
+@property (readonly) int numberOfTitles;
+@property (readonly) NSUInteger countOfTitles __attribute__((deprecated));
 @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *titles __attribute__((deprecated));
 
 extern NSString *const VLCTitleDescriptionName;

+ 4 - 3
NEWS

@@ -5,8 +5,9 @@ New APIs:
   - added properties: debugLogging, debugLoggingLevel
 
 - VLCMediaPlayer
-  - added properties: titleDescriptions, indexOfLongestTitle
-  - added selector: chaptersForTitleIndex:
+  - added properties: titleDescriptions, indexOfLongestTitle, numberOfTitles
+  - added selectors: chaptersForTitleIndex:
+                     numberOfChaptersForTitle:
 
 - VLCMedia
   - added keys: VLCMetaInformationTrackTotal, VLCMetaInformationDirector,
@@ -20,7 +21,7 @@ New APIs:
 
 Deprecated APIs:
 - VLCMediaPlayer
-  - titles, chaptersForTitleIndex:
+  - titles, chaptersForTitleIndex:, countOfTitles
 
 Version 2.2.2:
 --------------

+ 10 - 0
Sources/VLCMediaPlayer.m

@@ -695,6 +695,11 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
     return libvlc_media_player_get_title(_playerInstance);
 }
 
+- (int)numberOfTitles
+{
+    return libvlc_media_player_get_title_count(_playerInstance);
+}
+
 - (NSUInteger)countOfTitles
 {
     NSUInteger result = libvlc_media_player_get_title_count(_playerInstance);
@@ -781,6 +786,11 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
     return currentlyFoundTitle;
 }
 
+- (int)numberOfChaptersForTitle:(int)titleIndex
+{
+    return libvlc_media_player_get_chapter_count_for_title(_playerInstance, titleIndex);
+}
+
 - (NSArray *)chapterDescriptionsOfTitle:(int)titleIndex
 {
     libvlc_chapter_description_t **chapterDescriptions;