示例#1
0
PlayerCommand* PlayerDriver::DoProcessQueue(status_t& ret)
{
    PlayerCommand* ec = dequeueCommand();
	printf("HelixOverWebkit [%s] [%s] [%d] ec %p, ec->command() %d\n", __FILE__, __FUNCTION__, __LINE__, ec, (ec == NULL)?-1: ec->command());
    if (ec)
    {
        switch(ec->command())
        {
        case PlayerCommand::PLAYER_SET_DATA_SOURCE:
            ret = handleSetDataSource(static_cast<PlayerSetDataSource*>(ec));
            break;

        case PlayerCommand::PLAYER_PREPARE:
            ret = handlePrepare(static_cast<PlayerPrepare*>(ec));
            break;

        case PlayerCommand::PLAYER_START:
            ret = handleStart(static_cast<PlayerStart*>(ec));
            break;

        case PlayerCommand::PLAYER_STOP:
            ret = handleStop(static_cast<PlayerStop*>(ec));
            break;

        case PlayerCommand::PLAYER_PAUSE:
            ret = handlePause(static_cast<PlayerPause*>(ec));
            break;

        case PlayerCommand::PLAYER_SEEK:
            ret = handleSeek(static_cast<PlayerSeek*>(ec));
            break;

        case PlayerCommand::PLAYER_GET_POSITION:
            ret = handleGetPosition(static_cast<PlayerGetPosition*>(ec));
            break;

        case PlayerCommand::PLAYER_RESET:
            ret = handleReset(static_cast<PlayerReset*>(ec));
            break;

        case PlayerCommand::PLAYER_QUIT:
            ret = handleQuit(static_cast<PlayerQuit*>(ec));
            break;

        default:
            //cout << "Unexpected command %d" <<  ec->command();
            break;
        }
    }
    return ec;
}
示例#2
0
static void
handleExecuteCommandAlarm (const AsyncAlarmResult *result) {
  Queue *queue = getCommandQueue(0);

  if (queue) {
    int command = dequeueCommand(queue);

    if (command != EOF) {
      const CommandHandlerLevel *chl = commandHandlerStack;

      while (chl) {
        if (chl->handleCommand(command, chl->handlerData)) break;
        chl = chl->previousLevel;
      }
    }

    if (getQueueSize(queue) > 0) setExecuteCommandAlarm(result->data);
  }
}
示例#3
0
/*
 * The event helper thread. Dequeues commands and processes them.
 */
static void JNICALL
commandLoop(jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg)
{
    LOG_MISC(("Begin command loop thread"));

    while (JNI_TRUE) {
        HelperCommand *command = dequeueCommand();
        if (command != NULL) {
            /*
             * Setup for a potential doBlockCommand() call before calling
             * handleCommand() to prevent any races.
             */
            jboolean doBlock = needBlockCommandLoop(command);
            log_debugee_location("commandLoop(): command being handled", NULL, NULL, 0);
            handleCommand(jni_env, command);
            completeCommand(command);
            /* if we just finished a suspend-all cmd, then we block here */
            if (doBlock) {
                doBlockCommandLoop();
            }
        }
    }
    /* This loop never ends, even as connections come and go with server=y */
}