Table of Contents

Class IsoSink

Namespace
VAST.File.ISO
Assembly
VAST.File.ISO.dll

Implements IMediaSink and IUriRotatable for writing ISO base media file format (MP4) files using IsoFormatParser as the underlying writer. Supports file URI rotation for chunked recording.

public class IsoSink : IMediaSink, IDisposable, IUriRotatable
Inheritance
IsoSink
Implements
Inherited Members

Constructors

IsoSink()

Initializes a new instance of the IsoSink class.

public IsoSink()

IsoSink(ParsingParameters)

Initializes a new instance of the IsoSink class with the specified parsing parameters.

public IsoSink(ParsingParameters parsingParameters)

Parameters

parsingParameters ParsingParameters

The parsing parameters to use, or null to use defaults.

Properties

Capabilities

Gets the list of sink capabilities

public List<SinkCapability> Capabilities { get; }

Property Value

List<SinkCapability>

IsNetworkSink

Whether it's a network or local sink. Necessary to apply longer timeouts in media session processing logic.

public bool IsNetworkSink { get; }

Property Value

bool

NextUri

Function which returns next URI to be opened. Either Uri or NextUri or Stream shall be specified. Necessary for sinks with dynamically generated URI or file chunking. Exact URI syntax depends on the implementation.

public Func<string> NextUri { get; set; }

Property Value

Func<string>

Parameters

Gets or sets sink parameters

public SinkParameters Parameters { get; set; }

Property Value

SinkParameters

ParsingParameters

Gets or sets the parsing parameters used by the underlying ISO format writer.

public ParsingParameters ParsingParameters { get; set; }

Property Value

ParsingParameters

RotationPeriod

Rotation period in seconds after which the NextUri function will be called and sink will be re-created with the newly provided uri. Value 0 means no rotation

public int RotationPeriod { get; set; }

Property Value

int

State

Gets the current sink state.

public MediaState State { get; }

Property Value

MediaState

Stream

Gets or sets the output stream to write media data to. Either Uri or NextUri or Stream shall be specified.

public Stream Stream { get; set; }

Property Value

Stream

UniqueId

Gets or sets the unique identifier for this sink instance.

public Guid UniqueId { get; set; }

Property Value

Guid

Uri

URI to be opened. Either Uri or NextUri or Stream shall be specified. Exact URI syntax depends on the implementation.

public string Uri { get; set; }

Property Value

string

UserData

Gets or sets user data. Can be used to attach user specific data to a sink.

public object UserData { get; set; }

Property Value

object

Methods

AddStream(int, MediaType)

Adds a media stream descriptor for writing to the output file.

public void AddStream(int streamIndex, MediaType mediaType)

Parameters

streamIndex int

The input stream index.

mediaType MediaType

The media type of the stream.

Dispose()

Releases all resources used by the IsoSink class.

public void Dispose()

Open()

Opens the sink using the configured URI, NextUri function, or output stream.

public void Open()

PushMedia(int, VersatileBuffer)

Writes a media sample to the output file. Handles file rotation when the rotation period has elapsed.

public void PushMedia(int streamIndex, VersatileBuffer packet)

Parameters

streamIndex int

The input stream index.

packet VersatileBuffer

The media sample to write.

Start(bool)

Starts media sample writing. Streams must be added via AddStream(int, MediaType) before calling this method.

public void Start(bool delayedStart = false)

Parameters

delayedStart bool

false if media samples are expected immediately; true if the first media sample is expected after a significant time interval (e.g. tens of seconds).

Stop()

Stops media sample writing, flushes the writer, and releases file resources.

public void Stop()

Events

Error

Occurs when an error is encountered during writing.

public event EventHandler<ErrorEventArgs> Error

Event Type

EventHandler<ErrorEventArgs>

StateChanged

Occurs when the sink state changes.

public event EventHandler<MediaState> StateChanged

Event Type

EventHandler<MediaState>

UriRotated

Occurs when the output URI has been rotated to a new file.

public event EventHandler<UriRotatedEventArgs> UriRotated

Event Type

EventHandler<UriRotatedEventArgs>