Преглед изворни кода

VLCMovieViewController: adjust the audioDelay slider to be more sensitive

Jonathan Harris пре 7 година
родитељ
комит
7b3608471b

+ 4 - 4
Resources/VLCMovieViewController~ipad.xib

@@ -121,7 +121,7 @@
                             <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             <nil key="highlightedColor"/>
                         </label>
-                        <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-30" maxValue="30" id="ahb-li-nqH" customClass="VLCResettingSlider">
+                        <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-1000" maxValue="1000" id="ahb-li-nqH" customClass="VLCResettingSlider">
                             <rect key="frame" x="18" y="21" width="284" height="29"/>
                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                             <userDefinedRuntimeAttributes>
@@ -134,7 +134,7 @@
                                 <action selector="playbackSliderAction:" destination="-1" eventType="valueChanged" id="MB1-sB-W8m"/>
                             </connections>
                         </slider>
-                        <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="0.00 s" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="FYO-Rd-Vjg">
+                        <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="0 ms" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="FYO-Rd-Vjg">
                             <rect key="frame" x="20" y="7" width="280" height="21"/>
                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                             <fontDescription key="fontDescription" type="system" pointSize="13"/>
@@ -148,7 +148,7 @@
                             <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             <nil key="highlightedColor"/>
                         </label>
-                        <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-30" maxValue="30" id="juX-HR-PqD" customClass="VLCResettingSlider">
+                        <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-1000" maxValue="1000" id="juX-HR-PqD" customClass="VLCResettingSlider">
                             <rect key="frame" x="18" y="58" width="284" height="29"/>
                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                             <userDefinedRuntimeAttributes>
@@ -161,7 +161,7 @@
                                 <action selector="playbackSliderAction:" destination="-1" eventType="valueChanged" id="acG-8w-Mgd"/>
                             </connections>
                         </slider>
-                        <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="0 s" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="cTE-tb-Z89">
+                        <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="0 ms" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="cTE-tb-Z89">
                             <rect key="frame" x="20" y="44" width="280" height="21"/>
                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                             <fontDescription key="fontDescription" type="system" pointSize="13"/>

+ 5 - 5
Resources/VLCMovieViewController~iphone.xib

@@ -247,14 +247,14 @@
                             <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             <nil key="highlightedColor"/>
                         </label>
-                        <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="0.00 s" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="SDv-JW-DMi">
+                        <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="0 ms" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="SDv-JW-DMi">
                             <rect key="frame" x="20" y="7" width="280" height="21"/>
                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                             <fontDescription key="fontDescription" type="system" pointSize="13"/>
                             <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             <nil key="highlightedColor"/>
                         </label>
-                        <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-30" maxValue="30" id="oQe-Uu-1HY" customClass="VLCResettingSlider">
+                        <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-1000" maxValue="1000" id="oQe-Uu-1HY" customClass="VLCResettingSlider">
                             <rect key="frame" x="18" y="20" width="284" height="29"/>
                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                             <userDefinedRuntimeAttributes>
@@ -274,14 +274,14 @@
                             <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             <nil key="highlightedColor"/>
                         </label>
-                        <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="0 s" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="IzS-81-KII">
+                        <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="0 ms" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="IzS-81-KII">
                             <rect key="frame" x="20" y="44" width="280" height="21"/>
                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                             <fontDescription key="fontDescription" type="system" pointSize="13"/>
                             <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             <nil key="highlightedColor"/>
                         </label>
-                        <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-30" maxValue="30" id="JRI-0m-C0M" customClass="VLCResettingSlider">
+                        <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-5" maxValue="5" id="JRI-0m-C0M" customClass="VLCResettingSlider">
                             <rect key="frame" x="18" y="58" width="284" height="29"/>
                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                             <userDefinedRuntimeAttributes>
@@ -308,7 +308,7 @@
                             <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             <nil key="highlightedColor"/>
                         </label>
-                        <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-2" maxValue="2" id="168" customClass="VLCResettingSlider">
+                        <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="-1000" maxValue="1000" id="168" customClass="VLCResettingSlider">
                             <rect key="frame" x="18" y="97" width="284" height="29"/>
                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                             <userDefinedRuntimeAttributes>

