Class TsFileSink
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
IsNetworkSink
Gets a value indicating whether this is a network sink.
Always returns false for file sinks.
public bool IsNetworkSink { get; }
Property Value
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
Parameters
Gets or sets sink parameters
public SinkParameters Parameters { get; set; }
Property Value
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
State
Gets the current sink state.
public MediaState State { get; }
Property Value
Stream
public Stream Stream { get; set; }
Property Value
UniqueId
Gets or sets the unique identifier of this sink.
public Guid UniqueId { get; set; }
Property Value
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
Methods
AddStream(int, MediaType)
Adds a media stream for pushing.
public void AddStream(int streamIndex, MediaType mediaType)
Parameters
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
streamIndexintThe stream index.
packetVersatileBufferThe media sample to write.
Start(bool)
Starts media pushing to the file.
public void Start(bool delayedStart = false)
Parameters
delayedStartboolfalseif media samples are expected immediately;trueif 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
StateChanged
Occurs when the sink state has changed.
public event EventHandler<MediaState> StateChanged
Event Type
UriRotated
Occurs when the output URI has been rotated to a new file.
public event EventHandler<UriRotatedEventArgs> UriRotated