StreamInfo

primo::codecs::StreamInfo

class StreamInfo : public primo::Reference

Provides properties and operations that are common for all elementary streams.

AudioStreamInfo and VideoStreamInfo inherit from this interface.

See also

AudioStreamInfo

See also

VideoStreamInfo

Subclassed by primo::codecs::AudioStreamInfo, primo::codecs::VideoStreamInfo

Public Functions

virtual MediaType::Enum mediaType() const = 0

Returns the stream media type.

The media type of a StreamInfo object cannot be changed.

If the media type is MediaType::Audio this StreamInfo object can be safely cast to AudioStreamInfo.

If the media type is MediaType::Video this StreamInfo object can be safely cast to VideoStreamInfo.

Returns:

media type

virtual StreamType::Enum streamType() const = 0

Returns the stream type.

Returns:

stream type

virtual bool_t setStreamType(StreamType::Enum type) = 0

Sets the stream type.

Parameters:

type – major stream type.

Returns:

TRUE if the stream type is successfully set, otherwise FALSE.

virtual StreamSubType::Enum streamSubType() const = 0

Returns the stream subtype.

Returns:

stream subtype

virtual bool_t setStreamSubType(StreamSubType::Enum type) = 0

Sets the stream subtype.

Parameters:

type – stream subtype.

Returns:

TRUE if the stream subtype is successfully set, otherwise FALSE.

virtual double duration() const = 0

Returns the stream duration.

Returns:

duration in seconds

virtual bool_t setDuration(double duration) = 0

Sets the stream duration in seconds.

Parameters:

duration – in seconds

Returns:

TRUE if the duration is successfully set, otherwise FALSE.

virtual int32_t ID() const = 0

Returns the ID of the elementary stream.

Returns:

stream id

virtual bool_t setID(int32_t id) = 0

Sets the ID of the elementary stream.

Parameters:

id – elementary stream id

Returns:

TRUE if the ID is successfully set, otherwise FALSE.

virtual int32_t programNumber() const = 0

Returns the number of the program to which the elementary stream belongs.

Warning

If the elementary stream is shared by 2 or more programs this property will return the last parsed program that uses this stream.

Returns:

program number

virtual bool_t setProgramNumber(int32_t programNumber) = 0

Sets the program to which the elementary stream belongs.

Parameters:

programNumber – program number

Returns:

TRUE if the program number is successfully set, otherwise FALSE.

virtual int32_t bitrate() const = 0

Returns the stream bitrate.

Returns:

bitrate in bits per second.

virtual bool_t setBitrate(int32_t bitrate) = 0

Sets the stream bitrate.

Parameters:

bitrate – the bitrate is expressed in bits per second.

Returns:

TRUE if the bitrate is successfully set, otherwise FALSE.

virtual int32_t bitrateMode() const = 0

Returns the stream bitrate mode.

Returns:

A BitrateMode::Enum constant.

virtual bool_t setBitrateMode(int32_t bitrateMode) = 0

Sets the stream bitrate mode.

Parameters:

bitrateMode – A BitrateMode::Enum constant.

Returns:

TRUE if the bitrate mode is successfully set, otherwise FALSE.

virtual StreamInfo *clone() const = 0

Creates a copy of this object.

When the object is cloned the full underlying object is copied.

For example if a StreamInfo object is actually an instance of AudioStreamInfo and is cloned, the new object is also an instance of AudioStreamInfo.

The caller is responsible for releasing the new object when it is not needed anymore.

Remark

When cloned an immutable object becomes mutable.

Returns:

A new StreamInfo object that has the same dynamic type as the cloned object.

virtual bool_t copyTo(StreamInfo *destination) const = 0

Copies the state of the current object to a destination object of the same type.

The reference count of the source and the destination is not modified.

Parameters:

destination – [out] A pointer to the destination object

Returns:

TRUE The object state is copied, FALSE otherwise.

virtual bool_t reset() = 0

Resets the stream information to its default state.

The full underlying object is reset. The media type of the stream is never reset.

Returns:

TRUE The object is sucessfully reset.

Returns:

FALSE The object is immutable and cannot be reset.

virtual bool_t immutable() const = 0

Returns whether the object is immutable.

An immmutable object cannot be modified and all modifying methods fail to produce a result.

Remark

An immutable object can be modified by the AVBlocks library.

Remark

Object immutability spreads to all nested objects. Therefore it is not possible to add/set an immutable object to a mutable object.

Remark

When cloned an immutable object becomes mutable.

Returns:

TRUE if the object is immutable, FALSE otherwise.

virtual MediaBuffer *configData() const = 0

Returns decoder specific configuration data.

This data is typically obtained from a demuxer and is required for decoding certain stream types.

Version

3.3

Returns:

A pointer to a MediaBuffer object containing the configuration data, or NULL if not set.

virtual void setConfigData(MediaBuffer *configData) = 0

Sets decoder specific configuration data.

Version

3.3

Parameters:

configData – A pointer to a MediaBuffer object containing the configuration data. Can be NULL.