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 @@
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</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"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections>
......
......@@ -330,7 +330,7 @@
</button>
</subviews>
</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"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
......@@ -390,7 +390,7 @@
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</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"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<connections>
......
......@@ -561,6 +561,7 @@ continueUserActivity:(NSUserActivity *)userActivity
}
UINavigationController *navCon = [[VLCPlaybackNavigationController alloc] initWithRootViewController:self.movieViewController];
[self.movieViewController prepareForMediaPlayback:[VLCPlaybackController sharedInstance]];
navCon.modalPresentationStyle = UIModalPresentationFullScreen;
[self.window.rootViewController presentViewController:navCon animated:YES completion:nil];
}
......
......@@ -32,7 +32,6 @@
#import "VLCStatusLabel.h"
#define INPUT_RATE_DEFAULT 1000.
#define FORWARD_SWIPE_DURATION 30
#define BACKWARD_SWIPE_DURATION 10
......@@ -783,17 +782,16 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
[_equalizerView reloadData];
float playbackRate = controller.playbackRate;
self.playbackSpeedSlider.value = playbackRate;
double speed = pow(2, playbackRate / 17.);
self.playbackSpeedIndicator.text = [NSString stringWithFormat:@"%.2fx", speed];
self.playbackSpeedSlider.value = log2(playbackRate);
self.playbackSpeedIndicator.text = [NSString stringWithFormat:@"%.2fx", playbackRate];
VLCMediaPlayer *mediaPlayer = [VLCPlaybackController sharedInstance].mediaPlayer;
self.audioDelaySlider.value = mediaPlayer.currentAudioPlaybackDelay / 1000000;
self.audioDelayIndicator.text = [NSString stringWithFormat:@"%1.00f s", self.audioDelaySlider.value];
float audioDelay = controller.audioDelay;
self.audioDelaySlider.value = audioDelay;
self.audioDelayIndicator.text = [NSString stringWithFormat:@"%1.00f s", audioDelay];
self.spuDelaySlider.value = mediaPlayer.currentVideoSubTitleDelay / 1000000;
self.spuDelayIndicator.text = [NSString stringWithFormat:@"%1.00f s", self.spuDelaySlider.value];
float subtitleDelay = controller.subtitleDelay;
self.spuDelaySlider.value = subtitleDelay;
self.spuDelayIndicator.text = [NSString stringWithFormat:@"%1.00f s", subtitleDelay];
[self _resetIdleTimer];
}
......@@ -1473,18 +1471,19 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
{
LOCKCHECK;
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
VLCMediaPlayer *mediaPlayer = vpc.mediaPlayer;
if (sender == _playbackSpeedSlider) {
double speed = pow(2, sender.value / 17.);
vpc.playbackRate = INPUT_RATE_DEFAULT / speed;
double speed = exp2(sender.value);
vpc.playbackRate = speed;
self.playbackSpeedIndicator.text = [NSString stringWithFormat:@"%.2fx", speed];
} else if (sender == _audioDelaySlider) {
mediaPlayer.currentAudioPlaybackDelay = _audioDelaySlider.value * 1000000;
_audioDelayIndicator.text = [NSString stringWithFormat:@"%1.2f s", _audioDelaySlider.value];
double delay = sender.value;
vpc.audioDelay = delay;
_audioDelayIndicator.text = [NSString stringWithFormat:@"%1.2f s", delay];
} else if (sender == _spuDelaySlider) {
mediaPlayer.currentVideoSubTitleDelay = _spuDelaySlider.value * 1000000;
_spuDelayIndicator.text = [NSString stringWithFormat:@"%1.00f s", _spuDelaySlider.value];
double delay = sender.value;
vpc.subtitleDelay = delay;
_spuDelayIndicator.text = [NSString stringWithFormat:@"%1.00f s", delay];
}
[self _resetIdleTimer];
......
......@@ -61,7 +61,9 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
@property (nonatomic, readonly) NSInteger mediaDuration;
@property (nonatomic, readonly) BOOL isPlaying;
@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 currentMediaHasTrackToChooseFrom;
@property (nonatomic, readonly) BOOL activePlaybackSession;
......
......@@ -435,17 +435,8 @@
- (float)playbackRate
{
float f_rate = _mediaPlayer.rate;
double value = 17 * log(f_rate) / log(2.);
float returnValue = (int) ((value > 0) ? value + .5 : value - .5);
if (returnValue < -34.)
returnValue = -34.;
else if (returnValue > 34.)
returnValue = 34.;
_currentPlaybackRate = returnValue;
return returnValue;
_currentPlaybackRate = f_rate;
return f_rate;
}
- (void)setPlaybackRate:(float)playbackRate
......@@ -455,6 +446,23 @@
_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
{
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