[vlc-commits] [Git][videolan/vlc][master] 15 commits: Revert "stdbit: copy-paste error, fix first_leading_zero"

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun Dec 29 09:15:31 UTC 2024



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
465c24b1 by Rémi Denis-Courmont at 2024-12-28T15:10:05+00:00
Revert "stdbit: copy-paste error, fix first_leading_zero"

This reverts commit a025e757c90ea892648ada77c641e3ee702bba11.

- - - - -
3f1efe72 by Claudio Cambra at 2024-12-28T15:10:05+00:00
macosx: Add playback rate button in main video view controls bar

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
f688c694 by Claudio Cambra at 2024-12-28T15:10:05+00:00
macosx: Open playback menu on playabck rate button click

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
b635c7c2 by Claudio Cambra at 2024-12-28T15:10:05+00:00
macosx: Update playback rate button text on controls bar update method

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
88b49024 by Claudio Cambra at 2024-12-28T15:10:05+00:00
macosx: React to VLCPlayerRateChanged in main video view controls bar

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
0963f0e0 by Claudio Cambra at 2024-12-28T15:10:05+00:00
macosx: Also set playback rate button enablement via update method

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
4b0eafb9 by Claudio Cambra at 2024-12-28T15:10:05+00:00
macosx: Respond to capabilities change to correctly update playback rate button enablement in controls bar for main video view

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
1f44c4ad by Claudio Cambra at 2024-12-28T15:10:05+00:00
macosx: Present a slider on click of playback rate controls bar

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
1f73c9b9 by Claudio Cambra at 2024-12-28T15:10:05+00:00
macosx: Set expected init playback rate in player controller

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
9ec57fa0 by Claudio Cambra at 2024-12-28T15:10:05+00:00
macosx: Fix setting of button title on update

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
66a082d8 by Claudio Cambra at 2024-12-28T15:10:05+00:00
macosx: Make playback slider functional in main video view controls bar

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
d03cf9d0 by Claudio Cambra at 2024-12-28T15:10:05+00:00
macosx: Make playback rate button wide enough to keep text on one line

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
1f6f9744 by Claudio Cambra at 2024-12-28T15:10:05+00:00
macosx: Improve styling of playback rate slider in main video view controls bar

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
f2b53099 by Claudio Cambra at 2024-12-28T15:10:05+00:00
macosx: Add accessbility label and tooltip for playback rate button in main video view controls bar

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
a2b8814c by Claudio Cambra at 2024-12-28T15:10:05+00:00
macosx: Initialise nsslider for playback rate with correct value

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -


5 changed files:

- compat/stdbit/stdbit.h
- modules/gui/macosx/UI/VLCMainVideoView.xib
- modules/gui/macosx/playqueue/VLCPlayerController.m
- modules/gui/macosx/windows/controlsbar/VLCMainVideoViewControlsBar.h
- modules/gui/macosx/windows/controlsbar/VLCMainVideoViewControlsBar.m


Changes:

=====================================
compat/stdbit/stdbit.h
=====================================
@@ -275,27 +275,27 @@ static inline unsigned int stdc_first_leading_one_uc(unsigned char value)
 
 static inline unsigned int stdc_first_leading_zero_ull(unsigned long long value)
 {
-    return stdc_first_leading_one_ull(~value);
+    return stdc_leading_ones_ull(~value);
 }
 
 static inline unsigned int stdc_first_leading_zero_ul(unsigned long value)
 {
-    return stdc_first_leading_one_ul(~value);
+    return stdc_leading_ones_ul(~value);
 }
 
 static inline unsigned int stdc_first_leading_zero_ui(unsigned int value)
 {
-    return stdc_first_leading_one_ui(~value);
+    return stdc_leading_ones_ui(~value);
 }
 
 static inline unsigned int stdc_first_leading_zero_us(unsigned short value)
 {
-    return stdc_first_leading_one_us(~value);
+    return stdc_leading_ones_us(~value);
 }
 
 static inline unsigned int stdc_first_leading_zero_uc(unsigned char value)
 {
-    return stdc_first_leading_one_uc(~value);
+    return stdc_leading_ones_uc(~value);
 }
 
 #define stdc_first_leading_zero(value) \


=====================================
modules/gui/macosx/UI/VLCMainVideoView.xib
=====================================
@@ -51,6 +51,7 @@
                 <outlet property="pipButton" destination="yEi-SZ-SIS" id="vFi-Ln-9lT"/>
                 <outlet property="pipButtonWidthConstraint" destination="dxa-Jx-T4p" id="a5S-ec-2xD"/>
                 <outlet property="playButton" destination="PCC-8a-sVF" id="ddT-ZM-Jhz"/>
+                <outlet property="playbackRateButton" destination="GHq-pt-nIe" id="k0k-fd-Vz5"/>
                 <outlet property="playingItemDisplayField" destination="lEW-MN-FFU" id="hKa-df-8UB"/>
                 <outlet property="subtitlesButton" destination="YTl-LZ-WDe" id="893-XB-eDY"/>
                 <outlet property="timeField" destination="3ri-8b-8mw" id="f0i-Gh-R8V"/>
@@ -156,8 +157,21 @@
                                             <stackView distribution="fill" orientation="horizontal" alignment="centerY" spacing="5" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Y8F-hr-iaW">
                                                 <rect key="frame" x="0.0" y="0.0" width="254" height="32"/>
                                                 <subviews>
-                                                    <button wantsLayer="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="95O-Oc-zrQ" customClass="VLCImageButton">
+                                                    <button wantsLayer="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="GHq-pt-nIe" customClass="VLCImageButton">
                                                         <rect key="frame" x="0.0" y="-1" width="32" height="33"/>
+                                                        <buttonCell key="cell" type="recessed" title="1.0x" bezelStyle="recessed" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyUpOrDown" inset="2" id="pUr-pW-j5a">
+                                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
+                                                            <font key="font" metaFont="smallSystem"/>
+                                                        </buttonCell>
+                                                        <constraints>
+                                                            <constraint firstAttribute="width" constant="40" id="Nvo-dk-KyW"/>
+                                                        </constraints>
+                                                        <connections>
+                                                            <action selector="openPlaybackRate:" target="3" id="tLQ-DO-783"/>
+                                                        </connections>
+                                                    </button>
+                                                    <button wantsLayer="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="95O-Oc-zrQ" customClass="VLCImageButton">
+                                                        <rect key="frame" x="37" y="-1" width="32" height="33"/>
                                                         <buttonCell key="cell" type="recessed" bezelStyle="recessed" image="photo.tv" catalog="system" imagePosition="only" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyUpOrDown" inset="2" id="dnH-S4-sBc">
                                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
                                                             <font key="font" metaFont="system"/>
@@ -266,6 +280,7 @@
                                                     <integer value="1000"/>
                                                     <integer value="1000"/>
                                                     <integer value="1000"/>
+                                                    <integer value="1000"/>
                                                 </visibilityPriorities>
                                                 <customSpacing>
                                                     <real value="3.4028234663852886e+38"/>
@@ -275,6 +290,7 @@
                                                     <real value="3.4028234663852886e+38"/>
                                                     <real value="3.4028234663852886e+38"/>
                                                     <real value="3.4028234663852886e+38"/>
+                                                    <real value="3.4028234663852886e+38"/>
                                                 </customSpacing>
                                             </stackView>
                                             <stackView distribution="fill" orientation="horizontal" alignment="centerY" spacing="5" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zyp-45-IgR">
@@ -372,6 +388,7 @@
                                         <constraints>
                                             <constraint firstAttribute="width" constant="32" id="Xh5-1i-dxH"/>
                                             <constraint firstAttribute="width" secondItem="AXA-01-AU8" secondAttribute="height" multiplier="1:1" id="lgn-JT-8Qk"/>
+                                            <constraint firstAttribute="width" secondItem="AXA-01-AU8" secondAttribute="height" multiplier="1:1" id="tkp-uc-bfs"/>
                                         </constraints>
                                         <connections>
                                             <action selector="jumpBackward:" target="3" id="Kkq-12-jbm"/>
@@ -446,6 +463,7 @@
                                         <color key="contentTintColor" red="0.99999600649999998" green="1" blue="1" alpha="0.85338267140000001" colorSpace="custom" customColorSpace="sRGB"/>
                                         <constraints>
                                             <constraint firstAttribute="width" constant="32" id="OBA-WG-jaz"/>
+                                            <constraint firstAttribute="width" secondItem="aAq-uE-mLW" secondAttribute="height" multiplier="1:1" id="eMl-LK-UdE"/>
                                             <constraint firstAttribute="width" secondItem="aAq-uE-mLW" secondAttribute="height" multiplier="1:1" id="g5c-kh-jsZ"/>
                                         </constraints>
                                         <connections>
@@ -453,10 +471,6 @@
                                         </connections>
                                     </button>
                                 </subviews>
-                                <constraints>
-                                    <constraint firstItem="aAq-uE-mLW" firstAttribute="width" secondItem="aAq-uE-mLW" secondAttribute="height" multiplier="1:1" id="eMl-LK-UdE"/>
-                                    <constraint firstItem="AXA-01-AU8" firstAttribute="width" secondItem="AXA-01-AU8" secondAttribute="height" multiplier="1:1" id="tkp-uc-bfs"/>
-                                </constraints>
                                 <visibilityPriorities>
                                     <integer value="1000"/>
                                     <integer value="1000"/>


=====================================
modules/gui/macosx/playqueue/VLCPlayerController.m
=====================================
@@ -611,6 +611,8 @@ static int BossCallback(vlc_object_t *p_this,
         _aLoopPosition = -1;
         _bLoopPosition = -1;
 
+        _playbackRate = 1.0;
+
         libvlc_int_t *libvlc = vlc_object_instance(getIntf());
         var_AddCallback(libvlc, "intf-boss", BossCallback, (__bridge void *)self);
     }


=====================================
modules/gui/macosx/windows/controlsbar/VLCMainVideoViewControlsBar.h
=====================================
@@ -31,7 +31,9 @@ NS_ASSUME_NONNULL_BEGIN
 @property (readwrite, weak) IBOutlet NSButton *audioButton;
 @property (readwrite, weak) IBOutlet NSButton *videoButton;
 @property (readwrite, weak) IBOutlet NSButton *floatOnTopButton;
+ at property (readwrite, weak) IBOutlet NSButton *playbackRateButton;
 
+- (IBAction)openPlaybackRate:(id)sender;
 - (IBAction)openBookmarks:(id)sender;
 - (IBAction)openSubtitlesMenu:(id)sender;
 - (IBAction)openAudioMenu:(id)sender;


=====================================
modules/gui/macosx/windows/controlsbar/VLCMainVideoViewControlsBar.m
=====================================
@@ -66,6 +66,9 @@
     self.videoButton.toolTip = _NS("Video settings");
     self.videoButton.accessibilityLabel = self.videoButton.toolTip;
 
+    self.playbackRateButton.toolTip = _NS("Playback rate");
+    self.playbackRateButton.accessibilityLabel = self.playbackRateButton.toolTip;
+
     _playQueueController = VLCMain.sharedInstance.playQueueController;
     _playerController = _playQueueController.playerController;
 
@@ -74,6 +77,14 @@
                            selector:@selector(floatOnTopChanged:)
                                name:VLCWindowFloatOnTopChangedNotificationName
                              object:nil];
+    [notificationCenter addObserver:self
+                           selector:@selector(playbackRateChanged:)
+                               name:VLCPlayerRateChanged
+                             object:nil];
+    [notificationCenter addObserver:self
+                           selector:@selector(playbackRateChanged:)
+                               name:VLCPlayerCapabilitiesChanged
+                             object:nil];
 
     [self update];
 }
@@ -82,6 +93,7 @@
 {
     [super update];
     [self updateFloatOnTopButton];
+    [self updatePlaybackRateButton];
 }
 
 - (void)floatOnTopChanged:(NSNotification *)notification
@@ -121,6 +133,51 @@
     }
 }
 
+- (void)playbackRateChanged:(NSNotification *)notification
+{
+    [self updatePlaybackRateButton];
+}
+
+- (void)updatePlaybackRateButton
+{
+    self.playbackRateButton.title =
+        [NSString stringWithFormat:@"%.1fx", _playerController.playbackRate];
+    self.playbackRateButton.enabled = _playerController.rateChangable;
+}
+
+- (IBAction)openPlaybackRate:(id)sender
+{
+    NSSlider * const playbackRateSlider = [[NSSlider alloc] init];
+    playbackRateSlider.frame = NSMakeRect(0, 0, 272, 17);
+    playbackRateSlider.target = self;
+    playbackRateSlider.action = @selector(rateSliderAction:);
+    playbackRateSlider.minValue = -34.;
+    playbackRateSlider.maxValue = 34.;
+    playbackRateSlider.sliderType = NSSliderTypeLinear;
+    playbackRateSlider.numberOfTickMarks = 17;
+    playbackRateSlider.controlSize = NSControlSizeSmall;
+
+    const double value = 17.0 * log(_playerController.playbackRate) / log(2.);
+    const int sliderIntValue = (int)((value > 0) ? value + 0.5 : value - 0.5);
+    playbackRateSlider.intValue = sliderIntValue;
+
+    NSMenuItem * const menuItem = [[NSMenuItem alloc] init];
+    menuItem.title = _NS("Playback rate");
+    menuItem.view = playbackRateSlider;
+
+    NSMenu * const menu = [[NSMenu alloc] initWithTitle:_NS("Playback rate")];
+    [menu addItem:menuItem];
+    [menu popUpMenuPositioningItem:nil
+                        atLocation:self.playbackRateButton.frame.origin
+                            inView:((NSView *)sender).superview];
+}
+
+- (IBAction)rateSliderAction:(id)sender
+{
+    NSSlider * const slider = (NSSlider *)sender;
+    _playerController.playbackRate = pow(2, (double)slider.intValue / 17);
+}
+
 - (IBAction)openBookmarks:(id)sender
 {
     [VLCMain.sharedInstance.bookmarks toggleWindow:sender];



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d655abcb4188afbc86e0676662abd8163fb1dfe0...a2b8814cb93321d64aa9d9456fd54a5bbb0b543f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d655abcb4188afbc86e0676662abd8163fb1dfe0...a2b8814cb93321d64aa9d9456fd54a5bbb0b543f
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list