// the return value of this function is not suitable, it need report failure info to upper layer. int32_t CWelsDecoder::InitDecoder (const SDecodingParam* pParam) { WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::init_decoder(), openh264 codec version = %s, ParseOnly = %d", VERSION_NUMBER, (int32_t)pParam->bParseOnly); //reset decoder context if (m_pDecContext) //free UninitDecoder(); m_pDecContext = (PWelsDecoderContext)WelsMallocz (sizeof (SWelsDecoderContext), "m_pDecContext"); if (NULL == m_pDecContext) return cmMallocMemeError; int32_t iCacheLineSize = 16; // on chip cache line size in byte m_pDecContext->pMemAlign = new CMemoryAlign (iCacheLineSize); WELS_VERIFY_RETURN_PROC_IF (1, (NULL == m_pDecContext->pMemAlign), UninitDecoder()) //fill in default value into context WelsDecoderDefaults (m_pDecContext, &m_pWelsTrace->m_sLogCtx); //check param and update decoder context m_pDecContext->pParam = (SDecodingParam*) m_pDecContext->pMemAlign->WelsMallocz (sizeof (SDecodingParam), "SDecodingParam"); WELS_VERIFY_RETURN_PROC_IF (cmMallocMemeError, (NULL == m_pDecContext->pParam), UninitDecoder()); int32_t iRet = DecoderConfigParam (m_pDecContext, pParam); WELS_VERIFY_RETURN_IFNEQ (iRet, cmResultSuccess); //init decoder WELS_VERIFY_RETURN_PROC_IF (cmInitParaError, WelsInitDecoder (m_pDecContext, &m_pWelsTrace->m_sLogCtx), UninitDecoder()) return cmResultSuccess; }
long CWelsDecoder::Initialize (const SDecodingParam* pParam) { if (pParam == NULL) { IWelsTrace::WelsVTrace (m_pTrace, IWelsTrace::WELS_LOG_INFO, "CWelsDecoder::Initialize(), invalid input argument."); return cmInitParaError; } // H.264 decoder initialization,including memory allocation,then open it ready to decode InitDecoder(); DecoderConfigParam (m_pDecContext, pParam); return cmResultSuccess; }
long CWelsDecoder::Initialize (void_t* pParam, const INIT_TYPE keInitType) { if (pParam == NULL || keInitType != INIT_TYPE_PARAMETER_BASED) { IWelsTrace::WelsVTrace (m_pTrace, IWelsTrace::WELS_LOG_INFO, "CWelsDecoder::Initialize(), invalid input argument."); return cmInitParaError; } // H.264 decoder initialization,including memory allocation,then open it ready to decode InitDecoder(); DecoderConfigParam (m_pDecContext, pParam); return cmResultSuccess; }
long CWelsDecoder::Initialize (const SDecodingParam* pParam) { if (m_pWelsTrace == NULL) { return cmMallocMemeError; } if (pParam == NULL) { WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::Initialize(), invalid input argument."); return cmInitParaError; } // H.264 decoder initialization,including memory allocation,then open it ready to decode InitDecoder(); DecoderConfigParam (m_pDecContext, pParam); return cmResultSuccess; }
long CWelsDecoder::Initialize (const SDecodingParam* pParam) { int iRet = ERR_NONE; if (m_pWelsTrace == NULL) { return cmMallocMemeError; } if (pParam == NULL) { WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "CWelsDecoder::Initialize(), invalid input argument."); return cmInitParaError; } // H.264 decoder initialization,including memory allocation,then open it ready to decode iRet = InitDecoder (pParam->bParseOnly); if (iRet) return iRet; iRet = DecoderConfigParam (m_pDecContext, pParam); if (iRet) return iRet; return cmResultSuccess; }