OMX_ERRORTYPE OMXVideoDecoderAVCSecure::ProcessorInit(void) { sec_result_t sepres = Drm_Library_Init(); if (sepres != 0) { LOGE("Drm_Library_Init returned %08X", (unsigned int)sepres); } mSessionPaused = false; return OMXVideoDecoderBase::ProcessorInit(); }
int32_t OMXImplWVClassic::Init() { // // Initialize security library // sec_result_t sepres = Drm_Library_Init(); if (sepres != DRM_SUCCESSFUL) { LOGE("Drm_Library_Init() returned %08X", (unsigned int)sepres); return ERROR_FROM_DRM_ERROR(sepres) ; } LOGV("Drm_Library_Init() succeeded") ; // // Create WV Classic session // uint32_t imrOffset = 0; uint32_t imrBufferSize = IMR_BUFFER_SIZE; uint32_t sessionID = 0; sepres = Drm_WV_CreateSession(&imrOffset, &imrBufferSize, &sessionID); if (sepres != 0) { LOGE("Drm_WV_CreateSession failed. Result = %#x", sepres); return ERROR_FROM_DRM_ERROR(sepres) ; } // Note: originally, imrOffset parameter was added to Drm_WV_CreateSession(), // in case we would need to support several simultaneous protected content // apps (ha-ha), which would have to share IMR. Since we only support one // protected content usage at a time, the imrOffset would always be 0. if (sessionID != WV_SESSION_ID) { LOGE("Invalid session ID %#x created", sessionID); return OMXDRM_ERROR_INV_SESSION ; } LOGI("Drm_WV_CreateSession: IMR Offset = %d, IMR size = %#x", imrOffset, imrBufferSize); if (imrBufferSize != IMR_BUFFER_SIZE) { LOGE("Mismatch in IMR size: Requested: %#x Obtained: %#x", IMR_BUFFER_SIZE, imrBufferSize); return OMXDRM_ERROR ; } // // Create keep-alive timer // int ret; struct sigevent sev; memset(&sev, 0, sizeof(sev)); sev.sigev_notify = SIGEV_THREAD; sev.sigev_value.sival_ptr = this; sev.sigev_notify_function = KeepAliveTimerCallback; ret = timer_create(CLOCK_REALTIME, &sev, &mKeepAliveTimer); if (ret != 0) { LOGE("Failed to create timer (%d)", ret); // Call Deinit() to destroy session. Deinit() ; return OMXDRM_ERROR ; } else { struct itimerspec its; its.it_value.tv_sec = -1; // never expire its.it_value.tv_nsec = 0; its.it_interval.tv_sec = KEEP_ALIVE_INTERVAL; its.it_interval.tv_nsec = 0; ret = timer_settime(mKeepAliveTimer, TIMER_ABSTIME, &its, NULL); if (ret != 0) { LOGE("Failed to set timer (%d)", ret); } } LOGI("Created keep-alive timer") ; return OMXDRM_SUCCESS ; }