Commit aef26eb5 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Add S/PDIF option

(cherry picked from commit 8249ac00)
parent 3de0ef20
......@@ -97,24 +97,27 @@
@implementation VLCPlaybackInfoTracksDataSourceAudio
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return self.mediaPlayer.numberOfAudioTracks;
return self.mediaPlayer.numberOfAudioTracks + 1;
}
- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath
{
VLCPlaybackInfoTVCollectionViewCell *trackCell = (VLCPlaybackInfoTVCollectionViewCell*)cell;
NSInteger row = indexPath.row;
BOOL isSelected = NO;
NSArray *audioTrackIndexes = self.mediaPlayer.audioTrackIndexes;
if (row < audioTrackIndexes.count) {
isSelected = [audioTrackIndexes[row] intValue] == self.mediaPlayer.currentAudioTrackIndex;
}
trackCell.selectionMarkerVisible = isSelected;
NSString *trackName;
if (row >= audioTrackIndexes.count) {
trackName = NSLocalizedString(@"USE_SPDIF", nil);
trackCell.selectionMarkerVisible = [[NSUserDefaults standardUserDefaults] boolForKey:kVLCSettingUseSPDIF];
} else {
BOOL isSelected = [audioTrackIndexes[row] intValue] == self.mediaPlayer.currentVideoSubTitleIndex;
trackCell.selectionMarkerVisible = isSelected;
NSString *trackName = self.mediaPlayer.audioTrackNames[row];
if (trackName != nil) {
if ([trackName isEqualToString:@"Disable"])
trackName = NSLocalizedString(@"DISABLE_LABEL", nil);
trackName = self.mediaPlayer.audioTrackNames[row];
if (trackName != nil) {
if ([trackName isEqualToString:@"Disable"])
trackName = NSLocalizedString(@"DISABLE_LABEL", nil);
}
}
trackCell.titleLabel.text = trackName;
}
......@@ -123,7 +126,17 @@
{
NSArray *audioTrackIndexes = self.mediaPlayer.audioTrackIndexes;
NSInteger row = indexPath.row;
if (row < audioTrackIndexes.count) {
if (row >= audioTrackIndexes.count) {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
BOOL bValue = ![defaults boolForKey:kVLCSettingUseSPDIF];
[[VLCPlaybackController sharedInstance].mediaPlayer performSelector:@selector(setPassthroughAudio:) withObject:@(bValue)];
[defaults setBool:bValue forKey:kVLCSettingUseSPDIF];
[defaults synchronize];
/* restart the audio output */
int currentAudioTrackIndex = self.mediaPlayer.currentAudioTrackIndex;
self.mediaPlayer.currentAudioTrackIndex = -1;
self.mediaPlayer.currentAudioTrackIndex = currentAudioTrackIndex;
} else {
self.mediaPlayer.currentAudioTrackIndex = [audioTrackIndexes[row] intValue];
}
[collectionView reloadData];
......@@ -145,7 +158,7 @@
if (row >= spuTitleIndexes.count) {
trackName = NSLocalizedString(@"DOWNLOAD_SUBS_FROM_OSO", nil);
} else {
BOOL isSelected = [self.mediaPlayer.videoSubTitlesIndexes[row] intValue] == self.mediaPlayer.currentVideoSubTitleIndex;
BOOL isSelected = [spuTitleIndexes[row] intValue] == self.mediaPlayer.currentVideoSubTitleIndex;
trackCell.selectionMarkerVisible = isSelected;
trackName = self.mediaPlayer.videoSubTitlesNames[row];
......
......@@ -58,6 +58,7 @@
#define kVLCSettingSaveHTTPUploadServerStatus @"isHTTPServerOn"
#define kVLCAutomaticallyPlayNextItem @"AutomaticallyPlayNextItem"
#define kVLCSettingDownloadArtwork @"download-artwork"
#define kVLCSettingUseSPDIF @"kVLCSettingUseSPDIF"
#define kVLCSettingLastUsedSubtitlesSearchLanguage @"kVLCSettingLastUsedSubtitlesSearchLanguage"
#define kVLCSettingWiFiSharingIPv6 @"wifi-sharing-ipv6"
......
......@@ -15,6 +15,7 @@ iOS 2.7.3:
tvOS 1.0.3:
-----------
* General stability improvements and bug fixes
* Added S/PDIF pass-through option
* Added option to disable artwork retrieval
* Added automatic finding of external subtitles on HTTP, FTP, PLEX and UPnP
- Note that SMB shares are not supported yet.
......
......@@ -312,6 +312,7 @@
"CACHED_MEDIA_LONG"="Media shown here is stored locally on your Apple TV. Note that contents can be removed by the operating system without prior notice anytime when VLC is not running in case your device runs out of storage.";
"DOWNLOAD_SUBS_FROM_OSO"="Download subtitles from OpenSubtitles.org...";
"FOUND_SUBS"="Found subtitles";
"USE_SPDIF"="Use S/PDIF";
// Local Network Service Names
"UPNP_LONG"="Universal Plug'n'Play (UPnP)";
......
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