Class MpaSink
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
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
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
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 sink will be re-created with the newly provided uri. Value 0 means no rotation.
public int RotationPeriod { get; set; }
Property Value
State
Gets the current sink state.
public MediaState State { get; }
Property Value
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
UniqueId
Gets or sets the unique identifier for this sink instance.
public Guid UniqueId { get; set; }
Property Value
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
Methods
AddStream(int, MediaType)
Add media stream for pushing
public void AddStream(int streamIndex, MediaType mediaType)
Parameters
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
streamIndexintStream index
packetVersatileBufferMedia sample
Start(bool)
Start media pushing
public void Start(bool delayedStart = false)
Parameters
delayedStartboolFalse 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
StateChanged
Sink state changed
public event EventHandler<MediaState> StateChanged
Event Type
UriRotated
Output URI has been rotated
public event EventHandler<UriRotatedEventArgs> UriRotated