objc2_av_foundation/generated/
AVCaptureOutputBase.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-foundation")]
6use objc2_core_foundation::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11extern_class!(
12    /// AVCaptureOutput is an abstract class that defines an interface for an output destination of an AVCaptureSession.
13    ///
14    ///
15    /// AVCaptureOutput provides an abstract interface for connecting capture output destinations, such as files and video previews, to an AVCaptureSession.
16    ///
17    /// An AVCaptureOutput can have multiple connections represented by AVCaptureConnection objects, one for each stream of media that it receives from an AVCaptureInput. An AVCaptureOutput does not have any connections when it is first created. When an output is added to an AVCaptureSession, connections are created that map media data from that session's inputs to its outputs.
18    ///
19    /// Concrete AVCaptureOutput instances can be added to an AVCaptureSession using the -[AVCaptureSession addOutput:] and -[AVCaptureSession addOutputWithNoConnections:] methods.
20    ///
21    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureoutput?language=objc)
22    #[unsafe(super(NSObject))]
23    #[derive(Debug, PartialEq, Eq, Hash)]
24    pub struct AVCaptureOutput;
25);
26
27unsafe impl NSObjectProtocol for AVCaptureOutput {}
28
29impl AVCaptureOutput {
30    extern_methods!(
31        #[unsafe(method(init))]
32        #[unsafe(method_family = init)]
33        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
34
35        #[unsafe(method(new))]
36        #[unsafe(method_family = new)]
37        pub unsafe fn new() -> Retained<Self>;
38
39        #[cfg(feature = "AVCaptureSession")]
40        /// The connections that describe the flow of media data to the receiver from AVCaptureInputs.
41        ///
42        ///
43        /// The value of this property is an NSArray of AVCaptureConnection objects, each describing the mapping between the receiver and the AVCaptureInputPorts of one or more AVCaptureInputs.
44        #[unsafe(method(connections))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn connections(&self) -> Retained<NSArray<AVCaptureConnection>>;
47
48        #[cfg(all(feature = "AVCaptureSession", feature = "AVMediaFormat"))]
49        /// Returns the first connection in the connections array with an inputPort of the specified mediaType.
50        ///
51        ///
52        /// Parameter `mediaType`: An AVMediaType constant from AVMediaFormat.h, e.g. AVMediaTypeVideo.
53        ///
54        ///
55        /// This convenience method returns the first AVCaptureConnection in the receiver's connections array that has an AVCaptureInputPort of the specified mediaType. If no connection with the specified mediaType is found, nil is returned.
56        #[unsafe(method(connectionWithMediaType:))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn connectionWithMediaType(
59            &self,
60            media_type: &AVMediaType,
61        ) -> Option<Retained<AVCaptureConnection>>;
62
63        #[cfg(all(feature = "AVCaptureSession", feature = "AVMetadataObject"))]
64        /// Converts an AVMetadataObject's visual properties to the receiver's coordinates.
65        ///
66        ///
67        /// Parameter `metadataObject`: An AVMetadataObject originating from the same AVCaptureInput as the receiver.
68        ///
69        /// Parameter `connection`: The receiver's connection whose AVCaptureInput matches that of the metadata object to be converted.
70        ///
71        /// Returns: An AVMetadataObject whose properties are in output coordinates.
72        ///
73        ///
74        /// AVMetadataObject bounds may be expressed as a rect where {0,0} represents the top left of the picture area, and {1,1} represents the bottom right on an unrotated picture. Face metadata objects likewise express yaw and roll angles with respect to an unrotated picture. -transformedMetadataObjectForMetadataObject:connection: converts the visual properties in the coordinate space of the supplied AVMetadataObject to the coordinate space of the receiver. The conversion takes orientation, mirroring, and scaling into consideration. If the provided metadata object originates from an input source other than the preview layer's, nil will be returned.
75        ///
76        /// If an AVCaptureVideoDataOutput instance's connection's videoOrientation or videoMirrored properties are set to non-default values, the output applies the desired mirroring and orientation by physically rotating and or flipping sample buffers as they pass through it. AVCaptureStillImageOutput, on the other hand, does not physically rotate its buffers. It attaches an appropriate kCGImagePropertyOrientation number to captured still image buffers (see ImageIO/CGImageProperties.h) indicating how the image should be displayed on playback. Likewise, AVCaptureMovieFileOutput does not physically apply orientation/mirroring to its sample buffers -- it uses a QuickTime track matrix to indicate how the buffers should be rotated and/or flipped on playback.
77        ///
78        /// transformedMetadataObjectForMetadataObject:connection: alters the visual properties of the provided metadata object to match the physical rotation / mirroring of the sample buffers provided by the receiver through the indicated connection. I.e., for video data output, adjusted metadata object coordinates are rotated/mirrored. For still image and movie file output, they are not.
79        #[unsafe(method(transformedMetadataObjectForMetadataObject:connection:))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn transformedMetadataObjectForMetadataObject_connection(
82            &self,
83            metadata_object: &AVMetadataObject,
84            connection: &AVCaptureConnection,
85        ) -> Option<Retained<AVMetadataObject>>;
86
87        #[cfg(feature = "objc2-core-foundation")]
88        /// Converts a rectangle in the receiver's coordinate space to a rectangle of interest in the coordinate space of an AVCaptureMetadataOutput whose capture device is providing input to the receiver.
89        ///
90        ///
91        /// Parameter `rectInOutputCoordinates`: A CGRect in the receiver's coordinates.
92        ///
93        /// Returns: A CGRect in the coordinate space of the metadata output whose capture device is providing input to the receiver.
94        ///
95        ///
96        /// AVCaptureMetadataOutput rectOfInterest is expressed as a CGRect where {0,0} represents the top left of the picture area, and {1,1} represents the bottom right on an unrotated picture. This convenience method converts a rectangle in the coordinate space of the receiver to a rectangle of interest in the coordinate space of an AVCaptureMetadataOutput whose AVCaptureDevice is providing input to the receiver. The conversion takes orientation, mirroring, and scaling into consideration. See -transformedMetadataObjectForMetadataObject:connection: for a full discussion of how orientation and mirroring are applied to sample buffers passing through the output.
97        #[unsafe(method(metadataOutputRectOfInterestForRect:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn metadataOutputRectOfInterestForRect(
100            &self,
101            rect_in_output_coordinates: CGRect,
102        ) -> CGRect;
103
104        #[cfg(feature = "objc2-core-foundation")]
105        /// Converts a rectangle of interest in the coordinate space of an AVCaptureMetadataOutput whose capture device is providing input to the receiver to a rectangle in the receiver's coordinates.
106        ///
107        ///
108        /// Parameter `rectInMetadataOutputCoordinates`: A CGRect in the coordinate space of the metadata output whose capture device is providing input to the receiver.
109        ///
110        /// Returns: A CGRect in the receiver's coordinates.
111        ///
112        ///
113        /// AVCaptureMetadataOutput rectOfInterest is expressed as a CGRect where {0,0} represents the top left of the picture area, and {1,1} represents the bottom right on an unrotated picture. This convenience method converts a rectangle in the coordinate space of an AVCaptureMetadataOutput whose AVCaptureDevice is providing input to the coordinate space of the receiver. The conversion takes orientation, mirroring, and scaling into consideration. See -transformedMetadataObjectForMetadataObject:connection: for a full discussion of how orientation and mirroring are applied to sample buffers passing through the output.
114        #[unsafe(method(rectForMetadataOutputRectOfInterest:))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn rectForMetadataOutputRectOfInterest(
117            &self,
118            rect_in_metadata_output_coordinates: CGRect,
119        ) -> CGRect;
120    );
121}
122
123/// Constants indicating the reason a capture data output dropped data.
124///
125///
126/// No data was dropped.
127///
128/// Data was dropped because alwaysDiscardsLate{VideoFrames | DepthData} is YES and the client was still processing previous data when the current data needed to be delivered.
129///
130/// Data was dropped because its pool of buffers ran dry. This is usually indicative that the client is holding onto data objects too long.
131///
132/// Data was dropped because the device providing the data experienced a discontinuity, and an unknown number of data objects have been lost. This condition is typically caused by the system being too busy.
133///
134/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureoutputdatadroppedreason?language=objc)
135// NS_ENUM
136#[repr(transparent)]
137#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
138pub struct AVCaptureOutputDataDroppedReason(pub NSInteger);
139impl AVCaptureOutputDataDroppedReason {
140    #[doc(alias = "AVCaptureOutputDataDroppedReasonNone")]
141    pub const None: Self = Self(0);
142    #[doc(alias = "AVCaptureOutputDataDroppedReasonLateData")]
143    pub const LateData: Self = Self(1);
144    #[doc(alias = "AVCaptureOutputDataDroppedReasonOutOfBuffers")]
145    pub const OutOfBuffers: Self = Self(2);
146    #[doc(alias = "AVCaptureOutputDataDroppedReasonDiscontinuity")]
147    pub const Discontinuity: Self = Self(3);
148}
149
150unsafe impl Encode for AVCaptureOutputDataDroppedReason {
151    const ENCODING: Encoding = NSInteger::ENCODING;
152}
153
154unsafe impl RefEncode for AVCaptureOutputDataDroppedReason {
155    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
156}