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

Wrapper of AVOption. Get its type to know what the option is about: Int, Double, Ratio, Choice... Parse its array of options to get the potential childs (Choice and Group). More...

#include <Option.hpp>

Public Member Functions

 Option (AVOption &avOption, void *avContext)
 
 ~Option ()
 
EOptionBaseType getType () const
 
std::string getName () const
 
std::string getHelp () const
 
std::string getUnit () const
 
int getOffset () const
 
double getMin () const
 
double getMax () const
 
int getFlags () const
 
bool isEncodingOpt () const
 
bool isDecodingOpt () const
 
bool isAudioOpt () const
 
bool isVideoOpt () const
 
bool isSubtitleOpt () const
 
bool getDefaultBool () const
 
int getDefaultInt () const
 
double getDefaultDouble () const
 
std::string getDefaultString () const
 
std::pair< int, int > getDefaultRatio () const
 
bool getBool () const
 
int getInt () const
 
double getDouble () const
 
std::string getString () const
 
std::pair< int, int > getRatio () const
 
void setFlag (const std::string &flag, const bool enable)
 
void setBool (const bool value)
 
void setInt (const int value)
 
void setDouble (const double value)
 
void setString (const std::string &value)
 
void setRatio (const int num, const int den)
 
bool hasChild () const
 
const std::vector< Option > & getChilds () const
 
const OptiongetChildAtIndex (const size_t index) const
 
int getDefaultChildIndex () const
 
void setDefaultChildIndex (size_t index)
 
void appendChild (const Option &child)
 

Private Member Functions

EOptionBaseType getTypeFromAVOption (const std::string &unit, const AVOptionType avType)
 
void checkFFmpegGetOption (const int ffmpegReturnCode) const
 Check the return value from FFmpeg functions. More...
 
void checkFFmpegSetOption (const int ffmpegReturnCode, const std::string &optionValue)
 

Private Attributes

AVOption * _avOption
 Has link (no ownership) More...
 
EOptionBaseType _type
 
void * _avContext
 Pointer to the corresponding context. Need it to set and get the option values. More...
 
std::vector< Option_childOptions
 
size_t _defaultChildIndex
 

Detailed Description

Wrapper of AVOption. Get its type to know what the option is about: Int, Double, Ratio, Choice... Parse its array of options to get the potential childs (Choice and Group).

Definition at line 36 of file Option.hpp.

Constructor & Destructor Documentation

avtranscoder::Option::Option ( AVOption &  avOption,
void *  avContext 
)

Definition at line 14 of file Option.cpp.

References _avOption, _type, getTypeFromAVOption(), and getUnit().

avtranscoder::Option::~Option ( )
inline

Definition at line 40 of file Option.hpp.

Member Function Documentation

void avtranscoder::Option::appendChild ( const Option child)

Definition at line 205 of file Option.cpp.

References _childOptions.

Referenced by avtranscoder::loadOptions().

void avtranscoder::Option::checkFFmpegGetOption ( const int  ffmpegReturnCode) const
private

Check the return value from FFmpeg functions.

Note
Throw run_time exception if error

Definition at line 210 of file Option.cpp.

References avtranscoder::getDescriptionFromErrorCode(), and getName().

Referenced by getBool(), getDouble(), getInt(), getRatio(), getString(), and setFlag().

void avtranscoder::Option::checkFFmpegSetOption ( const int  ffmpegReturnCode,
const std::string &  optionValue 
)
private
bool avtranscoder::Option::getBool ( ) const

Definition at line 95 of file Option.cpp.

References _avContext, checkFFmpegGetOption(), and getName().

const Option& avtranscoder::Option::getChildAtIndex ( const size_t  index) const
inline

Definition at line 84 of file Option.hpp.

const std::vector<Option>& avtranscoder::Option::getChilds ( ) const
inline

Definition at line 83 of file Option.hpp.

Referenced by avtranscoder::loadOptions().

bool avtranscoder::Option::getDefaultBool ( ) const

Definition at line 70 of file Option.cpp.

References _avOption.

int avtranscoder::Option::getDefaultChildIndex ( ) const
inline

Definition at line 85 of file Option.hpp.

double avtranscoder::Option::getDefaultDouble ( ) const

Definition at line 80 of file Option.cpp.

References _avOption.

int avtranscoder::Option::getDefaultInt ( ) const

Definition at line 75 of file Option.cpp.

References _avOption.

Referenced by avtranscoder::loadOptions().

