Skip to content

Commit e891d86

Browse files
author
Clement Champetier
committed
InputFile: add setProfile
Can set a profile of the input (a format profile).
1 parent 08b9498 commit e891d86

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/AvTranscoder/File/InputFile.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,26 @@ bool InputFile::getReadStream( const size_t streamIndex )
211211
return _inputStreams.at( streamIndex )->getBufferred();
212212
}
213213

214+
void InputFile::setProfile( const Profile::ProfileDesc& desc )
215+
{
216+
ParamSet paramSet( _formatContext );
217+
218+
for( Profile::ProfileDesc::const_iterator it = desc.begin(); it != desc.end(); ++it )
219+
{
220+
if( (*it).first == Profile::avProfileIdentificator ||
221+
(*it).first == Profile::avProfileIdentificatorHuman ||
222+
(*it).first == Profile::avProfileType )
223+
continue;
224+
225+
try
226+
{
227+
paramSet.set( (*it).first, (*it).second );
228+
}
229+
catch( std::exception& e )
230+
{
231+
std::cout << "InputFile warning: " << e.what() << std::endl;
232+
}
233+
}
234+
}
235+
214236
}

src/AvTranscoder/File/InputFile.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <AvTranscoder/Metadatas/MediaMetadatasStructures.hpp>
1313
#include <AvTranscoder/ProgressListener.hpp>
1414

15+
#include <AvTranscoder/Profile.hpp>
16+
1517
#include <string>
1618
#include <vector>
1719

@@ -114,6 +116,12 @@ class AvExport InputFile
114116
* @return the reading status of the streamIndex
115117
**/
116118
bool getReadStream( const size_t streamIndex );
119+
120+
/**
121+
* @brief Set the format of the input file
122+
* @param desc: the profile of the input format
123+
*/
124+
virtual void setProfile( const Profile::ProfileDesc& desc );
117125

118126
protected:
119127
AVFormatContext* _formatContext;

0 commit comments

Comments
 (0)