Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

The format specific options are passed as arguments to the file header writing function#300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletionssrc/AvTranscoder/file/OutputFile.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand All@@ -28,6 +28,7 @@ OutputFile::~OutputFile()
{
delete(*it);
}
av_dict_free(&_profileOptions);
}

IOutputStream& OutputFile::addVideoStream(const VideoCodec& videoDesc)
Expand DownExpand Up@@ -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();
Expand DownExpand Up@@ -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())
}
}
}
Expand Down
2 changes: 1 addition & 1 deletionsrc/AvTranscoder/file/OutputFile.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -117,7 +117,7 @@ class AvExport OutputFile : public IOutputFile
* @see setupWrapping
* @see beginWrap
*/
ProfileLoader::Profile _profile;
AVDictionary* _profileOptions;
};
}

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp