Skip to content

Commit 483e4a3

Browse files
committed
media: Add macOS SDK 26.0 compatibility header
- Add types_compat.h for SDK 26.0 Beta compatibility - Define NSInteger, NSUInteger, and CFAttributedStringRef types - Include compatibility header in bindings.h Fixes build issues with newer macOS SDK versions where these types are missing or moved to different headers.
1 parent 878a79b commit 483e4a3

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

crates/media/src/bindings.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// SDK 26.0 compatibility - include type definitions first
2+
#include "types_compat.h"
3+
14
#import <CoreMedia/CMFormatDescription.h>
25
#import <CoreMedia/CMSampleBuffer.h>
36
#import <CoreVideo/CVPixelFormatDescription.h>

crates/media/src/types_compat.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#ifndef TYPES_COMPAT_H
2+
#define TYPES_COMPAT_H
3+
4+
// Compatibility header for macOS SDK 26.0 Beta
5+
// Defines types that are missing or moved in newer SDKs
6+
7+
#include <stdint.h>
8+
#include <MacTypes.h>
9+
10+
// NSInteger and NSUInteger definitions
11+
#ifndef NSInteger
12+
#if __LP64__ || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
13+
typedef long NSInteger;
14+
typedef unsigned long NSUInteger;
15+
#else
16+
typedef int NSInteger;
17+
typedef unsigned int NSUInteger;
18+
#endif
19+
#endif
20+
21+
// CFAttributedStringRef forward declaration
22+
#ifndef CFAttributedStringRef
23+
typedef const struct __CFAttributedString *CFAttributedStringRef;
24+
#endif
25+
26+
// NSIntegerMax for completeness
27+
#ifndef NSIntegerMax
28+
#if __LP64__ || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
29+
#define NSIntegerMax LONG_MAX
30+
#define NSIntegerMin LONG_MIN
31+
#define NSUIntegerMax ULONG_MAX
32+
#else
33+
#define NSIntegerMax INT_MAX
34+
#define NSIntegerMin INT_MIN
35+
#define NSUIntegerMax UINT_MAX
36+
#endif
37+
#endif
38+
39+
#endif /* TYPES_COMPAT_H */

0 commit comments

Comments
 (0)