Class M4AOutputBlock
- Namespace
- VisioForge.Core.MediaBlocks.Sinks
- Assembly
- VisioForge.Core.dll
M4A audio container output block for creating high-quality AAC audio files with MP4 container format. Provides professional audio file creation with configurable AAC encoding for music production, podcasting, and audio content distribution with industry-standard M4A format supporting metadata and chapter information. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class M4AOutputBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals, IMediaBlockDynamicInputsInheritance
Implements
Inherited Members
Extension Methods
Constructors
M4AOutputBlock(string)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sinks.M4AOutputBlock class with default AAC encoder settings. Creates an M4A output block configured for high-quality audio production with industry-standard AAC compression.
public M4AOutputBlock(string filename)Parameters
filenamestring-
The output M4A file path where the encoded audio content will be written.
M4AOutputBlock(string, MediaFileTags)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sinks.M4AOutputBlock class with default AAC encoder settings and metadata tags. Creates an M4A output block configured for high-quality audio production with industry-standard AAC compression and tag support.
public M4AOutputBlock(string filename, MediaFileTags tags)Parameters
filenamestring-
The output M4A file path where the encoded audio content will be written.
tagsMediaFileTags-
The metadata tags to be written to the M4A file, including title, artist, album, and other information.
M4AOutputBlock(MP4SinkSettings, IAACEncoderSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sinks.M4AOutputBlock class with custom AAC encoder settings. Provides full control over audio compression parameters for professional M4A audio file creation.
public M4AOutputBlock(MP4SinkSettings sinkSettings, IAACEncoderSettings aacSettings)Parameters
sinkSettingsMP4SinkSettings-
The MP4 container sink settings defining M4A output file configuration and metadata options.
aacSettingsIAACEncoderSettings-
The AAC audio encoder settings controlling audio compression quality and parameters.
M4AOutputBlock(MP4SinkSettings, IAACEncoderSettings, MediaFileTags)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sinks.M4AOutputBlock class with custom AAC encoder settings and metadata tags. Provides full control over audio compression parameters for professional M4A audio file creation with tag support.
public M4AOutputBlock(MP4SinkSettings sinkSettings, IAACEncoderSettings aacSettings, MediaFileTags tags)Parameters
sinkSettingsMP4SinkSettings-
The MP4 container sink settings defining M4A output file configuration and metadata options.
aacSettingsIAACEncoderSettings-
The AAC audio encoder settings controlling audio compression quality and parameters.
tagsMediaFileTags-
The metadata tags to be written to the M4A file, including title, artist, album, and other information.
Properties
Input
Gets the primary input pad (first in the collection of dynamic inputs).
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets all input pads available on this block (dynamic collection for audio streams).
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the primary output pad (none for output blocks that write to files).
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads available on this block (none for output blocks).
public override MediaBlockPad[] Outputs { get; }Property Value
Tags
Gets or sets the metadata tags to be written to the M4A file. These tags include information such as title, artist, album, year, and other audio metadata. Tags can be set before building the pipeline and will be applied during the encoding process.
public MediaFileTags Tags { get; set; }Property Value
Type
Gets the media block type identifier for M4A audio output operations.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds and initializes the M4A output block within the pipeline context. Creates the MP4 sink, AAC audio encoder, and establishes all necessary connections for encoding and writing audio content to the M4A file with metadata tags.
public override bool Build()Returns
- bool
-
trueif the M4A output block was successfully built and configured; otherwise,false.
CleanUp()
Cleans up all resources associated with the M4A output operations, including encoder, sink, and file handles.
public void CleanUp()CreateNewInput(MediaBlockPadMediaType)
Creates a new input pad for the specified media type, enabling dynamic addition of audio streams.
public MediaBlockPad CreateNewInput(MediaBlockPadMediaType mediaType)Parameters
mediaTypeMediaBlockPadMediaType-
The type of media (typically Audio) for the new input pad.
Returns
- MediaBlockPad
-
A new MediaBlockPad configured for the specified media type.
Dispose(bool)
Releases unmanaged and managed resources used by the M4A output block. Properly disposes of GStreamer elements, encoder, and file writing resources.
protected override void Dispose(bool disposing)Parameters
disposingbool-
trueto release both managed and unmanaged resources;falseto release only unmanaged resources.
GetCore()
Gets the core GStreamer element wrapper for advanced configuration and monitoring.
public BaseElement GetCore()Returns
- BaseElement
-
Always null for composite output blocks with multiple internal elements.
GetElement()
Gets the native GStreamer element for direct GStreamer pipeline integration.
public Element GetElement()Returns
- Element
-
Always null for composite output blocks with multiple internal elements.
GetFilenameOrURL()
Gets the current output filename or URL where the M4A content is being written.
public string GetFilenameOrURL()Returns
- string
-
The file path or URL string for the M4A output destination.
GetInput(MediaBlockPadMediaType)
Retrieves an existing input pad for the specified media type from the current collection.
public MediaBlockPad GetInput(MediaBlockPadMediaType mediaType)Parameters
mediaTypeMediaBlockPadMediaType-
The type of media (typically Audio) to search for.
Returns
- MediaBlockPad
-
The first matching MediaBlockPad for the specified media type, or null if not found.
IsAvailable(IAACEncoderSettings)
Determines whether M4A output functionality is available on the current system with the specified encoder settings. Requires GStreamer MP4 muxer and AAC audio encoder plugins to be installed and functional.
public static bool IsAvailable(IAACEncoderSettings aacSettings)Parameters
aacSettingsIAACEncoderSettings-
The AAC audio encoder settings to validate for availability.
Returns
- bool
-
trueif M4A output with AAC encoding is supported; otherwise,false.
SetFilenameOrURL(string)
Updates the output filename or URL for the M4A file destination, allowing dynamic output redirection.
public void SetFilenameOrURL(string value)Parameters
valuestring-
The new file path or URL where M4A content should be written.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the pipeline context for this M4A output block, providing access to the parent pipeline and logging context.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The parent MediaBlocks pipeline containing this M4A output block.