+ 8 - 6
Sources/VLCMovieViewController.m

@@ -970,11 +970,11 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
 
     float audioDelay = controller.audioDelay;
     self.audioDelaySlider.value = audioDelay;
-    self.audioDelayIndicator.text = [NSString stringWithFormat:@"%1.2f s", audioDelay];
+    self.audioDelayIndicator.text = [NSString stringWithFormat:@"%d ms", (int) audioDelay];
 
     float subtitleDelay = controller.subtitleDelay;
     self.spuDelaySlider.value = subtitleDelay;
-    self.spuDelayIndicator.text = [NSString stringWithFormat:@"%1.00f s", subtitleDelay];
+    self.spuDelayIndicator.text = [NSString stringWithFormat:@"%d ms", (int) subtitleDelay];
 
     [self _resetIdleTimer];
 }
@@ -1533,13 +1533,15 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
         _vpc.playbackRate = speed;
         self.playbackSpeedIndicator.text = [NSString stringWithFormat:@"%.2fx", speed];
     } else if (sender == _audioDelaySlider) {
-        double delay = sender.value;
+        int delay = ((int) round(sender.value / 50.)) * 50;
         _vpc.audioDelay = delay;
-        _audioDelayIndicator.text = [NSString stringWithFormat:@"%1.2f s", delay];
+        [sender setValue:delay animated:NO];
+        _audioDelayIndicator.text = [NSString stringWithFormat:@"%d ms", delay];
     } else if (sender == _spuDelaySlider) {
-        double delay = sender.value;
+        int delay = (int) (round(sender.value / 50.)) * 50;
         _vpc.subtitleDelay = delay;
-        _spuDelayIndicator.text = [NSString stringWithFormat:@"%1.00f s", delay];
+        [sender setValue:delay animated:NO];
+        _spuDelayIndicator.text = [NSString stringWithFormat:@"%d ms", delay];
     }
 
     [self _resetIdleTimer];

+ 2 - 2
Sources/VLCPlaybackController.h

@@ -61,9 +61,9 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
 @property (nonatomic, readwrite) VLCRepeatMode repeatMode;
 @property (nonatomic, assign, getter=isShuffleMode) BOOL shuffleMode;
 @property (nonatomic, readwrite) float playbackRate; // default = 1.0
-@property (nonatomic, readwrite) float audioDelay; // in seconds, default = 0.0
+@property (nonatomic, readwrite) float audioDelay; // in milliseconds, default = 0.0
 @property (nonatomic, readwrite) float playbackPosition; // in seconds, default = 0.0
-@property (nonatomic, readwrite) float subtitleDelay; // in seconds, default = 0.0
+@property (nonatomic, readwrite) float subtitleDelay; // in milliseconds, default = 0.0
 
 @property (nonatomic, readwrite) float hue; // default = 0.0
 @property (nonatomic, readwrite) float contrast; // default = 1.0

+ 4 - 4
Sources/VLCPlaybackController.m

@@ -499,12 +499,12 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
 
 - (void)setAudioDelay:(float)audioDelay
 {
-    _mediaPlayer.currentAudioPlaybackDelay = 1000000.*audioDelay;
+    _mediaPlayer.currentAudioPlaybackDelay = 1000.*audioDelay;
 }
 
 - (float)audioDelay
 {
-    return _mediaPlayer.currentAudioPlaybackDelay/1000000.;
+    return _mediaPlayer.currentAudioPlaybackDelay/1000.;
 }
 
 - (float)playbackPosition
@@ -519,12 +519,12 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
 
 - (void)setSubtitleDelay:(float)subtitleDeleay
 {
-    _mediaPlayer.currentVideoSubTitleDelay = 1000000.*subtitleDeleay;
+    _mediaPlayer.currentVideoSubTitleDelay = 1000.*subtitleDeleay;
 }
 
 - (float)subtitleDelay
 {
-    return _mediaPlayer.currentVideoSubTitleDelay/1000000.;
+    return _mediaPlayer.currentVideoSubTitleDelay/1000.;
 }
 
 - (float)hue