AVBlocks for .NET  2.3
Audio and Video Software Development Kit
MediaInfo Class Reference

Analyzes a file or a stream and provides information about its type and properties. More...

Inheritance diagram for MediaInfo:
Block

Public Member Functions

 MediaInfo ()
 Creates a MediaInfo object in its default state. More...
 
override void Close ()
 Closes the MediaInfo. More...
 
override void Dispose ()
 Disposes the MediaInfo and reclaims the resources used by the object. More...
 
override bool EndOfStream (int inputIndex)
 The method is not implemented. More...
 
override bool Flush ()
 The method is not implemented. More...
 
bool Load ()
 
override bool Open ()
 Analyzes the input specified by the Inputs property. More...
 
override bool Pull (out int outputIndex, MediaSample outputSample)
 The method is not implemented. More...
 
override bool PullUnmanaged (out int outputIndex, MediaSample outputSample)
 The method is not implemented. More...
 
override bool Push (int inputIndex, MediaSample inputSample)
 Pushes input data to the MediaInfo. More...
 
override bool PushUnmanaged (int inputIndex, MediaSample inputSample)
 Pushes input data to the MediaInfo. More...
 

Properties

override ErrorInfo Error [get]
 Error information for the last load operation. More...
 
String InputFile [get, set]
 
override MediaSocketList Inputs [get]
 A modifiable collection of MediaSocket objects which describe the input data of the MediaInfo. More...
 
System.IO.Stream InputStream [get, set]
 
bool IsReady [get]
 Indicates whether stream info and metadata have been loaded and parsed. More...
 
Metadata Metadata [get]
 
override MediaSocketList Outputs [get]
 An immutable collection of MediaSocket objects describing the audio and video streams (tracks) found in the input. More...
 
IList< StreamInfoStreams [get]
 
StreamSubType StreamSubType [get]
 
StreamType StreamType [get, set]
 
- Properties inherited from Block
abstract ErrorInfo Error [get]
 The error information for the last block operation. More...
 
abstract MediaSocketList Inputs [get]
 A modifiable collection of MediaSocket objects which describe the input data of the Block. More...
 
abstract MediaSocketList Outputs [get]
 A modifiable collection of MediaSocket objects which describe the output data of the Blocks. More...
 

Detailed Description

Analyzes a file or a stream and provides information about its type and properties.

Constructor & Destructor Documentation

MediaInfo ( )

Creates a MediaInfo object in its default state.

When the MediaInfo object is not needed anymore it should be disposed in order to deterministically reclaim the allocated resources.

References MediaInfo.Streams.

Member Function Documentation

override void Close ( )
virtual

Closes the MediaInfo.

Implements Block.

override void Dispose ( )
virtual

Disposes the MediaInfo and reclaims the resources used by the object.

Implements Block.

override bool EndOfStream ( int  inputIndex)
virtual

The method is not implemented.

Parameters
inputIndex
Returns

Implements Block.

References MediaInfo.IsReady.

override bool Flush ( )
virtual

The method is not implemented.

Returns

Implements Block.

bool Load ( )

Deprecated:
Please use MediaInfo.Open instead.

Analyzes the input specified by the InputFile or InputStream properties.

Returns
true if the input has been successfully analyzed, otherwise false.

If this method is successful the information about the detected media streams (tracks) can be obtained from the Streams collection.

References Metadata.Clone(), StreamInfo.Clone(), MediaInfo.Error, ObjectCollection< T >.Immutable, MediaInfo.Metadata, MediaInfo.Open(), MediaSocket.Pins, and MediaPin.StreamInfo.

override bool Open ( )
virtual

Analyzes the input specified by the Inputs property.

Returns
true if the input has been successfully analyzed, otherwise false.

If this method is succeeds the information about the detected media streams (tracks) can be obtained from the Outputs property.

Implements Block.

Referenced by MediaSocket.FromMediaInfo(), and MediaInfo.Load().

override bool Pull ( out int  outputIndex,
MediaSample  outputSample 
)
virtual

The method is not implemented.

Parameters
outputIndex
outputSample
Returns

Implements Block.

override bool PullUnmanaged ( out int  outputIndex,
MediaSample  outputSample 
)
virtual

