pub struct MediaFrame {
pub pts: i64,
pub dts: i64,
pub duration: Option<u64>,
pub data: Bytes,
pub codec: CodecId,
pub frame_type: FrameType,
pub flags: FrameFlags,
pub track_id: u32,
}Expand description
A single decoded or encoded media sample.
data is always a bytes::Bytes slice — zero-copy cloning is safe and
cheap. The same frame can be fanned-out to many subscribers without
copying the underlying buffer.
Fields§
§pts: i64Presentation timestamp in the stream’s time base (milliseconds).
dts: i64Decode timestamp in the stream’s time base (milliseconds).
duration: Option<u64>Duration of this frame in milliseconds. None = unknown.
data: BytesEncoded / raw payload.
codec: CodecIdCodec that produced this frame.
frame_type: FrameTypeFrame type classification.
flags: FrameFlagsBit flags.
track_id: u32Track index (0 = first video, 1 = first audio, etc.).
Implementations§
Source§impl MediaFrame
impl MediaFrame
pub fn new_video( pts: i64, dts: i64, data: Bytes, codec: CodecId, is_key: bool, ) -> Self
pub fn new_audio(pts: i64, data: Bytes, codec: CodecId) -> Self
pub fn is_keyframe(&self) -> bool
pub fn is_audio(&self) -> bool
pub fn is_video(&self) -> bool
pub fn pts_duration(&self) -> Duration
Trait Implementations§
Source§impl Clone for MediaFrame
impl Clone for MediaFrame
Source§fn clone(&self) -> MediaFrame
fn clone(&self) -> MediaFrame
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !Freeze for MediaFrame
impl RefUnwindSafe for MediaFrame
impl Send for MediaFrame
impl Sync for MediaFrame
impl Unpin for MediaFrame
impl UnsafeUnpin for MediaFrame
impl UnwindSafe for MediaFrame
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more