Commit 168999a1 authored by Felix Paul Kühne's avatar Felix Paul Kühne

VLCMediaPlayer: expand the API to switch / disable video tracks in similar fashion to SPU and Audio

parent 328204c6
......@@ -3,7 +3,7 @@
*****************************************************************************
* Copyright (C) 2007-2009 Pierre d'Herbemont
* Copyright (C) 2007-2009 VLC authors and VideoLAN
* Partial Copyright (C) 2009 Felix Paul Kühne
* Copyright (C) 2009-2013 Felix Paul Kühne
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
......@@ -166,6 +166,23 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
@property (readonly) VLCTime *remainingTime;
@property (readonly) NSUInteger fps;
/**
* Return the current video track index
* Note that the handled values do not match the videoTracks array indexes
* but refer to VLCMedia's VLCMediaTracksInformationId.
* \return 0 if none is set.
*
* Pass 0 to disable.
*/
@property (readwrite) NSUInteger currentVideoTrackIndex;
/**
* Return the video tracks
*
* It includes the disabled fake track at index 0.
*/
- (NSArray *)videoTracks;
/**
* Return the current video subtitle index
* Note that the handled values do not match the videoSubTitles array indexes
......
......@@ -271,6 +271,42 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
return audio;
}
#pragma mark -
#pragma mark Video Tracks
- (void)setCurrentVideoTrackIndex:(NSUInteger)value
{
libvlc_video_set_track(instance, (int)value);
}
- (NSUInteger)currentVideoTrackIndex
{
NSInteger count = libvlc_video_get_track_count(instance);
if (count <= 0)
return NSNotFound;
NSUInteger result = libvlc_video_get_track(instance);
return result;
}
- (NSArray *)videoTracks
{
NSInteger count = libvlc_video_get_track_count(instance);
if (count <= 0)
return [NSArray array];
libvlc_track_description_t *tracks = libvlc_video_get_track_description(instance);
NSMutableArray *tempArray = [NSMutableArray array];
NSUInteger i;
for (i = 0; i < count ; i++)
{
[tempArray addObject:[NSString stringWithUTF8String: tracks->psz_name]];
tracks = tracks->p_next;
}
libvlc_track_description_release(tracks);
return [NSArray arrayWithArray: tempArray];
}
#pragma mark -
#pragma mark Subtitles
......@@ -481,7 +517,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
#pragma mark Audio tracks
- (void)setCurrentAudioTrackIndex:(NSUInteger)value
{
libvlc_audio_set_track( instance, (int)value);
libvlc_audio_set_track(instance, (int)value);
}
- (NSUInteger)currentAudioTrackIndex
......
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