shithub: openh264

Download patch

ref: 67b5a79c2e52c89c34ea5b82f5cfd6f62a51c941
parent: 9b9713878633a27f04225d3cbc8898d20e7b3f0e
parent: 0b23d0facb26abd65ff51d0b0ec0f00dab9a1423
author: dongzha <[email protected]>
date: Thu Aug 28 06:47:12 EDT 2014

Merge pull request #1313 from huili2/SDP_support

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: