Class StreamMediaFoundationReader
MediaFoundationReader supporting reading from a stream
Automatically converts to PCM.
If it is a video file with multiple audio streams, it will pick out the first audio stream.
public class StreamMediaFoundationReader : MediaFoundationReader, IAsyncDisposable, IDisposable, IWaveProvider
- Inheritance
-
StreamMediaFoundationReader
- Implements
- Inherited Members
- Extension Methods
Constructors
StreamMediaFoundationReader(Stream, MediaFoundationReaderSettings, string, string)
Constructs a new media foundation reader from a stream
public StreamMediaFoundationReader(Stream stream, MediaFoundationReader.MediaFoundationReaderSettings settings = null, string contentType = null, string originName = null)
Parameters
streamStreamThe data stream to initialize the reader from.
settingsMediaFoundationReader.MediaFoundationReaderSettingsOptional. Additional options that affect how the reader reads data.
contentTypestringOptional. A MIME type hint (e.g.
"audio/ogg") for the byte stream, passed to Media Foundation asMF_BYTESTREAM_CONTENT_TYPEto help its source resolver select a byte-stream handler. Because a stream carries no file name, the resolver otherwise has only the content sniffer's guess to go on; supplying a hint here is the reliable way to decode formats the sniffer does not recognise. When supplied, automatic content sniffing is skipped.originNamestringOptional. A file name or URL whose extension identifies the format (e.g.
"track.ogg"), passed to Media Foundation asMF_BYTESTREAM_ORIGIN_NAME. This gives the byte-stream path the same extension-based resolution the file-based MediaFoundationReader gets viaMFCreateSourceReaderFromURL, and is generally the most reliable hint. When supplied, automatic content sniffing is skipped.
Remarks
A supplied hint only helps Media Foundation locate a decoder that is already installed on the machine; it does not add codec support. If both hints are supplied they are both applied.
Exceptions
- ArgumentNullException
streamis null.- ArgumentException
streamis unreadable, or unseekable.
Methods
Dispose(bool)
Cleanup the wrapper implementation
protected override void Dispose(bool disposing)
Parameters
disposingbool