• Api Documentation
  • Source Code
Search Results for

    Show / Hide Table of Contents
    • JeremyAnsel.DirectX.MediaFoundation
      • MF2DBuffer
      • MFAttributes
      • MFDXGIDeviceManager
      • MFFactory
      • MFHelpers
      • MFMediaBuffer
      • MFMediaFormatGuids
      • MFMediaFormatGuids.Audio
      • MFMediaFormatGuids.Image
      • MFMediaFormatGuids.Video
      • MFMediaType
      • MFMediaTypeGuids
      • MFMediaTypeMajorGuids
      • MFReadWriteGuids
      • MFSample
      • MFSinkWriter
      • MFSinkWriterGuids
      • MFSourceReader
      • MFSourceReaderControlFlags
      • MFSourceReaderFlags
      • MFSourceReaderGuids
      • MFVideoInterlaceMode

    Class MFSinkWriter

    Inheritance
    object
    DXComObject
    MFSinkWriter
    Implements
    IDisposable
    Inherited Members
    DXComObject.Dispose()
    DXComObject.AddRef()
    DXComObject.Release()
    DXComObject.QueryInterface(in Guid)
    DXComObject.Handle
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: JeremyAnsel.DirectX.MediaFoundation
    Assembly: JeremyAnsel.DirectX.MediaFoundation.dll
    Syntax
    [SecurityCritical]
    public class MFSinkWriter : DXComObject, IDisposable

    Constructors

    | Edit this page View Source

    MFSinkWriter(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 Source

    MFSinkWriterGuid

    The interface GUID.

    Declaration
    public static readonly Guid MFSinkWriterGuid
    Field Value
    Type Description
    Guid

    Methods

    | Edit this page View Source

    AddStream(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
    | Edit this page View Source

    BeginWriting()

    Called after all streams are configured, but before writing out any samples.

    Declaration
    public void BeginWriting()
    | Edit this page View Source

    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()
    | Edit this page View Source

    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
    | Edit this page View Source

    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
    | Edit this page View Source

    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

    Implements

    IDisposable
    • Edit this page
    • View Source
    In this article
    Back to top Copyright (c) 2026 Jérémy Ansel