File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -161,4 +161,29 @@ bool AudioDecoder::decodeNextFrame()
161
161
return true ;
162
162
}
163
163
164
+ void AudioDecoder::setProfile ( const ProfileLoader::Profile& profile )
165
+ {
166
+ // set threads if not in profile
167
+ if ( ! profile.count ( " threads" ) )
168
+ _inputStream->getAudioCodec ().getOption ( " threads" ).setString ( " auto" );
169
+
170
+ for ( ProfileLoader::Profile::const_iterator it = profile.begin (); it != profile.end (); ++it )
171
+ {
172
+ if ( (*it).first == constants::avProfileIdentificator ||
173
+ (*it).first == constants::avProfileIdentificatorHuman ||
174
+ (*it).first == constants::avProfileType )
175
+ continue ;
176
+
177
+ try
178
+ {
179
+ Option& decodeOption = _inputStream->getAudioCodec ().getOption ( (*it).first );
180
+ decodeOption.setString ( (*it).second );
181
+ }
182
+ catch ( std::exception& e )
183
+ {
184
+ std::cout << " [AudioDecoder] warning - can't set option " << (*it).first << " to " << (*it).second << " : " << e.what () << std::endl;
185
+ }
186
+ }
187
+ }
188
+
164
189
}
Original file line number Diff line number Diff line change 2
2
#define _AV_TRANSCODER_ESSENCE_STREAM_AV_INPUT_AUDIO_HPP_
3
3
4
4
#include " IDecoder.hpp"
5
+ #include < AvTranscoder/ProfileLoader.hpp>
5
6
6
7
struct AVFrame ;
7
8
@@ -21,6 +22,8 @@ class AvExport AudioDecoder : public IDecoder
21
22
bool decodeNextFrame ( Frame& frameBuffer );
22
23
bool decodeNextFrame ( Frame& frameBuffer, const size_t subStreamIndex );
23
24
25
+ void setProfile ( const ProfileLoader::Profile& profile );
26
+
24
27
private:
25
28
bool decodeNextFrame ();
26
29
Original file line number Diff line number Diff line change @@ -119,6 +119,10 @@ void VideoDecoder::flushDecoder()
119
119
120
120
void VideoDecoder::setProfile ( const ProfileLoader::Profile& profile )
121
121
{
122
+ // set threads if not in profile
123
+ if ( ! profile.count ( " threads" ) )
124
+ _inputStream->getVideoCodec ().getOption ( " threads" ).setString ( " auto" );
125
+
122
126
for ( ProfileLoader::Profile::const_iterator it = profile.begin (); it != profile.end (); ++it )
123
127
{
124
128
if ( (*it).first == constants::avProfileIdentificator ||
You can’t perform that action at this time.
0 commit comments