From 043bf735e8456adfba132cb133d1d90a076b041e Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 29 Sep 2023 01:23:35 -0500 Subject: [PATCH] Fix a few bugs in the new resolution options and remove dead code --- .../ViewControllers/SettingsViewController.m | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/Limelight/ViewControllers/SettingsViewController.m b/Limelight/ViewControllers/SettingsViewController.m index 1d2e4ef..c6aa9bd 100644 --- a/Limelight/ViewControllers/SettingsViewController.m +++ b/Limelight/ViewControllers/SettingsViewController.m @@ -203,13 +203,11 @@ BOOL isCustomResolution(CGSize res) { // they support HEVC decoding (A9 or later). if (@available(iOS 11.0, tvOS 11.0, *)) { if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC)) { - [self.resolutionSelector removeSegmentAtIndex:5 animated:NO]; - if (resolution >= 5) resolution--; + [self.resolutionSelector setEnabled:NO forSegmentAtIndex:3]; } } else { - [self.resolutionSelector removeSegmentAtIndex:5 animated:NO]; - if (resolution >= 5) resolution--; + [self.resolutionSelector setEnabled:NO forSegmentAtIndex:3]; } // Disable the HEVC selector if HEVC is not supported by the hardware @@ -271,7 +269,6 @@ BOOL isCustomResolution(CGSize res) { [self.bitrateSlider setValue:[self getSliderValueForBitrate:_bitrate] animated:YES]; [self.bitrateSlider addTarget:self action:@selector(bitrateSliderMoved) forControlEvents:UIControlEventValueChanged]; [self updateBitrateText]; - [self updateCustomResolutionText]; [self updateResolutionDisplayViewText]; } @@ -320,13 +317,13 @@ BOOL isCustomResolution(CGSize res) { } - (void) newResolutionChosen { - [self updateResolutionDisplayViewText]; BOOL lastSegmentSelected = [self.resolutionSelector selectedSegmentIndex] + 1 == [self.resolutionSelector numberOfSegments]; if (lastSegmentSelected) { [self promptCustomResolutionDialog]; } else { [self updateBitrate]; + [self updateResolutionDisplayViewText]; _lastSelectedResolutionIndex = [self.resolutionSelector selectedSegmentIndex]; } } @@ -404,7 +401,6 @@ BOOL isCustomResolution(CGSize res) { resolutionTable[RESOLUTION_TABLE_CUSTOM_INDEX] = CGSizeMake(width, height); [self updateBitrate]; - [self updateCustomResolutionText]; [self updateResolutionDisplayViewText]; self->_lastSelectedResolutionIndex = [self.resolutionSelector selectedSegmentIndex]; @@ -454,14 +450,6 @@ BOOL isCustomResolution(CGSize res) { [self.resolutionDisplayView addSubview:label2]; } -- (void) updateCustomResolutionText { - if (isCustomResolution(resolutionTable[RESOLUTION_TABLE_CUSTOM_INDEX])) { - NSString *newTitle = [NSString stringWithFormat:@"Custom"]; - [self.resolutionSelector setTitle:newTitle forSegmentAtIndex:[self.resolutionSelector numberOfSegments] - 1]; - self.resolutionSelector.apportionsSegmentWidthsByContent = YES; // to update the width - } -} - - (void) bitrateSliderMoved { assert(self.bitrateSlider.value < (sizeof(bitrateTable) / sizeof(*bitrateTable))); _bitrate = bitrateTable[(int)self.bitrateSlider.value];