mfxStatus MFXVideoUSER_ProcessFrameAsync(mfxSession session, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp) { mfxStatus mfxRes; MFX_CHECK(session, MFX_ERR_INVALID_HANDLE); //MFX_CHECK(session->m_pUSER.get(), MFX_ERR_NOT_INITIALIZED); MFX_CHECK(syncp, MFX_ERR_NULL_PTR); try { //generic plugin function std::auto_ptr<VideoCodecUSER> & registeredPlg = SessionPtr(session).plugin(); mfxSyncPoint syncPoint = NULL; MFX_TASK task; memset(&task, 0, sizeof(MFX_TASK)); mfxRes = registeredPlg->Check(in, in_num, out, out_num, &task.entryPoint); // source data is OK, go forward if (MFX_ERR_NONE == mfxRes) { mfxU32 i; task.pOwner = registeredPlg.get(); task.priority = session->m_priority; task.threadingPolicy = registeredPlg->GetThreadingPolicy(); // fill dependencies for (i = 0; i < in_num; i += 1) { task.pSrc[i] = in[i]; } for (i = 0; i < out_num; i += 1) { task.pDst[i] = out[i]; } // register input and call the task mfxRes = session->m_pScheduler->AddTask(task, &syncPoint); } // return pointer to synchronization point *syncp = syncPoint; } catch(MFX_CORE_CATCH_TYPE) { // set the default error value mfxRes = MFX_ERR_UNKNOWN; if (0 == session) { return MFX_ERR_INVALID_HANDLE; } else if (0 == session->m_plgGen.get()) { return MFX_ERR_NOT_INITIALIZED; } else if (0 == syncp) { return MFX_ERR_NULL_PTR; } } return mfxRes; } // mfxStatus MFXVideoUSER_ProcessFrameAsync(mfxSession session,
void SuperGroup::realDoInitialize(const Options &options, unsigned int generation) { vector<ComponentInfo> componentInfos; vector<ComponentInfo>::const_iterator it; ExceptionPtr exception; P_TRACE(2, "Initializing SuperGroup " << inspect() << " in the background..."); try { componentInfos = loadComponentInfos(options); } catch (const tracable_exception &e) { exception = copyException(e); } if (componentInfos.empty() && exception == NULL) { string message = "The directory " + options.appRoot + " does not seem to contain a web application."; exception = boost::make_shared<SpawnException>( message, message, false); } PoolPtr pool = getPool(); Pool::DebugSupportPtr debug = pool->debugSupport; vector<Callback> actions; { if (debug != NULL && debug->superGroup) { debug->debugger->send("About to finish SuperGroup initialization"); debug->messages->recv("Proceed with initializing SuperGroup"); } boost::unique_lock<boost::mutex> lock(getPoolSyncher(pool)); this_thread::disable_interruption di; this_thread::disable_syscall_interruption dsi; NOT_EXPECTING_EXCEPTIONS(); if (OXT_UNLIKELY(getPool() == NULL || generation != this->generation)) { return; } P_TRACE(2, "Initialization of SuperGroup " << inspect() << " almost done; grabbed lock"); assert(state == INITIALIZING); verifyInvariants(); if (componentInfos.empty()) { /* Somehow initialization failed. Maybe something has deleted * the supergroup files while we're working. */ assert(exception != NULL); setState(DESTROYED); actions.reserve(getWaitlist.size()); while (!getWaitlist.empty()) { const GetWaiter &waiter = getWaitlist.front(); actions.push_back(boost::bind(waiter.callback, SessionPtr(), exception)); getWaitlist.pop_front(); } } else { for (it = componentInfos.begin(); it != componentInfos.end(); it++) { const ComponentInfo &info = *it; GroupPtr group = boost::make_shared<Group>(shared_from_this(), options, info); groups.push_back(group); if (info.isDefault) { defaultGroup = group.get(); } } setState(READY); assignGetWaitlistToGroups(actions); } verifyInvariants(); P_TRACE(2, "Done initializing SuperGroup " << inspect()); } this_thread::disable_interruption di; this_thread::disable_syscall_interruption dsi; runAllActions(actions); runInitializationHooks(); }
inline SessionPtr getCurrentSessionPtr() { return SessionPtr(getCurrentRcfSessionPtr()); }