AvTranscoder  0.9.4
C++APIforLibav/FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ProfileLoader.hpp
Go to the documentation of this file.
1 #ifndef _AV_TRANSCODER_PROFILE_HPP_
2 #define _AV_TRANSCODER_PROFILE_HPP_
3 
5 
6 #include <string>
7 #include <vector>
8 #include <map>
9 #include <iostream>
10 
11 namespace avtranscoder
12 {
13 
14 namespace constants
15 {
16 const std::string avProfileIdentificator = "avProfileName";
17 const std::string avProfileIdentificatorHuman = "avProfileLongName";
18 const std::string avProfileType = "avProfileType";
19 const std::string avProfileTypeFormat = "avProfileTypeFormat";
20 const std::string avProfileTypeVideo = "avProfileTypeVideo";
21 const std::string avProfileTypeAudio = "avProfileTypeAudio";
22 const std::string avProfileFormat = "format";
23 const std::string avProfileCodec = "codec";
24 const std::string avProfilePixelFormat = "pix_fmt";
25 const std::string avProfileSampleFormat = "sample_fmt";
26 const std::string avProfileFrameRate = "r";
27 const std::string avProfileWidth = "width";
28 const std::string avProfileHeight = "height";
29 const std::string avProfileSampleRate = "ar";
30 const std::string avProfileChannel = "ac";
31 const std::string avProfileThreads = "threads";
32 const std::string avProfileProcessStat = "processStat"; ///< Do statistics during the process.
33 }
34 
35 class AvExport ProfileLoader
36 {
37 public:
38  typedef std::map<std::string, std::string> Profile;
39  typedef std::vector<Profile> Profiles;
40 
41 public:
42  /**
43  * @param autoload: load profiles defined as text files at AVPROFILES
44  */
45  ProfileLoader(const bool autoload = true);
46 
47  /**
48  * @brief Load profiles from files in avProfilesPath directory
49  * @param avProfilesPath: if empty, the path is replaced by value of AVPROFILES environment variable
50  */
51  void loadProfiles(const std::string& avProfilesPath = "");
52 
53  /**
54  * @brief Load the profile defines in the given file
55  */
56  void loadProfile(const std::string& avProfileFileName);
57 
58  /**
59  * @brief Load the given profile
60  * @exception throw std::runtime_error if the profile is invalid
61  */
62  void loadProfile(const Profile& profile);
63 
64  bool hasProfile(const Profile& profile) const;
65 
66  const Profiles& getProfiles() const;
67 
68  Profiles getFormatProfiles() const;
69  Profiles getVideoProfiles() const;
70  Profiles getAudioProfiles() const;
71 
72  const Profile& getProfile(const std::string& avProfileIdentificator) const;
73 
74 public:
75  static bool checkFormatProfile(const Profile& profileToCheck);
76  static bool checkVideoProfile(const Profile& profileToCheck);
77  static bool checkAudioProfile(const Profile& profileToCheck);
78 
79 private:
80  Profiles _profiles;
81 };
82 
83 #ifndef SWIG
84 // To print a profile
85 std::ostream& operator<<(std::ostream& os, const ProfileLoader::Profile& profile);
86 #endif
87 }
88 #endif
std::vector< Profile > Profiles
const std::string avProfileFrameRate
const std::string avProfileFormat
const std::string avProfileProcessStat
Do statistics during the process.
std::map< std::string, std::string > Profile
const std::string avProfileTypeAudio
const std::string avProfileIdentificator
const std::string avProfileIdentificatorHuman
const std::string avProfileSampleRate
const std::string avProfilePixelFormat
const std::string avProfileTypeVideo
const std::string avProfileTypeFormat
const std::string avProfileWidth
const std::string avProfileHeight
const std::string avProfileCodec
const std::string avProfileSampleFormat
const std::string avProfileThreads
std::ostream & operator<<(std::ostream &flux, const InputFile &input)
Definition: InputFile.cpp:171
const std::string avProfileChannel
const std::string avProfileType