CMFormatDescription

Struct CMFormatDescription 

Source
pub struct CMFormatDescription { /* private fields */ }
Available on crate feature CMFormatDescription only.
Expand description

A reference to a CMFormatDescription, a CF object describing media of a particular type (audio, video, muxed, etc).

See also Apple’s documentation

Implementations§

Source§

impl CMFormatDescription

Source

pub unsafe fn create( allocator: Option<&CFAllocator>, media_type: CMMediaType, media_sub_type: u32, extensions: Option<&CFDictionary>, format_description_out: NonNull<*const CMFormatDescription>, ) -> i32

Creates a generic CMFormatDescription object.

Use this call to create any CMFormatDescription that is composed solely of extensions, and for which CFEqual() of a the extensions dictionaries is a valid test for Format Description equality. Note that for some media types using this routine may result in creating a format description that is not fully specified for the purpose of media processing. Whenever possible, use media-specific format description creations routines such as CMVideoFormatDescriptionCreate, CMAudioFormatDescriptionCreate, etc.

Returns: A new CMFormatDescription object.

§Safety
  • extensions generics must be of the correct type.
  • format_description_out must be a valid pointer.
Source§

impl CMFormatDescription

Source

pub unsafe fn equal( format_description: Option<&CMFormatDescription>, other_format_description: Option<&CMFormatDescription>, ) -> bool

Compares two CMFormatDescription objects for equality.

This calls CFEqual on the provided CMFormatDescription objects. In contrast to the CF call it is NULL safe.

Source

pub unsafe fn equal_ignoring_extension_keys( format_description: Option<&CMFormatDescription>, other_format_description: Option<&CMFormatDescription>, format_description_extension_keys_to_ignore: Option<&CFType>, sample_description_extension_atom_keys_to_ignore: Option<&CFType>, ) -> bool

Compares two CMFormatDescription objects for equality, ignoring differences in specified lists of format description extension keys and sample description extension keys.

This function is NULL safe. If any keys are passed, kCMFormatDescriptionExtension_VerbatimSampleDescription and kCMFormatDescriptionExtension_VerbatimISOSampleEntry will also be automatically ignored for the purpose of comparison.

Parameter formatDescriptionExtensionKeysToIgnore: Either a single format description extension key (CFString) or a CFArray of such keys.

Parameter sampleDescriptionExtensionAtomKeysToIgnore: Either a single sample description extension atom key (four-character CFString) or a CFArray of such keys. See kCMFormatDescriptionExtension_SampleDescriptionExtensionAtoms.

§Safety
  • format_description_extension_keys_to_ignore should be of the correct type.
  • sample_description_extension_atom_keys_to_ignore should be of the correct type.
Source

pub unsafe fn media_type(&self) -> CMMediaType

Returns the media type of a CMFormatDescription.

For example, returns kCMMediaType_Audio for a description of an audio stream.

Returns: The media type of the CMFormatDescription.

Source

pub unsafe fn media_sub_type(&self) -> u32

Returns the media subtype of a CMFormatDescription.

The media subtype is defined in a media-specific way. For audio streams, the media subtype is the asbd.mFormatID. For video streams, the media subtype is the video codec type. For muxed streams, it is the format of the muxed stream. For example, ’aac ’ is returned for a description of an AAC audio stream, ‘avc1’ is returned for a description of an H.264 video stream, and ‘mp2t’ is returned for a description of an MPEG-2 transport (muxed) stream. If a particular type of media stream does not have subtypes, this API may return 0.

Returns: The media subtype of the CMFormatDescription.

Source

pub unsafe fn extensions(&self) -> Option<CFRetained<CFDictionary>>

Returns an immutable dictionary containing all the extensions of a CMFormatDescription.

If there are no extensions, NULL is returned. Extensions dictionaries are valid property list objects. This means that dictionary keys are all CFStrings, and the values are all either CFNumber, CFString, CFBoolean, CFArray, CFDictionary, CFDate, or CFData. The returned dictionary is not retained by this call, so clients are required to retain it if they need to keep it longer.

