objc2_video_toolbox/
errors.rs

1#[cfg(feature = "objc2")]
2use objc2::encode::{Encode, Encoding, RefEncode};
3
4/// Directives for the decompression session and the video decoder, passed into
5/// decodeFlags parameter of VTDecompressionSessionDecodeFrame.
6///
7///
8/// With the kVTDecodeFrame_EnableAsynchronousDecompression bit clear, the video decoder
9/// is compelled to emit every frame before it returns.  With the bit set, the decoder may
10/// process frames asynchronously, but it is not compelled to do so.
11///
12/// A hint to the decompression session and video decoder that a CVImageBuffer should not
13/// be emitted for this frame.  NULL will be returned instead.
14///
15/// A hint to the video decoder that it would be OK to use a low-power mode that can not decode faster than 1x realtime.
16///
17/// With the kVTDecodeFrame_EnableTemporalProcessing bit clear, the video decoder should emit
18/// every frame once that frame's decoding is done -- frames may not be delayed indefinitely.  With
19/// the bit set, it is legal for the decoder to delay frames indefinitely -- at least
20/// until VTDecompressionSessionFinishDelayedFrames or VTDecompressionSessionInvalidate is called.
21///
22/// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtdecodeframeflags?language=objc)
23// NS_OPTIONS
24#[repr(transparent)]
25#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
26pub struct VTDecodeFrameFlags(pub u32);
27bitflags::bitflags! {
28    impl VTDecodeFrameFlags: u32 {
29        #[doc(alias = "kVTDecodeFrame_EnableAsynchronousDecompression")]
30        const Frame_EnableAsynchronousDecompression = 1<<0;
31        #[doc(alias = "kVTDecodeFrame_DoNotOutputFrame")]
32        const Frame_DoNotOutputFrame = 1<<1;
33        #[doc(alias = "kVTDecodeFrame_1xRealTimePlayback")]
34        const Frame_1xRealTimePlayback = 1<<2;
35        #[doc(alias = "kVTDecodeFrame_EnableTemporalProcessing")]
36        const Frame_EnableTemporalProcessing = 1<<3;
37    }
38}
39
40#[cfg(feature = "objc2")]
41unsafe impl Encode for VTDecodeFrameFlags {
42    const ENCODING: Encoding = u32::ENCODING;
43}
44
45#[cfg(feature = "objc2")]
46unsafe impl RefEncode for VTDecodeFrameFlags {
47    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
48}