📄 eventmgr.cpp
字号:
/*****************************************************************************
******************************************************************************
** **
** Copyright (c) 2005-2006 Videon Central, Inc. **
** All rights reserved. **
** **
** The computer program contained herein contains proprietary information **
** which is the property of Videon Central, Inc. The program may be used **
** and/or copied only with the written permission of Videon Central, Inc. **
** or in accordance with the terms and conditions stipulated in the **
** agreement/contract under which the programs have been supplied. **
** **
******************************************************************************
*****************************************************************************/
/**
* @file eventmgr.cpp
*
* API to the User Event Manager.
* The User Event Manager receives user events and generates
* either a User Operation (UO) or a BD-J Key Event.
*
* $Id: eventmgr.cpp,v 1.44 2007/01/26 22:41:08 rbehe Exp $
*/
#include "vdvd_types.h"
#include "eventmgr.h"
#include "modmgr_private.h"
#ifdef VDVD_ENABLE_BDJ
#include "../bdjobjdb.h"
#endif
#include "../modmgr.h"
#include "../playctrl/playctrl.h"
#include "uoctrl.h"
#include "usrapi.h"
#include "dbgprint.h"
#include "qa.h" /* for qa automation */
/* Debug macros */
#define DBG_EVENTMGR DBG_ERROR
#define DBG_ON(x) (DBG_EVENTMGR >= x)
/**
* Local functions
*/
static EVENTMGR_STATUS eventmgrGenerateUO(MODMGR_STATE_INFO *pStateInfo, MODMGR_COMMAND cmd, ULONG ulParam);
static void eventmgrInterpretCmd(MODMGR_COMMAND cmd, MODMGR_COMMAND &new_cmd, ULONG &new_param);
#ifdef VDVD_ENABLE_BDJ
static BOOLEAN eventmgrGetKeyInterest(MODMGR_COMMAND cmd);
static EVENTMGR_STATUS eventmgrGenerateKeyEvent(MODMGR_COMMAND cmd, ULONG ulParam);
#endif
/**
* EventMgrProcessCmd -- process user event received from the
* module manager's command queue
*
* @param
* pStateInfo -- pointer to module manager state information
* cmd -- the user event to be processed
* ulParam -- optional parameter passed with command
*
* @retval
* EVENTMGR_STATUS
*/
EVENTMGR_STATUS EventMgrProcessCmd(MODMGR_STATE_INFO *pStateInfo, MODMGR_COMMAND cmd, ULONG ulParam)
{
EVENTMGR_STATUS tStatus = EVENTMGR_FAILURE;
DBGPRINT(DBG_ON(DBG_TRACE), ("EventMgrProcessCmd: ENTER\n"));
/* Check for valid state info */
if (pStateInfo == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("EventMgrProcessCmd: NULL pointer!\n"));
return (EVENTMGR_NULL_POINTER);
}
/* Tell IG decoder to reset it's user timeout duration timer */
PlayCtrlTakeSemaphore();
PlayCtrlResetUserTimeout();
PlayCtrlGiveSemaphore();
/*
* If active title is not BD-J, then generate a UO.
* Otherwise, do further processing.
*/
if ( (pStateInfo->tActiveTitle == MODMGR_TITLE_BDJ_MOVIE) ||
(pStateInfo->tActiveTitle == MODMGR_TITLE_BDJ_INTERACTIVE) )
{
#ifdef VDVD_ENABLE_BDJ
/* Check user event type */
if ( (cmd == MODMGR_PLAY) || ( (cmd == MODMGR_STOP) && !(ulParam & VDVD_STOP_MODE_FORCED)) || (cmd == MODMGR_SKIPTONEXTPOINT) ||
(cmd == MODMGR_SKIPTOPREVPOINT) || (cmd == MODMGR_FORWARDPLAY) || (cmd == MODMGR_BACKWARDPLAY) ||
(cmd == MODMGR_PAUSEON) || (cmd == MODMGR_PAUSEOFF) || (cmd == MODMGR_STILLOFF) ||
(cmd == MODMGR_PGANDSTENABLE ) || (cmd == MODMGR_RESTARTPOINT) )
{
/* Check if BD-J title is a movie title or interactive title */
if (pStateInfo->tActiveTitle == MODMGR_TITLE_BDJ_INTERACTIVE)
{
/* Check if key interest is registered */
if (eventmgrGetKeyInterest(cmd) == TRUE)
{
/* Generate BD-J Key Event */
tStatus = eventmgrGenerateKeyEvent(cmd, ulParam);
}
else
{
/* Generate UO */
tStatus = eventmgrGenerateUO(pStateInfo, cmd, ulParam);
}
}
else
{
/* Generate UO */
tStatus = eventmgrGenerateUO(pStateInfo, cmd, ulParam);
}
}
else if ( (cmd == MODMGR_MOVEUPSELECTEDBUTTON) || (cmd == MODMGR_MOVEDOWNSELECTEDBUTTON) ||
(cmd == MODMGR_MOVELEFTSELECTEDBUTTON) || (cmd == MODMGR_MOVERIGHTSELECTEDBUTTON) ||
(cmd == MODMGR_ACTIVATEBUTTON) || (cmd == MODMGR_POPUPON) || (cmd == MODMGR_POPUPOFF) ||
(cmd == MODMGR_COLOR_KEY) )
{
/* Generate BD-J Key Event */
tStatus = eventmgrGenerateKeyEvent(cmd, ulParam);
}
else if (cmd == MODMGR_SELECTANDACTIVATEBUTTON)
{
/* Generate BD-J Key Event */
tStatus = eventmgrGenerateKeyEvent(cmd, ulParam);
}
else if (( cmd == MODMGR_MOVEUPSELECTEDBUTTON_RELEASE) || (cmd == MODMGR_MOVEDOWNSELECTEDBUTTON_RELEASE) ||
(cmd == MODMGR_MOVELEFTSELECTEDBUTTON_RELEASE) || (cmd == MODMGR_MOVERIGHTSELECTEDBUTTON_RELEASE))
{
// Send the key release event in to BD-J.
tStatus = eventmgrGenerateKeyEvent(cmd, ulParam);
}
else
{
/* Generate UO */
tStatus = eventmgrGenerateUO(pStateInfo, cmd, ulParam);
}
#else
DBGPRINT(DBG_ON(DBG_ERROR), ("EventMgrProcessCmd: BD-J not supported\n"));
tStatus = EVENTMGR_NOT_IMPLEMENTED;
#endif
}
else
{
if (( cmd == MODMGR_MOVEUPSELECTEDBUTTON_RELEASE ) || ( cmd == MODMGR_MOVEDOWNSELECTEDBUTTON_RELEASE ) ||
( cmd == MODMGR_MOVELEFTSELECTEDBUTTON_RELEASE ) || ( cmd == MODMGR_MOVERIGHTSELECTEDBUTTON_RELEASE ))
{
tStatus = EVENTMGR_SUCCESS;
}
else
{
/* Generate UO */
tStatus = eventmgrGenerateUO(pStateInfo, cmd, ulParam);
}
}
return (tStatus);
}
/**
* eventmgrGenerateUO -- generate a UO 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 eventmgrGenerateUO(MODMGR_STATE_INFO *pStateInfo, MODMGR_COMMAND cmd, ULONG ulParam)
{
EVENTMGR_STATUS tStatus = EVENTMGR_SUCCESS;
BOOLEAN fUOValid = FALSE;
ULONG ulStatusEvent[4];
DbgAssert(pStateInfo != NULL);
DbgAssert(cmd < MODMGR_INVALID_COMMAND);
/* Interpret the user event received */
eventmgrInterpretCmd(cmd, cmd, ulParam);
/* Only process valid commands */
if (cmd >= MODMGR_INVALID_COMMAND)
{
DBGPRINT(DBG_ON(DBG_TRACE), ("EventMgrProcessCmd: Invalid command\n"));
return (EVENTMGR_SUCCESS);
}
/*
* Check if the UO corresponding to the user event is valid during
* the active title.
*/
#ifdef VDVD_ENABLE_BDJ
if (pStateInfo->tActiveTitle == MODMGR_TITLE_BDJ_MOVIE)
{
/*
* BD-J Movie title active. Title Control UO's and Playback Control UO's are valid.
*/
if ( (cmd == MODMGR_TITLESEARCH) || (cmd == MODMGR_MENUCALL) || (cmd == MODMGR_PLAY) ||
(cmd == MODMGR_RESUME) || (cmd == MODMGR_STOP) || (cmd == MODMGR_CHAPTERSEARCH) ||
(cmd == MODMGR_TIMESEARCH) || (cmd == MODMGR_SKIPTONEXTPOINT) || (cmd == MODMGR_SKIPTOPREVPOINT) ||
(cmd == MODMGR_PAUSEON) || (cmd == MODMGR_PAUSEOFF) || (cmd == MODMGR_STILLOFF) ||
(cmd == MODMGR_FORWARDPLAY) || (cmd == MODMGR_BACKWARDPLAY) || (cmd == MODMGR_AUDIOCHANGE) ||
(cmd == MODMGR_PGANDSTCHANGE) || (cmd == MODMGR_PGANDSTENABLE) || (cmd == MODMGR_ANGLECHANGE) ||
(cmd == MODMGR_RESTARTPOINT ) || (cmd == MODMGR_REPEAT) )
{
fUOValid = TRUE;
}
}
else if (pStateInfo->tActiveTitle == MODMGR_TITLE_BDJ_INTERACTIVE)
{
/*
* BD-J Interactive title active. Title Control UO's and Playback Control UO's are valid,
* with the exception of chapter search and time search.
*/
if ( (cmd == MODMGR_TITLESEARCH) || (cmd == MODMGR_MENUCALL) || (cmd == MODMGR_PLAY) ||
(cmd == MODMGR_RESUME) || (cmd == MODMGR_STOP) || (cmd == MODMGR_SKIPTONEXTPOINT) ||
(cmd == MODMGR_SKIPTOPREVPOINT) || (cmd == MODMGR_PAUSEON) || (cmd == MODMGR_PAUSEOFF) ||
(cmd == MODMGR_STILLOFF) || (cmd == MODMGR_FORWARDPLAY) || (cmd == MODMGR_BACKWARDPLAY) ||
(cmd == MODMGR_AUDIOCHANGE) || (cmd == MODMGR_PGANDSTCHANGE) || (cmd == MODMGR_PGANDSTENABLE) || (cmd == MODMGR_ANGLECHANGE) )
{
fUOValid = TRUE;
}
}
else
#endif
{
if (pStateInfo->tState == MODMGR_STATE_HOLD)
{
/*
* If module manager is in hold state, only commands that start/resume playback
* or fullstop are valid. Or repeat.
*/
if ( (cmd == MODMGR_TITLESEARCH) || (cmd == MODMGR_MENUCALL) || (cmd == MODMGR_PLAY) ||
(cmd == MODMGR_STOP) || (cmd == MODMGR_PLAYLOCATION) || (cmd == MODMGR_REPEAT) )
{
fUOValid = TRUE;
}
}
else
{
if (pStateInfo->tActiveTitle == MODMGR_TITLE_HDMV_MOVIE)
{
/*
* HDMV Movie title active. All UO's are valid.
*/
fUOValid = TRUE;
}
else if (pStateInfo->tActiveTitle == MODMGR_TITLE_HDMV_INTERACTIVE)
{
/*
* HDMV Interactive title active. All UO's except for Chapter Search,
* Time Search, and Repeat are valid.
*/
if ( (cmd != MODMGR_CHAPTERSEARCH) && (cmd != MODMGR_TIMESEARCH) && (cmd != MODMGR_REPEAT) )
{
fUOValid = TRUE;
}
}
else
{
/*
* No title active. Only UO's that start title playback are valid.
*/
if ( (cmd == MODMGR_TITLESEARCH) || (cmd == MODMGR_MENUCALL) || (cmd == MODMGR_PLAY) ||
(cmd == MODMGR_PLAYLOCATION) )
{
fUOValid = TRUE;
}
}
}
}
/*
* If the UO is invalid, send a prohibited status event through USRAPI.
* If the UO is valid, call the appropriate function to process
* the UO. Title Control User Operations are handled by the
* Module Manager. All other UO's are handled by the UO controller.
*/
if (fUOValid == FALSE)
{
DBGPRINT(DBG_ON(DBG_TRACE), ("eventmgrGenerateUO: UO prohibited during active title\n"));
/* Send prohibited status event */
UsrSendProhibitedEvent(VDVD_INFO_PROH_NORMAL, 0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -