Table of Contents

Interface IMediaBlocksPipelineCustomErrorHandler

Namespace
VisioForge.Core.Types.X
Assembly
VisioForge.Core.dll

Defines an interface for custom error handling within a MediaBlocks pipeline. Implementations of this interface can intercept and process errors that occur during pipeline execution.

public interface IMediaBlocksPipelineCustomErrorHandler

Examples

// Example custom error handler implementation.
public class MyCustomErrorHandler : IMediaBlocksPipelineCustomErrorHandler
{
    public bool ErrorHandler(Bus bus, Message msg, Pipeline pipeline)
    {
        // Log the error details.
        Console.WriteLine($"Pipeline Error: {{msg.ParseError().Message}}");

        // Attempt to recover from specific errors, e.g., network disconnections.
        if (msg.ParseError().Message.Contains("network"))
        {
            Console.WriteLine("Attempting to reconnect...");
            // Logic to re-establish connection or restart relevant elements.
            return true; // Indicate that the error was handled and pipeline should try to continue.
        }

        // For unhandled errors, return false to stop the pipeline.
        return false;
    }
}

// Usage (conceptual):
// var pipeline = new MediaBlocksPipeline();
// pipeline.CustomErrorHandler = new MyCustomErrorHandler();
// pipeline.Start();

Remarks

By implementing this interface and registering it with a MediaBlocks pipeline, developers can gain fine-grained control over how errors are managed. The VisioForge.Core.Types.X.IMediaBlocksPipelineCustomErrorHandler.ErrorHandler(Gst.Bus,Gst.Message,Gst.Pipeline) method allows for custom logic to decide whether the pipeline should attempt to recover from an error or stop.

Methods

ErrorHandler(Bus, Message, Pipeline)

Handles an error message received from the GStreamer bus.

bool ErrorHandler(Bus bus, Message msg, Pipeline pipeline)

Parameters

bus Bus

The GStreamer bus that emitted the error message.

msg Message

The GStreamer Gst.Message object containing the error details.

pipeline Pipeline

The GStreamer Gst.Pipeline instance where the error occurred.

Returns

bool

true if the error was handled and the pipeline should attempt to continue working; false if the error was not handled or if the pipeline should stop.