Commit 21163e0e authored by Tobias's avatar Tobias Committed by Felix Paul Kühne

fix playback speed slider reduce calculations in MoveViewController fix...

fix playback speed slider reduce calculations in MoveViewController fix missing update to current values if opening movie view controller from mini player

(cherry picked from commit 5ae55c00)
parent ad527e70
...@@ -249,7 +249,7 @@ ...@@ -249,7 +249,7 @@
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-34" maxValue="34" id="180" customClass="VLCSlider"> <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-2" maxValue="2" id="180" customClass="VLCSlider">
<rect key="frame" x="18" y="96" width="284" height="29"/> <rect key="frame" x="18" y="96" width="284" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections> <connections>
......
...@@ -330,7 +330,7 @@ ...@@ -330,7 +330,7 @@
</button> </button>
</subviews> </subviews>
</view> </view>
<view hidden="YES" contentMode="scaleToFill" id="165" userLabel="Controls panel" customClass="VLCFrostedGlasView"> <view hidden="YES" contentMode="scaleToFill" id="165" userLabel="speed delay Controls panel" customClass="VLCFrostedGlasView">
<rect key="frame" x="0.0" y="314" width="320" height="163"/> <rect key="frame" x="0.0" y="314" width="320" height="163"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews> <subviews>
...@@ -390,7 +390,7 @@ ...@@ -390,7 +390,7 @@
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-34" maxValue="34" id="168" customClass="VLCSlider"> <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-2" maxValue="2" id="168" customClass="VLCSlider">
<rect key="frame" x="18" y="97" width="284" height="29"/> <rect key="frame" x="18" y="97" width="284" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections> <connections>
......
...@@ -561,6 +561,7 @@ continueUserActivity:(NSUserActivity *)userActivity ...@@ -561,6 +561,7 @@ continueUserActivity:(NSUserActivity *)userActivity
} }
UINavigationController *navCon = [[VLCPlaybackNavigationController alloc] initWithRootViewController:self.movieViewController]; UINavigationController *navCon = [[VLCPlaybackNavigationController alloc] initWithRootViewController:self.movieViewController];
[self.movieViewController prepareForMediaPlayback:[VLCPlaybackController sharedInstance]];
navCon.modalPresentationStyle = UIModalPresentationFullScreen; navCon.modalPresentationStyle = UIModalPresentationFullScreen;
[self.window.rootViewController presentViewController:navCon animated:YES completion:nil]; [self.window.rootViewController presentViewController:navCon animated:YES completion:nil];
} }
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#import "VLCStatusLabel.h" #import "VLCStatusLabel.h"
#define INPUT_RATE_DEFAULT 1000.
#define FORWARD_SWIPE_DURATION 30 #define FORWARD_SWIPE_DURATION 30
#define BACKWARD_SWIPE_DURATION 10 #define BACKWARD_SWIPE_DURATION 10
...@@ -783,17 +782,16 @@ typedef NS_ENUM(NSInteger, VLCPanType) { ...@@ -783,17 +782,16 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
[_equalizerView reloadData]; [_equalizerView reloadData];
float playbackRate = controller.playbackRate; float playbackRate = controller.playbackRate;
self.playbackSpeedSlider.value = playbackRate; self.playbackSpeedSlider.value = log2(playbackRate);
double speed = pow(2, playbackRate / 17.); self.playbackSpeedIndicator.text = [NSString stringWithFormat:@"%.2fx", playbackRate];
self.playbackSpeedIndicator.text = [NSString stringWithFormat:@"%.2fx", speed];
VLCMediaPlayer *mediaPlayer = [VLCPlaybackController sharedInstance].mediaPlayer; float audioDelay = controller.audioDelay;
self.audioDelaySlider.value = audioDelay;
self.audioDelaySlider.value = mediaPlayer.currentAudioPlaybackDelay / 1000000; self.audioDelayIndicator.text = [NSString stringWithFormat:@"%1.00f s", audioDelay];
self.audioDelayIndicator.text = [NSString stringWithFormat:@"%1.00f s", self.audioDelaySlider.value];
self.spuDelaySlider.value = mediaPlayer.currentVideoSubTitleDelay / 1000000; float subtitleDelay = controller.subtitleDelay;
self.spuDelayIndicator.text = [NSString stringWithFormat:@"%1.00f s", self.spuDelaySlider.value]; self.spuDelaySlider.value = subtitleDelay;
self.spuDelayIndicator.text = [NSString stringWithFormat:@"%1.00f s", subtitleDelay];
[self _resetIdleTimer]; [self _resetIdleTimer];
} }
...@@ -1473,18 +1471,19 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom ...@@ -1473,18 +1471,19 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
{ {
LOCKCHECK; LOCKCHECK;
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance]; VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
VLCMediaPlayer *mediaPlayer = vpc.mediaPlayer;
if (sender == _playbackSpeedSlider) { if (sender == _playbackSpeedSlider) {
double speed = pow(2, sender.value / 17.); double speed = exp2(sender.value);
vpc.playbackRate = INPUT_RATE_DEFAULT / speed; vpc.playbackRate = speed;
self.playbackSpeedIndicator.text = [NSString stringWithFormat:@"%.2fx", speed]; self.playbackSpeedIndicator.text = [NSString stringWithFormat:@"%.2fx", speed];
} else if (sender == _audioDelaySlider) { } else if (sender == _audioDelaySlider) {
mediaPlayer.currentAudioPlaybackDelay = _audioDelaySlider.value * 1000000; double delay = sender.value;
_audioDelayIndicator.text = [NSString stringWithFormat:@"%1.2f s", _audioDelaySlider.value]; vpc.audioDelay = delay;
_audioDelayIndicator.text = [NSString stringWithFormat:@"%1.2f s", delay];
} else if (sender == _spuDelaySlider) { } else if (sender == _spuDelaySlider) {
mediaPlayer.currentVideoSubTitleDelay = _spuDelaySlider.value * 1000000; double delay = sender.value;
_spuDelayIndicator.text = [NSString stringWithFormat:@"%1.00f s", _spuDelaySlider.value]; vpc.subtitleDelay = delay;
_spuDelayIndicator.text = [NSString stringWithFormat:@"%1.00f s", delay];
} }
[self _resetIdleTimer]; [self _resetIdleTimer];
......
...@@ -61,7 +61,9 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom ...@@ -61,7 +61,9 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
@property (nonatomic, readonly) NSInteger mediaDuration; @property (nonatomic, readonly) NSInteger mediaDuration;
@property (nonatomic, readonly) BOOL isPlaying; @property (nonatomic, readonly) BOOL isPlaying;
@property (nonatomic, readwrite) VLCRepeatMode repeatMode; @property (nonatomic, readwrite) VLCRepeatMode repeatMode;
@property (nonatomic, readwrite) float playbackRate; @property (nonatomic, readwrite) float playbackRate; // default = 1.0
@property (nonatomic, readwrite) float audioDelay; // in seconds, default = 0.0
@property (nonatomic, readwrite) float subtitleDelay; // in seconds, default = 0.0
@property (nonatomic, readonly) BOOL currentMediaHasChapters; @property (nonatomic, readonly) BOOL currentMediaHasChapters;
@property (nonatomic, readonly) BOOL currentMediaHasTrackToChooseFrom; @property (nonatomic, readonly) BOOL currentMediaHasTrackToChooseFrom;
@property (nonatomic, readonly) BOOL activePlaybackSession; @property (nonatomic, readonly) BOOL activePlaybackSession;
......
...@@ -435,17 +435,8 @@ ...@@ -435,17 +435,8 @@
- (float)playbackRate - (float)playbackRate
{ {
float f_rate = _mediaPlayer.rate; float f_rate = _mediaPlayer.rate;
_currentPlaybackRate = f_rate;
double value = 17 * log(f_rate) / log(2.); return f_rate;
float returnValue = (int) ((value > 0) ? value + .5 : value - .5);
if (returnValue < -34.)
returnValue = -34.;
else if (returnValue > 34.)
returnValue = 34.;
_currentPlaybackRate = returnValue;
return returnValue;
} }
- (void)setPlaybackRate:(float)playbackRate - (void)setPlaybackRate:(float)playbackRate
...@@ -455,6 +446,23 @@ ...@@ -455,6 +446,23 @@
_currentPlaybackRate = playbackRate; _currentPlaybackRate = playbackRate;
} }
- (void)setAudioDelay:(float)audioDelay
{
_mediaPlayer.currentAudioPlaybackDelay = 1000000.*audioDelay;
}
- (float)audioDelay
{
return _mediaPlayer.currentAudioPlaybackDelay/1000000.;
}
-(void)setSubtitleDelay:(float)subtitleDeleay
{
_mediaPlayer.currentVideoSubTitleDelay = 1000000.*subtitleDeleay;
}
- (float)subtitleDelay
{
return _mediaPlayer.currentVideoSubTitleDelay/1000000.;
}
- (void)mediaPlayerStateChanged:(NSNotification *)aNotification - (void)mediaPlayerStateChanged:(NSNotification *)aNotification
{ {
VLCMediaPlayerState currentState = _mediaPlayer.state; VLCMediaPlayerState currentState = _mediaPlayer.state;
......
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