@@ -16,7 +16,7 @@ OutputFile::OutputFile(const std::string& filename, const std::string& formatNam
16
16
, _outputStreams()
17
17
, _frameCount()
18
18
, _previousProcessedStreamDuration(0.0 )
19
- ,_profile( )
19
+ ,_profileOptions( NULL )
20
20
{
21
21
_formatContext.setFilename (filename);
22
22
_formatContext.setOutputFormat (filename, formatName, mimeType);
@@ -28,6 +28,7 @@ OutputFile::~OutputFile()
28
28
{
29
29
delete (*it);
30
30
}
31
+ av_dict_free (&_profileOptions);
31
32
}
32
33
33
34
IOutputStream&OutputFile::addVideoStream (const VideoCodec& videoDesc)
@@ -154,7 +155,7 @@ bool OutputFile::beginWrap()
154
155
LOG_DEBUG (" Begin wrap of OutputFile" )
155
156
156
157
_formatContext.openRessource (getFilename (), AVIO_FLAG_WRITE);
157
- _formatContext.writeHeader ();
158
+ _formatContext.writeHeader (&_profileOptions );
158
159
159
160
// set specific wrapping options
160
161
setupRemainingWrappingOptions ();
@@ -296,28 +297,32 @@ void OutputFile::setupWrappingOptions(const ProfileLoader::Profile& profile)
296
297
catch (std::exception& e)
297
298
{
298
299
LOG_INFO (" OutputFile - option" << (*it).first <<" will be saved to be called when beginWrap" )
299
- _profile[( *it).first ] = (*it).second ;
300
+ av_dict_set (&_profileOptions, ( *it).first . c_str (), (*it).second . c_str (), 0 ) ;
300
301
}
301
302
}
302
303
}
303
304
304
305
void OutputFile::setupRemainingWrappingOptions ()
305
306
{
306
- // set format options
307
- for (ProfileLoader::Profile::const_iterator it = _profile.begin (); it != _profile.end (); ++it)
307
+ // set specific format options
308
+ AVDictionaryEntry* optionEntry =NULL ;
309
+ while ((optionEntry =av_dict_get (_profileOptions," " , optionEntry, AV_DICT_IGNORE_SUFFIX)))
308
310
{
309
- if ((*it).first == constants::avProfileIdentificator || (*it).first == constants::avProfileIdentificatorHuman ||
310
- (*it).first == constants::avProfileType || (*it).first == constants::avProfileFormat)
311
+ const std::stringoptionKey (optionEntry->key );
312
+ const std::stringoptionValue (optionEntry->value );
313
+
314
+ if (optionKey == constants::avProfileIdentificator || optionKey == constants::avProfileIdentificatorHuman ||
315
+ optionKey == constants::avProfileType || optionKey == constants::avProfileFormat)
311
316
continue ;
312
317
313
318
try
314
319
{
315
- Option& formatOption = _formatContext.getOption ((*it). first );
316
- formatOption.setString ((*it). second );
320
+ Option& formatOption = _formatContext.getOption (optionKey );
321
+ formatOption.setString (optionValue );
317
322
}
318
323
catch (std::exception& e)
319
324
{
320
- LOG_WARN (" OutputFile - can't set option" <<(*it). first <<" to" <<(*it). second <<" :" << e.what ())
325
+ LOG_WARN (" OutputFile - can't set option" <<optionKey <<" to" <<optionValue <<" :" << e.what ())
321
326
}
322
327
}
323
328
}