From 3dd3e458b95682c716a83c9b397fd19ab1a1f42d Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Sat, 30 Apr 2016 03:31:41 +0100 Subject: [PATCH] Add type name String as std::string --- app/ConfigureFormatDialog.cpp | 4 +- app/DialogSubWindowSelector.cpp | 4 -- app/ModulesHandleOptDialog.cpp | 8 ++-- app/PlaYUVerApp.cpp | 6 +-- app/VideoSubWindow.cpp | 2 +- lib/PlaYUVerDefs.h | 10 +++-- lib/PlaYUVerFrame.cpp | 16 +++---- lib/PlaYUVerFrame.h | 16 +++---- lib/PlaYUVerProgramOptions.cpp | 10 ++--- lib/PlaYUVerProgramOptions.h | 72 ++++++++++++++++---------------- lib/PlaYUVerStream.cpp | 20 ++++----- lib/PlaYUVerStream.h | 24 +++++------ lib/PlaYUVerStreamHandlerIf.h | 12 +++--- lib/StreamHandlerLibav.cpp | 2 +- lib/StreamHandlerLibav.h | 2 +- lib/StreamHandlerOpenCV.cpp | 7 ++-- lib/StreamHandlerOpenCV.h | 2 +- lib/StreamHandlerPortableMap.cpp | 2 +- lib/StreamHandlerPortableMap.h | 2 +- lib/StreamHandlerRaw.cpp | 2 +- lib/StreamHandlerRaw.h | 2 +- tools/PlaYUVerTools.cpp | 14 +++---- tools/PlaYUVerTools.h | 2 +- tools/PlaYUVerToolsCmdParser.cpp | 2 +- tools/PlaYUVerToolsCmdParser.h | 14 +++---- 25 files changed, 128 insertions(+), 129 deletions(-) diff --git a/app/ConfigureFormatDialog.cpp b/app/ConfigureFormatDialog.cpp index 0d717be..9c53950 100644 --- a/app/ConfigureFormatDialog.cpp +++ b/app/ConfigureFormatDialog.cpp @@ -271,7 +271,7 @@ Int ConfigureFormatDialog::runConfigureFormatDialog( QString Filename, UInt& rWi Int sampling = 0; if( rInputFormat >= 0 ) { - std::string pelFmtName = PlaYUVerFrame::supportedPixelFormatListNames()[rInputFormat]; + String pelFmtName = PlaYUVerFrame::supportedPixelFormatListNames()[rInputFormat]; for( UInt j = 0; j < PlaYUVerFrame::supportedColorSpacesListNames().size(); j++ ) { for( UInt i = 0; i < PlaYUVerFrame::supportedPixelFormatListNames( j ).size(); i++ ) @@ -314,7 +314,7 @@ Int ConfigureFormatDialog::runConfigureFormatDialog( QString Filename, UInt& rWi rHeight = m_spinBoxheight->value(); colorSpace = m_comboBoxColorSpace->currentIndex(); sampling = m_comboBoxPixelFormat->currentIndex(); - std::string pelFmtName = PlaYUVerFrame::supportedPixelFormatListNames( colorSpace )[sampling]; + String pelFmtName = PlaYUVerFrame::supportedPixelFormatListNames( colorSpace )[sampling]; for( UInt i = 0; i < PlaYUVerFrame::supportedPixelFormatListNames().size(); i++ ) { if( pelFmtName == PlaYUVerFrame::supportedPixelFormatListNames()[i] ) diff --git a/app/DialogSubWindowSelector.cpp b/app/DialogSubWindowSelector.cpp index 2bf40c3..ab53ea5 100644 --- a/app/DialogSubWindowSelector.cpp +++ b/app/DialogSubWindowSelector.cpp @@ -136,9 +136,6 @@ Void DialogSubWindowSelector::updateSubWindowList() if( !m_apcSelectedSubWindowList.contains( m_apcSubWindowList.at( i ) ) ) m_pcGroupCheckBox->layout()->addWidget( m_apcWindowsListCheckBox.at( i ) ); } - -// qDebug( ) << "Selected windows: " -// << m_apcSelectedSubWindowList.size(); } Void DialogSubWindowSelector::selectSubWindow( SubWindowAbstract * subWindow ) @@ -147,7 +144,6 @@ Void DialogSubWindowSelector::selectSubWindow( SubWindowAbstract * subWindow ) if( iIdx >= 0 ) { m_apcWindowsListCheckBox.at( iIdx )->setChecked( true ); - //m_apcSelectedSubWindowList.append( m_apcSubWindowList.at( iIdx ) ); } } diff --git a/app/ModulesHandleOptDialog.cpp b/app/ModulesHandleOptDialog.cpp index 6dbeea3..43ebe8e 100644 --- a/app/ModulesHandleOptDialog.cpp +++ b/app/ModulesHandleOptDialog.cpp @@ -66,7 +66,7 @@ public: } return m_pcValue->text(); } - const std::string& getName() + const String& getName() { return m_cName; } @@ -74,7 +74,7 @@ private: QLineEdit* m_pcValue; QCheckBox* m_pcChecked; QLabel* m_pcDescription; - std::string m_cName; + String m_cName; }; ModulesHandleOptDialog::ModulesHandleOptDialog( QWidget *parent, PlaYUVerAppModuleIf *pcCurrModuleIf ) : @@ -118,8 +118,8 @@ Int ModulesHandleOptDialog::runConfiguration() return QDialog::Rejected; } - std::vector argsArray; - std::string optionString; + std::vector argsArray; + String optionString; QString valueString( "" ); for( Int i = 0; i < m_apcOptionList.size(); i++ ) diff --git a/app/PlaYUVerApp.cpp b/app/PlaYUVerApp.cpp index dac2832..e980754 100644 --- a/app/PlaYUVerApp.cpp +++ b/app/PlaYUVerApp.cpp @@ -97,9 +97,9 @@ Bool PlaYUVerApp::parseArgs( Int argc, Char *argv[] ) m_pcCmdParser = new PlaYUVerCmdParser(); m_pcCmdParser->config( argc, argv ); - std::vector m_apcInputs; - std::string strResolution( "" ); - std::string strPelFmt( "" ); + std::vector m_apcInputs; + String strResolution( "" ); + String strPelFmt( "" ); m_pcCmdParser->Opts().addOptions()/**/ ( "input,i", m_apcInputs, "input file" ) /**/ diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index 3f2e68c..ef158e4 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -443,7 +443,7 @@ Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, { bGuessed = false; // Guess pixel format - QVector formats_list = QVector::fromStdVector( PlaYUVerFrame::supportedPixelFormatListNames() ); + QVector formats_list = QVector::fromStdVector( PlaYUVerFrame::supportedPixelFormatListNames() ); for( Int i = 0; i < formats_list.size(); i++ ) { if( FilenameShort.contains( formats_list.at( i ).c_str(), Qt::CaseInsensitive ) ) diff --git a/lib/PlaYUVerDefs.h b/lib/PlaYUVerDefs.h index e029da2..6262817 100644 --- a/lib/PlaYUVerDefs.h +++ b/lib/PlaYUVerDefs.h @@ -49,6 +49,8 @@ typedef float Float; typedef unsigned char UInt8; typedef unsigned int UInt16; +typedef std::string String; + // ==================================================================================================================== // 64-bit integer type // ==================================================================================================================== @@ -118,16 +120,16 @@ enum RGBcomponent }; -inline std::string lowercase( const std::string& in ) +inline String lowercase( const String& in ) { - std::string out; + String out; transform( in.begin(), in.end(), std::back_inserter( out ), tolower ); return out; } -inline std::string uppercase( const std::string& in ) +inline String uppercase( const String& in ) { - std::string out; + String out; transform( in.begin(), in.end(), std::back_inserter( out ), toupper ); return out; } diff --git a/lib/PlaYUVerFrame.cpp b/lib/PlaYUVerFrame.cpp index 48ef1cd..7df4a3a 100644 --- a/lib/PlaYUVerFrame.cpp +++ b/lib/PlaYUVerFrame.cpp @@ -37,18 +37,18 @@ #endif -std::vector PlaYUVerFrame::supportedColorSpacesListNames() +std::vector PlaYUVerFrame::supportedColorSpacesListNames() { - std::vector colorSpaceList; + std::vector colorSpaceList; colorSpaceList.push_back( "YUV" ); colorSpaceList.push_back( "RGB" ); colorSpaceList.push_back( "GRAY" ); return colorSpaceList; } -std::vector PlaYUVerFrame::supportedPixelFormatListNames() +std::vector PlaYUVerFrame::supportedPixelFormatListNames() { - std::vector formatsList; + std::vector formatsList; Int numberFormats = PLAYUVER_NUMBER_FORMATS; for( Int i = 0; i < numberFormats; i++ ) { @@ -57,9 +57,9 @@ std::vector PlaYUVerFrame::supportedPixelFormatListNames() return formatsList; } -std::vector PlaYUVerFrame::supportedPixelFormatListNames( Int colorSpace ) +std::vector PlaYUVerFrame::supportedPixelFormatListNames( Int colorSpace ) { - std::vector formatsList; + std::vector formatsList; Int numberFormats = PLAYUVER_NUMBER_FORMATS; for( Int i = 0; i < numberFormats; i++ ) { @@ -69,7 +69,7 @@ std::vector PlaYUVerFrame::supportedPixelFormatListNames( Int color return formatsList; } -Int PlaYUVerFrame::findPixelFormat( std::string name ) +Int PlaYUVerFrame::findPixelFormat( String name ) { for( Int i = 0; i < PLAYUVER_NUMBER_FORMATS; i++ ) { @@ -257,7 +257,7 @@ Bool PlaYUVerFrame::haveSameFmt( PlaYUVerFrame* other, UInt match ) const return bRet; } -std::string PlaYUVerFrame::getPelFmtName() +String PlaYUVerFrame::getPelFmtName() { return m_pcPelFormat->name; } diff --git a/lib/PlaYUVerFrame.h b/lib/PlaYUVerFrame.h index 2eb4fb6..cc49ed6 100644 --- a/lib/PlaYUVerFrame.h +++ b/lib/PlaYUVerFrame.h @@ -87,16 +87,16 @@ public: * of PlaYUVerFrame * @return vector of strings with pixel formats names */ - static std::vector supportedColorSpacesListNames(); + static std::vector supportedColorSpacesListNames(); /** * Function that handles the supported pixel formats * of PlaYUVerFrame * @return vector of strings with pixel formats names */ - static std::vector supportedPixelFormatListNames(); - static std::vector supportedPixelFormatListNames( Int colorSpace ); - static Int findPixelFormat( std::string name ); + static std::vector supportedPixelFormatListNames(); + static std::vector supportedPixelFormatListNames( Int colorSpace ); + static Int findPixelFormat( String name ); /** * Get number of bytes per frame of a specific @@ -221,7 +221,7 @@ public: Bool haveSameFmt( PlaYUVerFrame* other, UInt match = MATCH_ALL ) const; - std::string getPelFmtName(); + String getPelFmtName(); /** * Histogram @@ -271,9 +271,9 @@ public: NUMBER_METRICS, }; - static std::vector supportedQualityMetricsList() + static std::vector supportedQualityMetricsList() { - std::vector metrics; + std::vector metrics; metrics.push_back( "PSNR" ); metrics.push_back( "MSE" ); metrics.push_back( "SSIM" ); @@ -293,7 +293,7 @@ private: //! Struct with the pixel format description. PlaYUVerPixFmtDescriptor* m_pcPelFormat; - std::string m_cPelFmtName; + String m_cPelFmtName; UInt m_uiWidth; //!< Width of the frame UInt m_uiHeight; //!< Height of the frame diff --git a/lib/PlaYUVerProgramOptions.cpp b/lib/PlaYUVerProgramOptions.cpp index b63ac32..436b1bb 100644 --- a/lib/PlaYUVerProgramOptions.cpp +++ b/lib/PlaYUVerProgramOptions.cpp @@ -49,7 +49,7 @@ using namespace std; -Options::Options( const std::string& name ) +Options::Options( const String& name ) { m_cOptionGroupName = name; m_bAllowUnkonw = true; @@ -63,12 +63,12 @@ Options::~Options() } } -OptionBase* Options::operator[]( const std::string& optName ) +OptionBase* Options::operator[]( const String& optName ) { return getOption( optName ); } -OptionBase* Options::getOption( const std::string& optName ) +OptionBase* Options::getOption( const String& optName ) { Options::OptionMap::iterator opt_it; opt_it = opt_short_map.find( optName ); @@ -92,7 +92,7 @@ OptionBase* Options::getOption( const std::string& optName ) return NULL; } -Bool Options::hasOpt( const std::string& optName ) +Bool Options::hasOpt( const String& optName ) { return getOption( optName )->count() > 0 ? true : false; } @@ -347,7 +347,7 @@ list Options::scanArgv( unsigned argc, const char* argv[] ) return non_option_arguments; } -Void Options::scanArgs( std::vector args_array) +Void Options::scanArgs( std::vector args_array) { for( unsigned i = 0; i < args_array.size(); i++ ) { diff --git a/lib/PlaYUVerProgramOptions.h b/lib/PlaYUVerProgramOptions.h index b45792d..d1bcd8a 100644 --- a/lib/PlaYUVerProgramOptions.h +++ b/lib/PlaYUVerProgramOptions.h @@ -52,7 +52,7 @@ struct Options; struct ParseFailure: public std::exception { - ParseFailure( std::string arg0, std::string val0 ) throw() : + ParseFailure( String arg0, String val0 ) throw() : arg( arg0 ), val( val0 ) { @@ -62,8 +62,8 @@ struct ParseFailure: public std::exception { } - std::string arg; - std::string val; + String arg; + String val; const char* what() const throw() { @@ -76,7 +76,7 @@ struct ParseFailure: public std::exception * information should be stored in a derived class. */ struct OptionBase { - OptionBase( const std::string& name, const std::string& desc ) : + OptionBase( const String& name, const String& desc ) : arg_count( 0 ), opt_string( name ), opt_desc( desc ) @@ -88,7 +88,7 @@ struct OptionBase } /* parse argument arg, to obtain a value for the option */ - virtual void parse( const std::string& arg ) = 0; + virtual void parse( const String& arg ) = 0; /* set the argument to the default value */ //virtual void setDefault() = 0; int count() @@ -101,15 +101,15 @@ struct OptionBase } int arg_count; - std::string opt_string; - std::string opt_desc; + String opt_string; + String opt_desc; Bool is_binary; }; /** Type specific option storage */ struct FlagOpt: public OptionBase { - FlagOpt( const std::string& name, Bool default_val, const std::string& desc ) : + FlagOpt( const String& name, Bool default_val, const String& desc ) : OptionBase( name, desc ), opt_storage( false ), opt_default_val( default_val ) @@ -117,7 +117,7 @@ struct FlagOpt: public OptionBase is_binary = true; } - void parse( const std::string& arg ) + void parse( const String& arg ) { opt_storage = true; arg_count++; @@ -135,14 +135,14 @@ struct FlagOpt: public OptionBase template struct StandardOpt: public OptionBase { - StandardOpt( const std::string& name, T& storage, const std::string& desc ) : + StandardOpt( const String& name, T& storage, const String& desc ) : OptionBase( name, desc ), opt_storage( storage ) { is_binary = false; } - void parse( const std::string& arg ); + void parse( const String& arg ); // void setDefault() // { @@ -154,7 +154,7 @@ struct StandardOpt: public OptionBase /* Generic parsing */ template -inline void StandardOpt::parse( const std::string& arg ) +inline void StandardOpt::parse( const String& arg ) { std::istringstream arg_ss( arg, std::istringstream::in ); arg_ss.exceptions( std::ios::failbit ); @@ -170,7 +170,7 @@ inline void StandardOpt::parse( const std::string& arg ) } template<> -inline void StandardOpt< std::vector >::parse( const std::string& arg ) +inline void StandardOpt< std::vector >::parse( const String& arg ) { UInt aux_opt_storage; std::istringstream arg_ss( arg, std::istringstream::in ); @@ -188,7 +188,7 @@ inline void StandardOpt< std::vector >::parse( const std::string& arg ) } template<> -inline void StandardOpt< std::vector >::parse( const std::string& arg ) +inline void StandardOpt< std::vector >::parse( const String& arg ) { Int aux_opt_storage; std::istringstream arg_ss( arg, std::istringstream::in ); @@ -207,7 +207,7 @@ inline void StandardOpt< std::vector >::parse( const std::string& arg ) /* string parsing is specialized */ template<> -inline void StandardOpt::parse( const std::string& arg ) +inline void StandardOpt::parse( const String& arg ) { opt_storage = arg; arg_count++; @@ -215,7 +215,7 @@ inline void StandardOpt::parse( const std::string& arg ) /* string vector parsing is specialized */ template<> -inline void StandardOpt >::parse( const std::string& arg ) +inline void StandardOpt >::parse( const String& arg ) { opt_storage.push_back( arg ); arg_count++; @@ -224,9 +224,9 @@ inline void StandardOpt >::parse( const std::string& ar /** Option class for argument handling using a user provided function */ struct OptionFunc: public OptionBase { - typedef Void (Func)( Options&, const std::string& ); + typedef Void (Func)( Options&, const String& ); - OptionFunc( const std::string& name, Options& parent_, Func *func_, const std::string& desc ) : + OptionFunc( const String& name, Options& parent_, Func *func_, const String& desc ) : OptionBase( name, desc ), parent( parent_ ), func( func_ ) @@ -234,7 +234,7 @@ struct OptionFunc: public OptionBase is_binary = false; } - void parse( const std::string& arg ) + void parse( const String& arg ) { func( parent, arg ); arg_count++; @@ -247,7 +247,7 @@ struct OptionFunc: public OptionBase private: Options& parent; - void (*func)( Options&, const std::string& ); + void (*func)( Options&, const String& ); }; class OptionSpecific; @@ -267,49 +267,49 @@ public: if( opt ) delete opt; } - std::list opt_long; - std::list opt_short; + std::list opt_long; + std::list opt_short; OptionBase* opt; }; typedef std::list OptionsList; - Options( const std::string& name = "" ); + Options( const String& name = "" ); ~Options(); std::list scanArgv( unsigned argc, const char* argv[] ); - Void scanArgs( std::vector args_array); + Void scanArgs( std::vector args_array); Void doHelp( std::ostream& out, unsigned columns = 80 ); OptionSpecific addOptions(); Void setDefaults(); - OptionBase* operator[]( const std::string& optName ); - OptionBase* getOption( const std::string& optName ); + OptionBase* operator[]( const String& optName ); + OptionBase* getOption( const String& optName ); OptionsList& getOptionList() { return opt_list; } - Bool hasOpt( const std::string& optName ); + Bool hasOpt( const String& optName ); void addOption( OptionBase *opt ); private: - typedef std::map OptionMap; + typedef std::map OptionMap; OptionMap opt_long_map; OptionMap opt_short_map; OptionsList opt_list; - std::string m_cOptionGroupName; + String m_cOptionGroupName; Bool m_bAllowUnkonw; - Bool storePair( Bool allow_long, Bool allow_short, const std::string& name, const std::string& value ); - Bool storePair( const std::string& name, const std::string& value ); + Bool storePair( Bool allow_long, Bool allow_short, const String& name, const String& value ); + Bool storePair( const String& name, const String& value ); UInt parseLONG( unsigned argc, const char* argv[] ); - UInt parseLONG( std::string arg ); + UInt parseLONG( String arg ); unsigned parseSHORT( unsigned argc, const char* argv[] ); }; @@ -330,7 +330,7 @@ public: */ template OptionSpecific& - operator()( const std::string& name, T& storage, const std::string& desc ) + operator()( const String& name, T& storage, const String& desc ) { parent.addOption( new StandardOpt( name, storage, desc ) ); return *this; @@ -343,7 +343,7 @@ public: * with desc as an optional help description */ OptionSpecific& - operator()( const std::string& name, const std::string& desc ) + operator()( const String& name, const String& desc ) { parent.addOption( new FlagOpt( name, false, desc ) ); return *this; @@ -356,7 +356,7 @@ public: * with desc as an optional help description */ OptionSpecific& - operator()( const std::string& name, Bool default_val, const std::string& desc ) + operator()( const String& name, Bool default_val, const String& desc ) { parent.addOption( new FlagOpt( name, default_val, desc ) ); return *this; @@ -370,7 +370,7 @@ public: * handle evaluating the option's value. */ OptionSpecific& - operator()( const std::string& name, OptionFunc::Func *func, const std::string& desc ) + operator()( const String& name, OptionFunc::Func *func, const String& desc ) { parent.addOption( new OptionFunc( name, parent, func, desc ) ); return *this; diff --git a/lib/PlaYUVerStream.cpp b/lib/PlaYUVerStream.cpp index d55a141..586cc96 100644 --- a/lib/PlaYUVerStream.cpp +++ b/lib/PlaYUVerStream.cpp @@ -99,9 +99,9 @@ std::vector PlaYUVerStream::stdResolutionSizes() } -CreateStreamHandlerFn PlaYUVerStream::findStreamHandler( std::string strFilename, bool bRead ) +CreateStreamHandlerFn PlaYUVerStream::findStreamHandler( String strFilename, bool bRead ) { - std::string currExt = strFilename.substr( strFilename.find_last_of( "." ) + 1 ); + String currExt = strFilename.substr( strFilename.find_last_of( "." ) + 1 ); currExt = lowercase( currExt ); std::vector supportedFmts; @@ -119,7 +119,7 @@ CreateStreamHandlerFn PlaYUVerStream::findStreamHandler( std::string strFilename { return supportedFmts[i].formatFct; } - else if( strFilename.find( supportedFmts[i].formatExt ) != std::string::npos ) + else if( strFilename.find( supportedFmts[i].formatExt ) != String::npos ) { return supportedFmts[i].formatFct; } @@ -150,16 +150,16 @@ PlaYUVerStream::~PlaYUVerStream() close(); } -std::string PlaYUVerStream::getFormatName() +String PlaYUVerStream::getFormatName() { return !m_pcHandler ? "" : m_pcHandler->getFormatName(); } -std::string PlaYUVerStream::getCodecName() +String PlaYUVerStream::getCodecName() { return !m_pcHandler ? "" : m_pcHandler->getCodecName(); } -Bool PlaYUVerStream::open( std::string filename, std::string resolution, std::string input_format_name, UInt bitsPel, Int endianness, UInt frame_rate, Bool bInput ) +Bool PlaYUVerStream::open( String filename, String resolution, String input_format_name, UInt bitsPel, Int endianness, UInt frame_rate, Bool bInput ) { UInt width; UInt height; @@ -184,7 +184,7 @@ Bool PlaYUVerStream::open( std::string filename, std::string resolution, std::st return open( filename, width, height, input_format, bitsPel, endianness, frame_rate, bInput ); } -Bool PlaYUVerStream::open( std::string filename, UInt width, UInt height, Int input_format, UInt bitsPel, Int endianness, UInt frame_rate, Bool bInput ) +Bool PlaYUVerStream::open( String filename, UInt width, UInt height, Int input_format, UInt bitsPel, Int endianness, UInt frame_rate, Bool bInput ) { if( m_bInit ) { @@ -331,7 +331,7 @@ Void PlaYUVerStream::close() m_bInit = false; } -std::string PlaYUVerStream::getFileName() +String PlaYUVerStream::getFileName() { return m_cFilename; } @@ -488,12 +488,12 @@ Void PlaYUVerStream::writeFrame( PlaYUVerFrame *pcFrame ) return; } -Bool PlaYUVerStream::saveFrame( const std::string& filename ) +Bool PlaYUVerStream::saveFrame( const String& filename ) { return saveFrame( filename, m_pcCurrFrame ); } -Bool PlaYUVerStream::saveFrame( const std::string& filename, PlaYUVerFrame *saveFrame ) +Bool PlaYUVerStream::saveFrame( const String& filename, PlaYUVerFrame *saveFrame ) { PlaYUVerStream auxSaveStream; if( !auxSaveStream.open( filename, saveFrame->getWidth(), saveFrame->getHeight(), saveFrame->getPelFormat(), saveFrame->getBitsPel(), saveFrame->getEndianness(), 1, false ) ) diff --git a/lib/PlaYUVerStream.h b/lib/PlaYUVerStream.h index c785740..3449985 100644 --- a/lib/PlaYUVerStream.h +++ b/lib/PlaYUVerStream.h @@ -38,7 +38,7 @@ class PlaYUVerStreamHandlerIf; typedef struct { - std::string shortName; + String shortName; UInt uiWidth; UInt uiHeight; } PlaYUVerStdResolution; @@ -48,8 +48,8 @@ typedef PlaYUVerStreamHandlerIf* (*CreateStreamHandlerFn)( void ); typedef struct { - std::string formatName; - std::string formatExt; + String formatName; + String formatExt; CreateStreamHandlerFn formatFct; } PlaYUVerSupportedFormat; @@ -84,7 +84,7 @@ public: static std::vector supportedReadFormats(); static std::vector supportedWriteFormats(); - static CreateStreamHandlerFn findStreamHandler( std::string strFilename, bool bRead ); + static CreateStreamHandlerFn findStreamHandler( String strFilename, bool bRead ); static std::vector stdResolutionSizes(); @@ -100,15 +100,15 @@ public: END_OF_SEQ, }; - std::string getFormatName(); - std::string getCodecName(); + String getFormatName(); + String getCodecName(); - Bool open( std::string filename, std::string resolution, std::string input_format, UInt bitsPel, Int endianness, UInt frame_rate, Bool bInput = true ); - Bool open( std::string filename, UInt width, UInt height, Int input_format, UInt bitsPel, Int endianness, UInt frame_rate, Bool bInput = true ); + Bool open( String filename, String resolution, String input_format, UInt bitsPel, Int endianness, UInt frame_rate, Bool bInput = true ); + Bool open( String filename, UInt width, UInt height, Int input_format, UInt bitsPel, Int endianness, UInt frame_rate, Bool bInput = true ); Bool reload(); Void close(); - std::string getFileName(); + String getFileName(); UInt getFrameNum(); UInt getWidth() const; UInt getHeight() const; @@ -123,8 +123,8 @@ public: Void writeFrame(); Void writeFrame( PlaYUVerFrame *pcFrame ); - Bool saveFrame( const std::string& filename ); - static Bool saveFrame( const std::string& filename, PlaYUVerFrame *saveFrame ); + Bool saveFrame( const String& filename ); + static Bool saveFrame( const String& filename, PlaYUVerFrame *saveFrame ); Bool setNextFrame(); PlaYUVerFrame* getCurrFrame(); @@ -149,7 +149,7 @@ private: PlaYUVerStreamHandlerIf* m_pcHandler; Bool m_bIsInput; - std::string m_cFilename; + String m_cFilename; UInt64 m_uiTotalFrameNum; Int64 m_iCurrFrameNum; diff --git a/lib/PlaYUVerStreamHandlerIf.h b/lib/PlaYUVerStreamHandlerIf.h index 952b232..939471e 100644 --- a/lib/PlaYUVerStreamHandlerIf.h +++ b/lib/PlaYUVerStreamHandlerIf.h @@ -58,7 +58,7 @@ public: { } - virtual Bool openHandler( std::string strFilename, Bool bInput ) = 0; + virtual Bool openHandler( String strFilename, Bool bInput ) = 0; virtual Void closeHandler() = 0; virtual Bool configureBuffer( PlaYUVerFrame* pcFrame ) = 0; virtual UInt64 calculateFrameNumber() = 0; @@ -70,18 +70,18 @@ public: { m_uiNBytesPerFrame = uiNBytes; } - std::string getFormatName() + String getFormatName() { return m_strFormatName; } - std::string getCodecName() + String getCodecName() { return m_strCodecName; } protected: Bool m_bIsInput; - std::string m_cFilename; + String m_cFilename; UInt m_uiWidth; UInt m_uiHeight; Int m_iPixelFormat; @@ -91,8 +91,8 @@ protected: Byte* m_pStreamBuffer; UInt64 m_uiNBytesPerFrame; - std::string m_strFormatName; - std::string m_strCodecName; + String m_strFormatName; + String m_strCodecName; }; #endif // __PLAYUVERSTREAMHANDLERIF_H__ diff --git a/lib/StreamHandlerLibav.cpp b/lib/StreamHandlerLibav.cpp index 700a42a..8b9e9aa 100644 --- a/lib/StreamHandlerLibav.cpp +++ b/lib/StreamHandlerLibav.cpp @@ -87,7 +87,7 @@ static int open_codec_context( int *stream_idx, AVFormatContext *m_cFmtCtx, enum return 0; } -Bool StreamHandlerLibav::openHandler( std::string strFilename, Bool bInput ) +Bool StreamHandlerLibav::openHandler( String strFilename, Bool bInput ) { const char* filename = strFilename.c_str(); diff --git a/lib/StreamHandlerLibav.h b/lib/StreamHandlerLibav.h index 68cb592..953c97e 100644 --- a/lib/StreamHandlerLibav.h +++ b/lib/StreamHandlerLibav.h @@ -68,7 +68,7 @@ public: { } - Bool openHandler( std::string strFilename, Bool bInput ); + Bool openHandler( String strFilename, Bool bInput ); Void closeHandler(); Bool configureBuffer( PlaYUVerFrame* pcFrame ); UInt64 calculateFrameNumber(); diff --git a/lib/StreamHandlerOpenCV.cpp b/lib/StreamHandlerOpenCV.cpp index 10635c4..43aa139 100644 --- a/lib/StreamHandlerOpenCV.cpp +++ b/lib/StreamHandlerOpenCV.cpp @@ -29,7 +29,8 @@ #include "PlaYUVerFramePixelFormats.h" #include "LibMemory.h" -using namespace cv; +using cv::Mat; +using cv::VideoCapture; std::vector StreamHandlerOpenCV::supportedReadFormats() @@ -56,7 +57,7 @@ StreamHandlerOpenCV::StreamHandlerOpenCV() pcVideoCapture = NULL; } -Bool StreamHandlerOpenCV::openHandler( std::string strFilename, Bool bInput ) +Bool StreamHandlerOpenCV::openHandler( String strFilename, Bool bInput ) { m_cFilename = strFilename; if( bInput ) @@ -66,7 +67,7 @@ Bool StreamHandlerOpenCV::openHandler( std::string strFilename, Bool bInput ) /* * Special filename to handle webcam input */ - if( m_cFilename.find( "/dev/video" ) != std::string::npos ) + if( m_cFilename.find( "/dev/video" ) != String::npos ) { m_strFormatName = "DEV"; m_strCodecName = "Raw Video"; diff --git a/lib/StreamHandlerOpenCV.h b/lib/StreamHandlerOpenCV.h index 3a29b66..acb769a 100644 --- a/lib/StreamHandlerOpenCV.h +++ b/lib/StreamHandlerOpenCV.h @@ -55,7 +55,7 @@ public: { } - Bool openHandler( std::string strFilename, Bool bInput ); + Bool openHandler( String strFilename, Bool bInput ); Void closeHandler(); Bool configureBuffer( PlaYUVerFrame* pcFrame ); UInt64 calculateFrameNumber(); diff --git a/lib/StreamHandlerPortableMap.cpp b/lib/StreamHandlerPortableMap.cpp index 6ff1600..f866f53 100644 --- a/lib/StreamHandlerPortableMap.cpp +++ b/lib/StreamHandlerPortableMap.cpp @@ -31,7 +31,7 @@ #include "LibMemory.h" -Bool StreamHandlerPortableMap::openHandler( std::string strFilename, Bool bInput ) +Bool StreamHandlerPortableMap::openHandler( String strFilename, Bool bInput ) { m_bIsInput = bInput; m_pFile = NULL; diff --git a/lib/StreamHandlerPortableMap.h b/lib/StreamHandlerPortableMap.h index 5bb8829..4cbd389 100644 --- a/lib/StreamHandlerPortableMap.h +++ b/lib/StreamHandlerPortableMap.h @@ -44,7 +44,7 @@ public: StreamHandlerPortableMap() {} ~StreamHandlerPortableMap() {} - Bool openHandler( std::string strFilename, Bool bInput ); + Bool openHandler( String strFilename, Bool bInput ); Void closeHandler(); Bool configureBuffer( PlaYUVerFrame* pcFrame ); UInt64 calculateFrameNumber(); diff --git a/lib/StreamHandlerRaw.cpp b/lib/StreamHandlerRaw.cpp index 0781313..6164c46 100644 --- a/lib/StreamHandlerRaw.cpp +++ b/lib/StreamHandlerRaw.cpp @@ -30,7 +30,7 @@ #include "LibMemory.h" -Bool PlaYUVerRawHandler::openHandler( std::string strFilename, Bool bInput ) +Bool PlaYUVerRawHandler::openHandler( String strFilename, Bool bInput ) { m_bIsInput = bInput; m_pFile = NULL; diff --git a/lib/StreamHandlerRaw.h b/lib/StreamHandlerRaw.h index 4ad8bc6..28c23a5 100644 --- a/lib/StreamHandlerRaw.h +++ b/lib/StreamHandlerRaw.h @@ -45,7 +45,7 @@ public: PlaYUVerRawHandler() {} ~PlaYUVerRawHandler() {} - Bool openHandler( std::string strFilename, Bool bInput ); + Bool openHandler( String strFilename, Bool bInput ); Void closeHandler(); Bool configureBuffer( PlaYUVerFrame* pcFrame ); UInt64 calculateFrameNumber(); diff --git a/tools/PlaYUVerTools.cpp b/tools/PlaYUVerTools.cpp index 70dcf7c..d9b20d3 100644 --- a/tools/PlaYUVerTools.cpp +++ b/tools/PlaYUVerTools.cpp @@ -62,10 +62,10 @@ Int PlaYUVerTools::openInputs() */ if( m_cCmdLineHandler.Opts().hasOpt( "input" ) ) { - std::vector inputFileNames = m_cCmdLineHandler.m_apcInputs; + std::vector inputFileNames = m_cCmdLineHandler.m_apcInputs; - std::string resolutionString( "" ); - std::string fmtString( "yuv420p" ); + String resolutionString( "" ); + String fmtString( "yuv420p" ); UInt uiBitPerPixel = 8; UInt uiEndianness = 0; @@ -184,7 +184,7 @@ Int PlaYUVerTools::Open( Int argc, Char *argv[] ) */ if( m_cCmdLineHandler.Opts().hasOpt( "quality" ) ) { - std::string qualityMetric = m_cCmdLineHandler.m_strQualityMetric; + String qualityMetric = m_cCmdLineHandler.m_strQualityMetric; if( m_apcInputStreams.size() < 2 ) { m_cCmdLineHandler.log( LOG_ERROR, "Invalid number of inputs! " ); @@ -212,7 +212,7 @@ Int PlaYUVerTools::Open( Int argc, Char *argv[] ) */ if( m_cCmdLineHandler.Opts().hasOpt( "module" ) ) { - std::string moduleName = m_cCmdLineHandler.m_strModule; + String moduleName = m_cCmdLineHandler.m_strModule; PlaYUVerModuleFactoryMap& PlaYUVerModuleFactoryMap = PlaYUVerModuleFactory::Get()->getMap(); PlaYUVerModuleFactoryMap::iterator it = PlaYUVerModuleFactoryMap.begin(); @@ -263,7 +263,7 @@ Int PlaYUVerTools::Open( Int argc, Char *argv[] ) if( m_pcCurrModuleIf->m_iModuleType == FRAME_PROCESSING_MODULE ) { // Check outputs - std::vector outputFileNames; + std::vector outputFileNames; if( m_cCmdLineHandler.Opts().hasOpt( "output" ) ) outputFileNames.push_back( m_cCmdLineHandler.m_strOutput ); @@ -341,7 +341,7 @@ Int PlaYUVerTools::QualityOperation() Double adAverageQuality[MAX_NUMBER_INPUTS - 1][MAX_NUMBER_COMPONENTS]; Double dQuality; - std::string metric_fmt = " "; + String metric_fmt = " "; switch( m_uiQualityMetric ) { case PlaYUVerFrame::PSNR_METRIC: diff --git a/tools/PlaYUVerTools.h b/tools/PlaYUVerTools.h index 11fa035..baf0fcd 100644 --- a/tools/PlaYUVerTools.h +++ b/tools/PlaYUVerTools.h @@ -70,7 +70,7 @@ private: FpProcess m_fpProcess; Int64 m_iFrameNum; - std::vector m_pcOutputFileNames; + std::vector m_pcOutputFileNames; Int SaveOperation(); Int m_uiQualityMetric; diff --git a/tools/PlaYUVerToolsCmdParser.cpp b/tools/PlaYUVerToolsCmdParser.cpp index 36203bf..2af415a 100644 --- a/tools/PlaYUVerToolsCmdParser.cpp +++ b/tools/PlaYUVerToolsCmdParser.cpp @@ -165,7 +165,7 @@ Void PlaYUVerToolsCmdParser::listModules() Void PlaYUVerToolsCmdParser::listModuleHelp() { - std::string moduleName = m_strModule; + String moduleName = m_strModule; PlaYUVerModuleIf* pcCurrModuleIf = NULL; PlaYUVerModuleFactoryMap& PlaYUVerModuleFactoryMap = PlaYUVerModuleFactory::Get()->getMap(); diff --git a/tools/PlaYUVerToolsCmdParser.h b/tools/PlaYUVerToolsCmdParser.h index 67deeb1..adfde00 100644 --- a/tools/PlaYUVerToolsCmdParser.h +++ b/tools/PlaYUVerToolsCmdParser.h @@ -71,16 +71,16 @@ private: Bool m_bShowVersion; Bool m_bQuiet; - std::vector m_apcInputs; - std::vector m_strResolution; - std::vector m_strPelFmt; + std::vector m_apcInputs; + std::vector m_strResolution; + std::vector m_strPelFmt; std::vector m_uiBitsPerPixel; - std::vector m_strEndianness; - std::string m_strOutput; + std::vector m_strEndianness; + String m_strOutput; Int64 m_iFrames; - std::string m_strQualityMetric; - std::string m_strModule; + String m_strQualityMetric; + String m_strModule; Bool m_bListPelFmts; Bool m_bListQuality;