shithub: openh264

Download patch

ref: 0b23d0facb26abd65ff51d0b0ec0f00dab9a1423
parent: 0951c8fc0c1a2978e6fadd2b35ee5ba5b6f96f71
author: huili2 <huili2@cisco.com>
date: Tue Aug 26 21:21:29 EDT 2014

add decoder capability info

--- a/codec/api/svc/codec_api.h
+++ b/codec/api/svc/codec_api.h
@@ -188,6 +188,7 @@
 int  WelsCreateSVCEncoder (ISVCEncoder** ppEncoder);
 void WelsDestroySVCEncoder (ISVCEncoder* pEncoder);
 
+int WelsGetDecoderCapability (SDecoderCapability* pDecCapability);
 long WelsCreateDecoder (ISVCDecoder** ppDecoder);
 void WelsDestroyDecoder (ISVCDecoder* pDecoder);
 
--- a/codec/api/svc/codec_app_def.h
+++ b/codec/api/svc/codec_app_def.h
@@ -429,4 +429,17 @@
   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__
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -476,7 +476,24 @@
 
 
 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!! */
 
 /*
--- 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
--- a/test/api/decoder_test.cpp
+++ b/test/api/decoder_test.cpp
@@ -11,6 +11,27 @@
   }
 }
 
+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: