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.
This commit is contained in:
@@ -67,7 +67,6 @@ class CWelsH264SVCEncoder : public ISVCEncoder {
|
||||
* 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 @@ class CWelsH264SVCEncoder : public ISVCEncoder {
|
||||
virtual int EXTAPI GetOption (ENCODER_OPTION opt_id, void* option);
|
||||
|
||||
private:
|
||||
int Initialize2 (SWelsSvcCodingParam* argv);
|
||||
|
||||
sWelsEncCtx* m_pEncContext;
|
||||
|
||||
welsCodecTrace* m_pWelsTrace;
|
||||
|
||||
@@ -282,13 +282,13 @@ int CWelsH264SVCEncoder::Initialize (SEncParamBase* argv, const INIT_TYPE iInitT
|
||||
#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;
|
||||
}
|
||||
|
||||
@@ -298,8 +298,6 @@ int CWelsH264SVCEncoder::Initialize2 (void* argv, const INIT_TYPE iInitType) {
|
||||
Uninitialize();
|
||||
}
|
||||
|
||||
SWelsSvcCodingParam* pCfg = static_cast<SWelsSvcCodingParam*> (argv);
|
||||
|
||||
const int32_t iColorspace = pCfg->iInputCsp;
|
||||
if (0 == iColorspace) {
|
||||
WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), invalid iInputCsp= %d.\n", iColorspace);
|
||||
|
||||
Reference in New Issue
Block a user