Skip to content

Commit 1c1b180

Browse files
author
Clement Champetier
committed
OutputFile: add setProfile
Can set a profile of the output (a format profile).
1 parent 798100e commit 1c1b180

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

src/AvTranscoder/File/OutputFile.cpp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,46 @@ bool OutputFile::endWrap( )
183183
return true;
184184
}
185185

186+
187+
void OutputFile::setProfile( const Profile::ProfileDesc& desc )
188+
{
189+
ParamSet paramSet( _formatContext );
190+
191+
for( Profile::ProfileDesc::const_iterator it = desc.begin(); it != desc.end(); ++it )
192+
{
193+
if( (*it).first == Profile::avProfileIdentificator ||
194+
(*it).first == Profile::avProfileIdentificatorHuman ||
195+
(*it).first == Profile::avProfileType )
196+
continue;
197+
198+
try
199+
{
200+
paramSet.set( (*it).first, (*it).second );
201+
}
202+
catch( std::exception& e )
203+
{
204+
std::cout << "OutputFile warning: " << e.what() << std::endl;
205+
}
206+
}
207+
208+
setup();
209+
210+
for( Profile::ProfileDesc::const_iterator it = desc.begin(); it != desc.end(); ++it )
211+
{
212+
if( (*it).first == Profile::avProfileIdentificator ||
213+
(*it).first == Profile::avProfileIdentificatorHuman ||
214+
(*it).first == Profile::avProfileType )
215+
continue;
216+
217+
try
218+
{
219+
paramSet.set( (*it).first, (*it).second );
220+
}
221+
catch( std::exception& e )
222+
{
223+
std::cout << "OutputFile 2.warning: " << e.what() << std::endl;
224+
}
225+
}
226+
}
227+
186228
}

src/AvTranscoder/File/OutputFile.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
#include <AvTranscoder/CodedStream/AvOutputStream.hpp>
1111

12+
#include <AvTranscoder/Profile.hpp>
13+
1214
#include <string>
1315
#include <vector>
1416

@@ -82,6 +84,12 @@ class AvExport OutputFile
8284
* @note this method write the footer of file if necessary
8385
**/
8486
virtual bool endWrap( );
87+
88+
/**
89+
* @brief Set the format of the output file
90+
* @param desc: the profile of the output format
91+
*/
92+
virtual void setProfile( const Profile::ProfileDesc& desc );
8593

8694
private:
8795
std::vector<AvOutputStream*> _outputStreams;

0 commit comments

Comments
 (0)