Skip to content

Commit aa7c90b

Browse files
author
Clement Champetier
committed
InputVideo: add setProfile
Can set the profile of an InputStream.
1 parent fa914bb commit aa7c90b

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/AvTranscoder/EssenceStream/InputVideo.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ extern "C" {
1414
#include <AvTranscoder/EssenceStructures/VideoFrame.hpp>
1515

1616
#include <stdexcept>
17+
#include <iostream>
1718

1819
namespace avtranscoder
1920
{
@@ -146,4 +147,26 @@ void InputVideo::flushDecoder()
146147
avcodec_flush_buffers( _codecContext );
147148
}
148149

150+
void InputVideo::setProfile( const Profile::ProfileDesc& desc )
151+
{
152+
VideoDesc videoDesc = CodedDesc( *_codec, *_codecContext );
153+
154+
for( Profile::ProfileDesc::const_iterator it = desc.begin(); it != desc.end(); ++it )
155+
{
156+
if( (*it).first == Profile::avProfileIdentificator ||
157+
(*it).first == Profile::avProfileIdentificatorHuman ||
158+
(*it).first == Profile::avProfileType )
159+
continue;
160+
161+
try
162+
{
163+
videoDesc.set( (*it).first, (*it).second );
164+
}
165+
catch( std::exception& e )
166+
{
167+
std::cout << "warning: " << e.what() << std::endl;
168+
}
169+
}
170+
}
171+
149172
}

src/AvTranscoder/EssenceStream/InputVideo.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include "InputEssence.hpp"
55

6+
#include <AvTranscoder/Profile.hpp>
7+
68
class AVCodec;
79
class AVCodecContext;
810
class AVFrame;
@@ -24,7 +26,9 @@ class AvExport InputVideo : public InputEssence
2426
bool readNextFrame( Frame& frameBuffer, const size_t subStreamIndex );
2527

2628
void flushDecoder();
27-
29+
30+
void setProfile( const Profile::ProfileDesc& desc );
31+
2832
private:
2933
AvInputStream* _inputStream;
3034
AVCodec* _codec;

0 commit comments

Comments
 (0)