Returns: An immutable dictionary containing all the extensions of the CMFormatDescription. May be NULL.

Source§

impl CMFormatDescription

Source

pub unsafe fn extension( &self, extension_key: &CFString, ) -> Option<CFRetained<CFPropertyList>>

Returns the specified extension of a CMFormatDescription.

If the named extension does not exist, NULL is returned. The extension is always a valid property list object. This means that it will be either a CFNumber, CFString, CFBoolean, CFArray, CFDictionary, CFDate, or CFData. If it is a CFDictionary, the keys will all be CFStrings. The returned extension is not retained by this call, so it is only valid as long as the CMFormatDescription is valid. Clients are required to retain it if they need to keep it longer.

Returns: The specified extension of the CMFormatDescription. May be NULL.

Methods from Deref<Target = CFType>§

Source

pub fn downcast_ref<T>(&self) -> Option<&T>
where T: ConcreteType,

Available on crate feature CMAttachment only.

Attempt to downcast the type to that of type T.

This is the reference-variant. Use CFRetained::downcast if you want to convert a retained type. See also ConcreteType for more details on which types support being converted to.

Source

pub fn retain_count(&self) -> usize

Available on crate feature CMAttachment only.

Get the reference count of the object.

This function may be useful for debugging. You normally do not use this function otherwise.

Beware that some things (like CFNumbers, small CFStrings etc.) may not have a normal retain count for optimization purposes, and can return usize::MAX in that case.

Trait Implementations§

Source§

impl AsRef<AnyObject> for CMFormatDescription

Source§

fn as_ref(&self) -> &AnyObject

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CFType> for CMFormatDescription

Source§

fn as_ref(&self) -> &CFType

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<CMFormatDescription> for CMFormatDescription

Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<AnyObject> for CMFormatDescription

Source§

fn borrow(&self) -> &AnyObject

Immutably borrows from an owned value. Read more
Source§

impl Borrow<CFType> for CMFormatDescription

Source§

fn borrow(&self) -> &CFType

Immutably borrows from an owned value. Read more
Source§

impl ConcreteType for CMFormatDescription

Source§

fn type_id() -> CFTypeID

Returns the CFTypeID of CMFormatDescription objects.

You can check if a CFTypeRef object is actually a CMFormatDescription by comparing CFGetTypeID(object) with CMFormatDescriptionGetTypeID().

Source§

impl Debug for CMFormatDescription

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for CMFormatDescription

Source§

type Target = CFType

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Hash for CMFormatDescription

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Message for CMFormatDescription

Source§

fn retain(&self) -> Retained<Self>
where Self: Sized,

Increment the reference count of the receiver. Read more
Source§

impl PartialEq for CMFormatDescription

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl RefEncode for CMFormatDescription

Source§

const ENCODING_REF: Encoding

The Objective-C type-encoding for a reference of this type. Read more
Source§

impl Type for CMFormatDescription

Source§

fn retain(&self) -> CFRetained<Self>
where Self: Sized,

Increment the reference count of the receiver. Read more
Source§

fn as_concrete_TypeRef(&self) -> &Self

👎Deprecated: this is redundant
Helper for easier transition from the core-foundation crate.
Source§

unsafe fn wrap_under_get_rule(ptr: *const Self) -> CFRetained<Self>
where Self: Sized,

👎Deprecated: use CFRetained::retain
Helper for easier transition from the core-foundation crate. Read more
Source§

fn as_CFTypeRef(&self) -> &CFType
where Self: AsRef<CFType>,

👎Deprecated: this is redundant (CF types deref to CFType)
Helper for easier transition from the core-foundation crate.
Source§

unsafe fn wrap_under_create_rule(ptr: *const Self) -> CFRetained<Self>
where Self: Sized,

👎Deprecated: use CFRetained::from_raw
Helper for easier transition from the core-foundation crate. Read more
Source§

impl Eq for CMFormatDescription

Source§

impl Send for CMFormatDescription

Source§

impl Sync for CMFormatDescription

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,