shithub: openh264

Download patch

ref: 413b301e9c048413f59a127414d3453cef26e83b
parent: 2243467c1b9a15ccb8ea8b84c716518aa467053d
parent: 1075338b9b9c201e5b9a8a73870d68b37de02462
author: Ethan Hugg <[email protected]>
date: Tue Feb 18 06:27:38 EST 2014

Merge pull request #303 from mstorsjo/simplify-decoder-api

Simplify the Initialize decoder method

--- a/codec/api/svc/codec_api.h
+++ b/codec/api/svc/codec_api.h
@@ -94,7 +94,7 @@
 
 class ISVCDecoder {
  public:
-  virtual long EXTAPI Initialize (void* pParam, const INIT_TYPE iInitType) = 0;
+  virtual long EXTAPI Initialize (const SDecodingParam* pParam) = 0;
   virtual long EXTAPI Uninitialize() = 0;
 
   virtual DECODING_STATE EXTAPI DecodeFrame (const unsigned char* pSrc,
@@ -162,7 +162,7 @@
 typedef struct ISVCDecoderVtbl ISVCDecoderVtbl;
 typedef const ISVCDecoderVtbl* ISVCDecoder;
 struct ISVCDecoderVtbl {
-  long (*Initialize) (ISVCDecoder*, void* pParam, const INIT_TYPE iInitType);
+  long (*Initialize) (ISVCDecoder*, const SDecodingParam* pParam);
   long (*Uninitialize) (ISVCDecoder*);
 
   DECODING_STATE (*DecodeFrame) (ISVCDecoder*, const unsigned char* pSrc,
--- a/codec/console/dec/src/h264dec.cpp
+++ b/codec/console/dec/src/h264dec.cpp
@@ -406,7 +406,7 @@
     return 1;
   }
 
-  if (pDecoder->Initialize (&sDecParam, INIT_TYPE_PARAMETER_BASED)) {
+  if (pDecoder->Initialize (&sDecParam)) {
     printf ("Decoder initialization failed.\n");
     return 1;
   }
--- a/codec/decoder/core/inc/decoder.h
+++ b/codec/decoder/core/inc/decoder.h
@@ -52,7 +52,7 @@
 /*!
  * \brief	configure decoder parameters
  */
-int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const void* kpParam);
+int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpParam);
 
 /*!
  *************************************************************************************
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -350,7 +350,7 @@
 /*!
  * \brief	configure decoder parameters
  */
-int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const void* kpParam) {
+int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpParam) {
   if (NULL == pCtx || NULL == kpParam)
     return 1;
 
--- a/codec/decoder/plus/inc/welsDecoderExt.h
+++ b/codec/decoder/plus/inc/welsDecoderExt.h
@@ -59,7 +59,7 @@
 CWelsDecoder (void);
 virtual ~CWelsDecoder();
 
-virtual long EXTAPI Initialize (void* pParam, const INIT_TYPE keInitType);
+virtual long EXTAPI Initialize (const SDecodingParam* pParam);
 virtual long EXTAPI Uninitialize();
 
 /***************************************************************************
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -186,8 +186,8 @@
   }
 }
 
-long CWelsDecoder::Initialize (void* pParam, const INIT_TYPE keInitType) {
-  if (pParam == NULL || keInitType != INIT_TYPE_PARAMETER_BASED) {
+long CWelsDecoder::Initialize (const SDecodingParam* pParam) {
+  if (pParam == NULL) {
     IWelsTrace::WelsVTrace (m_pTrace, IWelsTrace::WELS_LOG_INFO, "CWelsDecoder::Initialize(), invalid input argument.");
     return cmInitParaError;
   }
--- a/test/BaseDecoderTest.cpp
+++ b/test/BaseDecoderTest.cpp
@@ -58,7 +58,7 @@
   decParam.uiEcActiveFlag  = 1;
   decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
 
-  rv = decoder_->Initialize(&decParam, INIT_TYPE_PARAMETER_BASED);
+  rv = decoder_->Initialize(&decParam);
   ASSERT_EQ(0, rv);
 }
 
--- a/test/cpp_interface_test.cpp
+++ b/test/cpp_interface_test.cpp
@@ -70,7 +70,7 @@
 
 struct SVCDecoderImpl : public ISVCDecoder {
   virtual ~SVCDecoderImpl() {}
-  virtual long EXTAPI Initialize(void* pParam, const INIT_TYPE iInitType) {
+  virtual long EXTAPI Initialize(const SDecodingParam* pParam) {
     EXPECT_TRUE(gThis == this);
     return 1;
   }