objc2-media-accessibility 0.3.2

Bindings to the MediaAccessibility framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;
#[cfg(feature = "objc2-foundation")]
use objc2_foundation::*;
#[cfg(feature = "objc2-io-surface")]
use objc2_io_surface::*;

use crate::*;

#[cfg(feature = "objc2")]
extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/maflashinglightsprocessorresult?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2")]
    pub struct MAFlashingLightsProcessorResult;
);

#[cfg(feature = "objc2")]
extern_conformance!(
    unsafe impl NSObjectProtocol for MAFlashingLightsProcessorResult {}
);

#[cfg(feature = "objc2")]
impl MAFlashingLightsProcessorResult {
    extern_methods!(
        #[unsafe(method(surfaceProcessed))]
        #[unsafe(method_family = none)]
        pub unsafe fn surfaceProcessed(&self) -> bool;

        #[unsafe(method(mitigationLevel))]
        #[unsafe(method_family = none)]
        pub unsafe fn mitigationLevel(&self) -> c_float;

        #[unsafe(method(intensityLevel))]
        #[unsafe(method_family = none)]
        pub unsafe fn intensityLevel(&self) -> c_float;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "objc2")]
impl MAFlashingLightsProcessorResult {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/maflashinglightsprocessoroptionkey?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
#[cfg(feature = "objc2-foundation")]
pub type MAFlashingLightsProcessorOptionKey = NSString;

#[cfg(feature = "objc2")]
extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/maflashinglightsprocessor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2")]
    pub struct MAFlashingLightsProcessor;
);

#[cfg(feature = "objc2")]
extern_conformance!(
    unsafe impl NSObjectProtocol for MAFlashingLightsProcessor {}
);

#[cfg(feature = "objc2")]
impl MAFlashingLightsProcessor {
    extern_methods!(
        #[cfg(feature = "objc2-io-surface")]
        /// Determines whether the flashing lights processor is able to process the content in the surface for flashing lights. This might be false on
        /// unsupported hardware or unsupported color spaces.
        ///
        /// Returns: A boolean result.
        #[unsafe(method(canProcessSurface:))]
        #[unsafe(method_family = none)]
        pub unsafe fn canProcessSurface(&self, surface: &IOSurfaceRef) -> bool;

        #[cfg(all(feature = "objc2-foundation", feature = "objc2-io-surface"))]
        /// Processes an inSurface by analyzing pixels for sequences of flashing lights and then darkens content to reduce the risk of discomfort from some users.
        /// The outSurface will contain the mitigated content.
        /// The timestamp indicates the time at which the surface will be shown in the video playback. FPS will be determined based on the values of the timestamps.
        /// Options dictionary for additional parameters.
        ///
        /// Returns: An object which indicates whether the surface was able to be processed, the amount of mitigation that was applied, and the intensitry level that was detected.
        ///
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(processSurface:outSurface:timestamp:options:))]
        #[unsafe(method_family = none)]
        pub unsafe fn processSurface_outSurface_timestamp_options(
            &self,
            in_surface: &IOSurfaceRef,
            out_surface: &IOSurfaceRef,
            timestamp: CFAbsoluteTime,
            options: Option<&NSDictionary<MAFlashingLightsProcessorOptionKey, AnyObject>>,
        ) -> Retained<MAFlashingLightsProcessorResult>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "objc2")]
impl MAFlashingLightsProcessor {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}