Skip to main content

SourceBufferCore

Struct SourceBufferCore 

Source
pub struct SourceBufferCore {
    pub id: usize,
    pub mime_type: String,
    pub updating: bool,
    pub buffered: TimeRanges,
    pub mode: String,
    pub timestamp_offset: f64,
    pub append_window_start: f64,
    pub append_window_end: f64,
    pub samples: Vec<FragSample>,
    pub demux: Fmp4Demuxer,
    pub owner: usize,
}
Expand description

個別トラックの SourceBuffer データ。 【2026-10-17】従来はバイト列を貯めて「100KB = 1 秒」と見なした buffered を返す仮実装だった。 fMP4 を Fmp4Demuxer で解析し、取り出したサンプルの表示時刻から buffered を作る。

Fields§

§id: usize§mime_type: String§updating: bool§buffered: TimeRanges§mode: String

"segments"(既定)または "sequence"。

§timestamp_offset: f64

セグメント内のタイムスタンプに加算するオフセット(秒)。

§append_window_start: f64

取り込む表示時刻の下限(秒、既定 0.0)。

§append_window_end: f64

取り込む表示時刻の上限(秒、既定 +∞)。

§samples: Vec<FragSample>

解析済みのサンプル(復号順。トラック情報は demux.tracks)。

§demux: Fmp4Demuxer§owner: usize

所属する MediaSource の番号(JS 側の _ms_id。0 は未所属)。

Implementations§

Source§

impl SourceBufferCore

Source

pub fn new(id: usize, mime_type: &str) -> Self

Source

pub fn set_mode(&mut self, mode: &str) -> Result<(), MseError>

Source

pub fn set_timestamp_offset(&mut self, offset: f64) -> Result<(), MseError>

Source

pub fn set_append_window_start(&mut self, start: f64) -> Result<(), MseError>

Source

pub fn set_append_window_end(&mut self, end: f64) -> Result<(), MseError>

Source

pub fn change_type(&mut self, mime_type: &str) -> Result<(), MseError>

changeType(type): 同一 SourceBuffer 上で後続セグメントの MIME タイプ・コーデックを切り替える。

Source

pub fn video_dimensions(&self) -> Option<(u32, u32)>

初期化セグメント(moov)から得られた映像トラックの (width, height)。

Source

pub fn append_buffer(&mut self, chunk: &[u8]) -> Result<(), MseError>

チャンクの追記(appendBuffer)。初期化セグメントもメディアセグメントも、任意の区切りで渡せる。

Source

fn update_buffered(&mut self)

buffered(秒): 最初のトラック(映像があれば映像)のサンプルの表示区間を併合したもの。

Source

pub fn remove_range(&mut self, start: f64, end: f64)

remove(start, end): 表示時刻が [start, end) 秒のサンプルを捨てる。

Source

pub fn abort(&mut self)

バッファのクリア(abort / remove)

Source

pub fn clear(&mut self)

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

Source§

type Output = T

Should always be Self
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.