Table of Contents

Class MpaSink

Namespace
VAST.File
Assembly
VAST.File.dll

Provides a media sink for writing MPEG audio (MP1, MP2, MP3) data to files or streams. Supports URI rotation for file chunking and delayed start for scheduled recordings.

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

Constructors

MpaSink()

Initializes a new instance of the MpaSink class.

public MpaSink()

Exceptions

UnauthorizedAccessException

Thrown when a valid license is not available.

Properties

Capabilities

Gets the list of sink capabilities

public List<SinkCapability> Capabilities { get; }

Property Value

List<SinkCapability>

IsNetworkSink

Gets whether this is a network or local sink. Necessary to apply longer timeouts in media session processing logic.

public bool IsNetworkSink { get; }

Property Value

bool

NextUri

Gets or sets the 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

RotationPeriod

Gets or sets the 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 for writing MPEG audio data. 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

Gets or sets the 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

Methods

AddStream(int, MediaType)

Add media stream for pushing

public void AddStream(int streamIndex, MediaType mediaType)

Parameters

streamIndex int

Stream index

mediaType MediaType

Stream media type

Dispose()

Disposes used resources

public void Dispose()

Open()

Open sink using specified URI

public void Open()

PushMedia(int, VersatileBuffer)

Push media sample

public void PushMedia(int streamIndex, VersatileBuffer packet)

Parameters

streamIndex int

Stream index

packet VersatileBuffer

Media sample

Start(bool)

Start media pushing

public void Start(bool delayedStart = false)

Parameters

delayedStart bool

False if media samples are expected immediately. True if first media sample is expected after significant time interval (e.g. tens of seconds)

Stop()

Stop media pushing

public void Stop()

Events

Error

Error occurred

public event EventHandler<ErrorEventArgs> Error

Event Type

EventHandler<ErrorEventArgs>

StateChanged

Sink state changed

public event EventHandler<MediaState> StateChanged

Event Type

EventHandler<MediaState>

UriRotated

Output URI has been rotated

public event EventHandler<UriRotatedEventArgs> UriRotated

Event Type

EventHandler<UriRotatedEventArgs>