[vlc-commits] [Git][videolan/vlc][master] 3 commits: video_output/apple: Fix rotation api availability check by using API_AVAILABLE
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sat Sep 21 08:05:15 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
03743b57 by Claudio Cambra at 2024-09-21T07:51:48+00:00
video_output/apple: Fix rotation api availability check by using API_AVAILABLE
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
6729b389 by Claudio Cambra at 2024-09-21T07:51:48+00:00
video_output/apple: Check if TARGET_OS_VISION is defined before checking its state
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
7341cf31 by Claudio Cambra at 2024-09-21T07:51:48+00:00
video_output/apple: Fix unknown receiver 'VLCPixelBufferRotationContextVT'
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
1 changed file:
- modules/video_output/apple/VLCSampleBufferDisplay.m
Changes:
=====================================
modules/video_output/apple/VLCSampleBufferDisplay.m
=====================================
@@ -137,7 +137,7 @@ typedef NS_ENUM(NSUInteger, VLCSampleBufferPixelFlip) {
uint32_t srcHeight = CVPixelBufferGetHeight(pixelBuffer);
uint32_t dstWidth = rotated ? srcHeight : srcWidth;
uint32_t dstHeight = rotated ? srcWidth : srcHeight;
-#if TARGET_OS_VISION
+#if defined(TARGET_OS_VISION) && TARGET_OS_VISION
const int numValues = 5;
#else
const int numValues = 6;
@@ -150,7 +150,7 @@ typedef NS_ENUM(NSUInteger, VLCSampleBufferPixelFlip) {
kCVPixelBufferMetalCompatibilityKey,
#if TARGET_OS_OSX
kCVPixelBufferOpenGLCompatibilityKey,
-#elif !TARGET_OS_VISION
+#elif !defined(TARGET_OS_VISION) || !TARGET_OS_VISION
kCVPixelBufferOpenGLESCompatibilityKey,
#endif
};
@@ -161,7 +161,7 @@ typedef NS_ENUM(NSUInteger, VLCSampleBufferPixelFlip) {
(__bridge CFNumberRef)(@(dstHeight)),
(__bridge CFDictionaryRef)@{},
kCFBooleanTrue,
-#if !TARGET_OS_VISION
+#if !defined(TARGET_OS_VISION) || !TARGET_OS_VISION
kCFBooleanTrue
#endif
};
@@ -209,7 +209,7 @@ typedef NS_ENUM(NSUInteger, VLCSampleBufferPixelFlip) {
#pragma mark - VLCPixelBufferRotationContextVT
#if IS_VT_ROTATION_API_AVAILABLE
-
+API_AVAILABLE(ios(16.0), tvos(16.0), macosx(13.0))
@interface VLCPixelBufferRotationContextVT : NSObject <VLCPixelBufferRotationContext>
@end
@@ -241,22 +241,20 @@ typedef NS_ENUM(NSUInteger, VLCSampleBufferPixelFlip) {
if (_rotation == rotation)
return;
_rotation = rotation;
- if (@available(iOS 16.0, tvOS 16.0, macOS 13.0, *)) {
- switch (rotation) {
- case kVLCSampleBufferPixelRotation_90CW:
- VTSessionSetProperty(_rotationSession, kVTPixelRotationPropertyKey_Rotation, kVTRotation_CW90);
- break;
- case kVLCSampleBufferPixelRotation_180:
- VTSessionSetProperty(_rotationSession, kVTPixelRotationPropertyKey_Rotation, kVTRotation_180);
- break;
- case kVLCSampleBufferPixelRotation_90CCW:
- VTSessionSetProperty(_rotationSession, kVTPixelRotationPropertyKey_Rotation, kVTRotation_CCW90);
- break;
- case kVLCSampleBufferPixelRotation_0:
- default:
- VTSessionSetProperty(_rotationSession, kVTPixelRotationPropertyKey_Rotation, kVTRotation_0);
- break;
- }
+ switch (rotation) {
+ case kVLCSampleBufferPixelRotation_90CW:
+ VTSessionSetProperty(_rotationSession, kVTPixelRotationPropertyKey_Rotation, kVTRotation_CW90);
+ break;
+ case kVLCSampleBufferPixelRotation_180:
+ VTSessionSetProperty(_rotationSession, kVTPixelRotationPropertyKey_Rotation, kVTRotation_180);
+ break;
+ case kVLCSampleBufferPixelRotation_90CCW:
+ VTSessionSetProperty(_rotationSession, kVTPixelRotationPropertyKey_Rotation, kVTRotation_CCW90);
+ break;
+ case kVLCSampleBufferPixelRotation_0:
+ default:
+ VTSessionSetProperty(_rotationSession, kVTPixelRotationPropertyKey_Rotation, kVTRotation_0);
+ break;
}
}
@@ -264,10 +262,8 @@ typedef NS_ENUM(NSUInteger, VLCSampleBufferPixelFlip) {
if (_flip == flip)
return;
_flip = flip;
- if (@available(iOS 16.0, tvOS 16.0, macOS 13.0, *)) {
- VTSessionSetProperty(_rotationSession, kVTPixelRotationPropertyKey_FlipHorizontalOrientation, flip & kVLCSampleBufferPixelFlip_H ? kCFBooleanTrue : kCFBooleanFalse);
- VTSessionSetProperty(_rotationSession, kVTPixelRotationPropertyKey_FlipVerticalOrientation, flip & kVLCSampleBufferPixelFlip_V ? kCFBooleanTrue : kCFBooleanFalse);
- }
+ VTSessionSetProperty(_rotationSession, kVTPixelRotationPropertyKey_FlipHorizontalOrientation, flip & kVLCSampleBufferPixelFlip_H ? kCFBooleanTrue : kCFBooleanFalse);
+ VTSessionSetProperty(_rotationSession, kVTPixelRotationPropertyKey_FlipVerticalOrientation, flip & kVLCSampleBufferPixelFlip_V ? kCFBooleanTrue : kCFBooleanFalse);
}
- (CVPixelBufferRef)rotate:(CVPixelBufferRef)pixelBuffer {
@@ -279,13 +275,8 @@ typedef NS_ENUM(NSUInteger, VLCSampleBufferPixelFlip) {
if (!rotated)
return NULL;
- if (@available(iOS 16.0, tvOS 16.0, macOS 13.0, *)) {
- OSStatus status = VTPixelRotationSessionRotateImage(_rotationSession, pixelBuffer, rotated);
- if (status != noErr) {
- CFRelease(rotated);
- return NULL;
- }
- } else {
+ OSStatus status = VTPixelRotationSessionRotateImage(_rotationSession, pixelBuffer, rotated);
+ if (status != noErr) {
CFRelease(rotated);
return NULL;
}
@@ -295,11 +286,8 @@ typedef NS_ENUM(NSUInteger, VLCSampleBufferPixelFlip) {
- (void)dealloc
{
- if (_rotationSession)
- {
- if (@available(iOS 16.0, tvOS 16.0, macOS 13.0, *)) {
- VTPixelRotationSessionInvalidate(_rotationSession);
- }
+ if (_rotationSession) {
+ VTPixelRotationSessionInvalidate(_rotationSession);
CFRelease(_rotationSession);
}
}
@@ -681,7 +669,8 @@ shouldInheritContentsScale:(CGFloat)newScale
if (_rotationContext)
return _rotationContext;
#if IS_VT_ROTATION_API_AVAILABLE
- _rotationContext = [VLCPixelBufferRotationContextVT new];
+ if (@available(iOS 16.0, tvOS 16.0, macOS 13.0, *))
+ _rotationContext = [VLCPixelBufferRotationContextVT new];
#endif
if (!_rotationContext)
_rotationContext = [VLCPixelBufferRotationContextCI new];
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b798bfa60c304aecea301f641d8bce2294d3cf23...7341cf3149666f2490bcfa27af9b997cde05c21a
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b798bfa60c304aecea301f641d8bce2294d3cf23...7341cf3149666f2490bcfa27af9b997cde05c21a
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