Interface IMediaSource
Defines the contract for a media source.
public interface IMediaSource : IReferenceable, IDisposable
- Inherited Members
Properties
Capabilities
Gets the list of capabilities supported by this source.
List<SourceCapability> Capabilities { get; }
Property Value
IsNetworkSource
Gets a value indicating whether this is a network source rather than a local source.
bool IsNetworkSource { get; }
Property Value
Parameters
Gets or sets the source configuration parameters.
SourceParameters Parameters { get; set; }
Property Value
State
Gets the current source state.
MediaState State { get; }
Property Value
StreamCount
Gets the total number of streams in the source.
int StreamCount { get; }
Property Value
UniqueId
Gets or sets the unique identifier for this source.
Guid UniqueId { get; set; }
Property Value
Uri
Gets or sets the source URI.
string Uri { get; set; }
Property Value
Methods
GetMediaType(int)
Gets the media type of the specified stream.
MediaType GetMediaType(int streamIndex)
Parameters
streamIndexintThe index of the stream to get the media type for.
Returns
- MediaType
The media type of the requested stream.
Open()
Opens the source. Typically used for network sources to establish a connection to a server.
void Open()
SetDesiredOutputType(int, MediaType)
Sets the desired output media type for the specified stream.
Task SetDesiredOutputType(int streamIndex, MediaType mediaType)
Parameters
streamIndexintThe index of the stream to set the desired output type for.
mediaTypeMediaTypeThe desired media type, which can be incomplete and specify only the necessary parameters.
Returns
Remarks
The source should implement decoding or encoding internally to provide the requested output type. The actual output type may not match the desired type exactly; use GetMediaType(int) to obtain the actual output media type.
Start()
Starts the source and begins pushing media data.
void Start()
Stop()
Stops the source. The source cannot be restarted after stopping; a new source must be created if needed.
void Stop()
Events
Error
Occurs when an error is encountered.
event EventHandler<ErrorEventArgs> Error
Event Type
NewSample
Occurs when a new sample is ready to be consumed.
event EventHandler<NewSampleEventArgs> NewSample
Event Type
NewStream
Occurs when a new stream is created or stream information becomes available.
event EventHandler<NewStreamEventArgs> NewStream
Event Type
StateChanged
Occurs when the source state changes.
event EventHandler<MediaState> StateChanged