use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;
use crate::*;
#[cfg(feature = "CMTime")]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CMTimeRange {
pub start: CMTime,
pub duration: CMTime,
}
#[cfg(all(feature = "CMTime", feature = "objc2"))]
unsafe impl Encode for CMTimeRange {
const ENCODING: Encoding = Encoding::Struct("?", &[<CMTime>::ENCODING, <CMTime>::ENCODING]);
}
#[cfg(all(feature = "CMTime", feature = "objc2"))]
unsafe impl RefEncode for CMTimeRange {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
#[cfg(feature = "CMTime")]
pub static kCMTimeRangeZero: CMTimeRange;
}
extern "C" {
#[cfg(feature = "CMTime")]
pub static kCMTimeRangeInvalid: CMTimeRange;
}
#[cfg(feature = "CMTime")]
impl CMTimeRange {
#[doc(alias = "CMTimeRangeMake")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn new(start: CMTime, duration: CMTime) -> CMTimeRange {
extern "C-unwind" {
fn CMTimeRangeMake(start: CMTime, duration: CMTime) -> CMTimeRange;
}
unsafe { CMTimeRangeMake(start, duration) }
}
#[doc(alias = "CMTimeRangeGetUnion")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn union(self, other_range: CMTimeRange) -> CMTimeRange {
extern "C-unwind" {
fn CMTimeRangeGetUnion(range: CMTimeRange, other_range: CMTimeRange) -> CMTimeRange;
}
unsafe { CMTimeRangeGetUnion(self, other_range) }
}
#[doc(alias = "CMTimeRangeGetIntersection")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn intersection(self, other_range: CMTimeRange) -> CMTimeRange {
extern "C-unwind" {
fn CMTimeRangeGetIntersection(
range: CMTimeRange,
other_range: CMTimeRange,
) -> CMTimeRange;
}
unsafe { CMTimeRangeGetIntersection(self, other_range) }
}
#[doc(alias = "CMTimeRangeEqual")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn equal(self, range2: CMTimeRange) -> bool {
extern "C-unwind" {
fn CMTimeRangeEqual(range1: CMTimeRange, range2: CMTimeRange) -> Boolean;
}
let ret = unsafe { CMTimeRangeEqual(self, range2) };
ret != 0
}
#[doc(alias = "CMTimeRangeContainsTime")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn contains_time(self, time: CMTime) -> bool {
extern "C-unwind" {
fn CMTimeRangeContainsTime(range: CMTimeRange, time: CMTime) -> Boolean;
}
let ret = unsafe { CMTimeRangeContainsTime(self, time) };
ret != 0
}
#[doc(alias = "CMTimeRangeContainsTimeRange")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn contains_time_range(self, other_range: CMTimeRange) -> bool {
extern "C-unwind" {
fn CMTimeRangeContainsTimeRange(
range: CMTimeRange,
other_range: CMTimeRange,
) -> Boolean;
}
let ret = unsafe { CMTimeRangeContainsTimeRange(self, other_range) };
ret != 0
}
#[doc(alias = "CMTimeRangeGetEnd")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn end(self) -> CMTime {
extern "C-unwind" {
fn CMTimeRangeGetEnd(range: CMTimeRange) -> CMTime;
}
unsafe { CMTimeRangeGetEnd(self) }
}
}
#[cfg(feature = "CMTime")]
impl CMTime {
#[doc(alias = "CMTimeMapTimeFromRangeToRange")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn map_time_from_range_to_range(
self,
from_range: CMTimeRange,
to_range: CMTimeRange,
) -> CMTime {
extern "C-unwind" {
fn CMTimeMapTimeFromRangeToRange(
t: CMTime,
from_range: CMTimeRange,
to_range: CMTimeRange,
) -> CMTime;
}
unsafe { CMTimeMapTimeFromRangeToRange(self, from_range, to_range) }
}
#[doc(alias = "CMTimeClampToRange")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn clamp_to_range(self, range: CMTimeRange) -> CMTime {
extern "C-unwind" {
fn CMTimeClampToRange(time: CMTime, range: CMTimeRange) -> CMTime;
}
unsafe { CMTimeClampToRange(self, range) }
}
#[doc(alias = "CMTimeMapDurationFromRangeToRange")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn map_duration_from_range_to_range(
self,
from_range: CMTimeRange,
to_range: CMTimeRange,
) -> CMTime {
extern "C-unwind" {
fn CMTimeMapDurationFromRangeToRange(
dur: CMTime,
from_range: CMTimeRange,
to_range: CMTimeRange,
) -> CMTime;
}
unsafe { CMTimeMapDurationFromRangeToRange(self, from_range, to_range) }
}
#[doc(alias = "CMTimeFoldIntoRange")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn fold_into_range(self, fold_range: CMTimeRange) -> CMTime {
extern "C-unwind" {
fn CMTimeFoldIntoRange(time: CMTime, fold_range: CMTimeRange) -> CMTime;
}
unsafe { CMTimeFoldIntoRange(self, fold_range) }
}
}
#[cfg(feature = "CMTime")]
impl CMTimeRange {
#[doc(alias = "CMTimeRangeFromTimeToTime")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn from_time_to_time(start: CMTime, end: CMTime) -> CMTimeRange {
extern "C-unwind" {
fn CMTimeRangeFromTimeToTime(start: CMTime, end: CMTime) -> CMTimeRange;
}
unsafe { CMTimeRangeFromTimeToTime(start, end) }
}
#[doc(alias = "CMTimeRangeCopyAsDictionary")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn as_dictionary(
self,
allocator: Option<&CFAllocator>,
) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn CMTimeRangeCopyAsDictionary(
range: CMTimeRange,
allocator: Option<&CFAllocator>,
) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { CMTimeRangeCopyAsDictionary(self, allocator) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "CMTimeRangeMakeFromDictionary")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn from_dictionary(dictionary_representation: &CFDictionary) -> CMTimeRange {
extern "C-unwind" {
fn CMTimeRangeMakeFromDictionary(
dictionary_representation: &CFDictionary,
) -> CMTimeRange;
}
unsafe { CMTimeRangeMakeFromDictionary(dictionary_representation) }
}
}
extern "C" {
pub static kCMTimeRangeStartKey: &'static CFString;
}
extern "C" {
pub static kCMTimeRangeDurationKey: &'static CFString;
}
#[cfg(feature = "CMTime")]
impl CMTimeRange {
#[doc(alias = "CMTimeRangeCopyDescription")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn description(
allocator: Option<&CFAllocator>,
range: CMTimeRange,
) -> Option<CFRetained<CFString>> {
extern "C-unwind" {
fn CMTimeRangeCopyDescription(
allocator: Option<&CFAllocator>,
range: CMTimeRange,
) -> Option<NonNull<CFString>>;
}
let ret = unsafe { CMTimeRangeCopyDescription(allocator, range) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "CMTimeRangeShow")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn show(self) {
extern "C-unwind" {
fn CMTimeRangeShow(range: CMTimeRange);
}
unsafe { CMTimeRangeShow(self) }
}
}
#[cfg(feature = "CMTime")]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CMTimeMapping {
pub source: CMTimeRange,
pub target: CMTimeRange,
}
#[cfg(all(feature = "CMTime", feature = "objc2"))]
unsafe impl Encode for CMTimeMapping {
const ENCODING: Encoding =
Encoding::Struct("?", &[<CMTimeRange>::ENCODING, <CMTimeRange>::ENCODING]);
}
#[cfg(all(feature = "CMTime", feature = "objc2"))]
unsafe impl RefEncode for CMTimeMapping {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
#[cfg(feature = "CMTime")]
pub static kCMTimeMappingInvalid: CMTimeMapping;
}
#[cfg(feature = "CMTime")]
impl CMTimeMapping {
#[doc(alias = "CMTimeMappingMake")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn new(source: CMTimeRange, target: CMTimeRange) -> CMTimeMapping {
extern "C-unwind" {
fn CMTimeMappingMake(source: CMTimeRange, target: CMTimeRange) -> CMTimeMapping;
}
unsafe { CMTimeMappingMake(source, target) }
}
#[doc(alias = "CMTimeMappingMakeEmpty")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn empty(target: CMTimeRange) -> CMTimeMapping {
extern "C-unwind" {
fn CMTimeMappingMakeEmpty(target: CMTimeRange) -> CMTimeMapping;
}
unsafe { CMTimeMappingMakeEmpty(target) }
}
#[doc(alias = "CMTimeMappingCopyAsDictionary")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn as_dictionary(
self,
allocator: Option<&CFAllocator>,
) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn CMTimeMappingCopyAsDictionary(
mapping: CMTimeMapping,
allocator: Option<&CFAllocator>,
) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { CMTimeMappingCopyAsDictionary(self, allocator) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "CMTimeMappingMakeFromDictionary")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn from_dictionary(dictionary_representation: &CFDictionary) -> CMTimeMapping {
extern "C-unwind" {
fn CMTimeMappingMakeFromDictionary(
dictionary_representation: &CFDictionary,
) -> CMTimeMapping;
}
unsafe { CMTimeMappingMakeFromDictionary(dictionary_representation) }
}
}
extern "C" {
pub static kCMTimeMappingSourceKey: &'static CFString;
}
extern "C" {
pub static kCMTimeMappingTargetKey: &'static CFString;
}
#[cfg(feature = "CMTime")]
impl CMTimeMapping {
#[doc(alias = "CMTimeMappingCopyDescription")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn description(
allocator: Option<&CFAllocator>,
mapping: CMTimeMapping,
) -> Option<CFRetained<CFString>> {
extern "C-unwind" {
fn CMTimeMappingCopyDescription(
allocator: Option<&CFAllocator>,
mapping: CMTimeMapping,
) -> Option<NonNull<CFString>>;
}
let ret = unsafe { CMTimeMappingCopyDescription(allocator, mapping) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "CMTimeMappingShow")]
#[cfg(feature = "CMTime")]
#[inline]
pub unsafe fn show(self) {
extern "C-unwind" {
fn CMTimeMappingShow(mapping: CMTimeMapping);
}
unsafe { CMTimeMappingShow(self) }
}
}
extern "C-unwind" {
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeRange::new`"]
pub fn CMTimeRangeMake(start: CMTime, duration: CMTime) -> CMTimeRange;
}
extern "C-unwind" {
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeRange::union`"]
pub fn CMTimeRangeGetUnion(range: CMTimeRange, other_range: CMTimeRange) -> CMTimeRange;
}
extern "C-unwind" {
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeRange::intersection`"]
pub fn CMTimeRangeGetIntersection(range: CMTimeRange, other_range: CMTimeRange) -> CMTimeRange;
}
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeRange::equal`"]
#[inline]
pub unsafe extern "C-unwind" fn CMTimeRangeEqual(range1: CMTimeRange, range2: CMTimeRange) -> bool {
extern "C-unwind" {
fn CMTimeRangeEqual(range1: CMTimeRange, range2: CMTimeRange) -> Boolean;
}
let ret = unsafe { CMTimeRangeEqual(range1, range2) };
ret != 0
}
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeRange::contains_time`"]
#[inline]
pub unsafe extern "C-unwind" fn CMTimeRangeContainsTime(range: CMTimeRange, time: CMTime) -> bool {
extern "C-unwind" {
fn CMTimeRangeContainsTime(range: CMTimeRange, time: CMTime) -> Boolean;
}
let ret = unsafe { CMTimeRangeContainsTime(range, time) };
ret != 0
}
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeRange::contains_time_range`"]
#[inline]
pub unsafe extern "C-unwind" fn CMTimeRangeContainsTimeRange(
range: CMTimeRange,
other_range: CMTimeRange,
) -> bool {
extern "C-unwind" {
fn CMTimeRangeContainsTimeRange(range: CMTimeRange, other_range: CMTimeRange) -> Boolean;
}
let ret = unsafe { CMTimeRangeContainsTimeRange(range, other_range) };
ret != 0
}
extern "C-unwind" {
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeRange::end`"]
pub fn CMTimeRangeGetEnd(range: CMTimeRange) -> CMTime;
}
extern "C-unwind" {
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTime::map_time_from_range_to_range`"]
pub fn CMTimeMapTimeFromRangeToRange(
t: CMTime,
from_range: CMTimeRange,
to_range: CMTimeRange,
) -> CMTime;
}
extern "C-unwind" {
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTime::clamp_to_range`"]
pub fn CMTimeClampToRange(time: CMTime, range: CMTimeRange) -> CMTime;
}
extern "C-unwind" {
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTime::map_duration_from_range_to_range`"]
pub fn CMTimeMapDurationFromRangeToRange(
dur: CMTime,
from_range: CMTimeRange,
to_range: CMTimeRange,
) -> CMTime;
}
extern "C-unwind" {
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTime::fold_into_range`"]
pub fn CMTimeFoldIntoRange(time: CMTime, fold_range: CMTimeRange) -> CMTime;
}
extern "C-unwind" {
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeRange::from_time_to_time`"]
pub fn CMTimeRangeFromTimeToTime(start: CMTime, end: CMTime) -> CMTimeRange;
}
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeRange::as_dictionary`"]
#[inline]
pub unsafe extern "C-unwind" fn CMTimeRangeCopyAsDictionary(
range: CMTimeRange,
allocator: Option<&CFAllocator>,
) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn CMTimeRangeCopyAsDictionary(
range: CMTimeRange,
allocator: Option<&CFAllocator>,
) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { CMTimeRangeCopyAsDictionary(range, allocator) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
extern "C-unwind" {
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeRange::from_dictionary`"]
pub fn CMTimeRangeMakeFromDictionary(dictionary_representation: &CFDictionary) -> CMTimeRange;
}
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeRange::description`"]
#[inline]
pub unsafe extern "C-unwind" fn CMTimeRangeCopyDescription(
allocator: Option<&CFAllocator>,
range: CMTimeRange,
) -> Option<CFRetained<CFString>> {
extern "C-unwind" {
fn CMTimeRangeCopyDescription(
allocator: Option<&CFAllocator>,
range: CMTimeRange,
) -> Option<NonNull<CFString>>;
}
let ret = unsafe { CMTimeRangeCopyDescription(allocator, range) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
extern "C-unwind" {
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeRange::show`"]
pub fn CMTimeRangeShow(range: CMTimeRange);
}
extern "C-unwind" {
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeMapping::new`"]
pub fn CMTimeMappingMake(source: CMTimeRange, target: CMTimeRange) -> CMTimeMapping;
}
extern "C-unwind" {
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeMapping::empty`"]
pub fn CMTimeMappingMakeEmpty(target: CMTimeRange) -> CMTimeMapping;
}
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeMapping::as_dictionary`"]
#[inline]
pub unsafe extern "C-unwind" fn CMTimeMappingCopyAsDictionary(
mapping: CMTimeMapping,
allocator: Option<&CFAllocator>,
) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn CMTimeMappingCopyAsDictionary(
mapping: CMTimeMapping,
allocator: Option<&CFAllocator>,
) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { CMTimeMappingCopyAsDictionary(mapping, allocator) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
extern "C-unwind" {
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeMapping::from_dictionary`"]
pub fn CMTimeMappingMakeFromDictionary(
dictionary_representation: &CFDictionary,
) -> CMTimeMapping;
}
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeMapping::description`"]
#[inline]
pub unsafe extern "C-unwind" fn CMTimeMappingCopyDescription(
allocator: Option<&CFAllocator>,
mapping: CMTimeMapping,
) -> Option<CFRetained<CFString>> {
extern "C-unwind" {
fn CMTimeMappingCopyDescription(
allocator: Option<&CFAllocator>,
mapping: CMTimeMapping,
) -> Option<NonNull<CFString>>;
}
let ret = unsafe { CMTimeMappingCopyDescription(allocator, mapping) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
extern "C-unwind" {
#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeMapping::show`"]
pub fn CMTimeMappingShow(mapping: CMTimeMapping);
}