objc2_video_toolbox/generated/VTHDRPerFrameMetadataGenerationSession.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-video")]
9use objc2_core_video::*;
10
11use crate::*;
12
13/// Video Toolbox HDR Metadata Generation Session
14///
15///
16/// This file defines the public API for the VTHDRPerFrameMetadataGenerationSession.
17///
18/// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vthdrperframemetadatagenerationhdrformattype?language=objc)
19// NS_TYPED_EXTENSIBLE_ENUM
20pub type VTHDRPerFrameMetadataGenerationHDRFormatType = CFString;
21
22extern "C" {
23 /// Specifies that DolbyVision data should be generated and attached for each pixel buffer.
24 ///
25 /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvthdrperframemetadatagenerationhdrformattype_dolbyvision?language=objc)
26 pub static kVTHDRPerFrameMetadataGenerationHDRFormatType_DolbyVision:
27 &'static VTHDRPerFrameMetadataGenerationHDRFormatType;
28}
29
30extern "C" {
31 /// Specifies an array of HDR formats that should be generated.
32 ///
33 /// This key represents a CFArrayRef. Only one key is supported ( kVTHDRPerFrameMetadataGenerationHDRFormatType_DolbyVision ).
34 ///
35 /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvthdrperframemetadatagenerationoptionskey_hdrformats?language=objc)
36 pub static kVTHDRPerFrameMetadataGenerationOptionsKey_HDRFormats: &'static CFString;
37}
38
39/// A mechanism for generating HDR Per Frame Metadata and attaching that metadata to a CVPixelBuffer and the backing IOSurface.
40///
41/// VTHDRPerFrameMetadataGenerationSessionRef is a CF type, so call CFRelease to release your object reference.
42///
43/// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vthdrperframemetadatagenerationsession?language=objc)
44#[repr(C)]
45pub struct VTHDRPerFrameMetadataGenerationSession {
46 inner: [u8; 0],
47 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
48}
49
50cf_type!(
51 #[encoding_name = "OpaqueVTHDRPerFrameMetadataGenerationSession"]
52 unsafe impl VTHDRPerFrameMetadataGenerationSession {}
53);
54
55unsafe impl ConcreteType for VTHDRPerFrameMetadataGenerationSession {
56 #[doc(alias = "VTHDRPerFrameMetadataGenerationSessionGetTypeID")]
57 #[inline]
58 fn type_id() -> CFTypeID {
59 extern "C-unwind" {
60 fn VTHDRPerFrameMetadataGenerationSessionGetTypeID() -> CFTypeID;
61 }
62 unsafe { VTHDRPerFrameMetadataGenerationSessionGetTypeID() }
63 }
64}
65
66extern "C-unwind" {
67 /// Creates a VTHDRPerFrameMetadataGenerationSession object.
68 ///
69 /// The returned VTHDRPerFrameMetadataGenerationSession object may be used to perform HDR Per Frame Metadata Generation
70 /// Call CFRelease to release your object reference.
71 ///
72 /// Parameter `framesPerSecond`: Value must be greater than 0.0
73 ///
74 /// Parameter `options`: CFDictionary may contain the key kVTHDRPerFrameMetadataGenerationOptionsHDRFormatsKey.
75 pub fn VTHDRPerFrameMetadataGenerationSessionCreate(
76 allocator: Option<&CFAllocator>,
77 frames_per_second: c_float,
78 options: Option<&CFDictionary>,
79 hdr_per_frame_metadata_generation_session_out: NonNull<
80 *mut VTHDRPerFrameMetadataGenerationSession,
81 >,
82 ) -> OSStatus;
83}
84
85/// Attaches the Per Frame Metadata to the CVPixelBuffer and the backing IOSurface
86///
87/// Call this to analyze and attach HDR Metadata. This call will change CVPixelBuffer attachments and backing IOSurface attachments.
88///
89/// Parameter `hdrPerFrameMetadataGenerationSession`:
90/// Parameter `pixelBuffer`:
91/// Parameter `sceneChange`: If this frame changes significantly in brightness from the previous frame, for example going from an indoor scene to an outdoor scene or
92/// from a night scene to a daytime scene, set this to true.
93#[cfg(feature = "objc2-core-video")]
94#[inline]
95pub unsafe extern "C-unwind" fn VTHDRPerFrameMetadataGenerationSessionAttachMetadata(
96 hdr_per_frame_metadata_generation_session: &VTHDRPerFrameMetadataGenerationSession,
97 pixel_buffer: &CVPixelBuffer,
98 scene_change: bool,
99) -> OSStatus {
100 extern "C-unwind" {
101 fn VTHDRPerFrameMetadataGenerationSessionAttachMetadata(
102 hdr_per_frame_metadata_generation_session: &VTHDRPerFrameMetadataGenerationSession,
103 pixel_buffer: &CVPixelBuffer,
104 scene_change: Boolean,
105 ) -> OSStatus;
106 }
107 unsafe {
108 VTHDRPerFrameMetadataGenerationSessionAttachMetadata(
109 hdr_per_frame_metadata_generation_session,
110 pixel_buffer,
111 scene_change as _,
112 )
113 }
114}