TuttleOFX  1
LibAVPreset.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_PLUGIN_LIBAV_LIBAVPRESET_HPP_
00002 #define _TUTTLE_PLUGIN_LIBAV_LIBAVPRESET_HPP_
00003 
00004 #include "LibAVPresetParser.hpp"
00005 #include "LibAVPresetFileParser.hpp"
00006 
00007 #include <boost/foreach.hpp>
00008 #include <boost/filesystem.hpp>
00009 
00010 namespace tuttle {
00011 namespace plugin {
00012 namespace av {
00013 
00014 namespace bfs = boost::filesystem;
00015 
00016 class LibAVPreset
00017 {
00018 public:
00019         LibAVPreset( const std::string& id )
00020                 : presetID( id )
00021         {
00022                 BOOST_FOREACH( const std::string& presetPath, LibAVPresetParser::researchPresetsFiles() )
00023                 {
00024                         bfs::path f = presetPath;
00025                         if( f.extension() == kPresetExtension )
00026                         {
00027                                 LibAVPresetFileParser fp( presetPath );
00028                                 if( presetID == fp.getId() )
00029                                 {
00030                                         params = fp.getParameters();
00031                                 }
00032                         }
00033                 }
00034                 //TUTTLE_TLOG_VAR( TUTTLE_INFO, presetID );
00035         }
00036         
00037         ~LibAVPreset()
00038         {
00039                 
00040         }
00041         
00042         static void getPresetList( std::vector<std::string>& presetID )
00043         {
00044                 LibAVPresetParser::getPresetList( presetID, kPresetExtension );
00045         }
00046         
00047         static void getPresetList( std::vector<std::string>& presetID, std::vector<std::string>& presetLabelID )
00048         {
00049                 LibAVPresetParser::getPresetList( presetID, presetLabelID, kPresetExtension );
00050         }
00051         
00052         std::string getPresetID() { return presetID; }
00053         std::string getFormatID() { return params.find( "format" )->second.at(0); }
00054         std::string getVideoID()  { return params.find( "video" )->second.at(0); }
00055         std::string getAudioID()  { return params.find( "audio" )->second.at(0); }
00056         
00057         PresetsList getPresetsPathList()
00058         {
00059                 return LibAVPresetParser::getPresetsPathList( kPresetExtension );
00060         }
00061         
00062 private:
00063         std::string      presetID;
00064         PresetParameters params;
00065         
00066 };
00067 
00068 }
00069 }
00070 }
00071 
00072 #endif