TuttleOFX  1
LibAVVideoPreset.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_PLUGIN_LIBAV_LIBAVVIDEOPRESET_HPP_
00002 #define _TUTTLE_PLUGIN_LIBAV_LIBAVVIDEOPRESET_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 LibAVVideoPreset
00017 {
00018 public:
00019         LibAVVideoPreset( 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() == kPresetVideoExtension )
00026                         {
00027                                 LibAVPresetFileParser fp( presetPath );
00028                                 if( presetID == fp.getId() )
00029                                 {
00030                                         params = fp.getParameters();
00031                                 }
00032                         }
00033                 }
00034         }
00035         
00036         ~LibAVVideoPreset()
00037         {
00038                 
00039         }
00040         
00041         static void getPresetList( std::vector<std::string>& presetID )
00042         {
00043                 LibAVPresetParser::getPresetList( presetID, kPresetVideoExtension );
00044         }
00045         
00046         static void getPresetList( std::vector<std::string>& presetID, std::vector<std::string>& presetLabelID )
00047         {
00048                 LibAVPresetParser::getPresetList( presetID, presetLabelID, kPresetVideoExtension );
00049         }
00050         
00051         std::string getPresetID() { return presetID; }
00052         std::string getVideoCodec() { return params.find( "vcodec" )->second.at(0); }
00053         
00054         PresetParameters& getParameters() { return params; }
00055         
00056         PresetsList getPresetsPathList()
00057         {
00058                 return LibAVPresetParser::getPresetsPathList( kPresetVideoExtension );
00059         }
00060         
00061 private:
00062         std::string      presetID;
00063         PresetParameters params;
00064         
00065 };
00066 
00067 }
00068 }
00069 }
00070 #endif