AVBlocks for C++  3.0
Audio and Video Software Development Kit
Loading...
Searching...
No Matches
MediaInfo Class Referenceabstract

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

#include <avb.h>

Inheritance diagram for MediaInfo:
Block Reference

Public Member Functions

virtual const char_t * inputFile () const =0
 Returns the input file previously set via setInputFile().
 
virtual MediaSocketListinputs () const =0
 Returns a modifiable collection of MediaSocket objects which describe the input data of the MediaInfo.
 
virtual primo::StreaminputStream () const =0
 Returns the input stream previously set via setInputStream().
 
virtual bool_t isReady ()=0
 Indicates whether stream info and metadata have been loaded and parsed.
 
virtual bool_t load ()=0
 Analyzes the input specified by setInputFile() or setInputStream() and loads the information in the MediaInfo object.
 
virtual primo::codecs::Metadatametadata () const =0
 Returns the metadata for the input.
 
virtual bool_t open ()=0
 Analyzes the input specified by inputs() and loads the information in the MediaInfo object.
 
virtual MediaSocketListoutputs () const =0
 Returns an immutable collection of MediaSocket objects describing the audio and video streams (tracks) found in the input.
 
virtual bool_t push (int32_t inputIndex, primo::codecs::MediaSample *inputSample)=0
 Pushes input data to the MediaInfo.
 
virtual void setInputFile (const char_t *filename)=0
 Sets the input that should be analyzed.
 
virtual void setInputStream (primo::Stream *stream)=0
 Sets the input stream that should be analyzed.
 
virtual void setStreamType (primo::codecs::StreamType::Enum streamType)=0
 Forces a specific stream type.
 
virtual primo::codecs::StreamInfoEnumstreams () const =0
 Returns a collection of StreamInfo objects describing the audio and video streams (tracks) found in the input.
 
virtual primo::codecs::StreamSubType::Enum streamSubType () const =0
 Returns the stream subtype detected by MediaInfo.
 
virtual primo::codecs::StreamType::Enum streamType () const =0
 Returns the stream type previously set via setStreamType() or the one detected by MediaInfo.
 
- Public Member Functions inherited from Block
virtual void close ()=0
 Closes the block.
 
virtual bool_t endOfStream (int32_t inputIndex)=0
 Tells the block that there's no more data for the specified input socket.
 
virtual const primo::error::ErrorInfoerror () const =0
 Returns the error information for the last operation.
 
virtual bool_t flush ()=0
 Flushes the data buffered in the block to the output.
 
virtual MediaSocketListinputs () const =0
 Returns a modifiable collection of MediaSocket objects which describe the input data of the block.
 
virtual bool_t open ()=0
 Initializes the block based on the specified inputs and outputs.
 
virtual MediaSocketListoutputs () const =0
 Returns a modifiable collection of MediaSocket objects which describe the output data of the block.
 
virtual bool_t pull (int32_t &outputIndex, primo::codecs::MediaSample *outputData)=0
 Pulls output data from the block.
 
virtual bool_t push (int32_t inputIndex, primo::codecs::MediaSample *inputSample)=0
 Pushes input data to the block.
 
- Public Member Functions inherited from Reference
virtual int32_t release () const =0
 Releases the instance.
 
virtual int32_t retain () const =0
 Retains the instance.
 
virtual int32_t retainCount () const =0
 Returns the current reference count.
 

Protected Member Functions

 ~MediaInfo ()
 This object can be destroyed only by the AVBlocks library.
 

Detailed Description

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

Member Function Documentation

◆ inputFile()

virtual const char_t * inputFile ( ) const
pure virtual

Returns the input file previously set via setInputFile().

Returns
A filename as an Unicode zero terminated string. Can be NULL if the source file is not set.
Deprecated:
Please use primo::avblocks::MediaInfo::inputs instead.

◆ inputs()

virtual MediaSocketList * inputs ( ) const
pure virtual

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

The collection contains one default MediaSocket that must be configured.

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

Returns
A pointer to a collection of input sockets. Cannot be NULL.

Implements Block.

◆ inputStream()

virtual primo::Stream * inputStream ( ) const
pure virtual

Returns the input stream previously set via setInputStream().

Returns
A Stream object. Can be NULL if the source stream is not set.
Deprecated:
Please use primo::avblocks::MediaInfo::inputs instead.

◆ isReady()

virtual bool_t isReady ( )
pure virtual

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

See also
MediaInfo::push

◆ load()

virtual bool_t load ( )
pure virtual

Analyzes the input specified by setInputFile() or setInputStream() and loads the information in the MediaInfo object.

