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

Based class to read a stream. More...

#include <IReader.hpp>

Public Member Functions

 IReader (const std::string &filename, const size_t streamIndex=0, const int channelIndex=-1)
 Create a new InputFile and prepare to read the stream at the given index. More...
 
 IReader (InputFile &inputFile, const size_t streamIndex=0, const int channelIndex=-1)
 Get the existing InputFile and prepare to read the stream at the given index. More...
 
virtual ~IReader ()=0
 
FramereadNextFrame ()
 
FramereadPrevFrame ()
 
FramereadFrameAt (const size_t frame)
 
const StreamPropertiesgetSourceProperties () const
 Get the properties of the source stream read. More...
 
void continueWithGenerator (const bool continueWithGenerator=true)
 Set the reader state to generate data (ie silence or black) when there is no more data to decode. More...
 

Protected Attributes

InputFile_inputFile
 
const StreamProperties_streamProperties
 
IDecoder_decoder
 
IDecoder_generator
 
IDecoder_currentDecoder
 Link to _inputDecoder or _generator. More...
 
Frame_srcFrame
 
Frame_dstFrame
 
ITransform_transform
 
size_t _streamIndex
 
int _channelIndex
 

Private Attributes

int _currentFrame
 The current decoded frame. More...
 
bool _inputFileAllocated
 Does the InputFile is held by the class or not (depends on the constructor called) More...
 
bool _continueWithGenerator
 If there is no more data to decode, complete with generated data. More...
 

Detailed Description

Based class to read a stream.

Definition at line 18 of file IReader.hpp.

Constructor & Destructor Documentation

avtranscoder::IReader::IReader ( const std::string &  filename,
const size_t  streamIndex = 0,
const int  channelIndex = -1 
)

Create a new InputFile and prepare to read the stream at the given index.

Parameters
streamIndexby default read the first stream
channelIndexby default -1 (all channels of the stream)

Definition at line 8 of file IReader.cpp.

References _inputFile.

avtranscoder::IReader::IReader ( InputFile inputFile,
const size_t  streamIndex = 0,
const int  channelIndex = -1 
)

Get the existing InputFile and prepare to read the stream at the given index.

Note
This constructor can improve performances when you create several readers from one InputFile.

Definition at line 26 of file IReader.cpp.

avtranscoder::IReader::~IReader ( )
pure virtual

Definition at line 43 of file IReader.cpp.

References _inputFile, and _inputFileAllocated.

Member Function Documentation

void avtranscoder::IReader::continueWithGenerator ( const bool  continueWithGenerator = true)
inline

Set the reader state to generate data (ie silence or black) when there is no more data to decode.

Note
By default, the reader returns an empty frame.

Definition at line 64 of file IReader.hpp.

References continueWithGenerator().

Referenced by continueWithGenerator().

const StreamProperties* avtranscoder::IReader::getSourceProperties ( ) const
inline

Get the properties of the source stream read.

Definition at line 58 of file IReader.hpp.

Frame * avtranscoder::IReader::readFrameAt ( const size_t  frame)
Frame * avtranscoder::IReader::readNextFrame ( )
Returns
Get next frame after decoding
See also
readFrameAt

Definition at line 49 of file IReader.cpp.

References _currentFrame, and readFrameAt().

Referenced by Window::displayNextFrame().

Frame * avtranscoder::IReader::readPrevFrame ( )
Returns
Get previous frame after decoding
See also
readFrameAt

Definition at line 54 of file IReader.cpp.

References _currentFrame, and readFrameAt().

Referenced by Window::displayPrevFrame().

Field Documentation

int avtranscoder::IReader::_channelIndex
protected

Definition at line 79 of file IReader.hpp.

Referenced by avtranscoder::AudioReader::init(), and readFrameAt().

bool avtranscoder::IReader::_continueWithGenerator
private

If there is no more data to decode, complete with generated data.

Definition at line 84 of file IReader.hpp.

Referenced by readFrameAt().

IDecoder* avtranscoder::IReader::_currentDecoder
protected

Link to _inputDecoder or _generator.

Definition at line 71 of file IReader.hpp.

Referenced by avtranscoder::AudioReader::init(), avtranscoder::VideoReader::init(), and readFrameAt().

int avtranscoder::IReader::_currentFrame
private

The current decoded frame.

Definition at line 82 of file IReader.hpp.

Referenced by readFrameAt(), readNextFrame(), and readPrevFrame().

InputFile* avtranscoder::IReader::_inputFile
protected
bool avtranscoder::IReader::_inputFileAllocated
private

Does the InputFile is held by the class or not (depends on the constructor called)

Definition at line 83 of file IReader.hpp.

Referenced by ~IReader().

size_t avtranscoder::IReader::_streamIndex
protected

Definition at line 78 of file IReader.hpp.

Referenced by avtranscoder::AudioReader::init(), and avtranscoder::VideoReader::init().

const StreamProperties* avtranscoder::IReader::_streamProperties
protected

Definition at line 68 of file IReader.hpp.

Referenced by avtranscoder::AudioReader::init(), and avtranscoder::VideoReader::init().


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