chore: Prepare for Rust edition bump to 2024 (without autofix) (#27791)

Successor to #27779 - in this PR I've applied changes manually, without
futzing with if let lifetimes at all.

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-03-31 20:10:36 +02:00 committed by GitHub
parent d51aa2ffb0
commit 0729d24d77
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
162 changed files with 2333 additions and 1937 deletions

View file

@ -24,4 +24,4 @@ core-video.workspace = true
objc = "0.2"
[build-dependencies]
bindgen = "0.70.0"
bindgen = "0.71"

View file

@ -96,7 +96,7 @@ pub mod core_media {
}
#[link(name = "CoreMedia", kind = "framework")]
extern "C" {
unsafe extern "C" {
fn CMSampleBufferGetTypeID() -> CFTypeID;
fn CMSampleBufferGetSampleAttachmentsArray(
buffer: CMSampleBufferRef,
@ -163,7 +163,7 @@ pub mod core_media {
}
#[link(name = "CoreMedia", kind = "framework")]
extern "C" {
unsafe extern "C" {
fn CMFormatDescriptionGetTypeID() -> CFTypeID;
fn CMVideoFormatDescriptionGetH264ParameterSetAtIndex(
video_desc: CMFormatDescriptionRef,
@ -202,7 +202,7 @@ pub mod core_media {
}
#[link(name = "CoreMedia", kind = "framework")]
extern "C" {
unsafe extern "C" {
fn CMBlockBufferGetTypeID() -> CFTypeID;
fn CMBlockBufferGetDataPointer(
buffer: CMBlockBufferRef,
@ -258,15 +258,17 @@ pub mod core_video {
/// metal_device must be valid according to CVMetalTextureCacheCreate
pub unsafe fn new(metal_device: *mut MTLDevice) -> Result<Self> {
let mut this = ptr::null();
let result = CVMetalTextureCacheCreate(
kCFAllocatorDefault,
ptr::null(),
metal_device,
ptr::null(),
&mut this,
);
let result = unsafe {
CVMetalTextureCacheCreate(
kCFAllocatorDefault,
ptr::null(),
metal_device,
ptr::null(),
&mut this,
)
};
if result == kCVReturnSuccess {
Ok(CVMetalTextureCache::wrap_under_create_rule(this))
unsafe { Ok(CVMetalTextureCache::wrap_under_create_rule(this)) }
} else {
Err(anyhow!("could not create texture cache, code: {}", result))
}
@ -285,19 +287,21 @@ pub mod core_video {
plane_index: usize,
) -> Result<CVMetalTexture> {
let mut this = ptr::null();
let result = CVMetalTextureCacheCreateTextureFromImage(
kCFAllocatorDefault,
self.as_concrete_TypeRef(),
source,
texture_attributes,
pixel_format,
width,
height,
plane_index,
&mut this,
);
let result = unsafe {
CVMetalTextureCacheCreateTextureFromImage(
kCFAllocatorDefault,
self.as_concrete_TypeRef(),
source,
texture_attributes,
pixel_format,
width,
height,
plane_index,
&mut this,
)
};
if result == kCVReturnSuccess {
Ok(CVMetalTexture::wrap_under_create_rule(this))
unsafe { Ok(CVMetalTexture::wrap_under_create_rule(this)) }
} else {
Err(anyhow!("could not create texture, code: {}", result))
}
@ -305,7 +309,7 @@ pub mod core_video {
}
#[link(name = "CoreVideo", kind = "framework")]
extern "C" {
unsafe extern "C" {
fn CVMetalTextureCacheGetTypeID() -> CFTypeID;
fn CVMetalTextureCacheCreate(
allocator: CFAllocatorRef,
@ -345,7 +349,7 @@ pub mod core_video {
}
#[link(name = "CoreVideo", kind = "framework")]
extern "C" {
unsafe extern "C" {
fn CVMetalTextureGetTypeID() -> CFTypeID;
fn CVMetalTextureGetTexture(texture: CVMetalTextureRef) -> *mut c_void;
}