You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: zero_copy.rs
    path of file: ./repos/gyroflow/src/rendering
    
    the code of the file until where you have to start completion: // SPDX-License-Identifier: GPL-3.0-or-later
// Copyright Â© 2022 Adrian <adrian.eddy at gmail>

#![allow(unused_variables)]
#![allow(unused_mut)]

use ffmpeg_next::format::Pixel;
use ffmpeg_next::frame::Video;
use gyroflow_core::gpu::{ BufferDescription, BufferSource };

#[derive(Default)]
pub struct RenderGlobals {
    #[cfg(any(target_os = "macos", target_os = "ios"))]
    pub tex_cache: Option<mac_ffi::MetalTextureCache>
}

pub fn map_hardware_format(format: Pixel, frame: &Video) -> Option<Pixel> {
    match format {
        #[cfg(any(target_os = "macos", target_os = "ios"))]
        Pixel::VIDEOTOOLBOX => {
            let pix_fmt = unsafe { mac_ffi::CVPixelBufferGetPixelFormatType((*frame.as_ptr()).data[3] as mac_ffi::CVPixelBufferRef) };
            let pix_fmt_bytes = pix_fmt.to_be_bytes();
            match &pix_fmt_bytes {
                b"BGRA" => Some(Pixel::BGRA),    // kCVPixelFormatType_32BGRA                        | 32 bit BGRA
                b"xf20" => Some(Pixel::P010LE),  // kCVPixelFormatType_420YpCbCr10BiPlanarFullRange  | 2 plane YCbCr10 4:2:0, each 10 bits in the MSBs of 16bits, full-range (Y range 0-1023)
                b"x420" => Some(Pixel
    
pub fn map_hardware_format(format: Pixel, frame: &Video) -> Option<Pixel> {
    match format {
        #[cfg(any(target_os = "macos", target_os = "ios"))]
        Pixel::VIDEOTOOLBOX => {
            let pix_fmt = unsafe { mac_ffi::CVPixelBufferGetPixelFormatType((*frame.as_ptr()).data[3] as mac_ffi::CVPixelBufferRef) };
            let pix_fmt_bytes = pix_fmt.to_be_bytes();
            match &pix_fmt_bytes {
                b"BGRA" => Some(Pixel::BGRA),    // kCVPixelFormatType_32BGRA                        | 32 bit BGRA
                b"xf20" => Some(Pixel::P010LE),  // kCVPixelFormatType_420YpCbCr10BiPlanarFullRange  | 2 plane YCbCr10 4:2:0, each 10 bits in the MSBs of 16bits, full-range (Y range 0-1023)
                b"x420" => Some(Pixel::P010LE),  // kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange | 2 plane YCbCr10 4:2:0, each 10 bits in the MSBs of 16bits, video-range (luma=[64,940] chroma=[64,960])
                b"420f" => Some(Pixel::NV12),    // kCVPixelFormatType_420YpCbCr8BiPlanarFullRange   | Bi-Planar Component Y'CbCr 8-bit 4:2:0, full-range (luma=[0,255] chroma=[1,255]).  baseAddr points to a big-endian CVPlanarPixelBufferInfo_YCbCrBiPlanar struct
                b"420v" => Some(Pixel::NV12),    // kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange  | Bi-Planar Component Y'CbCr 8-bit 4:2:0, video-range (luma=[16,235] chroma=[16,240]).  baseAddr points to a big-endian CVPlanarPixelBufferInfo_YCbCrBiPlanar struct
                b"y420" => Some(Pixel::YUV420P), // kCVPixelFormatType_420YpCbCr8Planar              | Planar Component Y'CbCr 8-bit 4:2:0.  baseAddr points to a big-endian CVPlanarPixelBufferInfo_YCbCrPlanar struct
                b"f420" => Some(Pixel::YUV420P), // kCVPixelFormatType_420YpCbCr8PlanarFullRange     | Planar Component Y'CbCr 8-bit 4:2:0, full range.  baseAddr points to a big-endian CVPlanarPixelBufferInfo_YCbCrPlanar struct
                b"xf22" => Some(Pixel::P210LE),  // kCVPixelFormatType_422YpCbCr10BiPlanarFullRange  | 2 plane YCbCr10 4:2:2, each 10 bits in the MSBs of 16bits, full-range (Y range 0-1023)
                b"x422" => Some(Pixel::P210LE),  // kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange | 2 plane YCbCr10 4:2:2, each 10 bits in the MSBs of 16bits, video-range (luma=[64,940] chroma=[64,960])
                b"sv22" => Some(Pixel::P216LE),  // kCVPixelFormatType_422YpCbCr16BiPlanarVideoRange |
                b"2vuy" => Some(Pixel::UYVY422), // kCVPixelFormatType_422YpCbCr8                    | Component Y'CbCr 8-bit 4:2:2, ordered Cb Y'0 Cr Y'1
                b"422f" => Some(Pixel::NV16),    // kCVPixelFormatType_422YpCbCr8BiPlanarFullRange   |
                b"422v" => Some(Pixel::NV16),    // kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange  |
                b"y416" => Some(Pixel::AYUV64),  // kCVPixelFormatType_4444AYpCbCr16                 | Component Y'CbCrA 16-bit 4:4:4:4, ordered A Y' Cb Cr, full range alpha, video range Y'CbCr, 16-bit little-endian samples.
                b"xf44" => Some(Pixel::P410LE),  // kCVPixelFormatType_444YpCbCr10BiPlanarFullRange  | 2 plane YCbCr10 4:4:4, each 10 bits in the MSBs of 16bits, full-range (Y range 0-1023)
                b"x444" => Some(Pixel::P410LE),  // kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange | 2 plane YCbCr10 4:4:4, each 10 bits in the MSBs of 16bits, video-range (luma=[64,940] chroma=[64,960])
                b"sv44" => Some(Pixel::P416LE),  // kCVPixelFormatType_444YpCbCr16BiPlanarVideoRange |
                b"444f" => Some(Pixel::NV24),    // kCVPixelFormatType_444YpCbCr8BiPlanarFullRange   |
                b"444v" => Some(Pixel::NV24),    // kCVPixelFormatType_444YpCbCr8BiPlanarVideoRange  |
                _ => {  log::error!("Unknown VT pixel format: {pix_fmt:08x}"); None }
            }
        },
        _ => None
    }
}