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: 's avatarCarola Nitz <nitz.carola@googlemail.com>
parent 953999aa
<?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">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<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"/>
</dependencies>
<objects>
......@@ -149,7 +149,7 @@
<rect key="frame" x="0.0" y="342" width="320" height="198"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<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"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections>
......
......@@ -184,8 +184,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
name:UIScreenDidConnectNotification object:nil];
[center addObserver:self selector:@selector(handleExternalScreenDidDisconnect:)
name:UIScreenDidDisconnectNotification object:nil];
[center addObserver:self selector:@selector(screenBrightnessChanged:)
name:UIScreenBrightnessDidChangeNotification object:nil];
[center addObserver:self
selector:@selector(appBecameActive:)
name:UIApplicationDidBecomeActiveNotification
......@@ -405,7 +403,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
self.artistNameLabel.text = nil;
self.albumNameLabel.text = nil;
[self screenBrightnessChanged:nil];
[self setControlsHidden:NO animated:animated];
[self updateDefaults];
......@@ -946,8 +943,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
self.timeNavigationTitleView.positionSlider.value = 0.;
[self.timeNavigationTitleView.timeDisplayButton setTitle:@"" forState:UIControlStateNormal];
self.timeNavigationTitleView.timeDisplayButton.accessibilityLabel = @"";
if (![[UIDevice currentDevice] VLCHasExternalDisplay])
self.brightnessSlider.value = [UIScreen mainScreen].brightness * 2.;
[_equalizerView reloadData];
double playbackRate = controller.playbackRate;
......@@ -1492,15 +1487,14 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
{
if (sender == self.hueSlider)
_vpc.hue = self.hueSlider.value;
if (sender == self.contrastSlider)
else if (sender == self.contrastSlider)
_vpc.contrast = self.contrastSlider.value;
if (sender == self.brightnessSlider)
else if (sender == self.brightnessSlider)
_vpc.brightness = self.brightnessSlider.value;
if (sender == self.saturationSlider)
else if (sender == self.saturationSlider)
_vpc.saturation = self.saturationSlider.value;
if (sender == self.gammaSlider)
else if (sender == self.gammaSlider)
_vpc.gamma = self.gammaSlider.value;
else if (sender == self.resetVideoFilterButton) {
self.hueSlider.value = 0.;
self.contrastSlider.value = 1.;
......@@ -1513,14 +1507,6 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
[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
{
VLCPlayerDisplayController *pdc = [VLCPlayerDisplayController sharedInstance];
......
......@@ -530,20 +530,12 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
{
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
{
_mediaPlayer.brightness = brightness;
}
#endif
- (float)saturation
{
return _mediaPlayer.saturation;
......@@ -569,7 +561,6 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
_mediaPlayer.hue = 0.;
_mediaPlayer.contrast = 1.;
_mediaPlayer.brightness = 1.;
[self setBrightness:1.];
_mediaPlayer.saturation = 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