AvTranscoder  0.9.4
C++APIforLibav/FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
avtranscoder::Frame Class Reference

This class describes decoded (raw) audio or video data. More...

#include <Frame.hpp>

Public Member Functions

 Frame ()
 Allocate an empty frame. This only allocates the AVFrame itself, not the data buffers. More...
 
 Frame (const Frame &otherFrame)
 Copy properties and reference data of the other frame. More...
 
virtual ~Frame ()
 
unsigned char ** getData ()
 Get all the data of the frame. More...
 
int * getLineSize () const
 Returns the size in byte. For video, size in bytes of each picture line. For audio, size in bytes of each plane. More...
 
int getEncodedSize () const
 
void copyData (const Frame &frameToRef)
 Copy the data of the given Frame. More...
 
void copyProperties (const Frame &otherFrame)
 Copy all the fields that do not affect the data layout in the buffers. More...
 
void refFrame (const Frame &otherFrame)
 Copy frame properties and create a new reference to data of the given frame. More...
 
void clear ()
 Unreference all the buffers referenced by frame and reset the frame fields. More...
 
bool isAudioFrame () const
 
bool isVideoFrame () const
 
AVFrame & getAVFrame ()
 
const AVFrame & getAVFrame () const
 
const unsigned char ** getData () const
 

Protected Attributes

AVFrame * _frame
 

Private Member Functions

void allocateAVFrame ()
 

Detailed Description

This class describes decoded (raw) audio or video data.

Definition at line 16 of file Frame.hpp.

Constructor & Destructor Documentation

avtranscoder::Frame::Frame ( )

Allocate an empty frame. This only allocates the AVFrame itself, not the data buffers.

Definition at line 8 of file Frame.cpp.

References allocateAVFrame().

avtranscoder::Frame::Frame ( const Frame otherFrame)

Copy properties and reference data of the other frame.

Definition at line 14 of file Frame.cpp.

References allocateAVFrame(), getAVFrame(), and refFrame().

avtranscoder::Frame::~Frame ( )
virtual

Definition at line 26 of file Frame.cpp.

References _frame.

Member Function Documentation

void avtranscoder::Frame::allocateAVFrame ( )
private

Definition at line 76 of file Frame.cpp.

References _frame.

Referenced by Frame().

void avtranscoder::Frame::clear ( )

Unreference all the buffers referenced by frame and reset the frame fields.

Definition at line 71 of file Frame.cpp.

References _frame.

Referenced by avtranscoder::AudioGenerator::decodeNextFrame(), and avtranscoder::VideoGenerator::decodeNextFrame().

void avtranscoder::Frame::copyData ( const Frame frameToRef)

Copy the data of the given Frame.

Note
This function does not allocate anything: the current frame must be already initialized and allocated with the same parameters as the given frame, to be ready for memcpy instructions.

Definition at line 48 of file Frame.cpp.

References _frame, getAVFrame(), and avtranscoder::getDescriptionFromErrorCode().

Referenced by avtranscoder::AudioGenerator::decodeNextFrame(), and avtranscoder::VideoGenerator::decodeNextFrame().

void avtranscoder::Frame::copyProperties ( const Frame otherFrame)

Copy all the fields that do not affect the data layout in the buffers.

Definition at line 57 of file Frame.cpp.

References _frame, and getAVFrame().

Referenced by avtranscoder::AudioDecoder::decodeNextFrame().

const AVFrame& avtranscoder::Frame::getAVFrame ( ) const
inline

Definition at line 89 of file Frame.hpp.

unsigned char** avtranscoder::Frame::getData ( )
inline
const unsigned char** avtranscoder::Frame::getData ( ) const
inline

Definition at line 90 of file Frame.hpp.

int avtranscoder::Frame::getEncodedSize ( ) const
Returns
Size of the corresponding packet containing the compressed frame (in bytes)
Warning
returns a negative value if the size is unknown

Definition at line 43 of file Frame.cpp.

References _frame.

Referenced by avtranscoder::VideoProperties::analyseGopStructure(), and avtranscoder::VideoProperties::getBitRate().

int* avtranscoder::Frame::getLineSize ( ) const
inline

Returns the size in byte. For video, size in bytes of each picture line. For audio, size in bytes of each plane.

Note
For audio, only linesize[0] may be set. For planar audio, each channel plane must be the same size.

Definition at line 44 of file Frame.hpp.

Referenced by avtranscoder::VideoTransform::convert().

bool avtranscoder::Frame::isAudioFrame ( ) const
Returns
If it corresponds to a valid audio frame.
See also
AudioFrame

Definition at line 89 of file Frame.cpp.

References _frame.

Referenced by avtranscoder::AudioGenerator::decodeNextFrame(), avtranscoder::FilterGraph::pushInBuffer(), and avtranscoder::FilterGraph::pushOutBuffer().

bool avtranscoder::Frame::isVideoFrame ( ) const
Returns
If it corresponds to a valid video frame.
See also
VideoFrame

Definition at line 96 of file Frame.cpp.

References _frame.

Referenced by avtranscoder::VideoGenerator::decodeNextFrame(), avtranscoder::FilterGraph::pushInBuffer(), and avtranscoder::FilterGraph::pushOutBuffer().

void avtranscoder::Frame::refFrame ( const Frame otherFrame)

Copy frame properties and create a new reference to data of the given frame.

Warning
This method allocates new data that will be freed only by calling the destructor of the referenced frame.

Definition at line 62 of file Frame.cpp.

References _frame, getAVFrame(), and avtranscoder::getDescriptionFromErrorCode().

Referenced by Frame().

Field Documentation


The documentation for this class was generated from the following files: