Skip to content

Commit 3154895

Browse files
author
Clement Champetier
committed
ICodec: add _type attribute
* Access by getCodecType. * Type could be encoder or decoder.
1 parent a3b2269 commit 3154895

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/AvTranscoder/codec/ICodec.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace avtranscoder {
1313
ICodec::ICodec( const ECodecType type, const std::string& codecName )
1414
: _codec( NULL )
1515
, _codecContext( NULL )
16+
, _type( type )
1617
{
1718
if( codecName.size() )
1819
{
@@ -23,6 +24,7 @@ ICodec::ICodec( const ECodecType type, const std::string& codecName )
2324
ICodec::ICodec( const ECodecType type, const AVCodecID codecId )
2425
: _codec( NULL )
2526
, _codecContext( NULL )
27+
, _type( type )
2628
{
2729
setCodec( type, codecId );
2830
}

src/AvTranscoder/codec/ICodec.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ class AvExport ICodec
2424
ICodec( const ECodecType type, const AVCodecID codecId );
2525

2626
virtual ~ICodec() = 0;
27-
28-
std::string getCodecName() const;
29-
AVCodecID getCodecId() const;
30-
31-
int getLatency() const;
27+
28+
std::string getCodecName() const;
29+
AVCodecID getCodecId() const;
30+
ECodecType getCodecType() const { return _type; }
31+
int getLatency() const;
3232

3333
void setCodec( const ECodecType type, const std::string& codecName );
3434
void setCodec( const ECodecType type, const AVCodecID codecId );
@@ -41,6 +41,8 @@ class AvExport ICodec
4141
protected:
4242
AVCodec* _codec; ///< Codec abstract description
4343
AVCodecContext* _codecContext; ///< Full codec instance description
44+
45+
ECodecType _type;
4446
};
4547

4648
}

0 commit comments

Comments
 (0)