Skip to main content

AccessUnit

Struct AccessUnit 

Source
pub struct AccessUnit {
    pub track_id: TrackId,
    pub codec: Codec,
    pub pts: Duration,
    pub dts: Option<Duration>,
    pub rtp_timestamp: RtpTimestamp,
    pub is_keyframe: bool,
    pub data: Bytes,
    pub nal_offsets: Option<Arc<[u32]>>,
}

Fields§

§track_id: TrackId§codec: Codec§pts: Duration§dts: Option<Duration>§rtp_timestamp: RtpTimestamp§is_keyframe: bool§data: Bytes§nal_offsets: Option<Arc<[u32]>>

帧内 NAL 边界(每个 NAL 的起始偏移,末尾带 len 哨兵)。 硬件编码器(HiSilicon VENC)直接给出时填 Some,下游 RTP 打包按偏移切分, 不必扫描 Annex-B 起始码。一帧内所有 NAL 共享同一 pts/rtp_timestamp。

Implementations§

Source§

impl AccessUnit

Source

pub fn kind(&self) -> MediaKind

Determine the media kind from the codec.

Source

pub fn video( track_id: TrackId, codec: Codec, pts: Duration, rtp_timestamp: RtpTimestamp, is_keyframe: bool, data: Bytes, ) -> Self

Construct a video access unit. data is an Annex-B H.264/H.265 access unit (start codes included, as produced by HiMPP VENC).

Source

pub fn video_with_nal_offsets( track_id: TrackId, codec: Codec, pts: Duration, rtp_timestamp: RtpTimestamp, is_keyframe: bool, data: Bytes, nal_offsets: Arc<[u32]>, ) -> Self

构造一帧“带 NAL 边界”的视频访问单元(硬件编码器多 packet 输出)。

data 是整帧连续缓冲(可来自 DMA/MMZ),nal_offsets 是帧内每个 NAL 的 起始偏移加末尾哨兵。下游 RTP 打包按偏移切片,不再扫描 Annex-B 起始码。 一帧内所有 NAL(SPS/PPS/SEI/slice)共享同一个 pts / rtp_timestamp。

Source

pub fn audio( track_id: TrackId, codec: Codec, pts: Duration, rtp_timestamp: RtpTimestamp, data: Bytes, ) -> Self

Construct an audio access unit (raw AAC frame or 8 kHz G.711 sample block; the caller supplies the RTP timestamp).

Trait Implementations§

Source§

impl Clone for AccessUnit

Source§

fn clone(&self) -> Self

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 Debug for AccessUnit

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for AccessUnit

§

impl Forget for AccessUnit

§

impl Move for AccessUnit

§

impl RefUnwindSafe for AccessUnit

§

impl Send for AccessUnit
where Bytes: Send, Arc<[u32]>: Send,

§

impl Sync for AccessUnit
where Bytes: Sync, Arc<[u32]>: Sync,

§

impl Unpin for AccessUnit
where *const u8: Unpin, Align8<*mut ()>: Unpin, &'static Vtable: Unpin, Arc<[u32]>: Unpin,

§

impl UnsafeUnpin for AccessUnit
where *const u8: UnsafeUnpin, Align8<*mut ()>: UnsafeUnpin, &'static Vtable: UnsafeUnpin, *const ArcInner<[u32]> is !null: UnsafeUnpin, PhantomData<ArcInner<[u32]>>: UnsafeUnpin,

§

impl UnwindSafe for AccessUnit
where *const u8: UnwindSafe, Align8<*mut ()>: UnwindSafe, &'static Vtable: UnwindSafe, Arc<[u32]>: UnwindSafe,

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> 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> 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, !>

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