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

MediaSample represents one or more samples of audio or video data. More...

#include <av.h>

Inheritance diagram for MediaSample:
Reference

Public Member Functions

virtual MediaBufferbuffer ()=0
 Returns the buffer associated with this sample.
 
virtual MediaSampleclone () const =0
 Creates a deep copy of this object.
 
virtual double endTime () const =0
 Returns the end time of the media sample.
 
virtual int32_t flags () const =0
 Returns the media sample flags.
 
virtual PictureType::Enum pictureType () const =0
 Returns the picture type (I/P/B/etc.) of a demuxed, decoded or encoded frame.
 
virtual void reset ()=0
 Resets the sample to its default values and clears the data in the buffer.
 
virtual void setBuffer (MediaBuffer *buffer)=0
 Sets a new MediaBuffer object.
 
virtual void setEndTime (double time)=0
 Sets the end time of the media sample.
 
virtual void setFlags (int32_t flags)=0
 Sets the media sample flags.
 
virtual void setPictureType (PictureType::Enum pictureType)=0
 Sets the required picture type (I/P/B/etc.).
 
virtual void setStartTime (double time)=0
 Sets presentation timestamp (PTS) of the media sample.
 
virtual void setStreamNumber (int32_t streamNumber)=0
 Sets the elementary stream to which the sample belongs.
 
virtual double startTime () const =0
 Returns the presentation timestamp (PTS) of the media sample.
 
virtual int32_t streamNumber () const =0
 Returns the elementary stream to which the sample belongs.
 
virtual int32_t videoBufferSizeInBytes (int32_t frameWidth, int32_t frameHeight, ColorFormat::Enum colorFormat) const =0
 Calculates the exact number of bytes that are needed for a video frame with the specified properties.
 
- 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

 ~MediaSample ()
 This object can be destroyed only by its implementation.
 

Detailed Description

MediaSample represents one or more samples of audio or video data.

It is used for storing uncompressed or compressed data.

Constructor & Destructor Documentation

◆ ~MediaSample()

~MediaSample ( )
protected

This object can be destroyed only by its implementation.

The caller must use Reference::release.

See also
Object Management

Member Function Documentation

◆ buffer()

virtual MediaBuffer * buffer ( )
pure virtual

Returns the buffer associated with this sample.

Returns
A pointer to a MediaBuffer object. Can be NULL.

◆ clone()

virtual MediaSample * clone ( ) const
pure virtual

Creates a deep copy of this object.

Returns
A new MediaSample object. The caller is responsible for releasing the new object when it's not needed anymore.
NULL if the object cannot be cloned because there is not enough memory.
See also
Object Management

◆ endTime()

virtual double endTime ( ) const
pure virtual

Returns the end time of the media sample.

Returns
The time when the sample should end. Time in seconds.
Remarks
The end time is optional and is valid only if it is greater than the start time.

◆ flags()

virtual int32_t flags ( ) const
pure virtual

Returns the media sample flags.

Returns
A combination of flags defined in MediaSampleFlags::Enum.

◆ pictureType()

virtual PictureType::Enum pictureType ( ) const
pure virtual

Returns the picture type (I/P/B/etc.) of a demuxed, decoded or encoded frame.

Returns
A constant from the PictureType::Enum.
Note
Currently this is returned only by the MPEG-2 encoder.

◆ setBuffer()

virtual void setBuffer ( MediaBuffer buffer)
pure virtual

Sets a new MediaBuffer object.

The old MediaBuffer object is released. The new one is retained.

Parameters
bufferA pointer to the new MediaBuffer object. Can be NULL.

◆ setEndTime()

virtual void setEndTime ( double  time)
pure virtual

Sets the end time of the media sample.

Parameters
time[in] The time when the sample should end. Time is in seconds.
Remarks
The end time is optional and is valid only if it is greater than the start time.

◆ setFlags()

virtual void setFlags ( int32_t  flags)
pure virtual

Sets the media sample flags.

Parameters
flags[in] A combination of flags defined in MediaSampleFlags::Enum.

◆ setPictureType()

virtual void setPictureType ( PictureType::Enum  pictureType)
pure virtual

Sets the required picture type (I/P/B/etc.).

Parameters
pictureType[in] A constant from the PictureType::Enum.
Note
Currently this is ignored by encoders.

◆ setStartTime()

virtual void setStartTime ( double  time)
pure virtual

Sets presentation timestamp (PTS) of the media sample.

Parameters
timein seconds

◆ setStreamNumber()

virtual void setStreamNumber ( int32_t  streamNumber)
pure virtual

Sets the elementary stream to which the sample belongs.

Parameters
streamNumber[in] A zero-based index of the elementary stream in the container.

◆ startTime()

virtual double startTime ( ) const
pure virtual

Returns the presentation timestamp (PTS) of the media sample.

Returns
time in seconds

◆ streamNumber()

virtual int32_t streamNumber ( ) const
pure virtual

Returns the elementary stream to which the sample belongs.

Returns
A zero-based index of the elementary stream in the container.

◆ videoBufferSizeInBytes()

virtual int32_t videoBufferSizeInBytes ( int32_t  frameWidth,
int32_t  frameHeight,
ColorFormat::Enum  colorFormat 
) const
pure virtual

Calculates the exact number of bytes that are needed for a video frame with the specified properties.

Parameters
frameWidth[in] frame width in pixels.
frameHeight[in] frame height in pixels.
colorFormat[in] the color format represents how colors are coded in the video frame.
Returns
The number of bytes needed to store a video frame with the specified properties. Zero if it is not possible to calculate the video frame buffer size from the supplied arguments.