16
16
namespace avtranscoder
17
17
{
18
18
19
- const std::string Profile::avProfileIdentificator ( " avProfile" );
20
- const std::string Profile::avProfileIdentificatorHuman ( " avProfileLong" );
21
- const std::string Profile::avProfileType ( " avProfileType" );
22
- const std::string Profile::avProfileTypeFormat ( " avProfileTypeFormat" );
23
- const std::string Profile::avProfileTypeVideo ( " avProfileTypeVideo" );
24
- const std::string Profile::avProfileTypeAudio ( " avProfileTypeAudio" );
25
- const std::string Profile::avProfileFormat ( " format" );
26
- const std::string Profile::avProfileCodec ( " codec" );
27
- const std::string Profile::avProfilePixelFormat ( " pix_fmt" );
28
- const std::string Profile::avProfileSampleFormat ( " sample_fmt" );
29
- const std::string Profile::avProfileFrameRate ( " r" );
30
- const std::string Profile::avProfileSampleRate ( " ar" );
31
- const std::string Profile::avProfileChannel ( " ac" );
32
-
33
19
Profile::Profile ( bool autoload )
34
20
{
35
21
if ( autoload )
@@ -53,11 +39,11 @@ void Profile::loadProfile( const std::string& avProfileFile )
53
39
}
54
40
// check if profile contains required values
55
41
if (
56
- customProfile.count ( avProfileIdentificator ) &&
57
- customProfile.count ( avProfileIdentificatorHuman ) &&
58
- customProfile.count ( avProfileType ) &&
59
- ( customProfile.find ( avProfileType )->second == avProfileTypeVideo ||
60
- customProfile.find ( avProfileType )->second == avProfileTypeAudio )
42
+ customProfile.count ( constants:: avProfileIdentificator ) &&
43
+ customProfile.count ( constants:: avProfileIdentificatorHuman ) &&
44
+ customProfile.count ( constants:: avProfileType ) &&
45
+ ( customProfile.find ( constants:: avProfileType )->second == constants:: avProfileTypeVideo ||
46
+ customProfile.find ( constants:: avProfileType )->second == constants:: avProfileTypeAudio )
61
47
)
62
48
{
63
49
_profiles.push_back ( customProfile );
@@ -99,11 +85,11 @@ void Profile::loadProfiles( const std::string& avProfilesPath )
99
85
100
86
void Profile::update ( const ProfileDesc& profile )
101
87
{
102
- std::string profileId ( profile.find ( avProfileIdentificator )->second );
88
+ std::string profileId ( profile.find ( constants:: avProfileIdentificator )->second );
103
89
size_t profileIndex = 0 ;
104
90
for ( ProfilesDesc::iterator it = _profiles.begin (); it != _profiles.end (); ++it )
105
91
{
106
- if ( (*it).find ( avProfileIdentificator )->second == profileId )
92
+ if ( (*it).find ( constants:: avProfileIdentificator )->second == profileId )
107
93
{
108
94
_profiles.at ( profileIndex ) = profile;
109
95
return ;
@@ -125,7 +111,7 @@ Profile::ProfilesDesc Profile::getFormatProfiles()
125
111
126
112
for ( ProfilesDesc::iterator it = _profiles.begin (); it != _profiles.end (); ++it )
127
113
{
128
- if ( (*it).find ( avProfileType )->second == avProfileTypeFormat )
114
+ if ( (*it).find ( constants:: avProfileType )->second == constants:: avProfileTypeFormat )
129
115
profiles.push_back ( *it );
130
116
}
131
117
@@ -138,7 +124,7 @@ Profile::ProfilesDesc Profile::getVideoProfiles()
138
124
139
125
for ( ProfilesDesc::iterator it = _profiles.begin (); it != _profiles.end (); ++it )
140
126
{
141
- if ( (*it).find ( avProfileType )->second == avProfileTypeVideo )
127
+ if ( (*it).find ( constants:: avProfileType )->second == constants:: avProfileTypeVideo )
142
128
profiles.push_back ( *it );
143
129
}
144
130
@@ -151,7 +137,7 @@ Profile::ProfilesDesc Profile::getAudioProfiles()
151
137
152
138
for ( ProfilesDesc::iterator it = _profiles.begin (); it != _profiles.end (); ++it )
153
139
{
154
- if ( (*it).find ( avProfileType )->second == avProfileTypeAudio )
140
+ if ( (*it).find ( constants:: avProfileType )->second == constants:: avProfileTypeAudio )
155
141
profiles.push_back ( *it );
156
142
}
157
143
@@ -162,26 +148,12 @@ Profile::ProfileDesc& Profile::getProfile( const std::string& searchProfile )
162
148
{
163
149
for ( ProfilesDesc::iterator it = _profiles.begin (); it != _profiles.end (); ++it )
164
150
{
165
- if ( (*it).find ( avProfileIdentificator )->second == searchProfile )
151
+ if ( (*it).find ( constants:: avProfileIdentificator )->second == searchProfile )
166
152
{
167
153
return (*it);
168
154
}
169
155
}
170
156
throw std::runtime_error ( " unable to find profile: " + searchProfile );
171
157
}
172
158
173
- const std::string & Profile::getAvProfileIdentificatorKey () { return avProfileIdentificator; };
174
- const std::string & Profile::getAvProfileIdentificatorHumanKey () { return avProfileIdentificatorHuman; };
175
- const std::string & Profile::getAvProfileTypeKey () { return avProfileType; };
176
- const std::string & Profile::getAvProfileTypeFormatKey () { return avProfileTypeFormat; };
177
- const std::string & Profile::getAvProfileTypeVideoKey () { return avProfileTypeVideo; };
178
- const std::string & Profile::getAvProfileTypeAudioKey () { return avProfileTypeAudio; };
179
- const std::string & Profile::getAvProfileFormatKey () { return avProfileFormat; };
180
- const std::string & Profile::getAvProfileCodecKey () { return avProfileCodec; };
181
- const std::string & Profile::getAvProfilePixelFormatKey () { return avProfilePixelFormat; };
182
- const std::string & Profile::getAvProfileSampleFormatKey () { return avProfileSampleFormat; };
183
- const std::string & Profile::getAvProfileFrameRateKey () { return avProfileFrameRate; };
184
- const std::string & Profile::getAvProfileSampleRateKey () { return avProfileSampleRate; };
185
- const std::string & Profile::getAvProfileChannelKey () { return avProfileChannel; };
186
-
187
159
}
0 commit comments