Class ProxySource
Provides a proxy wrapper around an IMediaSource that enables additional processing and routing.
public class ProxySource : IMediaSource, IReferenceable, IDisposable
- Inheritance
-
ProxySource
- Implements
- Inherited Members
Constructors
ProxySource(IMediaSource)
Initializes a new instance of the ProxySource class.
public ProxySource(IMediaSource originalSource)
Parameters
originalSourceIMediaSourceThe original media source to wrap.
Properties
AudioRenderer
Gets or sets the optional audio renderer for capture preview.
public IAudioRenderer AudioRenderer { get; set; }
Property Value
Capabilities
Gets the list of capabilities supported by this source.
public List<SourceCapability> Capabilities { get; }
Property Value
EchoCanceller
Gets or sets the echo canceller for two-way communication scenarios.
public IEchoCanceller EchoCanceller { get; set; }
Property Value
GenerateIntermediateFrames
Gets or sets a value indicating whether intermediate frames should be generated.
public bool GenerateIntermediateFrames { get; set; }
Property Value
IsDisposed
Gets a value indicating whether this object has been disposed and can no longer be used.
public bool IsDisposed { get; }
Property Value
IsNetworkSource
Gets a value indicating whether this is a network source rather than a local source.
public bool IsNetworkSource { get; }
Property Value
Parameters
Gets or sets the source configuration parameters.
public SourceParameters Parameters { get; set; }
Property Value
RefCount
Gets the current reference count of the object.
public int RefCount { get; }
Property Value
State
Gets the current source state.
public MediaState State { get; }
Property Value
StreamCount
Gets the total number of streams in the source.
public int StreamCount { get; }
Property Value
UniqueId
Gets or sets the unique identifier for this source.
public Guid UniqueId { get; set; }
Property Value
Uri
Gets or sets the source URI.
public string Uri { get; set; }
Property Value
Methods
AddRef()
Adds a reference to this object.
public void AddRef()
Dispose()
Releases all resources used by this proxy source.
public void Dispose()
GetMediaType(int)
Gets the media type of the specified stream.
public 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, or
nullif not found.
GetPlatformContext(int)
Gets the platform-specific context for the specified stream.
public object GetPlatformContext(int streamIndex)
Parameters
streamIndexintThe index of the stream to get the platform context for.
Returns
- object
The platform context, or
nullif not available.
Open()
Opens the source and prepares it for streaming.
public void Open()
Release()
Releases a reference to this object.
public void Release()
Remarks
If the reference count reaches zero, Dispose() is called automatically. The caller must not use this object after calling this method.
SetDesiredOutputType(int, MediaType)
Sets the desired output media type for the specified stream.
public virtual 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 implements 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.
SetStreamMapping(int, int)
Sets the mapping between input and output stream indices.
public void SetStreamMapping(int inputStreamIndex, int outputStreamIndex)
Parameters
inputStreamIndexintThe input stream index to map.
outputStreamIndexintThe output stream index, or -1 to discard the input stream.
Remarks
This method can be used to reorder source streams or discard input streams. Output stream indices must form a consecutive sequence starting from 0, without overlapping. Examples: 0 → 0 (same index), 0 → 1 (reorder), 0 → -1 (discard).
Exceptions
- InvalidOperationException
Thrown if not in Opened state.
Start()
Starts the source and begins pushing media data.
public void Start()
Stop()
Stops the source and releases the underlying media source.
public void Stop()
Events
Error
Occurs when an error is encountered.
public event EventHandler<ErrorEventArgs> Error
Event Type
NewSample
Occurs when a new sample is ready to be consumed.
public event EventHandler<NewSampleEventArgs> NewSample
Event Type
NewStream
Occurs when a new stream is created or stream information becomes available.
public event EventHandler<NewStreamEventArgs> NewStream
Event Type
StateChanged
Occurs when the source state changes.
public event EventHandler<MediaState> StateChanged