diff --git a/codec/api/svc/codec_api.h b/codec/api/svc/codec_api.h index 0ee0adae..5e2ce64c 100644 --- a/codec/api/svc/codec_api.h +++ b/codec/api/svc/codec_api.h @@ -188,6 +188,7 @@ typedef void (*WelsTraceCallback) (void* ctx, int level, const char* string); int WelsCreateSVCEncoder (ISVCEncoder** ppEncoder); void WelsDestroySVCEncoder (ISVCEncoder* pEncoder); +int WelsGetDecoderCapability (SDecoderCapability* pDecCapability); long WelsCreateDecoder (ISVCDecoder** ppDecoder); void WelsDestroyDecoder (ISVCDecoder* pDecoder); diff --git a/codec/api/svc/codec_app_def.h b/codec/api/svc/codec_app_def.h index a0fe87f8..fb04b909 100644 --- a/codec/api/svc/codec_app_def.h +++ b/codec/api/svc/codec_app_def.h @@ -429,4 +429,17 @@ typedef struct TagDeliveryStatus { int iDropFrameType; // the frame type that is dropped int iDropFrameSize; // the frame size that is dropped } SDeliveryStatus; + +typedef struct TagDecoderCapability { + int iProfileIdc; + int iProfileIop; + int iLevelIdc; + int iMaxMbps; + int iMaxFs; + int iMaxCpb; + int iMaxDpb; + int iMaxBr; + bool bRedPicCap; +} SDecoderCapability; + #endif//WELS_VIDEO_CODEC_APPLICATION_DEFINITION_H__ diff --git a/codec/decoder/plus/src/welsDecoderExt.cpp b/codec/decoder/plus/src/welsDecoderExt.cpp index 1a327616..0b08bf4c 100644 --- a/codec/decoder/plus/src/welsDecoderExt.cpp +++ b/codec/decoder/plus/src/welsDecoderExt.cpp @@ -476,7 +476,24 @@ DECODING_STATE CWelsDecoder::DecodeFrameEx (const unsigned char* kpSrc, using namespace WelsDec; +/* +* WelsGetDecoderCapability +* @return: DecCapability information +*/ +int WelsGetDecoderCapability(SDecoderCapability* pDecCapability) { + memset (pDecCapability, 0, sizeof (SDecoderCapability)); + pDecCapability->iProfileIdc = 66; //Baseline + pDecCapability->iProfileIop = 0xE0; //11100000b + pDecCapability->iLevelIdc = 32; //level_idc = 3.2 + pDecCapability->iMaxMbps = 216000; //from level_idc = 3.2 + pDecCapability->iMaxFs = 5120; //from level_idc = 3.2 + pDecCapability->iMaxCpb = 20000; //from level_idc = 3.2 + pDecCapability->iMaxDpb = 20480; //from level_idc = 3.2 + pDecCapability->iMaxBr = 20000; //from level_idc = 3.2 + pDecCapability->bRedPicCap = 0; //not support redundant pic + return ERR_NONE; +} /* WINAPI is indeed in prefix due to sync to application layer callings!! */ /* diff --git a/codec/decoder/plus/src/wels_dec_export.def b/codec/decoder/plus/src/wels_dec_export.def index 4944aec8..29a37e3e 100644 --- a/codec/decoder/plus/src/wels_dec_export.def +++ b/codec/decoder/plus/src/wels_dec_export.def @@ -1,3 +1,4 @@ EXPORTS + WelsGetDecoderCapability WelsCreateDecoder - WelsDestroyDecoder \ No newline at end of file + WelsDestroyDecoder diff --git a/test/api/decoder_test.cpp b/test/api/decoder_test.cpp index 3d64b420..9ed8596f 100644 --- a/test/api/decoder_test.cpp +++ b/test/api/decoder_test.cpp @@ -11,6 +11,27 @@ static void UpdateHashFromPlane (SHA1Context* ctx, const uint8_t* plane, } } +class DecoderCapabilityTest : public ::testing::Test { + public: + virtual void SetUp() {} + virtual void TearDown() {} +}; + +TEST_F (DecoderCapabilityTest, JustInit) { + SDecoderCapability sDecCap; + int iRet = WelsGetDecoderCapability (&sDecCap); + ASSERT_TRUE (iRet == 0); + EXPECT_EQ (sDecCap.iProfileIdc, 66); + EXPECT_EQ (sDecCap.iProfileIop, 0xE0); + EXPECT_EQ (sDecCap.iLevelIdc, 32); + EXPECT_EQ (sDecCap.iMaxMbps, 216000); + EXPECT_EQ (sDecCap.iMaxFs, 5120); + EXPECT_EQ (sDecCap.iMaxCpb, 20000); + EXPECT_EQ (sDecCap.iMaxDpb, 20480); + EXPECT_EQ (sDecCap.iMaxBr, 20000); + EXPECT_EQ (sDecCap.bRedPicCap, 0); +} + class DecoderInitTest : public ::testing::Test, public BaseDecoderTest { public: