Commit f4e37f19 authored by Soomin Lee's avatar Soomin Lee Committed by Carola Nitz

VLCMovieViewController: Fix brightness filter slider

This removes the confusion between screen brightness and video
filter brightness. Hence, it fixes the position of the brightness silder
position on a start of a media.
Signed-off-by: default avatarCarola Nitz <nitz.carola@googlemail.com>
parent 953999aa
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13770" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" colorMatched="YES">
<device id="retina4_7" orientation="portrait"> <device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/> <adaptation id="fullscreen"/>
</device> </device>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13770"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<objects> <objects>
...@@ -149,7 +149,7 @@ ...@@ -149,7 +149,7 @@
<rect key="frame" x="0.0" y="342" width="320" height="198"/> <rect key="frame" x="0.0" y="342" width="320" height="198"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews> <subviews>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="2" id="128" customClass="VLCSlider"> <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.0" maxValue="2" id="128" customClass="VLCSlider">
<rect key="frame" x="18" y="19" width="284" height="29"/> <rect key="frame" x="18" y="19" width="284" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections> <connections>
......
...@@ -184,8 +184,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -184,8 +184,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
name:UIScreenDidConnectNotification object:nil]; name:UIScreenDidConnectNotification object:nil];
[center addObserver:self selector:@selector(handleExternalScreenDidDisconnect:) [center addObserver:self selector:@selector(handleExternalScreenDidDisconnect:)
name:UIScreenDidDisconnectNotification object:nil]; name:UIScreenDidDisconnectNotification object:nil];
[center addObserver:self selector:@selector(screenBrightnessChanged:)
name:UIScreenBrightnessDidChangeNotification object:nil];
[center addObserver:self [center addObserver:self
selector:@selector(appBecameActive:) selector:@selector(appBecameActive:)
name:UIApplicationDidBecomeActiveNotification name:UIApplicationDidBecomeActiveNotification
...@@ -405,7 +403,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -405,7 +403,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
self.artistNameLabel.text = nil; self.artistNameLabel.text = nil;
self.albumNameLabel.text = nil; self.albumNameLabel.text = nil;
[self screenBrightnessChanged:nil];
[self setControlsHidden:NO animated:animated]; [self setControlsHidden:NO animated:animated];
[self updateDefaults]; [self updateDefaults];
...@@ -946,8 +943,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -946,8 +943,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
self.timeNavigationTitleView.positionSlider.value = 0.; self.timeNavigationTitleView.positionSlider.value = 0.;
[self.timeNavigationTitleView.timeDisplayButton setTitle:@"" forState:UIControlStateNormal]; [self.timeNavigationTitleView.timeDisplayButton setTitle:@"" forState:UIControlStateNormal];
self.timeNavigationTitleView.timeDisplayButton.accessibilityLabel = @""; self.timeNavigationTitleView.timeDisplayButton.accessibilityLabel = @"";
if (![[UIDevice currentDevice] VLCHasExternalDisplay])
self.brightnessSlider.value = [UIScreen mainScreen].brightness * 2.;
[_equalizerView reloadData]; [_equalizerView reloadData];
double playbackRate = controller.playbackRate; double playbackRate = controller.playbackRate;
...@@ -1492,15 +1487,14 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom ...@@ -1492,15 +1487,14 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
{ {
if (sender == self.hueSlider) if (sender == self.hueSlider)
_vpc.hue = self.hueSlider.value; _vpc.hue = self.hueSlider.value;
if (sender == self.contrastSlider) else if (sender == self.contrastSlider)
_vpc.contrast = self.contrastSlider.value; _vpc.contrast = self.contrastSlider.value;
if (sender == self.brightnessSlider) else if (sender == self.brightnessSlider)
_vpc.brightness = self.brightnessSlider.value; _vpc.brightness = self.brightnessSlider.value;
if (sender == self.saturationSlider) else if (sender == self.saturationSlider)
_vpc.saturation = self.saturationSlider.value; _vpc.saturation = self.saturationSlider.value;
if (sender == self.gammaSlider) else if (sender == self.gammaSlider)
_vpc.gamma = self.gammaSlider.value; _vpc.gamma = self.gammaSlider.value;
else if (sender == self.resetVideoFilterButton) { else if (sender == self.resetVideoFilterButton) {
self.hueSlider.value = 0.; self.hueSlider.value = 0.;
self.contrastSlider.value = 1.; self.contrastSlider.value = 1.;
...@@ -1513,14 +1507,6 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom ...@@ -1513,14 +1507,6 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
[self _resetIdleTimer]; [self _resetIdleTimer];
} }
- (void)screenBrightnessChanged:(NSNotification *)notification
{
if (notification)
self.brightnessSlider.value = [(UIScreen *)notification.object brightness] * 2.;
else if (![[UIDevice currentDevice] VLCHasExternalDisplay])
self.brightnessSlider.value = [(UIScreen *)[[UIScreen screens] firstObject] brightness] * 2.;
}
- (void)appBecameActive:(NSNotification *)aNotification - (void)appBecameActive:(NSNotification *)aNotification
{ {
VLCPlayerDisplayController *pdc = [VLCPlayerDisplayController sharedInstance]; VLCPlayerDisplayController *pdc = [VLCPlayerDisplayController sharedInstance];
......
...@@ -530,20 +530,12 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) { ...@@ -530,20 +530,12 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
{ {
return _mediaPlayer.brightness; return _mediaPlayer.brightness;
} }
#if TARGET_OS_IOS
- (void)setBrightness:(float)brightness
{
if (![[UIDevice currentDevice] VLCHasExternalDisplay])
_mediaPlayer.brightness = brightness;
else
[[UIScreen mainScreen] setBrightness:(brightness / 2.)];
}
#else
- (void)setBrightness:(float)brightness - (void)setBrightness:(float)brightness
{ {
_mediaPlayer.brightness = brightness; _mediaPlayer.brightness = brightness;
} }
#endif
- (float)saturation - (float)saturation
{ {
return _mediaPlayer.saturation; return _mediaPlayer.saturation;
...@@ -569,7 +561,6 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) { ...@@ -569,7 +561,6 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
_mediaPlayer.hue = 0.; _mediaPlayer.hue = 0.;
_mediaPlayer.contrast = 1.; _mediaPlayer.contrast = 1.;
_mediaPlayer.brightness = 1.; _mediaPlayer.brightness = 1.;
[self setBrightness:1.];
_mediaPlayer.saturation = 1.; _mediaPlayer.saturation = 1.;
_mediaPlayer.gamma = 1.; _mediaPlayer.gamma = 1.;
} }
......
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