Skip to main content

CapabilityDescriptor

Struct CapabilityDescriptor 

Source
pub struct CapabilityDescriptor {
    pub output_memory: MemoryDomainKind,
    pub acceleration: Acceleration,
    pub rank: i16,
}
Expand description

What an element offers the auto-plug search beyond its pad templates: the signals used to choose among several elements that satisfy the same caps.

This generalizes a bare output-memory tag, the principled alternative to a flat global rank. A single integer cannot express that the best element is context-dependent (a hardware decoder that keeps frames on the GPU beats a faster one that forces a PCIe download when the consumer is GPU-resident), so score ranks a candidate against a SelectionContext; the numeric rank is only the deterministic tiebreaker among otherwise-equal candidates (the explicit-override knob GStreamer’s rank gets right). All-default descriptors score equally, so registration order decides, leaving a plain pipeline’s selection unchanged.

Fields§

§output_memory: MemoryDomainKind

The memory feature the source pad emits (a decodebin caps feature, GStreamer’s memory:CUDAMemory analog). Caps geometry / format is in the pad templates; the memory domain is not, so it rides here. Matching the consumer’s domain avoids a copy / download (e.g. pick NvDec -> Cuda).

§acceleration: Acceleration

Hardware vs software path.

§rank: i16

Deterministic tiebreaker among candidates of equal score (higher wins); default 0. Use it to order otherwise-equivalent backends (e.g. two ffmpeg codecs), or as an operator override, not as the primary selector.

Implementations§

Source§

impl CapabilityDescriptor

Source

pub fn score(&self, ctx: &SelectionContext) -> i32

Score this candidate against what the search wants; higher is tried first. Memory-domain match dominates (it removes a download, the structural win), then a hardware preference, then the explicit rank.

Trait Implementations§

Source§

impl Clone for CapabilityDescriptor

Source§

fn clone(&self) -> CapabilityDescriptor

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for CapabilityDescriptor

Source§

impl Debug for CapabilityDescriptor

Source§

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

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

impl Default for CapabilityDescriptor

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for CapabilityDescriptor

Source§

impl PartialEq for CapabilityDescriptor

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CapabilityDescriptor

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ElementBound for T
where T: Send,

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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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.