The method is not implemented.

Parameters
outputIndex
outputSample
Returns

Implements Block.

override bool Push ( int  inputIndex,
MediaSample  inputSample 
)
virtual

Pushes input data to the MediaInfo.

Parameters
inputIndexSpecifies the index of the input socket whose data is pushed to the MediaInfo. Must be zero.
inputSampleA MediaSample object that contains the input data in the MediaBuffer property.
Returns
true when the MediaInfo has successfully processed the input data, otherwise false.

In order to use this method the Inputs[0].StreamType must be set.

See also
MediaInfo.IsReady
Supported stream types: StreamType.Mpeg1Video
StreamType.Mpeg2Video
StreamType.H264
StreamType.MpegTS

Implements Block.

References MediaSample.Buffer, MediaBuffer.DataOffset, MediaBuffer.DataSize, MediaInfo.IsReady, MediaBuffer.SetData(), and MediaBuffer.Start.

override bool PushUnmanaged ( int  inputIndex,
MediaSample  inputSample 
)
virtual

Pushes input data to the MediaInfo.

Parameters
inputIndexSpecifies the index of the input socket whose data is pushed to the MediaInfo. Must be zero.
inputSampleA MediaSample object that contains the input data in the UnmanagedMediaBuffer property.
Returns
true when the MediaInfo has successfully processed the input data, otherwise false.

In order to use this method the Inputs[0].StreamType must be set.

See also
MediaInfo.IsReady
Supported stream types: StreamType.Mpeg1Video
StreamType.Mpeg2Video
StreamType.H264
StreamType.MpegTS

Implements Block.

References UnmanagedMediaBuffer.Clear(), UnmanagedMediaBuffer.DataSize, MediaInfo.IsReady, and MediaSample.UnmanagedBuffer.

Property Documentation

override ErrorInfo Error
get

Error information for the last load operation.

Referenced by MediaInfo.Load().

String InputFile
getset

Deprecated:
Please use MediaInfo.Inputs instead.

The input file that should be analyzed. The default value is null.

override MediaSocketList Inputs
get

A modifiable collection of MediaSocket objects which describe the input data of the MediaInfo.

Each socket in the collection represents an input point - it can be a container with one or more streams or just an elementary stream.

The default value of this property is a collection with one element.

System.IO.Stream InputStream
getset

Deprecated:
Please use MediaInfo.Inputs instead.

The input stream that should be analyzed. The default value is null. This is an alternative to InputFile.

MediaInfo will use InputFile when both InputStream and InputFile are set.

bool IsReady
get

Indicates whether stream info and metadata have been loaded and parsed.

See also
MediaInfo.Push

Referenced by MediaInfo.EndOfStream(), MediaSocket.FromMediaInfo(), MediaInfo.Push(), and MediaInfo.PushUnmanaged().

Deprecated:
Please use MediaInfo.Outputs instead.

Contains the metadata of the analyzed file/stream. The default value is null. When there's no metadata for the analyzed file/stream, null is returned.

Referenced by MediaInfo.Load().

override MediaSocketList Outputs
get

An immutable collection of MediaSocket objects describing the audio and video streams (tracks) found in the input.

The default value of this property is an empty collection.

Referenced by MediaSocket.FromMediaInfo().

IList<StreamInfo> Streams
get

Deprecated:
Please use MediaInfo.Outputs instead.

A collection of StreamInfo objects describing the audio and video streams found in the input.

This collection is read-only. Each StreamInfo object in the collection represents a stream (track) in the analyzed input.

Referenced by MediaInfo.MediaInfo().

Deprecated:
Please use MediaInfo.Outputs instead.

Returns the stream subtype detected by MediaInfo. The default value is StreamSubType.Unknown.

Deprecated:
Please use MediaInfo.Inputs instead.

Forces a specific stream type on the input stream or file. The default value is StreamType.Unknown.

If the input is a file and StreamType is not set, the stream type is deduced from the filename extension. If the input is a stream, MediaInfo requires StreamType to be specified. If StreamType is set to something other than StreamType.Unknown, it takes precedence and is used by MediaInfo regardless of the detected stream type.