mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-30 17:58:37 +08:00
plugins: Fix build issues in Xcode 26.4
Replaced implicit type conversion within macOS plugins (mac-capture, mac-syphon, mac-videotoolbox, mac-virtualcam) with explicit type conversions to clear compile errors with Apple Clang 21.0 and Xcode 26.4. Co-authored-by: PatTheMav <patthemav+github@gmail.com> Co-authored-by: jcm <6864788+jcm93@users.noreply.github.com>
This commit is contained in:
committed by
Ryan Foster
parent
854948b8df
commit
d412d64ef9
@@ -438,16 +438,7 @@ static OSStatus input_callback(void *data, AudioUnitRenderActionFlags *action_fl
|
||||
: ca->buf_list->mNumberBuffers;
|
||||
audio.format = ca->format;
|
||||
audio.samples_per_sec = ca->sample_rate;
|
||||
static double factor = 0.;
|
||||
static mach_timebase_info_data_t info = {0, 0};
|
||||
if (info.numer == 0 && info.denom == 0) {
|
||||
mach_timebase_info(&info);
|
||||
factor = ((double)info.numer) / info.denom;
|
||||
}
|
||||
if (info.numer != info.denom)
|
||||
audio.timestamp = (uint64_t)(factor * ts_data->mHostTime);
|
||||
else
|
||||
audio.timestamp = ts_data->mHostTime;
|
||||
audio.timestamp = AudioConvertHostTimeToNanos(ts_data->mHostTime);
|
||||
|
||||
obs_source_output_audio(ca->source, &audio);
|
||||
|
||||
|
||||
@@ -275,10 +275,13 @@ API_AVAILABLE(macos(12.5)) void screen_stream_video_update(struct screen_capture
|
||||
needs_to_update_properties = true;
|
||||
}
|
||||
} else {
|
||||
size_t width = CVPixelBufferGetWidth(image_buffer);
|
||||
size_t height = CVPixelBufferGetHeight(image_buffer);
|
||||
int width = CVPixelBufferGetWidth(image_buffer);
|
||||
int height = CVPixelBufferGetHeight(image_buffer);
|
||||
|
||||
if ((sc->frame.size.width != width) || (sc->frame.size.height != height)) {
|
||||
int frameWidth = (int) sc->frame.size.width;
|
||||
int frameHeight = (int) sc->frame.size.height;
|
||||
|
||||
if ((frameWidth != width) || (frameHeight != height)) {
|
||||
sc->frame.size.width = width;
|
||||
sc->frame.size.height = height;
|
||||
needs_to_update_properties = true;
|
||||
|
||||
@@ -630,10 +630,13 @@ static void syphon_video_tick(void *data, float seconds)
|
||||
if (s->crop)
|
||||
crop = &s->crop_rect;
|
||||
|
||||
float origin_x = (float) crop->origin.x;
|
||||
float origin_y = (float) (s->height - crop->origin.y);
|
||||
float end_x = (float) (s->width - crop->size.width);
|
||||
float end_y = (float) crop->size.height;
|
||||
|
||||
obs_enter_graphics();
|
||||
build_sprite_rect(gs_vertexbuffer_get_data(s->vertbuffer), (float) crop->origin.x,
|
||||
s->height - (float) crop->origin.y, s->width - (float) crop->size.width,
|
||||
(float) crop->size.height);
|
||||
build_sprite_rect(gs_vertexbuffer_get_data(s->vertbuffer), origin_x, origin_y, end_x, end_y);
|
||||
obs_leave_graphics();
|
||||
}
|
||||
|
||||
|
||||
@@ -539,12 +539,13 @@ static OSStatus create_encoder(struct vt_encoder *enc)
|
||||
kVTCompressionPropertyKey_AllowFrameReordering,
|
||||
kVTCompressionPropertyKey_ProfileLevel};
|
||||
|
||||
SInt32 key_frame_interval = (SInt32)(enc->keyint * ((float)enc->fps_num / enc->fps_den));
|
||||
float expected_framerate = (float)enc->fps_num / enc->fps_den;
|
||||
int actual_frame_rate = enc->fps_num / enc->fps_den;
|
||||
int key_frame_interval = enc->keyint * actual_frame_rate;
|
||||
|
||||
CFNumberRef MaxKeyFrameInterval =
|
||||
CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &key_frame_interval);
|
||||
CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &key_frame_interval);
|
||||
CFNumberRef ExpectedFrameRate =
|
||||
CFNumberCreate(kCFAllocatorDefault, kCFNumberFloat32Type, &expected_framerate);
|
||||
CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &actual_frame_rate);
|
||||
CFTypeRef AllowFrameReordering = enc->bframes ? kCFBooleanTrue : kCFBooleanFalse;
|
||||
|
||||
video_t *video = obs_encoder_video(enc->encoder);
|
||||
|
||||
@@ -19,7 +19,8 @@ CMSampleTimingInfo CMSampleTimingInfoForTimestamp(uint64_t timestampNanos, uint3
|
||||
CMTimeScale scale = 600;
|
||||
CMSampleTimingInfo timing;
|
||||
timing.duration = CMTimeMake(fpsDenominator * scale, fpsNumerator * scale);
|
||||
timing.presentationTimeStamp = CMTimeMakeWithSeconds(timestampNanos / (double) NSEC_PER_SEC, scale);
|
||||
CMTime timestamp = CMTimeMake(timestampNanos, NSEC_PER_SEC);
|
||||
timing.presentationTimeStamp = CMTimeConvertScale(timestamp, scale, kCMTimeRoundingMethod_QuickTime);
|
||||
timing.decodeTimeStamp = kCMTimeInvalid;
|
||||
return timing;
|
||||
}
|
||||
|
||||
@@ -123,8 +123,8 @@
|
||||
{
|
||||
if (NSEqualSizes(_testCardSize, NSZeroSize)) {
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSInteger width = [[defaults objectForKey:kTestCardWidthKey] integerValue];
|
||||
NSInteger height = [[defaults objectForKey:kTestCardHeightKey] integerValue];
|
||||
double width = [[defaults objectForKey:kTestCardWidthKey] doubleValue];
|
||||
double height = [[defaults objectForKey:kTestCardHeightKey] doubleValue];
|
||||
if (width == 0 || height == 0) {
|
||||
_testCardSize = NSMakeSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
} else {
|
||||
@@ -238,9 +238,9 @@
|
||||
NSParameterAssert(pxdata != NULL);
|
||||
|
||||
CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
CGContextRef context = CGBitmapContextCreate(pxdata, width, height, 8,
|
||||
CVPixelBufferGetBytesPerRowOfPlane(pxbuffer, 0), rgbColorSpace,
|
||||
kCGImageAlphaPremultipliedFirst | kCGImageByteOrder32Big);
|
||||
CGContextRef context =
|
||||
CGBitmapContextCreate(pxdata, width, height, 8, CVPixelBufferGetBytesPerRowOfPlane(pxbuffer, 0), rgbColorSpace,
|
||||
(CGBitmapInfo) kCGImageAlphaPremultipliedFirst | kCGImageByteOrder32Big);
|
||||
CFRelease(rgbColorSpace);
|
||||
NSParameterAssert(context);
|
||||
|
||||
@@ -249,7 +249,8 @@
|
||||
|
||||
NSRect rect = NSMakeRect(0, 0, self.testCardImage.size.width, self.testCardImage.size.height);
|
||||
CGImageRef image = [self.testCardImage CGImageForProposedRect:&rect context:nsContext hints:nil];
|
||||
CGContextDrawImage(context, CGRectMake(0, 0, CGImageGetWidth(image), CGImageGetHeight(image)), image);
|
||||
CGContextDrawImage(context, CGRectMake(0, 0, (double) CGImageGetWidth(image), (double) CGImageGetHeight(image)),
|
||||
image);
|
||||
|
||||
// DrawDialWithFrame(
|
||||
// NSMakeRect(0, 0, width, height),
|
||||
|
||||
Reference in New Issue
Block a user