status_t SoftAVC::reInitDecoder(uint32_t width, uint32_t height) { status_t ret; deInitDecoder(); ret = initDecoder(width, height); if (OK != ret) { ALOGE("Create failure"); deInitDecoder(); return NO_MEMORY; } return OK; }
status_t SoftMPEG2::reInitDecoder() { status_t ret; deInitDecoder(); ret = initDecoder(); if (OK != ret) { ALOGE("Create failure"); deInitDecoder(); return NO_MEMORY; } return OK; }
status_t SoftHEVC::initDecoder() { IV_API_CALL_STATUS_T status; mNumCores = GetCPUCoreCount(); mCodecCtx = NULL; mStride = outputBufferWidth(); /* Initialize the decoder */ { ivdext_create_ip_t s_create_ip; ivdext_create_op_t s_create_op; void *dec_fxns = (void *)ivdec_api_function; s_create_ip.s_ivd_create_ip_t.u4_size = sizeof(ivdext_create_ip_t); s_create_ip.s_ivd_create_ip_t.e_cmd = IVD_CMD_CREATE; s_create_ip.s_ivd_create_ip_t.u4_share_disp_buf = 0; s_create_op.s_ivd_create_op_t.u4_size = sizeof(ivdext_create_op_t); s_create_ip.s_ivd_create_ip_t.e_output_format = mIvColorFormat; s_create_ip.s_ivd_create_ip_t.pf_aligned_alloc = ivd_aligned_malloc; s_create_ip.s_ivd_create_ip_t.pf_aligned_free = ivd_aligned_free; s_create_ip.s_ivd_create_ip_t.pv_mem_ctxt = NULL; status = ivdec_api_function(mCodecCtx, (void *)&s_create_ip, (void *)&s_create_op); mCodecCtx = (iv_obj_t*)s_create_op.s_ivd_create_op_t.pv_handle; mCodecCtx->pv_fxns = dec_fxns; mCodecCtx->u4_size = sizeof(iv_obj_t); if (status != IV_SUCCESS) { ALOGE("Error in create: 0x%x", s_create_op.s_ivd_create_op_t.u4_error_code); deInitDecoder(); mCodecCtx = NULL; return UNKNOWN_ERROR; } } /* Reset the plugin state */ resetPlugin(); /* Set the run time (dynamic) parameters */ setParams(mStride); /* Set number of cores/threads to be used by the codec */ setNumCores(); /* Get codec version */ logVersion(); mFlushNeeded = false; return OK; }
SoftHEVC::~SoftHEVC() { ALOGV("In SoftHEVC::~SoftHEVC"); CHECK_EQ(deInitDecoder(), (status_t)OK); }
SoftAVC::~SoftAVC() { CHECK_EQ(deInitDecoder(), (status_t)OK); }
SoftMPEG2::~SoftMPEG2() { CHECK_EQ(deInitDecoder(), (status_t)OK); }
SoftFFmpegVideo::~SoftFFmpegVideo() { LOGV("~SoftFFmpegVideo"); deInitDecoder(); deInitFFmpeg(); }