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#[doc(alias = "VTMultiPassStorageRef")]
21#[repr(C)]
22pub struct VTMultiPassStorage {
23    inner: [u8; 0],
24    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
25}
26
27cf_type!(
28    unsafe impl VTMultiPassStorage {}
29);
30#[cfg(feature = "objc2")]
31cf_objc2_type!(
32    unsafe impl RefEncode<"OpaqueVTMultiPassStorage"> for VTMultiPassStorage {}
33);
34
35unsafe impl ConcreteType for VTMultiPassStorage {
36    #[doc(alias = "VTMultiPassStorageGetTypeID")]
37    #[inline]
38    fn type_id() -> CFTypeID {
39        extern "C-unwind" {
40            fn VTMultiPassStorageGetTypeID() -> CFTypeID;
41        }
42        unsafe { VTMultiPassStorageGetTypeID() }
43    }
44}
45
46impl VTMultiPassStorage {
47    /// Creates a VTMultiPassStorage object using a temporary file.
48    ///
49    /// The returned VTMultiPassStorage object may be used to perform multi-pass encoding; see kVTCompressionPropertyKey_MultiPassStorage.
50    /// Call CFRelease to release your retain on the created VTMultiPassStorage object when you are done with it.
51    ///
52    /// Parameter `fileURL`: Specifies where to put the backing file for the VTMultiPassStorage object.
53    /// If you pass NULL for fileURL, the video toolbox will pick a unique temporary file name.
54    ///
55    /// Parameter `timeRange`: Gives a hint to the multi pass storage about valid time stamps for data.
56    ///
57    /// 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.
58    ///
59    /// # Safety
60    ///
61    /// - `options` generics must be of the correct type.
62    /// - `multi_pass_storage_out` must be a valid pointer.
63    #[doc(alias = "VTMultiPassStorageCreate")]
64    #[cfg(feature = "objc2-core-media")]
65    #[inline]
66    pub unsafe fn create(
67        allocator: Option<&CFAllocator>,
68        file_url: Option<&CFURL>,
69        time_range: CMTimeRange,
70        options: Option<&CFDictionary>,
71        multi_pass_storage_out: NonNull<*mut VTMultiPassStorage>,
72    ) -> OSStatus {
73        extern "C-unwind" {
74            fn VTMultiPassStorageCreate(
75                allocator: Option<&CFAllocator>,
76                file_url: Option<&CFURL>,
77                time_range: CMTimeRange,
78                options: Option<&CFDictionary>,
79                multi_pass_storage_out: NonNull<*mut VTMultiPassStorage>,
80            ) -> OSStatus;
81        }
82        unsafe {
83            VTMultiPassStorageCreate(
84                allocator,
85                file_url,
86                time_range,
87                options,
88                multi_pass_storage_out,
89            )
90        }
91    }
92}
93
94extern "C" {
95    /// [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtmultipassstoragecreationoption_donotdelete?language=objc)
96    pub static kVTMultiPassStorageCreationOption_DoNotDelete: &'static CFString;
97}
98
99impl VTMultiPassStorage {
100    /// Ensures that any pending data is written to the multipass storage file and closes the file.
101    ///
102    /// After this function is called, all methods on the multipass storage object will fail.
103    /// It is still necessary to release the object by calling CFRelease.
104    #[doc(alias = "VTMultiPassStorageClose")]
105    #[inline]
106    pub unsafe fn close(&self) -> OSStatus {
107        extern "C-unwind" {
108            fn VTMultiPassStorageClose(multi_pass_storage: &VTMultiPassStorage) -> OSStatus;
109        }
110        unsafe { VTMultiPassStorageClose(self) }
111    }
112}
113
114extern "C-unwind" {
115    #[cfg(feature = "objc2-core-media")]
116    #[deprecated = "renamed to `VTMultiPassStorage::create`"]
117    pub fn VTMultiPassStorageCreate(
118        allocator: Option<&CFAllocator>,
119        file_url: Option<&CFURL>,
120        time_range: CMTimeRange,
121        options: Option<&CFDictionary>,
122        multi_pass_storage_out: NonNull<*mut VTMultiPassStorage>,
123    ) -> OSStatus;
124}
125
126extern "C-unwind" {
127    #[deprecated = "renamed to `VTMultiPassStorage::close`"]
128    pub fn VTMultiPassStorageClose(multi_pass_storage: &VTMultiPassStorage) -> OSStatus;
129}