Class IsoSource
Provides an ISO base media file format (MP4) media source that implements IInteractiveMediaSource for reading and playing back ISO media files with support for seeking, pausing, looping, and variable playback rates.
public class IsoSource : IInteractiveMediaSource, IMediaSource, IReferenceable, IDisposable
- Inheritance
-
IsoSource
- Implements
- Inherited Members
Constructors
IsoSource()
Initializes a new instance of the IsoSource class.
public IsoSource()
IsoSource(ParsingParameters)
Initializes a new instance of the IsoSource class with the specified parsing parameters.
public IsoSource(ParsingParameters parsingParameters)
Parameters
parsingParametersParsingParametersThe parsing parameters to use for ISO format parsing.
Properties
AllowEos
Gets or sets whether source will stop on end of stream.
public bool AllowEos { get; set; }
Property Value
AllowSourceUpdate
Gets or sets whether to allow source update when original source is dirty
public bool AllowSourceUpdate { get; set; }
Property Value
Available
Gets whether source actually supports exposed IInteractiveMediaSource for currently opened URI. Always true for this class.
public bool Available { get; }
Property Value
CanPause
Gets whether source is capable of pausing
public bool CanPause { get; }
Property Value
CanSeek
Gets whether source is capable of seeking
public bool CanSeek { get; }
Property Value
Capabilities
Gets the list of source capabilities
public List<SourceCapability> Capabilities { get; }
Property Value
DeleteFileOnClose
Gets or sets whether to delete source file when closing the source
public bool DeleteFileOnClose { get; set; }
Property Value
Duration
Gets source duration if applicable, otherwise 0
public TimeSpan Duration { get; }
Property Value
IsChangeable
Gets whether source is changeable, i.e. duration will change in time
public bool IsChangeable { get; }
Property Value
IsDisposed
Can be used to check whether object is already disposed and can't be used anymore
public bool IsDisposed { get; }
Property Value
IsMonitor
Gets or sets whether source is monitoring file changes
public bool IsMonitor { get; set; }
Property Value
IsNetworkSource
Whether it's a network or local source.
public bool IsNetworkSource { get; }
Property Value
Loop
Gets or sets whether playback should be an endless loop. If value is true then seek and pause are not available.
public bool Loop { get; set; }
Property Value
NtpTime
Gets the NTP time associated with the media file.
public DateTime NtpTime { get; }
Property Value
OriginalSource
Gets or sets the original source used for sharing parsed file data and receiving source change notifications.
public IsoSource OriginalSource { get; set; }
Property Value
Parameters
Gets or sets source parameters
public SourceParameters Parameters { get; set; }
Property Value
ParsingParameters
Gets or sets the parsing parameters used for ISO format parsing.
public ParsingParameters ParsingParameters { get; set; }
Property Value
PlaybackRate
Gets or sets playback rate (if applicable). If value is 1 then normal playback pace is maintained. If value is more than 1 then it means fast forward playback with possible I-frames only stream if supported by source. If value is in (0..1) range then it means slow motion playback. If value is less or equal to -1 then it means rewind playback with possible I-frames only stream if supported by source. If value is double.MaxValue then source pushes samples as quickly as possible, without considering sample timestamps and playback time.
public double PlaybackRate { get; set; }
Property Value
Position
Gets or sets source playback position if seek is supported
public TimeSpan Position { get; set; }
Property Value
RefCount
Gets current reference count of the object
public int RefCount { get; }
Property Value
State
Gets the current source state.
public MediaState State { get; }
Property Value
Stream
Gets or sets stream to read data from
public Stream Stream { get; set; }
Property Value
StreamCount
Gets the total stream count of the source.
public int StreamCount { get; }
Property Value
UniqueId
Gets or sets the unique source identifier.
public Guid UniqueId { get; set; }
Property Value
UpdateIntervalSec
Gets or sets the update interval in seconds for the file monitoring thread.
public int UpdateIntervalSec { get; set; }
Property Value
Uri
Gets or sets the URI to be opened to pull data from.
public string Uri { get; set; }
Property Value
UseAbsoluteTimestamps
Gets or sets a value indicating whether dispatched samples should use absolute timestamps based on the start time.
public bool UseAbsoluteTimestamps { get; set; }
Property Value
Methods
AddRef()
Add reference
public void AddRef()
Dispose()
Releases all resources used by the IsoSource class.
public void Dispose()
GetMediaType(int)
Gets media type of the stream
public MediaType GetMediaType(int streamIndex)
Parameters
streamIndexintStream index to get media type for
Returns
- MediaType
Media type of requested stream
GetMediaTypeAndIndices(int)
Gets media type of the specified stream and all indices
public NewStreamEventArgs GetMediaTypeAndIndices(int streamIndex)
Parameters
streamIndexintStream index to get media type for
Returns
- NewStreamEventArgs
Media type and all indices of requested stream
Open()
Open source using specified URI
public void Open()
Pause()
Pauses pushing of media data
public void Pause()
QueueRequiredAction(ActionRequiredEventArgs)
Queues required action for further processing
public void QueueRequiredAction(ActionRequiredEventArgs e)
Parameters
eActionRequiredEventArgsRequired action
Release()
Release reference. If reference count becomes 0 then Dispose() method is called. Calling object must not use current object after this call.
public void Release()
SetDesiredOutputType(int, MediaType)
Sets desired output media type of the specified stream. Desired media type could be an incomplete media type specifying only necessary parameters. Source should implement decoding or encoding internally to provide requested output type. It is not guaranteed though that an actual output type will match a desired type exactly. GetMediaType function should be used to obtain actual output media type.
public Task SetDesiredOutputType(int streamIndex, MediaType mediaType)
Parameters
streamIndexintStream index to set desired output media type for
mediaTypeMediaTypeDesired media type
Returns
Start()
Start media pushing
public void Start()
Stop()
Stop media pushing and closes the source
public void Stop()
Events
Error
Occurs when an error has occurred during source operation.
public event EventHandler<ErrorEventArgs> Error
Event Type
NewSample
Occurs when a new media sample is ready for consumption.
public event EventHandler<NewSampleEventArgs> NewSample
Event Type
NewStream
Occurs when a new stream has been created during source opening or update.
public event EventHandler<NewStreamEventArgs> NewStream
Event Type
SourceChanged
Occurs when the source has changed, indicating that duration and frame tables need to be updated.
public event EventHandler SourceChanged
Event Type
StateChanged
Occurs when the source state has changed.
public event EventHandler<MediaState> StateChanged