Skip to content

Commit e3ce42d

Browse files
author
Clement Champetier
committed
OutputAudio: completely set profile
* Completely set the profile of the audioDesc, by using all key of the ProfileDesc. * Like the videoDesc, set parameters twice (before and after a setup), to set the parameters which need a setup.
1 parent c4bf09d commit e3ce42d

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/AvTranscoder/EssenceStream/OutputAudio.cpp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,50 @@ void OutputAudio::setProfile( Profile::ProfileDesc& desc, const AudioFrameDesc&
195195
size_t channels = std::strtoul( desc[ Profile::avProfileChannel ].c_str(), NULL, 0 );
196196

197197
_audioDesc.setAudioParameters( sample_rate, channels, av_get_sample_fmt( desc[ Profile::avProfileSampleFormat ].c_str() ) );
198+
199+
for( Profile::ProfileDesc::iterator it = desc.begin(); it != desc.end(); ++it )
200+
{
201+
if( (*it).first == Profile::avProfileIdentificator ||
202+
(*it).first == Profile::avProfileIdentificatorHuman ||
203+
(*it).first == Profile::avProfileType ||
204+
(*it).first == Profile::avProfileCodec ||
205+
(*it).first == Profile::avProfileSampleFormat ||
206+
(*it).first == Profile::avProfileSampleRate ||
207+
(*it).first == Profile::avProfileChannel )
208+
continue;
209+
210+
try
211+
{
212+
_audioDesc.set( (*it).first, (*it).second );
213+
}
214+
catch( std::exception& e )
215+
{
216+
std::cout << "warning: " << e.what() << std::endl;
217+
}
218+
}
198219

199220
setup();
221+
222+
for( Profile::ProfileDesc::iterator it = desc.begin(); it != desc.end(); ++it )
223+
{
224+
if( (*it).first == Profile::avProfileIdentificator ||
225+
(*it).first == Profile::avProfileIdentificatorHuman ||
226+
(*it).first == Profile::avProfileType ||
227+
(*it).first == Profile::avProfileCodec ||
228+
(*it).first == Profile::avProfileSampleFormat ||
229+
(*it).first == Profile::avProfileSampleRate ||
230+
(*it).first == Profile::avProfileChannel )
231+
continue;
232+
233+
try
234+
{
235+
_audioDesc.set( (*it).first, (*it).second );
236+
}
237+
catch( std::exception& e )
238+
{
239+
std::cout << "2.warning: " << e.what() << std::endl;
240+
}
241+
}
200242
}
201243

202244
}

0 commit comments

Comments
 (0)