AVBlocks for .NET  3.0
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.
 
override void Close ()
 Closes the MediaInfo.
 
override void Dispose ()
 Disposes the MediaInfo and reclaims the resources used by the object.
 
override bool EndOfStream (int inputIndex)
 The method is not implemented.
 
override bool Flush ()
 The method is not implemented.
 
bool Load ()
 
override bool Open ()
 Analyzes the input specified by the Inputs property.
 
override bool Pull (out int outputIndex, MediaSample outputSample)
 The method is not implemented.
 
override bool PullUnmanaged (out int outputIndex, MediaSample outputSample)
 The method is not implemented.
 
override bool Push (int inputIndex, MediaSample inputSample)
 Pushes input data to the MediaInfo.
 
override bool PushUnmanaged (int inputIndex, MediaSample inputSample)
 Pushes input data to the MediaInfo.
 
abstract void Close ()
 Closes the Block.
 
abstract void Dispose ()
 Disposes the Block and reclaims the resources used by the object.
 
abstract bool EndOfStream (int inputIndex)
 Tells the Block that there's no more data for the specified input socket.
 
abstract bool Flush ()
 Flushes the data buffered in the Block to the output.
 
abstract bool Open ()
 Initializes the Block based on the specified input and desired output.
 
abstract bool Pull (out int outputIndex, MediaSample outputSample)
 Pulls output data from the Block.
 
abstract bool PullUnmanaged (out int outputIndex, MediaSample outputSample)
 Pulls output data from the Block.
 
abstract bool Push (int inputIndex, MediaSample inputSample)
 Pushes input data to the Blocks.
 
abstract bool PushUnmanaged (int inputIndex, MediaSample inputSample)
 Pushes input data to the Block.
 

Properties

override ErrorInfo Error [get]
 Error information for the last load operation.
 
String InputFile [get, set]
 
override MediaSocketList Inputs [get]
 A modifiable collection of MediaSocket objects which describe the input data of the MediaInfo.
 
System.IO.Stream InputStream [get, set]
 
bool IsReady [get]
 Indicates whether stream info and metadata have been loaded and parsed.
 
Metadata Metadata [get]
 
override MediaSocketList Outputs [get]
 An immutable collection of MediaSocket objects describing the audio and video streams (tracks) found in the input.
 
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.
 
abstract MediaSocketList Inputs [get]
 A modifiable collection of MediaSocket objects which describe the input data of the Block.
 
abstract MediaSocketList Outputs [get]
 A modifiable collection of MediaSocket objects which describe the output data of the Blocks.
 

Detailed Description

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

Constructor & Destructor Documentation

◆ MediaInfo()

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.

Member Function Documentation

◆ Close()

override void Close ( )
virtual

Closes the MediaInfo.

Implements Block.

◆ Dispose()

override void Dispose ( )
virtual

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

Implements Block.

◆ EndOfStream()

override bool EndOfStream ( int  inputIndex)
virtual

The method is not implemented.

Parameters
inputIndex
Returns

Implements Block.

◆ Flush()

override bool Flush ( )
virtual

The method is not implemented.

Returns

Implements Block.

◆ Load()

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 MediaInfo.Open().

◆ Open()

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().

◆ Pull()

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

The method is not implemented.

Parameters
outputIndex
outputSample
Returns

Implements Block.

◆ PullUnmanaged()

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

The method is not implemented.

Parameters
outputIndex
outputSample
Returns

Implements Block.

◆ Push()

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.

◆ PushUnmanaged()

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

◆ InputFile

String InputFile
getset
Deprecated:
Please use MediaInfo.Inputs instead. The input file that should be analyzed. The default value is null.

◆ Inputs

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.

◆ InputStream

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.

◆ IsReady

bool IsReady
get

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

See also
MediaInfo.Push

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

◆ Metadata

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.

◆ Outputs

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().

◆ Streams

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.

◆ StreamSubType

Deprecated:
Please use MediaInfo.Outputs instead. Returns the stream subtype detected by MediaInfo. The default value is StreamSubType.Unknown.

◆ StreamType

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.