Returns
TRUE if the input is successfully analyzed, otherwise FALSE.

If this method is successful the information about the detected media streams (tracks) and metadata can be obtained from MediaInfo.

Deprecated:
Please use primo::avblocks::MediaInfo::open instead.
See also
MediaInfo::streams
MediaInfo::metadata

◆ metadata()

virtual primo::codecs::Metadata * metadata ( ) const
pure virtual

Returns the metadata for the input.

Returns
A pointer to a Metadata object. Can be NULL if the input has no metadata.

Normally the caller is not required and should not release the returned object. However it is allowed to retain the Metadata object and it will be valid even when the MediaInfo instance is destroyed. In all cases when the caller retains the returned object it should release it when it is not needed anymore.

Deprecated:
Please use primo::avblocks::MediaInfo::outputs instead.
See also
Object Management

◆ open()

virtual bool_t open ( )
pure virtual

Analyzes the input specified by inputs() and loads the information in the MediaInfo object.

Returns
TRUE if the input is successfully analyzed.
FALSE if the input could not be analyzed. In this case, the error() method will return detailed error information.

If this method succeeds the information about the detected media streams (tracks) and metadata can be obtained from MediaInfo.

Implements Block.

◆ outputs()

virtual MediaSocketList * outputs ( ) const
pure virtual

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

Returns
A pointer to a collection of output sockets. Cannot be NULL.

Implements Block.

◆ push()

virtual bool_t push ( int32_t  inputIndex,
primo::codecs::MediaSample inputSample 
)
pure virtual

Pushes input data to the MediaInfo.

Parameters
inputIndex[in] Specifies the index of the input socket whose data is pushed to the MediaInfo. Must be zero.
inputSample[in] A pointer to a MediaSample object that contains the input data.
Returns
TRUE The MediaInfo has successfully processed the input data, otherwise FALSE.
Remarks
In order to use this method the inputs()->at(0)->streamType() must be set and open() must be called.
See also
MediaInfo::isReady
Note
Supported stream types: StreamType::MPEG1_Video
StreamType::MPEG2_Video
StreamType::H264
StreamType::MPEG_TS

Implements Block.

◆ setInputFile()

virtual void setInputFile ( const char_t *  filename)
pure virtual

Sets the input that should be analyzed.

Parameters
filename[in] a filename as an Unicode zero terminated string. If NULL the filename is cleared. When not NULL the filename is copied internally and is not required to be valid after the method returns.
Deprecated:
Please use primo::avblocks::MediaInfo::inputs instead.

◆ setInputStream()

virtual void setInputStream ( primo::Stream stream)
pure virtual

Sets the input stream that should be analyzed.

This is an alternative to setInputFile().

Parameters
stream[in] A pointer to a Stream object. If NULL the input stream is cleared. Internally the Stream object is retained by MediaInfo, so it is safe to release it after this method returns.

MediaInfo will use the input file when both an input file and input stream are set.

Deprecated:
Please use primo::avblocks::MediaInfo::inputs instead.
See also
Object Management

◆ setStreamType()

virtual void setStreamType ( primo::codecs::StreamType::Enum  streamType)
pure virtual

Forces a specific stream type.

Parameters
streamType[in] stream type such as AVI, WAV, MP4, etc.

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

Deprecated:
Please use primo::avblocks::MediaInfo::inputs instead.

◆ streams()

virtual primo::codecs::StreamInfoEnum * streams ( ) const
pure virtual

Returns a collection of StreamInfo objects describing the audio and video streams (tracks) found in the input.

Returns
A read-only collection of StreamInfo objects. Each StreamInfo object in the collection represents a stream (track) in the analyzed input.

Normally the caller is not required and should not release the returned object. However it is allowed to retain the collection and it will be valid even when the MediaInfo instance is destroyed. In all cases when the caller retains the returned collection it should release it when it is not needed anymore.

Deprecated:
Please use primo::avblocks::MediaInfo::outputs instead.
See also
Object Management

◆ streamSubType()

virtual primo::codecs::StreamSubType::Enum streamSubType ( ) const
pure virtual

Returns the stream subtype detected by MediaInfo.

Returns
input stream subtype. The default value is StreamSubType::Unknown.
Deprecated:
Please use primo::avblocks::MediaInfo::inputs instead.

◆ streamType()

virtual primo::codecs::StreamType::Enum streamType ( ) const
pure virtual

Returns the stream type previously set via setStreamType() or the one detected by MediaInfo.

Returns
input stream type. The default value is StreamType::Unknown.
Deprecated:
Please use primo::avblocks::MediaInfo::inputs instead.