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;
|
* return: CM_RETURN: 0 - success; otherwise - failed;
|
||||||
*/
|
*/
|
||||||
virtual int EXTAPI Initialize (SEncParamBase* argv, const INIT_TYPE init_type);
|
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();
|
virtual int EXTAPI Uninitialize();
|
||||||
|
|
||||||
@@ -102,6 +101,8 @@ class CWelsH264SVCEncoder : public ISVCEncoder {
|
|||||||
virtual int EXTAPI GetOption (ENCODER_OPTION opt_id, void* option);
|
virtual int EXTAPI GetOption (ENCODER_OPTION opt_id, void* option);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int Initialize2 (SWelsSvcCodingParam* argv);
|
||||||
|
|
||||||
sWelsEncCtx* m_pEncContext;
|
sWelsEncCtx* m_pEncContext;
|
||||||
|
|
||||||
welsCodecTrace* m_pWelsTrace;
|
welsCodecTrace* m_pWelsTrace;
|
||||||
|
|||||||
@@ -282,13 +282,13 @@ int CWelsH264SVCEncoder::Initialize (SEncParamBase* argv, const INIT_TYPE iInitT
|
|||||||
#endif//REC_FRAME_COUNT
|
#endif//REC_FRAME_COUNT
|
||||||
m_iSrcListSize = 1;
|
m_iSrcListSize = 1;
|
||||||
|
|
||||||
return Initialize2 ((void*)&sConfig, INIT_TYPE_PARAMETER_BASED);
|
return Initialize2 (&sConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CWelsH264SVCEncoder::Initialize2 (void* argv, const INIT_TYPE iInitType) {
|
int CWelsH264SVCEncoder::Initialize2 (SWelsSvcCodingParam* pCfg) {
|
||||||
if (INIT_TYPE_PARAMETER_BASED != iInitType || NULL == argv) {
|
if (NULL == pCfg) {
|
||||||
WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), invalid iInitType= %d, argv= 0x%p.\n",
|
WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), invalid argv= 0x%p.\n",
|
||||||
iInitType, (void*)argv);
|
pCfg);
|
||||||
return cmInitParaError;
|
return cmInitParaError;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,8 +298,6 @@ int CWelsH264SVCEncoder::Initialize2 (void* argv, const INIT_TYPE iInitType) {
|
|||||||
Uninitialize();
|
Uninitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
SWelsSvcCodingParam* pCfg = static_cast<SWelsSvcCodingParam*> (argv);
|
|
||||||
|
|
||||||
const int32_t iColorspace = pCfg->iInputCsp;
|
const int32_t iColorspace = pCfg->iInputCsp;
|
||||||
if (0 == iColorspace) {
|
if (0 == iColorspace) {
|
||||||
WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), invalid iInputCsp= %d.\n", iColorspace);
|
WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), invalid iInputCsp= %d.\n", iColorspace);
|
||||||
|
|||||||
Reference in New Issue
Block a user