Class MFSinkWriter
Implements
Inherited Members
Namespace: JeremyAnsel.DirectX.MediaFoundation
Assembly: JeremyAnsel.DirectX.MediaFoundation.dll
Syntax
[SecurityCritical]
public class MFSinkWriter : DXComObject, IDisposable
Constructors
| Edit this page View SourceMFSinkWriter(nint)
Initializes a new instance of the MFSinkWriter class.
Declaration
public MFSinkWriter(nint comPtr)
Parameters
| Type | Name | Description |
|---|---|---|
| nint | comPtr |
Fields
| Edit this page View SourceMFSinkWriterGuid
The interface GUID.
Declaration
public static readonly Guid MFSinkWriterGuid
Field Value
| Type | Description |
|---|---|
| Guid |
Methods
| Edit this page View SourceAddStream(MFMediaType)
Adds a stream to the writer. - pTargetMediaType specifies the target format of the media samples for the stream. This is the format of the samples as they will be written out to the storage medium. - pdwStreamIndex receives the stream index associated with the new stream.
Declaration
public uint AddStream(MFMediaType pTargetMediaType)
Parameters
| Type | Name | Description |
|---|---|---|
| MFMediaType | pTargetMediaType |
Returns
| Type | Description |
|---|---|
| uint |
BeginWriting()
Called after all streams are configured, but before writing out any samples.
Declaration
public void BeginWriting()
FinalizeWriter()
Called after all samples have been passed to the writer.
Note: By default, this call will block until the content generation has completed, which may take some time. The app can choose to make Finalize() return immediately and trigger a callback when the operation completes by configuring the Sink Writer with an IMFSinkWriterCallback interface set on the attribute store during Sink Writer creation.
Declaration
public void FinalizeWriter()
Flush(uint)
Called to flush all samples that are queued to be encoded or have not yet been sent to the sink.
- dwStreamIndex can either specify a single stream or can be set to
MF_SINK_WRITER_ALL_STREAMS to flush all stream.
Declaration
public void Flush(uint dwStreamIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | dwStreamIndex |
SetInputMediaType(uint, MFMediaType, MFAttributes?)
Specifies the format of the media samples that will be passed to the Sink Writer for a particular stream if different from the target format. This method is used to identify the encoder to be used for the stream.
- dwStreamIndex specifies the index of the stream to configure.
- pInputMediaType specifies the format of the media samples that
will be passed to the Sink Writer for this stream.
- pEncodingParameters is used to specify additional attributes used
to configure the encoder.
Note: This can called at any time to dynamically change the format of the input samples for the stream. Since a format change is queued on the stream, and may fail during processing, calling SetInputMediaType will immediately test the MFT to see if the new type is supported, and only then will it queue the format change.
Declaration
public void SetInputMediaType(uint dwStreamIndex, MFMediaType pInputMediaType, MFAttributes? pEncodingParameters)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | dwStreamIndex | |
| MFMediaType | pInputMediaType | |
| MFAttributes | pEncodingParameters |
WriteSample(uint, MFSample)
Called to pass in a new sample to the writer.
Note: By default calls to WriteSample may block for a period of time to throttle the rate at which samples are processed. The application can disable this throttling by configuring the writer with the MF_SINK_WRITER_DISABLE_THROTTLING attribute.
Declaration
public void WriteSample(uint dwStreamIndex, MFSample pSample)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | dwStreamIndex | |
| MFSample | pSample |