Fix a cast on arm64
This commit is contained in:
5 files changed
+24
-10
No files matched your search
@@ -1129,7 +1129,7 @@ MP42_OBJC_DIRECT_MEMBERS
|
||||
|
||||
// Get CMBlockBufferRef to extract the actual data later
|
||||
CMBlockBufferRef buffer = CMSampleBufferGetDataBuffer(sampleBuffer);
|
||||
size_t bufferSize = CMBlockBufferGetDataLength(buffer);
|
||||
size_t bufferSize = buffer ? CMBlockBufferGetDataLength(buffer) : 0;
|
||||
|
||||
// We have only a sample
|
||||
// or the format is PCM, if so send only a single buffer to improve performance
|
||||
|
||||
@@ -18,6 +18,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, readwrite, retain, nullable) MP42Image *image;
|
||||
@property (nonatomic, readwrite) MP42Duration timestamp;
|
||||
|
||||
- (NSComparisonResult)compare:(MP42TextSample *)otherObject;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -9,7 +9,7 @@
|
||||
#import <MP42Foundation/MP42MediaFormat.h>
|
||||
|
||||
// Direct method and property calls increases performance and reduces binary size.
|
||||
#if defined(__IPHONE_14_0) || defined(__MAC_10_16) || defined(__TVOS_14_0) || defined(__WATCHOS_7_0)
|
||||
#if defined(__IPHONE_14_0) || defined(__MAC_10_16) || defined(__MAC_11_0) || defined(__TVOS_14_0) || defined(__WATCHOS_7_0)
|
||||
#define MP42_OBJC_DIRECT_MEMBERS __attribute__((objc_direct_members))
|
||||
#define MP42_OBJC_DIRECT __attribute__((objc_direct))
|
||||
#define MP42_DIRECT ,direct
|
||||
|
||||
+20
-6
@@ -103,6 +103,20 @@ MP42_OBJC_DIRECT_MEMBERS
|
||||
return self;
|
||||
}
|
||||
|
||||
static uint32_t convertToFixedPoint(CGFloat value) {
|
||||
uint32_t fixedValue = 0;
|
||||
#ifdef __arm64
|
||||
if (value < 0) {
|
||||
fixedValue = UINT32_MAX - UINT16_MAX * (value * -1);
|
||||
} else {
|
||||
#endif
|
||||
fixedValue = value * 0x10000;
|
||||
#ifdef __arm64
|
||||
}
|
||||
#endif
|
||||
return CFSwapInt32HostToBig(fixedValue);
|
||||
}
|
||||
|
||||
- (BOOL)writeToFile:(MP4FileHandle)fileHandle error:(NSError * __autoreleasing *)outError __attribute__((no_sanitize("float-cast-overflow")))
|
||||
{
|
||||
if (!fileHandle || !self.trackId || ![super writeToFile:fileHandle error:outError]) {
|
||||
@@ -125,12 +139,12 @@ MP42_OBJC_DIRECT_MEMBERS
|
||||
|
||||
MP4GetTrackBytesProperty(fileHandle ,self.trackId, "tkhd.matrix", &val, &size);
|
||||
memcpy(nval, val, size);
|
||||
ptr32[0] = CFSwapInt32HostToBig(_transform.a * 0x10000);
|
||||
ptr32[1] = CFSwapInt32HostToBig(_transform.b * 0x10000);
|
||||
ptr32[3] = CFSwapInt32HostToBig(_transform.c * 0x10000);
|
||||
ptr32[4] = CFSwapInt32HostToBig(_transform.d * 0x10000);
|
||||
ptr32[6] = CFSwapInt32HostToBig(_transform.tx * 0x10000);
|
||||
ptr32[7] = CFSwapInt32HostToBig(_transform.ty * 0x10000);
|
||||
ptr32[0] = convertToFixedPoint(_transform.a);
|
||||
ptr32[1] = convertToFixedPoint(_transform.b);
|
||||
ptr32[3] = convertToFixedPoint(_transform.c);
|
||||
ptr32[4] = convertToFixedPoint(_transform.d);
|
||||
ptr32[6] = convertToFixedPoint(_transform.tx);
|
||||
ptr32[7] = convertToFixedPoint(_transform.ty);
|
||||
MP4SetTrackBytesProperty(fileHandle, self.trackId, "tkhd.matrix", nval, size);
|
||||
|
||||
free(val);
|
||||
|
||||
@@ -1201,7 +1201,6 @@
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
|
||||
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
|
||||
@@ -1267,7 +1266,6 @@
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "";
|
||||
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
|
||||
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
|
||||
|
||||
Reference in new issue
Block a user