std::pair< int, int > avtranscoder::Option::getDefaultRatio ( ) const

Definition at line 90 of file Option.cpp.

References _avOption.

std::string avtranscoder::Option::getDefaultString ( ) const

Definition at line 85 of file Option.cpp.

References _avOption.

double avtranscoder::Option::getDouble ( ) const

Definition at line 113 of file Option.cpp.

References _avContext, checkFFmpegGetOption(), and getName().

int avtranscoder::Option::getFlags ( ) const
inline

Definition at line 52 of file Option.hpp.

std::string avtranscoder::Option::getHelp ( ) const
inline

Definition at line 45 of file Option.hpp.

int avtranscoder::Option::getInt ( ) const

Definition at line 104 of file Option.cpp.

References _avContext, checkFFmpegGetOption(), and getName().

double avtranscoder::Option::getMax ( ) const
inline

Definition at line 49 of file Option.hpp.

double avtranscoder::Option::getMin ( ) const
inline

Definition at line 48 of file Option.hpp.

std::string avtranscoder::Option::getName ( ) const
inline
int avtranscoder::Option::getOffset ( ) const
inline

Definition at line 47 of file Option.hpp.

std::pair< int, int > avtranscoder::Option::getRatio ( ) const

Definition at line 136 of file Option.cpp.

References _avContext, checkFFmpegGetOption(), and getName().

std::string avtranscoder::Option::getString ( ) const

Definition at line 122 of file Option.cpp.

References _avContext, checkFFmpegGetOption(), and getName().

EOptionBaseType avtranscoder::Option::getType ( ) const

Definition at line 65 of file Option.cpp.

References _type.

Referenced by avtranscoder::loadOptions().

std::string avtranscoder::Option::getUnit ( ) const
inline

Definition at line 46 of file Option.hpp.

Referenced by avtranscoder::loadOptions(), and Option().

bool avtranscoder::Option::hasChild ( ) const
inline

Definition at line 82 of file Option.hpp.

bool avtranscoder::Option::isAudioOpt ( ) const
inline

Definition at line 55 of file Option.hpp.

bool avtranscoder::Option::isDecodingOpt ( ) const
inline

Definition at line 54 of file Option.hpp.

bool avtranscoder::Option::isEncodingOpt ( ) const
inline

Definition at line 53 of file Option.hpp.

bool avtranscoder::Option::isSubtitleOpt ( ) const
inline

Definition at line 57 of file Option.hpp.

bool avtranscoder::Option::isVideoOpt ( ) const
inline

Definition at line 56 of file Option.hpp.

void avtranscoder::Option::setBool ( const bool  value)

Definition at line 160 of file Option.cpp.

References _avContext, checkFFmpegSetOption(), and getName().

void avtranscoder::Option::setDefaultChildIndex ( size_t  index)
inline

Definition at line 87 of file Option.hpp.

Referenced by avtranscoder::loadOptions().

void avtranscoder::Option::setDouble ( const double  value)

Definition at line 178 of file Option.cpp.

References _avContext, checkFFmpegSetOption(), and getName().

void avtranscoder::Option::setFlag ( const std::string &  flag,
const bool  enable 
)
void avtranscoder::Option::setRatio ( const int  num,
const int  den 
)

Definition at line 193 of file Option.cpp.

References _avContext, checkFFmpegSetOption(), and getName().

Field Documentation

void* avtranscoder::Option::_avContext
private

Pointer to the corresponding context. Need it to set and get the option values.

Has link (no ownership)

Definition at line 108 of file Option.hpp.

Referenced by getBool(), getDouble(), getInt(), getRatio(), getString(), setBool(), setDouble(), setFlag(), setInt(), setRatio(), and setString().

AVOption* avtranscoder::Option::_avOption
private

Has link (no ownership)

Definition at line 101 of file Option.hpp.

Referenced by getDefaultBool(), getDefaultDouble(), getDefaultInt(), getDefaultRatio(), getDefaultString(), Option(), and setFlag().

std::vector<Option> avtranscoder::Option::_childOptions
private

If the option corresponds to a Choice or a Group, it can contain childs, which are also options.

Definition at line 114 of file Option.hpp.

Referenced by appendChild().

size_t avtranscoder::Option::_defaultChildIndex
private

Definition at line 115 of file Option.hpp.

EOptionBaseType avtranscoder::Option::_type
private

Definition at line 102 of file Option.hpp.

Referenced by getType(), and Option().


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