Skip to main content

PacketBufferError

Enum PacketBufferError 

Source
pub enum PacketBufferError {
    Refcount {
        len: usize,
    },
    Bounds {
        offset: usize,
        len: usize,
        size: usize,
    },
    SideDataEntries {
        count: i32,
        cap: usize,
    },
    SideDataArray {
        count: i32,
    },
    SideDataPayload {
        index: usize,
        size: usize,
    },
    SideDataBytes {
        bytes: usize,
        cap: usize,
    },
    UnrepresentableFlags {
        raw: i32,
    },
    SideDataAlloc {
        size: usize,
    },
}
Expand description

Why a packet could not be carried across the boundary — its payload, or the side data that comes with it.

Every arm means the bytes are real and this crate could not carry them — never that there were none. “No payload” is Ok(None) from FfmpegBuffer::from_packet, and keeping the two apart is the whole point of the type: a demuxer that reads a refcount failure as an empty marker drops a video packet under memory pressure and carries on as though the file said so. The side-data arms exist for the same reason one tier along — a packet whose side data cannot be carried whole is refused, never delivered with some of it.

Variants§

§

Refcount

av_buffer_ref returned null — out of memory taking a second reference to a payload that is there.

Fields

§len: usize

The payload’s length in bytes.

§

Bounds

The payload does not lie inside the packet’s own buffer. AVPacket guarantees it does; a packet that says otherwise is malformed, and wrapping it would hand out a view over memory the buffer does not own.

Fields

§offset: usize

Where the payload starts inside the buffer.

§len: usize

The payload’s length in bytes.

§size: usize

The buffer’s own length in bytes.

§

SideDataEntries

A packet declares more side-data entries than this crate will walk, or a negative count.

The cap bounds the work a crafted packet can demand before it is refused. It cannot trip on anything FFmpeg’s own packet API produces: both av_packet_new_side_data and av_packet_add_side_data replace an entry of the same type, so a packet carries at most one entry per named type — forty-three in this build, and the cap tracks that number if it ever grows past the floor.

Fields

§count: i32

The count the packet declared.

§cap: usize

The most entries this crate will walk.

§

SideDataArray

A packet declares side-data entries and carries no array to read them from.

Malformed, and named rather than read as “no side data”: a null array with a positive count is the same silent loss as a truncated copy, reached through the pointer instead of the cap.

Fields

§count: i32

The count the packet declared.

§

SideDataPayload

A side-data entry declares bytes it does not carry.

Fields

§index: usize

The entry’s position in the packet’s array.

§size: usize

The length the entry declared.

§

SideDataBytes

A packet’s side data is larger than this crate will copy.

Fields

§bytes: usize

The total the packet’s entries reached.

§cap: usize

The most bytes this crate will copy.

§

UnrepresentableFlags

A packet carries flag bits the portable vocabulary cannot hold.

mediadecode’s PacketFlags is a u8 bit set, and every packet flag FFmpeg names today lives in that byte — so this cannot fire against this build. It exists so that the day one does not, the packet is refused by name instead of arriving with a bit quietly missing: the same rule the rest of this boundary keeps.

Fields

§raw: i32

AVPacket.flags as FFmpeg wrote it.

§

SideDataAlloc

Out of memory copying a side-data entry.

Fields

§size: usize

The entry’s length in bytes.

Trait Implementations§

Source§

impl Clone for PacketBufferError

Source§

fn clone(&self) -> PacketBufferError

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 PacketBufferError

Source§

impl Debug for PacketBufferError

Source§

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

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

impl Display for PacketBufferError

Source§

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

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

impl Eq for PacketBufferError

Source§

impl Error for PacketBufferError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for PacketBufferError

Source§

fn eq(&self, other: &PacketBufferError) -> 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 PacketBufferError

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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> ToSmolStr for T
where T: Display + ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more