pub struct MediaSource<R, S = Seekable> { /* private fields */ }Expand description
MediaSource represents a media data source that can be parsed by
MediaParser.
-
Use
MediaSource::file_path(path)orMediaSource::file(file)to create a MediaSource from a file -
Use
MediaSource::tcp_stream(stream)to create a MediaSource from aTcpStream -
In other cases:
-
Use
MediaSource::seekable(reader)to create a MediaSource from aRead + Seek -
Use
MediaSource::unseekable(reader)to create a MediaSource from a reader that only implRead
-
seekable is preferred to unseekable, since the former is more efficient
when the parser needs to skip a large number of bytes.
Passing in a BufRead should be avoided because MediaParser comes with
its own buffer management and the buffers can be shared between multiple
parsing tasks, thus avoiding frequent memory allocations.