- (void)setVideoAspectRatio:(char *)value;
- (char *)videoAspectRatio;
-- (void)setVideoSubTitles:(int)value;
-- (int)countOfVideoSubTitles;
-- (BOOL)openVideoSubTitlesFromFile:(NSString *)path;
-- (int)currentVideoSubTitles;
-- (NSArray *)videoSubTitles;
- (void)setVideoCropGeometry:(char *)value;
- (char *)videoCropGeometry;
@property (readonly) VLCTime *remainingTime;
@property (readonly) int fps;
-- (void)setChapter:(int)value;
-- (int)currentChapter;
-- (int)countOfChapters;
-- (NSArray *)chaptersForTitle:(int)title;
+/**
+ * Return the current video subtitle index, or
+ * \return NSNotFound if none is set.
+ *
+ * To disable subtitle pass NSNotFound.
+ */
+@property (readwrite) NSUInteger currentVideoSubTitleIndex;
+- (NSArray *)videoSubTitles;
+
+/**
+ * Load and set a specific video subtitle, from a file.
+ * \param path to a file
+ * \return if the call succeed..
+ */
+- (BOOL)openVideoSubTitlesFromFile:(NSString *)path;
-- (void)setCurrentTitle:(int)value;
-- (int)currentTitle;
-- (int)countOfTitles;
+/**
+ * Chapter selection and enumeration, it is bound
+ * to a title option.
+ */
+
+/**
+ * Return the current video subtitle index, or
+ * \return NSNotFound if none is set.
+ *
+ * To disable subtitle pass NSNotFound.
+ */
+@property (readwrite) NSUInteger currentChapterIndex;
+- (void)previousChapter;
+- (void)nextChapter;
+- (NSArray *)chaptersForTitleIndex:(NSUInteger)titleIndex;
+
+/**
+ * Title selection and enumeration
+ * \return NSNotFound if none is set.
+ */
+@property (readwrite) NSUInteger currentTitleIndex;
- (NSArray *)titles;
/* Audio Options */
-- (void)setAudioTrack:(int)value;
-- (int)currentAudioTrack;
-- (int)countOfAudioTracks;
+@property (readwrite) NSUInteger currentAudioTrackIndex;
- (NSArray *)audioTracks;
- (void)setAudioChannel:(int)value;
return [[VLCLibrary sharedLibrary] audio];
}
-- (void)setVideoAspectRatio:(char *)value
-{
- libvlc_exception_t ex;
- libvlc_exception_init( &ex );
- libvlc_video_set_aspect_ratio( instance, value, &ex );
- catch_exception( &ex );
-}
-
-- (char *)videoAspectRatio
-{
- libvlc_exception_t ex;
- libvlc_exception_init( &ex );
- char * result = libvlc_video_get_aspect_ratio( instance, &ex );
- catch_exception( &ex );
- return result;
-}
+#pragma mark -
+#pragma mark Subtitles
-- (void)setVideoSubTitles:(int)value
+- (void)setCurrentVideoSubTitleIndex:(NSUInteger)index
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
- libvlc_video_set_spu( instance, value, &ex );
+ libvlc_video_set_spu( instance, (int)index, &ex );
catch_exception( &ex );
}
-- (int)countOfVideoSubTitles
+- (NSUInteger)currentVideoSubTitleIndex
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
- int result = libvlc_video_get_spu_count( instance, &ex );
+ int count = libvlc_video_get_spu_count( instance, &ex );
catch_exception( &ex );
- return result;
-}
-
-- (int)currentVideoSubTitles
-{
- libvlc_exception_t ex;
- libvlc_exception_init( &ex );
- int result = libvlc_video_get_spu( instance, &ex );
+ if (count <= 0)
+ return NSNotFound;
+ NSUInteger result = libvlc_video_get_spu( instance, &ex );
catch_exception( &ex );
return result;
}
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
+ int count = libvlc_video_get_spu_count( instance, &ex );
+ catch_exception( &ex );
+
libvlc_track_description_t *tracks = libvlc_video_get_spu_description( instance, &ex );
NSMutableArray *tempArray = [NSMutableArray array];
NSInteger i;
- for (i = 0; i < [self countOfVideoSubTitles] ; i++)
+ for (i = 0; i < count; i++)
{
[tempArray addObject:[NSString stringWithUTF8String: tracks->psz_name]];
tracks = tracks->p_next;
return [NSArray arrayWithArray: tempArray];
}
+
+#pragma mark -
+#pragma mark Video Crop geometry
+
- (void)setVideoCropGeometry:(char *)value
{
libvlc_exception_t ex;
return result;
}
+- (void)setVideoAspectRatio:(char *)value
+{
+ libvlc_exception_t ex;
+ libvlc_exception_init( &ex );
+ libvlc_video_set_aspect_ratio( instance, value, &ex );
+ catch_exception( &ex );
+}
+
+- (char *)videoAspectRatio
+{
+ libvlc_exception_t ex;
+ libvlc_exception_init( &ex );
+ char * result = libvlc_video_get_aspect_ratio( instance, &ex );
+ catch_exception( &ex );
+ return result;
+}
+
- (void)setVideoTeleText:(int)value
{
libvlc_exception_t ex;
return result;
}
-- (void)setChapter:(int)value;
+#pragma mark -
+#pragma mark Chapters
+- (void)setCurrentChapterIndex:(NSUInteger)value;
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
catch_exception( &ex );
}
-- (int)currentChapter
+- (NSUInteger)currentChapterIndex
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
- int result = libvlc_media_player_get_chapter( instance, &ex );
+ int count = libvlc_media_player_get_chapter_count( instance, &ex );
catch_exception( &ex );
- return result;
-}
-
-- (int)countOfChapters
-{
- libvlc_exception_t ex;
- libvlc_exception_init( &ex );
- int result = libvlc_media_player_get_chapter_count( instance, &ex );
+ if (count <= 0)
+ return NSNotFound;
+ NSUInteger result = libvlc_media_player_get_chapter( instance, &ex );
catch_exception( &ex );
return result;
}
catch_exception( &ex );
}
-- (NSArray *)chaptersForTitle:(int)title
+- (NSArray *)chaptersForTitleIndex:(NSUInteger)title
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
+ int count = libvlc_media_player_get_chapter_count(instance, &ex);
+ if (count <= 0)
+ return [NSArray array];
+
libvlc_track_description_t *tracks = libvlc_video_get_chapter_description( instance, title, &ex );
NSMutableArray *tempArray = [NSMutableArray array];
NSInteger i;
- for (i = 0; i < [self countOfChapters] ; i++)
+ for (i = 0; i < count ; i++)
{
[tempArray addObject:[NSString stringWithUTF8String: tracks->psz_name]];
tracks = tracks->p_next;
return [NSArray arrayWithArray: tempArray];
}
-- (void)setCurrentTitle:(int)value
+#pragma mark -
+#pragma mark Titles
+
+- (void)setCurrentTitleIndex:(NSUInteger)value
{
libvlc_exception_t ex;
- libvlc_exception_init( &ex );
+ libvlc_exception_init( &ex );
libvlc_media_player_set_title( instance, value, &ex );
catch_exception( &ex );
}
-- (int)currentTitle
+- (NSUInteger)currentTitleIndex
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
- int result = libvlc_media_player_get_title( instance, &ex );
+
+ int count = libvlc_media_player_get_title_count( instance, &ex );
+ catch_exception( &ex );
+ if (count <= 0)
+ return NSNotFound;
+
+ NSUInteger result = libvlc_media_player_get_title( instance, &ex );
catch_exception( &ex );
return result;
}
return [NSArray arrayWithArray: tempArray];
}
-- (void)setAudioTrack:(int)value
+#pragma mark -
+#pragma mark Audio tracks
+- (void)setCurrentAudioTrackIndex:(NSUInteger)value
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
- libvlc_audio_set_track( instance, value, &ex );
+ libvlc_audio_set_track( instance, (int)value, &ex );
catch_exception( &ex );
}
-- (int)currentAudioTrack
+- (NSUInteger)currentAudioTrackIndex
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
- int result = libvlc_audio_get_track( instance, &ex );
+ int count = libvlc_audio_get_track_count( instance, &ex );
catch_exception( &ex );
- return result;
-}
-
-- (int)countOfAudioTracks
-{
- libvlc_exception_t ex;
- libvlc_exception_init( &ex );
- int result = libvlc_audio_get_track_count( instance, &ex );
+ if (count <= 0)
+ return NSNotFound;
+
+ NSUInteger result = libvlc_audio_get_track( instance, &ex );
catch_exception( &ex );
return result;
}
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
+ int count = libvlc_audio_get_track_count( instance, &ex );
+ catch_exception( &ex );
+ if (count <= 0)
+ return [NSArray array];
+
libvlc_track_description_t *tracks = libvlc_audio_get_track_description( instance, &ex );
NSMutableArray *tempArray = [NSMutableArray array];
NSInteger i;
- for (i = 0; i < [self countOfAudioTracks] ; i++)
+ for (i = 0; i < count ; i++)
{
[tempArray addObject:[NSString stringWithUTF8String: tracks->psz_name]];
tracks = tracks->p_next;