objc2_video_toolbox/generated/
VTMultiPassStorage.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::marker::{PhantomData, PhantomPinned};
5use core::ptr::NonNull;
6#[cfg(feature = "objc2")]
7use objc2::__framework_prelude::*;
8use objc2_core_foundation::*;
9#[cfg(feature = "objc2-core-media")]
10use objc2_core_media::*;
11
12use crate::*;
13
14/// A mechanism for storing information for each frame of a multi-pass compression session.
15///
16/// VTMultiPassStorageRef is a CF type, so call CFRelease and CFRetain to manage objects of this type.
17/// The data stored in the VTMultiPassStorage is private to the video encoder.
18///
19/// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtmultipassstorage?language=objc)
20#[repr(C)]
21pub struct VTMultiPassStorage {
22    inner: [u8; 0],
23    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
24}
25
26cf_type!(
27    unsafe impl VTMultiPassStorage {}
28);
29#[cfg(feature = "objc2")]
30cf_objc2_type!(
31    unsafe impl RefEncode<"OpaqueVTMultiPassStorage"> for VTMultiPassStorage {}
32);
33
34unsafe impl ConcreteType for VTMultiPassStorage {
35    #[doc(alias = "VTMultiPassStorageGetTypeID")]
36    #[inline]
37    fn type_id() -> CFTypeID {
38        extern "C-unwind" {
39            fn VTMultiPassStorageGetTypeID() -> CFTypeID;
40        }
41        unsafe { VTMultiPassStorageGetTypeID() }
42    }
43}
44
45impl VTMultiPassStorage {
46    /// Creates a VTMultiPassStorage object using a temporary file.
47    ///
48    /// The returned VTMultiPassStorage object may be used to perform multi-pass encoding; see kVTCompressionPropertyKey_MultiPassStorage.
49    /// Call CFRelease to release your retain on the created VTMultiPassStorage object when you are done with it.
50    ///
51    /// Parameter `fileURL`: Specifies where to put the backing file for the VTMultiPassStorage object.
52    /// If you pass NULL for fileURL, the video toolbox will pick a unique temporary file name.
53    ///
54    /// Parameter `timeRange`: Gives a hint to the multi pass storage about valid time stamps for data.
55    ///
56    /// Parameter `options`: If the file did not exist when the storage was created, the file will be deleted when the VTMultiPassStorage object is finalized, unless you set the kVTMultiPassStorageCreationOption_DoNotDelete option to kCFBooleanTrue in the options dictionary.
57    #[doc(alias = "VTMultiPassStorageCreate")]
58    #[cfg(feature = "objc2-core-media")]
59    #[inline]
60    pub unsafe fn create(
61        allocator: Option<&CFAllocator>,
62        file_url: Option<&CFURL>,
63        time_range: CMTimeRange,
64        options: Option<&CFDictionary>,
65        multi_pass_storage_out: NonNull<*mut VTMultiPassStorage>,
66    ) -> OSStatus {
67        extern "C-unwind" {
68            fn VTMultiPassStorageCreate(
69                allocator: Option<&CFAllocator>,
70                file_url: Option<&CFURL>,
71                time_range: CMTimeRange,
72                options: Option<&CFDictionary>,
73                multi_pass_storage_out: NonNull<*mut VTMultiPassStorage>,
74            ) -> OSStatus;
75        }
76        unsafe {
77            VTMultiPassStorageCreate(
78                allocator,
79                file_url,
80                time_range,
81                options,
82                multi_pass_storage_out,
83            )
84        }
85    }
86}
87
88extern "C" {
89    /// [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtmultipassstoragecreationoption_donotdelete?language=objc)
90    pub static kVTMultiPassStorageCreationOption_DoNotDelete: &'static CFString;
91}
92
93impl VTMultiPassStorage {
94    /// Ensures that any pending data is written to the multipass storage file and closes the file.
95    ///
96    /// After this function is called, all methods on the multipass storage object will fail.
97    /// It is still necessary to release the object by calling CFRelease.
98    #[doc(alias = "VTMultiPassStorageClose")]
99    #[inline]
100    pub unsafe fn close(self: &VTMultiPassStorage) -> OSStatus {
101        extern "C-unwind" {
102            fn VTMultiPassStorageClose(multi_pass_storage: &VTMultiPassStorage) -> OSStatus;
103        }
104        unsafe { VTMultiPassStorageClose(self) }
105    }
106}
107
108extern "C-unwind" {
109    #[cfg(feature = "objc2-core-media")]
110    #[deprecated = "renamed to `VTMultiPassStorage::create`"]
111    pub fn VTMultiPassStorageCreate(
112        allocator: Option<&CFAllocator>,
113        file_url: Option<&CFURL>,
114        time_range: CMTimeRange,
115        options: Option<&CFDictionary>,
116        multi_pass_storage_out: NonNull<*mut VTMultiPassStorage>,
117    ) -> OSStatus;
118}
119
120extern "C-unwind" {
121    #[deprecated = "renamed to `VTMultiPassStorage::close`"]
122    pub fn VTMultiPassStorageClose(multi_pass_storage: &VTMultiPassStorage) -> OSStatus;
123}