Table of Contents

Class TsFileSink

Namespace
VAST.TS
Assembly
VAST.TS.dll

Provides a transport stream file sink that writes media data to a file.

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

Constructors

TsFileSink()

Initializes a new instance of the TsFileSink class.

public TsFileSink()

Properties

Capabilities

Gets the list of sink capabilities

public List<SinkCapability> Capabilities { get; }

Property Value

List<SinkCapability>

IsNetworkSink

Gets a value indicating whether this is a network sink. Always returns false for file sinks.

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

RotationPeriod

Gets or sets the rotation period in seconds after which the NextUri function will be called and the sink will be re-created with the newly provided URI. A value of 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. Either Uri or NextUri or Stream shall be specified.

public Stream Stream { get; set; }

Property Value

Stream

UniqueId

Gets or sets the unique identifier of this sink.

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

Methods

AddStream(int, MediaType)

Adds a media stream for pushing.

public void AddStream(int streamIndex, MediaType mediaType)

Parameters

streamIndex int

The stream index.

mediaType MediaType

The stream media type.

Dispose()

Releases all resources used by the TsFileSink class.

public void Dispose()

Open()

Opens the sink using the specified URI or output stream.

public void Open()

PushMedia(int, VersatileBuffer)

Pushes a media sample to the file.

public void PushMedia(int streamIndex, VersatileBuffer packet)

Parameters

streamIndex int

The stream index.

packet VersatileBuffer

The media sample to write.

Start(bool)

Starts media pushing to the file.

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 pushing and closes the file.

public void Stop()

Events

Error

Occurs when an error has occurred during sink operation.

public event EventHandler<ErrorEventArgs> Error

Event Type

EventHandler<ErrorEventArgs>

StateChanged

Occurs when the sink state has changed.

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>