objc2-av-foundation 0.3.2

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

use crate::*;

extern "C-unwind" {
    /// Returns a scaled CGRect that maintains the aspect ratio specified by a CGSize within a bounding CGRect.
    ///
    /// This is useful when attempting to fit the presentationSize property of an AVPlayerItem within the bounds of another CALayer.
    /// You would typically use the return value of this function as an AVPlayerLayer frame property value. For example:
    /// myPlayerLayer.frame = AVMakeRectWithAspectRatioInsideRect(myPlayerItem.presentationSize, mySuperLayer.bounds);
    ///
    /// Parameter `aspectRatio`: The width
    /// &
    /// height ratio, or aspect, you wish to maintain.
    ///
    /// Parameter `boundingRect`: The bounding CGRect you wish to fit into.
    #[cfg(feature = "objc2-core-foundation")]
    pub fn AVMakeRectWithAspectRatioInsideRect(
        aspect_ratio: CGSize,
        bounding_rect: CGRect,
    ) -> CGRect;
}

mod private_NSValueCMVideoDimensionsExtensions {
    pub trait Sealed {}
}

/// Category on [`NSValue`].
pub unsafe trait NSValueCMVideoDimensionsExtensions:
    ClassType + Sized + private_NSValueCMVideoDimensionsExtensions::Sealed
{
    extern_methods!(
        #[cfg(feature = "objc2-core-media")]
        /// Creates a NSValue object encoding a CMVideoDimensions struct value.
        ///
        ///
        /// Parameter `dimensions`: The CMVideoDimensions struct to encode.
        ///
        /// Returns: An NSValue object encoding the provided dimensions.
        ///
        ///
        /// This extension simplifies converting CMVideoDimensions struct values into NSValue objects.
        #[unsafe(method(valueWithCMVideoDimensions:))]
        #[unsafe(method_family = none)]
        unsafe fn valueWithCMVideoDimensions(
            dimensions: CMVideoDimensions,
        ) -> Option<Retained<NSValue>>;

        #[cfg(feature = "objc2-core-media")]
        /// Returns the CMVideoDimensions struct encoded by this object.
        ///
        ///
        /// This property simplifies accessing the contents of AVCaptureDeviceFormat.supportedMaxPhotoDimensions which are CMVideoDimension struct values encoded in NSValue objects.
        #[unsafe(method(CMVideoDimensionsValue))]
        #[unsafe(method_family = none)]
        unsafe fn CMVideoDimensionsValue(&self) -> CMVideoDimensions;
    );
}

impl private_NSValueCMVideoDimensionsExtensions::Sealed for NSValue {}
unsafe impl NSValueCMVideoDimensionsExtensions for NSValue {}