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

Commit845e2a4

Browse files
author
Valentin Noel
committed
OutputFile: replace the profile attribute by a AVDictionary pointer
In order to set the format specific options on the file header writing step.
1 parent858cc2f commit845e2a4

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

‎src/AvTranscoder/file/OutputFile.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ OutputFile::OutputFile(const std::string& filename, const std::string& formatNam
1616
, _outputStreams()
1717
, _frameCount()
1818
, _previousProcessedStreamDuration(0.0)
19-
,_profile()
19+
,_profileOptions(NULL)
2020
{
2121
_formatContext.setFilename(filename);
2222
_formatContext.setOutputFormat(filename, formatName, mimeType);
@@ -28,6 +28,7 @@ OutputFile::~OutputFile()
2828
{
2929
delete(*it);
3030
}
31+
av_dict_free(&_profileOptions);
3132
}
3233

3334
IOutputStream&OutputFile::addVideoStream(const VideoCodec& videoDesc)
@@ -154,7 +155,7 @@ bool OutputFile::beginWrap()
154155
LOG_DEBUG("Begin wrap of OutputFile")
155156

156157
_formatContext.openRessource(getFilename(), AVIO_FLAG_WRITE);
157-
_formatContext.writeHeader();
158+
_formatContext.writeHeader(&_profileOptions);
158159

159160
// set specific wrapping options
160161
setupRemainingWrappingOptions();
@@ -296,28 +297,32 @@ void OutputFile::setupWrappingOptions(const ProfileLoader::Profile& profile)
296297
catch(std::exception& e)
297298
{
298299
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);
300301
}
301302
}
302303
}
303304

304305
voidOutputFile::setupRemainingWrappingOptions()
305306
{
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)))
308310
{
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)
311316
continue;
312317

313318
try
314319
{
315-
Option& formatOption = _formatContext.getOption((*it).first);
316-
formatOption.setString((*it).second);
320+
Option& formatOption = _formatContext.getOption(optionKey);
321+
formatOption.setString(optionValue);
317322
}
318323
catch(std::exception& e)
319324
{
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())
321326
}
322327
}
323328
}

‎src/AvTranscoder/file/OutputFile.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class AvExport OutputFile : public IOutputFile
117117
* @see setupWrapping
118118
* @see beginWrap
119119
*/
120-
ProfileLoader::Profile _profile;
120+
AVDictionary* _profileOptions;
121121
};
122122
}
123123

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp