Skip to main content

LocalFileSource

Struct LocalFileSource 

Source
pub struct LocalFileSource { /* private fields */ }
Expand description

本地文件,按需 seek 读取,不整体载入内存。

这是播放大视频的默认来源:内存占用与文件大小无关。

Implementations§

Source§

impl LocalFileSource

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self>

打开本地 .omy 文件。

只读取头部,载荷按需读取。

§Errors

文件不存在、无法读取或头部无效时返回错误。

Source

pub fn path(&self) -> &Path

文件路径。

Trait Implementations§

Source§

impl BlockSource for LocalFileSource

Source§

fn header(&self) -> &FixedHeader

文件头。实现者应缓存,避免每次重新解析。
Source§

fn read_ct(&self, offset: u64, len: u64) -> Result<Vec<u8>>

读取载荷区中 [offset, offset + len) 的密文。 Read more
Source§

fn ct_len(&self) -> u64

载荷区密文总长。
Source§

fn describe(&self) -> String

来源的可读描述,用于错误信息与日志。
Source§

fn is_remote(&self) -> bool

是否为远程来源。UI 据此显示网络状态、调整预读策略。
Source§

impl Debug for LocalFileSource

Source§

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

Formats the value using the given formatter. Read more

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

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.