ref: 1a32ae71208a936765459e587af150c0a7aa7168
parent: 5cb85183067fd94b827f506b92a88915f3366567
author: Martin Storsjö <[email protected]>
date: Tue Feb 18 06:04:29 EST 2014
Simplify the CWelsH264SVCEncoder::Initialize2 method Remove the useless iInitType parameter, make the method private within CWelsH264SVCEncoder class, give the pointer parameter the correct type, avoiding needless casting.
--- a/codec/encoder/plus/inc/welsEncoderExt.h
+++ b/codec/encoder/plus/inc/welsEncoderExt.h
@@ -67,7 +67,6 @@
* return: CM_RETURN: 0 - success; otherwise - failed;
*/
virtual int EXTAPI Initialize (SEncParamBase* argv, const INIT_TYPE init_type);
- virtual int EXTAPI Initialize2 (void* argv, const INIT_TYPE init_type);
virtual int EXTAPI Uninitialize();
@@ -102,6 +101,8 @@
virtual int EXTAPI GetOption (ENCODER_OPTION opt_id, void* option);
private:
+ int Initialize2 (SWelsSvcCodingParam* argv);
+
sWelsEncCtx* m_pEncContext;
welsCodecTrace* m_pWelsTrace;
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -282,13 +282,13 @@
#endif//REC_FRAME_COUNT
m_iSrcListSize = 1;
- return Initialize2 ((void*)&sConfig, INIT_TYPE_PARAMETER_BASED);
+ return Initialize2 (&sConfig);
}
-int CWelsH264SVCEncoder::Initialize2 (void* argv, const INIT_TYPE iInitType) {
- if (INIT_TYPE_PARAMETER_BASED != iInitType || NULL == argv) {
- WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), invalid iInitType= %d, argv= 0x%p.\n",
- iInitType, (void*)argv);
+int CWelsH264SVCEncoder::Initialize2 (SWelsSvcCodingParam* pCfg) {
+ if (NULL == pCfg) {
+ WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), invalid argv= 0x%p.\n",
+ pCfg);
return cmInitParaError;
}
@@ -297,8 +297,6 @@
m_bInitialFlag);
Uninitialize();
}
-
- SWelsSvcCodingParam* pCfg = static_cast<SWelsSvcCodingParam*> (argv);
const int32_t iColorspace = pCfg->iInputCsp;
if (0 == iColorspace) {