fix(macos): compile the VideoToolbox import and clean platform warnings
The macOS job finally reached the build (after the vcpkg manifest fix) and hit a macOS-only compile error in the VideoToolbox import: `*ptr as *const T` parses as `(*ptr) as *const T`, so `sw_format` was read off a pointer instead of the AVHWFramesContext. Bind the frames pointer first. Also fix the warnings the cross-check surfaced: the redundant MTLPixelFormat import, and doc comments on an extern block and a thread_local! (rustdoc does not document those). Verified locally with a host-cc wrapper: `cargo check -p oak-core -p oak-codec -p oak-node -p oak-render -p oak-task -p oak-plugin --target aarch64-apple-darwin` is clean. (oak-app itself needs a real Apple toolchain for ring.)
This commit is contained in:
@@ -516,7 +516,7 @@ fn d3d11_import(req: &HwImportRequest<'_>, ctx: &Arc<GpuContext>) -> ImportOutco
|
||||
// macOS: VideoToolbox CVPixelBuffer -> IOSurface -> Metal textures
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// `CVPixelBufferGetIOSurface` (CoreVideo).
|
||||
// `CVPixelBufferGetIOSurface` (CoreVideo).
|
||||
#[cfg(target_os = "macos")]
|
||||
#[link(name = "CoreVideo", kind = "framework")]
|
||||
extern "C" {
|
||||
@@ -543,7 +543,8 @@ fn videotoolbox_import(req: &HwImportRequest<'_>, ctx: &Arc<GpuContext>) -> Impo
|
||||
return ImportOutcome::Unsupported;
|
||||
}
|
||||
// SAFETY: `hw_frames_ctx` is an AVHWFramesContext for this frame.
|
||||
let sw_format = unsafe { (*(*frames).data as *const sys::AVHWFramesContext).sw_format };
|
||||
let hw_frames = unsafe { (*frames).data as *const sys::AVHWFramesContext };
|
||||
let sw_format = unsafe { (*hw_frames).sw_format };
|
||||
let format = match sw_format {
|
||||
sys::AVPixelFormat::AV_PIX_FMT_NV12 => PlanarFormat::Nv12,
|
||||
sys::AVPixelFormat::AV_PIX_FMT_P010LE | sys::AVPixelFormat::AV_PIX_FMT_P010BE => {
|
||||
|
||||
Reference in New Issue
Block a user