Class MXFSinkBlock
- Namespace
- VisioForge.Core.MediaBlocks.Sinks
- Assembly
- VisioForge.Core.dll
Provides a media sink for writing MXF (Material eXchange Format) files with professional broadcast features.
public class MXFSinkBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals, IMediaBlockDynamicInputsInheritance
Implements
Inherited Members
Extension Methods
Examples
// Create MXF sink for broadcast-quality recording
var settings = new MXFSinkSettings
{
Filename = "output.mxf",
VideoStreamType = MXFVideoStreamType.DNxHD,
AudioStreamType = MXFAudioStreamType.Uncompressed
};
var mxfSink = new MXFSinkBlock(settings);
// Create inputs for video and audio
var videoInput = mxfSink.CreateNewInput(MediaBlockPadMediaType.Video);
var audioInput = mxfSink.CreateNewInput(MediaBlockPadMediaType.Audio);
// Connect to pipeline
pipeline.Connect(videoEncoder.Output, videoInput);
pipeline.Connect(audioSource.Output, audioInput);
Remarks
The MXFSinkBlock enables recording of audio and video content to MXF files, a professional format widely used in broadcast and post-production workflows. It supports multiple video and audio stream types with broadcast-quality encoding options.
Key features include:
- Support for multiple video codecs: DV, JPEG2000, MPEG (1/2/4), H.264, DNxHD, and uncompressed
- Support for multiple audio formats: ALAW, MPEG, and uncompressed BWF
- Dynamic input creation for multi-track recording
- Professional broadcast metadata support
- Industry-standard MXF operational patterns
Common use cases:
- Professional video production and archiving
- Broadcast content creation and delivery
- Post-production interchange format
- Long-term media preservation
- Multi-track recording workflows
The block automatically selects appropriate pad templates based on the configured video and audio stream types in the settings. Multiple streams can be multiplexed into a single MXF container.
Constructors
MXFSinkBlock(MXFSinkSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sinks.MXFSinkBlock class with the specified settings.
public MXFSinkBlock(MXFSinkSettings settings)Parameters
settingsMXFSinkSettings-
The MXF sink configuration settings that define output format and encoding options.
Remarks
The settings must specify valid output filename and desired stream types before building the block. The block name is automatically set to "MXFSink".
Exceptions
- ArgumentNullException
-
Thrown when
settingsisnull.
Properties
Input
Gets the first input.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets the inputs.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the output.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets the outputs.
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets or sets the MXF sink configuration settings.
public MXFSinkSettings Settings { get; set; }Property Value
Remarks
The settings determine which video and audio stream types are supported and how the MXF container is structured. Changes to settings after building the block will not take effect.
Type
Gets the type.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds the MXF sink block and configures input pads based on stream type settings.
public override bool Build()Returns
- bool
-
trueif the block was successfully built; otherwise,false.
Remarks
This method initializes the underlying GStreamer MXF muxer element and creates appropriate input pads based on the configured video and audio stream types. Each input pad is matched to a specific pad template that corresponds to the desired codec format.
Pad template mapping:
- DV video: "dv_dif_video_sink_%u"
- JPEG2000 video: "jpeg2000_video_sink_%u"
- MPEG video: "mpeg_video_sink_%u" (for MPEG-1/2/4 and H.264)
- Uncompressed video: "up_video_sink_%u"
- DNxHD video: "vc3_video_sink_%u"
- ALAW audio: "alaw_audio_sink_%u"
- MPEG audio: "mpeg_audio_sink_%u"
- Uncompressed audio: "bwf_audio_sink_%u"
The method will skip any input pads that don't have a corresponding template for the configured stream type. Subtitle inputs are currently not processed.
CleanUp()
Cleans up.
public void CleanUp()CreateNewInput(MediaBlockPadMediaType)
Creates a new input pad for the specified media type to support multi-stream recording.
public MediaBlockPad CreateNewInput(MediaBlockPadMediaType mediaType)Parameters
mediaTypeMediaBlockPadMediaType-
The type of media stream (video, audio, or subtitle) for the new input.
Returns
- MediaBlockPad
-
A new VisioForge.Core.MediaBlocks.MediaBlockPad configured for the specified media type.
Remarks
This method enables dynamic creation of inputs for multi-track MXF files. Each input corresponds to a separate stream in the output file. The actual pad template used depends on the stream type configured in the settings.
Multiple inputs of the same type can be created for multi-track scenarios (e.g., multiple audio tracks for different languages).
Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected override void Dispose(bool disposing)Parameters
disposingbool-
trueto release both managed and unmanaged resources;falseto release only unmanaged resources.
GetCore()
Gets core.
public BaseElement GetCore()Returns
- BaseElement
-
VisioForge.Core.GStreamer.Base.BaseElement.
GetElement()
Gets the element.
public Element GetElement()Returns
- Element
-
Gst.Element.
GetFilenameOrURL()
Gets the output filename for the MXF file.
public string GetFilenameOrURL()Returns
- string
-
The configured output filename path.
Remarks
This method implements the IMediaBlockSink interface requirement and returns the filename specified in the settings.
GetInput(MediaBlockPadMediaType)
Retrieves an existing input pad of the specified media type.
public MediaBlockPad GetInput(MediaBlockPadMediaType mediaType)Parameters
mediaTypeMediaBlockPadMediaType-
The media type to search for.
Returns
- MediaBlockPad
-
The first VisioForge.Core.MediaBlocks.MediaBlockPad matching the specified type, or
nullif none exists.
Remarks
This method returns the first input pad that matches the requested media type. If multiple inputs of the same type exist, only the first one is returned. Use VisioForge.Core.MediaBlocks.Sinks.MXFSinkBlock.Inputs to access all input pads.
IsAvailable()
Determines whether the MXF sink functionality is available in the current environment.
public static bool IsAvailable()Returns
- bool
-
trueif MXF writing is supported; otherwise,false.
Remarks
Availability depends on the presence of required GStreamer plugins (mxf muxer) and appropriate codec support. The correct NuGet SDK redistribution package must be included in your project for this block to function.
SetFilenameOrURL(string)
Sets the output filename for the MXF file.
public void SetFilenameOrURL(string value)Parameters
valuestring-
The new output filename path.
Remarks
This method updates the filename in the settings. Changes made after the block is built will not take effect until the block is rebuilt.
The filename should include the full path and use the .mxf extension for proper file type identification.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the context.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The pipeline.