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