Commit 55f19bbc authored by Felix Paul Kühne's avatar Felix Paul Kühne

osx/framework: added methods to access end-user-compliant names of subtitles, audio tracks, etc.

parent 3154a8b7
...@@ -107,8 +107,9 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state); ...@@ -107,8 +107,9 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
- (char *)videoAspectRatio; - (char *)videoAspectRatio;
- (void)setVideoSubTitles:(int)value; - (void)setVideoSubTitles:(int)value;
- (int)countOfVideoSubTitles; - (int)countOfVideoSubTitles;
- (int)currentVideoSubTitles;
- (BOOL)openVideoSubTitlesFromFile:(NSString *)path; - (BOOL)openVideoSubTitlesFromFile:(NSString *)path;
- (int)currentVideoSubTitles;
- (NSArray *)videoSubTitles;
- (void)setVideoCropGeometry:(char *)value; - (void)setVideoCropGeometry:(char *)value;
- (char *)videoCropGeometry; - (char *)videoCropGeometry;
...@@ -163,15 +164,18 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state); ...@@ -163,15 +164,18 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
- (void)setChapter:(int)value; - (void)setChapter:(int)value;
- (int)currentChapter; - (int)currentChapter;
- (int)countOfChapters; - (int)countOfChapters;
- (NSArray *)chaptersForTitle:(int)title;
- (void)setCurrentTitle:(int)value; - (void)setCurrentTitle:(int)value;
- (int)currentTitle; - (int)currentTitle;
- (int)countOfTitles; - (int)countOfTitles;
- (NSArray *)titles;
/* Audio Options */ /* Audio Options */
- (void)setAudioTrack:(int)value; - (void)setAudioTrack:(int)value;
- (int)currentAudioTrack; - (int)currentAudioTrack;
- (int)countOfAudioTracks; - (int)countOfAudioTracks;
- (NSArray *)audioTracks;
- (void)setAudioChannel:(int)value; - (void)setAudioChannel:(int)value;
- (int)audioChannel; - (int)audioChannel;
......
...@@ -297,16 +297,8 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -297,16 +297,8 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init( &ex ); libvlc_exception_init( &ex );
int result = libvlc_video_get_spu( instance, &ex ); int result = libvlc_video_get_spu( instance, &ex );
if (libvlc_exception_raised(&ex)) catch_exception( &ex );
{ return result;
libvlc_exception_clear(&ex);
return -1;
}
else
{
libvlc_exception_clear(&ex);
return result;
}
} }
- (BOOL)openVideoSubTitlesFromFile:(NSString *)path - (BOOL)openVideoSubTitlesFromFile:(NSString *)path
...@@ -318,6 +310,21 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -318,6 +310,21 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
return result; return result;
} }
- (NSArray *)videoSubTitles
{
libvlc_exception_t ex;
libvlc_exception_init( &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++)
{
[tempArray addObject:[NSString stringWithUTF8String: tracks->psz_name]];
tracks = tracks->p_next;
}
return [NSArray arrayWithArray: tempArray];
}
- (void)setVideoCropGeometry:(char *)value - (void)setVideoCropGeometry:(char *)value
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
...@@ -493,6 +500,21 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -493,6 +500,21 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
catch_exception( &ex ); catch_exception( &ex );
} }
- (NSArray *)chaptersForTitle:(int)title
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
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++)
{
[tempArray addObject:[NSString stringWithUTF8String: tracks->psz_name]];
tracks = tracks->p_next;
}
return [NSArray arrayWithArray: tempArray];
}
- (void)setCurrentTitle:(int)value - (void)setCurrentTitle:(int)value
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
...@@ -519,6 +541,21 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -519,6 +541,21 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
return result; return result;
} }
- (NSArray *)titles
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
libvlc_track_description_t *tracks = libvlc_video_get_title_description( instance, &ex );
NSMutableArray *tempArray = [NSMutableArray array];
NSInteger i;
for (i = 0; i < [self countOfTitles] ; i++)
{
[tempArray addObject:[NSString stringWithUTF8String: tracks->psz_name]];
tracks = tracks->p_next;
}
return [NSArray arrayWithArray: tempArray];
}
- (void)setAudioTrack:(int)value - (void)setAudioTrack:(int)value
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
...@@ -545,6 +582,22 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void * ...@@ -545,6 +582,22 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
return result; return result;
} }
- (NSArray *)audioTracks
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
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++)
{
[tempArray addObject:[NSString stringWithUTF8String: tracks->psz_name]];
tracks = tracks->p_next;
}
return [NSArray arrayWithArray: tempArray];
}
- (void)setAudioChannel:(int)value - (void)setAudioChannel:(int)value
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
......
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