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

#include <InputStream.hpp>

Public Member Functions

 InputStream (InputFile &inputFile, const size_t streamIndex)
 
 ~InputStream ()
 
bool readNextPacket (CodedData &data)
 Read the next packet of the stream. More...
 
const StreamPropertiesgetProperties () const
 
size_t getStreamIndex () const
 
VideoCodecgetVideoCodec ()
 
AudioCodecgetAudioCodec ()
 
DataCodecgetDataCodec ()
 
void activate (const bool activate=true)
 Functions about buffering Activate the stream will buffered its data when read packets. More...
 
bool isActivated () const
 
void addPacket (const AVPacket &packet)
 
void clearBuffering ()
 
- Public Member Functions inherited from avtranscoder::IInputStream
virtual ~IInputStream ()
 

Private Member Functions

 InputStream (const InputStream &inputStream)
 
InputStreamoperator= (const InputStream &inputStream)
 

Private Attributes

InputFile_inputFile
 Has link (no ownership) More...
 
ICodec_codec
 Has ownership. More...
 
std::queue< CodedData_streamCache
 Cache of packet data already read and corresponding to this stream. More...
 
size_t _streamIndex
 Index of the stream in the input file. More...
 
bool _isActivated
 If the stream is activated, data read from it will be buffered. More...
 

Detailed Description

Definition at line 15 of file InputStream.hpp.

Constructor & Destructor Documentation

avtranscoder::InputStream::InputStream ( const InputStream inputStream)
private
avtranscoder::InputStream::InputStream ( InputFile inputFile,
const size_t  streamIndex 
)
avtranscoder::InputStream::~InputStream ( )

Definition at line 48 of file InputStream.cpp.

References _codec.

Member Function Documentation

void avtranscoder::InputStream::activate ( const bool  activate = true)
inlinevirtual

Functions about buffering Activate the stream will buffered its data when read packets.

See also
IInputStream methods

Implements avtranscoder::IInputStream.

Definition at line 34 of file InputStream.hpp.

References activate().

Referenced by activate(), and avtranscoder::InputFile::activateStream().

void avtranscoder::InputStream::addPacket ( const AVPacket &  packet)

Definition at line 116 of file InputStream.cpp.

References _isActivated, _streamCache, _streamIndex, and LOG_DEBUG.

void avtranscoder::InputStream::clearBuffering ( )
virtual

Implements avtranscoder::IInputStream.

Definition at line 130 of file InputStream.cpp.

References _streamCache.

DataCodec & avtranscoder::InputStream::getDataCodec ( )
virtual

Implements avtranscoder::IInputStream.

Definition at line 99 of file InputStream.cpp.

References _codec, and getProperties().

const StreamProperties & avtranscoder::InputStream::getProperties ( ) const
virtual
Note
The returned object could be cast depending on the type of the stream (video, audio...)
See also
VideoProperties, AudioProperties...
Returns
the properties of the stream

Implements avtranscoder::IInputStream.

Definition at line 111 of file InputStream.cpp.

References _inputFile, _streamIndex, avtranscoder::InputFile::getProperties(), and avtranscoder::FileProperties::getStreamPropertiesWithIndex().

Referenced by getAudioCodec(), getDataCodec(), avtranscoder::Transcoder::getProfileFromFile(), and getVideoCodec().

size_t avtranscoder::InputStream::getStreamIndex ( ) const
inlinevirtual
Returns
the index of the stream

Implements avtranscoder::IInputStream.

Definition at line 28 of file InputStream.hpp.

VideoCodec & avtranscoder::InputStream::getVideoCodec ( )
virtual

Return the codec informations of the stream

Exceptions
Raisea runtime error if the stream is not of the corresponding type

Implements avtranscoder::IInputStream.

Definition at line 75 of file InputStream.cpp.

References _codec, and getProperties().

Referenced by avtranscoder::VideoDecoder::decodeNextFrame(), avtranscoder::VideoDecoder::flushDecoder(), avtranscoder::VideoReader::init(), and avtranscoder::VideoDecoder::setupDecoder().

bool avtranscoder::InputStream::isActivated ( ) const
inlinevirtual

Implements avtranscoder::IInputStream.

Definition at line 35 of file InputStream.hpp.

InputStream& avtranscoder::InputStream::operator= ( const InputStream inputStream)
private
bool avtranscoder::InputStream::readNextPacket ( CodedData data)
virtual

Read the next packet of the stream.

Parameters
datadata of next packet read
Returns
if next packet was read succefully

Implements avtranscoder::IInputStream.

Definition at line 53 of file InputStream.cpp.

References _inputFile, _isActivated, _streamCache, _streamIndex, avtranscoder::CodedData::copyData(), avtranscoder::InputFile::getFilename(), LOG_DEBUG, and avtranscoder::InputFile::readNextPacket().

Referenced by avtranscoder::AudioDecoder::decodeNextFrame(), and avtranscoder::VideoDecoder::decodeNextFrame().

Field Documentation

ICodec* avtranscoder::InputStream::_codec
private

Has ownership.

Definition at line 41 of file InputStream.hpp.

Referenced by getAudioCodec(), getDataCodec(), getVideoCodec(), InputStream(), and ~InputStream().

InputFile* avtranscoder::InputStream::_inputFile
private

Has link (no ownership)

Definition at line 40 of file InputStream.hpp.

Referenced by getProperties(), InputStream(), and readNextPacket().

bool avtranscoder::InputStream::_isActivated
private

If the stream is activated, data read from it will be buffered.

Definition at line 46 of file InputStream.hpp.

Referenced by addPacket(), and readNextPacket().

std::queue<CodedData> avtranscoder::InputStream::_streamCache
private

Cache of packet data already read and corresponding to this stream.

Definition at line 43 of file InputStream.hpp.

Referenced by addPacket(), clearBuffering(), and readNextPacket().

size_t avtranscoder::InputStream::_streamIndex
private

Index of the stream in the input file.

Definition at line 45 of file InputStream.hpp.

Referenced by addPacket(), getProperties(), InputStream(), and readNextPacket().


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