Exemplo n.º 1
0
// Handle messages for this resource.
UtlBoolean MprToneGen::handleMessage(MpResourceMsg& rMsg)
{
   UtlBoolean msgHandled = FALSE;
   int msgType;

   MpToneResourceMsg* toneMsg = (MpToneResourceMsg*)(&rMsg);

   msgType = rMsg.getMsg();
   switch (msgType)
   {
   case MpResourceMsg::MPRM_START_TONE:
      MpToneGen_startTone(mpToneGenState, toneMsg->getToneCode());
      enable();
      msgHandled = TRUE;
      break;
   case MpResourceMsg::MPRM_STOP_TONE:
      MpToneGen_stopTone(mpToneGenState);
      disable();
      msgHandled = TRUE;
      break;
   default:
      // If we don't handle the message here, let our parent try.
      msgHandled = MpResource::handleMessage(rMsg); 
      break;
   }
   return msgHandled;
}
Exemplo n.º 2
0
// 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;
}
Exemplo n.º 3
0
UtlBoolean MpRtpInputConnection::handleMessage(MpResourceMsg& rMsg)
{
   UtlBoolean msgHandled = FALSE;

   switch (rMsg.getMsg()) 
   {
   case MPRM_SET_INACTIVITY_TIMEOUT:
      {
         MpIntResourceMsg *pMsg = (MpIntResourceMsg*)&rMsg;
         OsTime timeout(pMsg->getData());
         handleSetInactivityTimeout(timeout);
      }
      msgHandled = TRUE;
      break;

   case MPRM_ENABLE_SSRC_DISCARD:
   case MPRM_DISABLE_SSRC_DISCARD:
      {
         MpIntResourceMsg *pMsg = (MpIntResourceMsg*)&rMsg;
         RtpSRC ssrc = pMsg->getData();
         UtlBoolean enable = (rMsg.getMsg() == MPRM_ENABLE_SSRC_DISCARD);
         handleEnableSsrcDiscard(enable, ssrc);
      }
      msgHandled = TRUE;
      break;

   case MpResourceMsg::MPRM_DISABLE_ALL_NOTIFICATIONS:
   case MpResourceMsg::MPRM_ENABLE_ALL_NOTIFICATIONS:
      // Enable/disable all notifications sent out from this resource.
      msgHandled = MpResource::handleMessage(rMsg); 
      if (msgHandled)
      {
         UtlBoolean enabled = (rMsg.getMsg() == MpResourceMsg::MPRM_ENABLE_ALL_NOTIFICATIONS);
         mpRtpDispatcher->setNotificationsEnabled(enabled);
      }
      break;

   default:
      // If we don't handle the message here, let our parent try.
      msgHandled = MpResource::handleMessage(rMsg); 
      break;
   }
   return msgHandled;
}
Exemplo n.º 4
0
UtlBoolean MprDelay::handleMessage(MpResourceMsg& rMsg)
{
   UtlBoolean msgHandled = TRUE;
   switch (rMsg.getMsg())
   {
   case MPRM_DELAY_START_PLAY:
      mState = MPDS_PLAYING;
      break;
   case MPRM_DELAY_STOP_PLAY:
      mState = MPDS_WAITING;
      mFifo.reset();
      break;
   default:
      return MpResource::handleMessage(rMsg);
   }
   return msgHandled;
}
Exemplo n.º 5
0
UtlBoolean MprBridge::handleMessage(MpResourceMsg& rMsg)
{
   UtlBoolean msgHandled = FALSE;

   MprBridgeSetGainsMsg* pBridgeMsg = NULL;
   switch (rMsg.getMsg()) 
   {
   case MpResourceMsg::MPRM_BRIDGE_SET_GAINS:
      pBridgeMsg = (MprBridgeSetGainsMsg*)&rMsg;

      if (pBridgeMsg->getType() == MprBridgeSetGainsMsg::GAINS_ROW)
      {
         // Set row in mix matrix
         handleSetMixWeightsForOutput(pBridgeMsg->getPort(),
                                      pBridgeMsg->getGainsNum(),
                                      pBridgeMsg->getGains());
      }
      else if (pBridgeMsg->getType() == MprBridgeSetGainsMsg::GAINS_COLUMN)
      {
         // Set column in mix matrix
         handleSetMixWeightsForInput(pBridgeMsg->getPort(),
                                     pBridgeMsg->getGainsNum(),
                                     pBridgeMsg->getGains());
      }
      else
      {
         // Unknown type
         assert(false);
      }

      msgHandled = TRUE;
      break;

   default:
      // If we don't handle the message here, let our parent try.
      msgHandled = MpResource::handleMessage(rMsg); 
      break;
   }
   return msgHandled;
}