diff --git a/src/AvTranscoder/file/OutputFile.cpp b/src/AvTranscoder/file/OutputFile.cpp index 72042db5..8d292b95 100644 --- a/src/AvTranscoder/file/OutputFile.cpp +++ b/src/AvTranscoder/file/OutputFile.cpp @@ -16,7 +16,7 @@ OutputFile::OutputFile(const std::string& filename, const std::string& formatNam , _outputStreams() , _frameCount() , _previousProcessedStreamDuration(0.0) - , _profile() + , _profileOptions(NULL) { _formatContext.setFilename(filename); _formatContext.setOutputFormat(filename, formatName, mimeType); @@ -28,6 +28,7 @@ OutputFile::~OutputFile() { delete(*it); } + av_dict_free(&_profileOptions); } IOutputStream& OutputFile::addVideoStream(const VideoCodec& videoDesc) @@ -154,7 +155,7 @@ bool OutputFile::beginWrap() LOG_DEBUG("Begin wrap of OutputFile") _formatContext.openRessource(getFilename(), AVIO_FLAG_WRITE); - _formatContext.writeHeader(); + _formatContext.writeHeader(&_profileOptions); // set specific wrapping options setupRemainingWrappingOptions(); @@ -296,28 +297,32 @@ void OutputFile::setupWrappingOptions(const ProfileLoader::Profile& profile) catch(std::exception& e) { LOG_INFO("OutputFile - option " << (*it).first << " will be saved to be called when beginWrap") - _profile[(*it).first] = (*it).second; + av_dict_set(&_profileOptions, (*it).first.c_str(), (*it).second.c_str(), 0); } } } void OutputFile::setupRemainingWrappingOptions() { - // set format options - for(ProfileLoader::Profile::const_iterator it = _profile.begin(); it != _profile.end(); ++it) + // set specific format options + AVDictionaryEntry* optionEntry = NULL; + while((optionEntry = av_dict_get(_profileOptions, "", optionEntry, AV_DICT_IGNORE_SUFFIX))) { - if((*it).first == constants::avProfileIdentificator || (*it).first == constants::avProfileIdentificatorHuman || - (*it).first == constants::avProfileType || (*it).first == constants::avProfileFormat) + const std::string optionKey(optionEntry->key); + const std::string optionValue(optionEntry->value); + + if(optionKey == constants::avProfileIdentificator || optionKey == constants::avProfileIdentificatorHuman || + optionKey == constants::avProfileType || optionKey == constants::avProfileFormat) continue; try { - Option& formatOption = _formatContext.getOption((*it).first); - formatOption.setString((*it).second); + Option& formatOption = _formatContext.getOption(optionKey); + formatOption.setString(optionValue); } catch(std::exception& e) { - LOG_WARN("OutputFile - can't set option " << (*it).first << " to " << (*it).second << ": " << e.what()) + LOG_WARN("OutputFile - can't set option " << optionKey << " to " << optionValue << ": " << e.what()) } } } diff --git a/src/AvTranscoder/file/OutputFile.hpp b/src/AvTranscoder/file/OutputFile.hpp index f9e7731f..4a18e4c0 100644 --- a/src/AvTranscoder/file/OutputFile.hpp +++ b/src/AvTranscoder/file/OutputFile.hpp @@ -117,7 +117,7 @@ class AvExport OutputFile : public IOutputFile * @see setupWrapping * @see beginWrap */ - ProfileLoader::Profile _profile; + AVDictionary* _profileOptions; }; } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy