⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eventmgr.cpp

📁 这是DVD中伺服部分的核心代码
💻 CPP
📖 第 1 页 / 共 3 页
字号:
                {
                    DBGPRINT(DBG_ON(DBG_ERROR), ("eventmgrGenerateUO: failed to send status event!\n"));
                    tStatus = EVENTMGR_FAILURE;
                }
            }
        }
        else if ( (tUOCtrlStatus == UOCTRL_PROHIBITED) || (tModMgrStatus == MODMGR_UOP_PROHIBITED) )
        {
            DBGPRINT(DBG_ON(DBG_TRACE), ("eventmgrGenerateUO: UO prohibited by UO mask\n"));

            /* Send prohibited status event */
            UsrSendProhibitedEvent(VDVD_INFO_PROH_NORMAL, 0);
        }
        else
        {
            DBGPRINT(DBG_ON(DBG_ERROR), ("eventmgrGenerateUO: failed to process UO %d!\n", cmd));

            /* Send prohibited status event */
            UsrSendProhibitedEvent(VDVD_INFO_PROH_NORMAL, 0);

            /* return error */
            tStatus = EVENTMGR_FAILURE;
        }
    }

    return (tStatus);
}

/**
 * eventmgrInterpretCmd -- Interpret a command based on the current playback state.  This may take
 *                         a command and interpret it as something different (for example play
 *                         command means pause off if pause is currently on).
 *
 * @param
 *      cmd -- the user event to interpret
 *      new_cmd -- variable that gets set to interpreted user event
 *      new_param -- variable that get set to interpreted user event info param
 *
 * @retval
 *      None
 */
static void  eventmgrInterpretCmd(MODMGR_COMMAND cmd, MODMGR_COMMAND &new_cmd, ULONG &new_param)
{
    MODMGR_PLAYSTATE play_state;

    switch (cmd)
    {
    case MODMGR_PLAY:

        /* Get current play state */
        play_state = MogMgrGetPlayState();

        /*
         * If in fast/slow mode, then resume normal speed.
         * If paused, do a pause off.
         * If in a still, do a still off.
         */
        if (play_state == MODMGR_PLAYSTATE_STILL)
        {
            /* If repeat a point is set, but not b point, then set repeat to off */
            if (ModMgrGetRepeatMode() == VDVD_INFO_REPEAT_A)
            {
                UOCtrlRepeat(VDVD_INFO_REPEAT_OFF);
            }

            /* menu detection
             *
             * The parameter is used to modify the behavior of the play button.
             * It is a bitfield used as follows.
             *
             * 0    - play key is always treated like a play key
             * bit0 - play key is interpreted as select when in a menu
             * bit1 - play key is interpreted as pause when in normal play mode (not in menu)
             */
            if ( (ModMgrIsButtonSelected() == TRUE) && (new_param & 0x01) )
            {
                new_cmd = MODMGR_ACTIVATEBUTTON;
            }
            else
            {
                new_cmd = MODMGR_STILLOFF;
            }
        }
        else if ( (play_state == MODMGR_PLAYSTATE_FAST_F) || (play_state == MODMGR_PLAYSTATE_SLOW_F) ||
                  (play_state == MODMGR_PLAYSTATE_FAST_R) || (play_state == MODMGR_PLAYSTATE_SLOW_R) ||
                  (play_state == MODMGR_PLAYSTATE_PLAY) )
        {
            /* menu detection
             *
             * The parameter is used to modify the behavior of the play button.
             * It is a bitfield used as follows.
             *
             * 0    - play key is always treated like a play key
             * bit0 - play key is interpreted as select when in a menu
             * bit1 - play key is interpreted as pause when in normal play mode (not in menu)
             */
            if (play_state == MODMGR_PLAYSTATE_PLAY)
            {
                if ( (ModMgrIsButtonSelected() == TRUE) && (new_param & 0x01) )
                {
                    /* if the play key is also used for pause then only translate to select
                     * when in the top menu or popup menu, the rest of the time translate
                     * it to pause */
                    if ( (new_param &= 0x02) && (ModMgrGetTitle() != 0) && (ModMgrIsPopupOn() == FALSE) )
                    {
                        uint64 UO_mask_table = 0;

                        /* lastly check the UOP mask
                         * if pause is prohibited and we have a selectable button we might as well
                         * select it instead of sending pause */
                        PlayCtrlTakeSemaphore();
                        PlayCtrlGetUOPMaskTable(&UO_mask_table);
                        PlayCtrlGiveSemaphore();

                        if ( ( UO_mask_table & ((uint64)1 << 55) ) != 0)
                        {
                            /* pause is prohibited so activate instead */
                            new_cmd = MODMGR_ACTIVATEBUTTON;
                        }
                        else
                        {
                            new_cmd = MODMGR_PAUSEON;
                        }
                    }
                    else
                    {
                        new_cmd = MODMGR_ACTIVATEBUTTON;
                    }
                }
                else if (new_param &= 0x02)
                {
                    new_cmd = MODMGR_PAUSEON;
                }
                else
                {
                    new_cmd   = MODMGR_FORWARDPLAY;
                    new_param = 1000;
                }
            }
            else
            {
                new_cmd   = MODMGR_FORWARDPLAY;
                new_param = 1000;
            }
        }
        else if (play_state == MODMGR_PLAYSTATE_PAUSE)
        {
            /* If repeat a point is set, but not b point, then set repeat to off */
            if (ModMgrGetRepeatMode() == VDVD_INFO_REPEAT_A)
            {
                UOCtrlRepeat(VDVD_INFO_REPEAT_OFF);
            }

            new_cmd = MODMGR_PAUSEOFF;
        }
        break;

    default:
        break;
    }
}

#ifdef VDVD_ENABLE_BDJ
/**
 * eventmgrGetKeyInterest -- get key interest flag for BD-J Key Event corresponding
 *                           to the specified user event
 *
 * @param
 *      cmd -- the user event to get key interest for
 *
 * @retval
 *      TRUE if Key interest is registered
 *      FALSE if Key interest is not registered
 */
static BOOLEAN  eventmgrGetKeyInterest(MODMGR_COMMAND cmd)
{
	BOOLEAN gen_key_event = FALSE;

	DBGPRINT(DBG_ON(DBG_VERBOSE), ("eventmgrGetKeyInterest: BD-J key_interest_table = %lx\n", key_interest_table));

	switch( cmd )
	{
		case MODMGR_PLAY:
			if ( key_interest_table & 0x80000000 )
			{
				gen_key_event = TRUE;
			}
		break;

		case MODMGR_STOP:
			if ( key_interest_table & 0x40000000 )
			{
				gen_key_event = TRUE;
			}
		break;

		case MODMGR_FORWARDPLAY:
			if ( key_interest_table & 0x20000000 )
			{
				gen_key_event = TRUE;
			}
		break;

		case MODMGR_BACKWARDPLAY:
			if ( key_interest_table & 0x10000000 )
			{
				gen_key_event = TRUE;
			}
		break;

		case MODMGR_SKIPTONEXTPOINT:
			if ( key_interest_table & 0x08000000 )
			{
				gen_key_event = TRUE;
			}
		break;

		case MODMGR_SKIPTOPREVPOINT:
        case MODMGR_RESTARTPOINT:
			if ( key_interest_table & 0x04000000 )
			{
				gen_key_event = TRUE;
			}
		break;

		case MODMGR_PAUSEON:
		case MODMGR_PAUSEOFF:
			if ( key_interest_table & 0x02000000 )
			{
				gen_key_event = TRUE;
			}
		break;

		case MODMGR_STILLOFF:
			if ( key_interest_table & 0x01000000 )
			{
				gen_key_event = TRUE;
			}
		break;

		case MODMGR_PGANDSTENABLE:
			if ( key_interest_table & 0x00200000 )
			{
				gen_key_event = TRUE;
			}
		break;

		default:
			gen_key_event = FALSE;
		break;
	}

    return (gen_key_event);
}
#endif

#ifdef VDVD_ENABLE_BDJ
/**
 * eventmgrGenerateKeyEvent -- generate a BD-J Key Event in accordance with the received user event
 *
 * @param
 *      pStateInfo -- pointer to module manager state information
 *      cmd -- the user event to be processed
 *      ulParam -- optional parameter passed with command
 *
 * @retval
 *      EVENTMGR_STATUS
 */
static EVENTMGR_STATUS eventmgrGenerateKeyEvent(MODMGR_COMMAND cmd, ULONG ulParam)
{
    BDROM_InputKeyCodes bdjCmd = GetBDJEventType( cmd, ulParam );

    DBGPRINT(DBG_ON(DBG_VERBOSE), ("eventmgrGenerateKeyEvent: Sending cmd %d to the BD-J module.\n", bdjCmd));

    if (( cmd == MODMGR_MOVEUPSELECTEDBUTTON_RELEASE) || (cmd == MODMGR_MOVEDOWNSELECTEDBUTTON_RELEASE) ||
        (cmd == MODMGR_MOVELEFTSELECTEDBUTTON_RELEASE) || (cmd == MODMGR_MOVERIGHTSELECTEDBUTTON_RELEASE))
    {
        BDJ_UserEvent( bdj_handle, bdjCmd, false );

        DBGPRINT(DBG_ON(DBG_VERBOSE), ("eventmgrGenerateKeyEvent: Sending cmd %d (KEY RELEASE = %d) to the BD-J module.\n",
										bdjCmd, cmd ));
    }
    else
    {
        BDJ_UserEvent( bdj_handle, bdjCmd, true );
    }

    return (EVENTMGR_SUCCESS);
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -