// Handles an incoming resource message for this media processing object. // Returns TRUE if the message was handled, otherwise FALSE. UtlBoolean MpResource::handleMessage(MpResourceMsg& rMsg) { UtlBoolean msgHandled = FALSE; // Do stuff for resource messages. msgHandled = TRUE; // assume we'll handle the msg switch (rMsg.getMsg()) { case MpResourceMsg::MPRM_RESOURCE_DISABLE: // disable this resource msgHandled = handleDisable(); break; case MpResourceMsg::MPRM_RESOURCE_ENABLE: // enable this resource msgHandled = handleEnable(); break; case MpResourceMsg::MPRM_DISABLE_ALL_NOTIFICATIONS: // Disable all notifications sent out from this resource. setNotificationsEnabled(FALSE); break; case MpResourceMsg::MPRM_ENABLE_ALL_NOTIFICATIONS: // Enable all notifications sent out from this resource. setNotificationsEnabled(TRUE); break; default: msgHandled = FALSE; // we didn't handle the msg after all break; } return msgHandled; }
// Handles an incoming message for the flow graph. // Returns TRUE if the message was handled, otherwise FALSE. UtlBoolean MpFlowGraphBase::handleMessage(OsMsg& rMsg) { MpFlowGraphMsg* pMsg = (MpFlowGraphMsg*) &rMsg ; UtlBoolean retCode; MpResource* ptr1; MpResource* ptr2; int int1; int int2; retCode = FALSE; ptr1 = (MpResource*) pMsg->getPtr1(); // get the parameters out of ptr2 = (MpResource*) pMsg->getPtr2(); // the message int1 = pMsg->getInt1(); int2 = pMsg->getInt2(); switch (pMsg->getMsg()) { case MpFlowGraphMsg::FLOWGRAPH_ADD_LINK: retCode = handleAddLink(ptr1, int1, ptr2, int2); break; case MpFlowGraphMsg::FLOWGRAPH_ADD_RESOURCE: retCode = handleAddResource(ptr1, int1); break; case MpFlowGraphMsg::FLOWGRAPH_DESTROY_RESOURCES: retCode = handleDestroyResources(); break; case MpFlowGraphMsg::FLOWGRAPH_DISABLE: retCode = handleDisable(); break; case MpFlowGraphMsg::FLOWGRAPH_ENABLE: retCode = handleEnable(); break; case MpFlowGraphMsg::FLOWGRAPH_REMOVE_LINK: retCode = handleRemoveLink(ptr1, int1); break; case MpFlowGraphMsg::FLOWGRAPH_REMOVE_RESOURCE: retCode = handleRemoveResource(ptr1); break; case MpFlowGraphMsg::FLOWGRAPH_SET_SAMPLES_PER_FRAME: retCode = handleSetSamplesPerFrame(int1); break; case MpFlowGraphMsg::FLOWGRAPH_SET_SAMPLES_PER_SEC: retCode = handleSetSamplesPerSec(int1); break; case MpFlowGraphMsg::FLOWGRAPH_START: retCode = handleStart(); break; case MpFlowGraphMsg::FLOWGRAPH_STOP: retCode = handleStop(); break; default: break; } return retCode; }
// Constructor MprBridge::MprBridge(const UtlString& rName, int maxInOutputs, UtlBoolean mixSilence, AlgType algorithm) : MpAudioResource(rName, 1, maxInOutputs, 1, maxInOutputs) #ifdef TEST_PRINT_CONTRIBUTORS // [ , mpMixContributors(NULL) , mpLastOutputContributors(NULL) #endif // TEST_PRINT_CONTRIBUTORS ] , mAlgType(algorithm) , mpBridgeAlg(NULL) , mMixSilence(mixSilence) #ifdef PRINT_CLIPPING_STATS , mClippedFramesCounted(0) , mpOutputClippingCount(NULL) #endif { handleDisable(); #ifdef TEST_PRINT_CONTRIBUTORS mpMixContributors = new MpContributorVector(maxInOutputs); mpLastOutputContributors = new MpContributorVector*[maxInOutputs]; for (int i = 0; i < maxInOutputs; i++) { mpLastOutputContributors[i] = new MpContributorVector(maxInOutputs); } #endif #ifdef PRINT_CLIPPING_STATS OsSysLog::add(FAC_MP, PRI_DEBUG, "MprBridge::MprBridge new int[%d]", maxInOutputs); mpOutputClippingCount = new int[maxInOutputs]; OsSysLog::add(FAC_MP, PRI_DEBUG, "MprBridge::MprBridge after new int[%d]", maxInOutputs); OsSysLog::flush(); for(int outIndex = 0; outIndex < maxInOutputs; outIndex++) { mpOutputClippingCount[outIndex] = 0; } OsSysLog::add(FAC_MP, PRI_DEBUG, "MprBridge::MprBridge initialized maxInOutputs"); #endif }
// Handles an incoming flowgraph message for this media processing object. // Returns TRUE if the message was handled, otherwise FALSE. UtlBoolean MpResource::handleMessage(MpFlowGraphMsg& fgMsg) { UtlBoolean msgHandled = FALSE; msgHandled = TRUE; // assume we'll handle the msg switch (fgMsg.getMsg()) { case MpFlowGraphMsg::RESOURCE_DISABLE: // disable this resource msgHandled = handleDisable(); break; case MpFlowGraphMsg::RESOURCE_ENABLE: // enable this resource msgHandled = handleEnable(); break; default: msgHandled = FALSE; // we didn't handle the msg after all break; } return msgHandled; }