pub trait MediaSource: Read + Seek + Send + Sync {
    // Required methods
    fn is_seekable(&self) -> bool;
    fn byte_len(&self) -> Option<u64>;
}
Expand description

MediaSource is a composite trait of std::io::Read and std::io::Seek. A source must implement this trait to be used by MediaSourceStream.

Despite requiring the std::io::Seek trait, seeking is an optional capability that can be queried at runtime.

Required Methods§

source

fn is_seekable(&self) -> bool

Returns if the source is seekable. This may be an expensive operation.

source

fn byte_len(&self) -> Option<u64>

Returns the length in bytes, if available. This may be an expensive operation.

Implementations on Foreign Types§

source§

impl MediaSource for File

source§

fn is_seekable(&self) -> bool

Returns if the std::io::File backing the MediaSource is seekable.

Note: This operation involves querying the underlying file descriptor for information and may be moderately expensive. Therefore it is recommended to cache this value if used often.

source§

fn byte_len(&self) -> Option<u64>

Returns the length in bytes of the std::io::File backing the MediaSource.

Note: This operation involves querying the underlying file descriptor for information and may be moderately expensive. Therefore it is recommended to cache this value if used often.

source§

impl<T: AsRef<[u8]> + Send + Sync> MediaSource for Cursor<T>

source§

fn is_seekable(&self) -> bool

Always returns true since a io::Cursor<u8> is always seekable.

source§

fn byte_len(&self) -> Option<u64>

Returns the length in bytes of the io::Cursor<u8> backing the MediaSource.

Implementors§