📄 pbc_engine.cpp
字号:
fSendMsg = FALSE;
}
DBGPRINT(DBG_ON(DBG_TRACE), ("BOS for PI: %u\n", pPIContext->uiPlayitemID));
}
else if ( ( ((PE_BEG_OF_STREAM_EVENT_INFO *)pEventInfo)->input != INPUT_BDROM_SUBPATH_TEXT_SUBTITLE) &&
( ((PE_BEG_OF_STREAM_EVENT_INFO *)pEventInfo)->input != INPUT_BDROM_SUBPATH_INTERACTIVE_GRAPHICS) )
{
/* if it's not the MAIN or textst or ig subpath, go idle (this will need to change for secondary streams) */
tStatus = PE_EVNT_IDLE;
fSendMsg = FALSE;
}
if (fSendMsg == TRUE)
{
/* Send beginning of stream msg to pbc msg queue. */
tMsgType = PBCENGINE_MSGTYPE_BEG_STREAM;
ulData0 = (ULONG)pPIContext;
ulData1 = ((PE_BEG_OF_STREAM_EVENT_INFO *)pEventInfo)->input;
ulData2 = (ULONG)FALSE;
}
break;
case PE_EVENT_END_OF_STREAM:
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcEnginePEiStrmCtrlCallback: PE_EVENT_END_OF_STREAM\n"));
uint16 uiNextPlayitemID;
/* Send end of stream msg to pbc msg queue. */
fSendMsg = TRUE;
tMsgType = PBCENGINE_MSGTYPE_END_STREAM;
ulData0 = (ULONG)((PE_END_OF_STREAM_EVENT_INFO *)pEventInfo)->pContext;
ulData1 = ((PE_END_OF_STREAM_EVENT_INFO *)pEventInfo)->input;
ulData2 = (ULONG)FALSE;
pPIContext = (PBC_PLAYITEM_CONTEXT *)(((PE_END_OF_STREAM_EVENT_INFO *)pEventInfo)->pContext);
DBGPRINT(DBG_ON(DBG_TRACE), ("EOS for PI: %u\n", ((PBC_PLAYITEM_CONTEXT *)ulData0)->uiPlayitemID));
/* check for still */
if (((PE_END_OF_STREAM_EVENT_INFO *)pEventInfo)->pContext != NULL)
{
/* check that the end of stream event is from the main path */
if (((PE_END_OF_STREAM_EVENT_INFO *)pEventInfo)->input == INPUT_MAIN)
{
PLAYITEM *pPlayItem = NULL;
/* Get playitem information */
if (MPLSGetPlayItem(((PBC_PLAYITEM_CONTEXT *)ulData0)->uiPlayitemID, &pPlayItem) == MPLS_SUCCESS)
{
uint32 uiPlaylistID;
/* make sure the info came from the correct playlist */
PbcRegGetPSR(PLAYCTRL_PSR_PLAYLIST, &uiPlaylistID);
if (((PBC_PLAYITEM_CONTEXT *)ulData0)->uiPlaylistID == uiPlaylistID)
{
/* If still mode is set for this playitem, then set still time */
if ( (pPlayItem->still_mode == 0x01) || (pPlayItem->still_mode == 0x02) )
{
tStatus |= PE_EVNT_BEGIN_STILL;
tStatus |= PE_EVNT_WAIT_FOR_DONE;
}
APPINFOPLAYLIST_TABLE *pPLAppInfo = NULL;
if (MPLSGetAppInfo(&pPLAppInfo) != MPLS_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPLCtrlEndStream: MPLSGetAppInfo() Failed!\n"));
return (PLAYCTRL_FAILURE);
}
uiNextPlayitemID = PbcPLCtrlGetNextPlayitem(hPBC, pPIContext->uiPlayitemID);
/* if we're at the end, return info for such */
/* if we've reversed to the start of the playlist */
if (( (pPIContext->PlayRate.direction == PE_ISTREAMCTRL_DIRECTION_BACKWARD) &&
( ( (pPLAppInfo->PlayList_playback_type == MPLS_SEQUENTIAL_PLAYLIST) && (pPIContext->uiPlayitemID == 0 ) ) ||
( (pPLAppInfo->PlayList_playback_type != MPLS_SEQUENTIAL_PLAYLIST) && (pPIContext->ubRandomShuffleIndex == 0) ) ) ) ||
/* Or if we've played forward to the end of the playlist */
( (pPIContext->PlayRate.direction == PE_ISTREAMCTRL_DIRECTION_FORWARD) && (uiNextPlayitemID == INVALID_PLAYITEM) ) )
{
tStatus |= PE_EVNT_END_OF_PLAY;
tStatus |= PE_EVNT_WAIT_FOR_DONE;
}
}
}
else
{
fSendMsg = FALSE;
}
}
}
break;
case PE_EVENT_DISCONTINUITY:
DBGPRINT(DBG_ON(DBG_VERBOSE), ("PbcEnginePEiStrmCtrlCallback: PE_EVENT_DISCONTINUITY\n"));
break;
case PE_EVENT_ASYNC_PREFILL:
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcEnginePEiStrmCtrlCallback: PE_EVENT_ASYNC_PREFILL\n"));
/* Send prefill complete msg to pbc msg queue. */
fSendMsg = TRUE;
tMsgType = PBCENGINE_MSGTYPE_PREFILL_COMPLETE;
ulData0 = ((PE_PREFILL_EVENT_INFO *)pEventInfo)->input;
break;
case PE_EVENT_VSYNC:
DBGPRINT(DBG_ON(DBG_VERBOSE), ("PbcEnginePEiStrmCtrlCallback: PE_EVENT_VSYNC\n"));
fSendMsg = FALSE;
/* update our PSRs */
tStatus = PbcPLCtrlUpdateLocation(hPBC, ((PE_VSYNC_EVENT_INFO *)pEventInfo)->time45k_vidpts);
break;
case PE_EVENT_ICS_VALID:
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcEnginePEiStrmCtrlCallback: PE_EVENT_ICS_VALID\n"));
if (pEventInfo != NULL)
{
/* Take register mutex semaphore */
OS_SemTake(hPBC->semRegisterMutex, OS_WAIT_FOREVER);
/* Beginning of an Interactive Composition Segment
* We need to return the current Button and Page to the IG Decoder */
PbcRegGetPSR(PLAYCTRL_PSR_SEL_BUTTON, &((PE_ICS_VALID_EVENT_INFO *)pEventInfo)->uiButtonPSR);
PbcRegGetPSR(PLAYCTRL_PSR_MENU_PAGE, &((PE_ICS_VALID_EVENT_INFO *)pEventInfo)->uiPagePSR);
/* Give register mutex semaphore */
OS_SemGive(hPBC->semRegisterMutex);
/* return success */
tStatus = PE_SUCCESS;
}
else
{
tStatus = PE_INVALID_PARAM;
}
break;
case PE_EVENT_ICS_INVALID:
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcEnginePEiStrmCtrlCallback: PE_EVENT_ICS_INVALID\n"));
/* clear the UO mask table */
hPBC->ICS_UO_mask_table = 0;
/* return success */
tStatus = PE_SUCCESS;
break;
case PE_EVENT_SELECT_PAGE:
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcEnginePEiStrmCtrlCallback: PE_EVENT_SELECT_PAGE\n"));
if (pEventInfo != NULL)
{
/* Take register mutex semaphore */
OS_SemTake(hPBC->semRegisterMutex, OS_WAIT_FOREVER);
/* store the UO mask table */
if (((PE_SELECT_PAGE_EVENT_INFO *)pEventInfo)->pUO_mask_table != NULL)
{
hPBC->ICS_UO_mask_table = *(uint64 *)(((PE_SELECT_PAGE_EVENT_INFO *)pEventInfo)->pUO_mask_table);
}
/* Set the Page PSR */
PbcRegSetPSR(PLAYCTRL_PSR_MENU_PAGE, ((PE_SELECT_PAGE_EVENT_INFO *)pEventInfo)->uiPageID);
/* We need to return the current Button to the IG Decoder */
PbcRegGetPSR(PLAYCTRL_PSR_SEL_BUTTON, &((PE_SELECT_PAGE_EVENT_INFO *)pEventInfo)->uiButtonPSR);
/* Give register mutex semaphore */
OS_SemGive(hPBC->semRegisterMutex);
/* return success */
tStatus = PE_SUCCESS;
}
else
{
tStatus = PE_INVALID_PARAM;
}
break;
case PE_EVENT_SELECT_BUTTON:
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcEnginePEiStrmCtrlCallback: PE_EVENT_SELECT_BUTTON\n"));
if (pEventInfo != NULL)
{
BYTE sound_id = ((PE_SELECT_BUTTON_EVENT_INFO *)pEventInfo)->ucSelectedStateSoundID;
/* Take register mutex semaphore */
OS_SemTake(hPBC->semRegisterMutex, OS_WAIT_FOREVER);
/* Set the Page PSR */
PbcRegSetPSR(PLAYCTRL_PSR_SEL_BUTTON, ((PE_SELECT_BUTTON_EVENT_INFO *)pEventInfo)->uiButtonID);
/* Give register mutex semaphore */
OS_SemGive(hPBC->semRegisterMutex);
/* play the sound sample if there is one
* NOTE: 0xff indicates there is no sound data for this button */
if (sound_id != 0xff)
{
/* Send prefill complete msg to pbc msg queue. */
fSendMsg = TRUE;
tMsgType = PBCENGINE_MSGTYPE_PLAY_BTN_SOUND;
ulData0 = sound_id;
}
/* return success */
tStatus = PE_SUCCESS;
}
else
{
tStatus = PE_INVALID_PARAM;
}
break;
case PE_EVENT_ACTIVATE_BUTTON:
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcEnginePEiStrmCtrlCallback: PE_EVENT_ACTIVATE_BUTTON\n"));
if (pEventInfo != NULL)
{
/* send event to the module manager */
if (hPBC->pCallback != NULL)
{
BYTE sound_id = ((PE_ACTIVATE_BUTTON_EVENT_INFO *)pEventInfo)->ucActivatedStateSoundID;
/* play the sound sample if there is one
* NOTE: 0xff indicates there is no sound data for this button */
if (sound_id != 0xff)
{
/* Send prefill complete msg to pbc msg queue. */
fSendMsg = TRUE;
tMsgType = PBCENGINE_MSGTYPE_PLAY_BTN_SOUND;
ulData0 = sound_id;
}
}
else
{
tStatus = PE_FAILURE;
}
}
else
{
tStatus = PE_INVALID_PARAM;
}
break;
case PE_EVENT_PROCESS_BOBJ:
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcEnginePEiStrmCtrlCallback: PE_EVENT_PROCESS_BOBJ\n"));
if (pEventInfo != NULL)
{
/* send event to the module manager */
if (hPBC->pCallback != NULL)
{
BOOLEAN isRunning;
BYTE sound_id = ((PE_ACTIVATE_BUTTON_EVENT_INFO *)pEventInfo)->ucActivatedStateSoundID;
/* The button object should not be processed until after sound finishes as
* per paragraph six section 8.8.4.6.5.3.5 */
while (sound_id != 0xff)
{
if (PLAYCTRL_SUCCESS != PlayCtrlAMGetSoundState(hPBC->iaudio_id, &isRunning))
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PlayCtrlAMGetSoundState: ERROR\n"));
break;
}
DBGPRINT(DBG_ON(DBG_TRACE), ("PlayCtrlAMGetSoundState: isRunning %d\n", isRunning));
if (TRUE != isRunning)
{
break;
}
OS_TaskDelayMsec(20);
}
/* Once sound has finished, going on processing the button object */
hPBC->pCallback(hPBC->pvCallbackContext, PLAYCTRL_EVENT_PROCESS_BOBJ, pEventInfo);
}
else
{
tStatus = PE_FAILURE;
}
}
else
{
tStatus = PE_INVALID_PARAM;
}
break;
case PE_EVENT_DECODE_DONE:
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcEnginePEiStrmCtrlCallback: PE_EVENT_DECODE_DONE\n"));
fSendMsg = TRUE;
tMsgType = PBCENGINE_MSGTYPE_DEC_DONE;
break;
case PE_EVENT_AM_LEVEL_CHG:
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcEnginePEiStrmCtrlCallback: PE_EVENT_AM_LEVEL_CHG\n"));
if (hPBC->pCallback != NULL)
{
/* send event to the module manager */
hPBC->pCallback(hPBC->pvCallbackContext, PLAYCTRL_EVENT_AM_LEVEL_CHANGE, pEventInfo);
}
break;
case PE_EVENT_AM_PANNING_CHG:
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcEnginePEiStrmCtrlCallback: PE_EVENT_AM_PANNING_CHG\n"));
if (hPBC->pCallback != NULL)
{
/* send event to the module manager */
hPBC->pCallback(hPBC->pvCallbackContext, PLAYCTRL_EVENT_AM_PANNING_CHANGE, pEventInfo);
}
break;
case PE_EVENT_AM_STOP_SOUND:
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcEnginePEiStrmCtrlCallback: PE_EVENT_AM_STOP_SOUND\n"));
if (hPBC->pCallback != NULL)
{
/* send event to the module manager */
hPBC->pCallback(hPBC->pvCallbackContext, PLAYCTRL_EVENT_AM_STOP_SOUND, pEventInfo);
}
break;
case PE_EVENT_AM_CLOSE_SOUND:
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcEnginePEiStrmCtrlCallback: PE_EVENT_AM_CLOSE_SOUND\n"));
if (hPBC->pCallback != NULL)
{
/* send event to the module manager */
hPBC->pCallback(hPBC->pvCallbackContext, PLAYCTRL_EVENT_AM_CLOSE_SOUND, pEventInfo);
}
break;
default:
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcEnginePEiStrmCtrlCallback: Unknown event\n"));
tStatus = PE_FAILURE;
break;
}
/*
* If message should be sent to PBC engine task, then send message.
*
* NOTE: We do not take the PBC semaphore since that could lead to
* a deadlock.
*/
if (fSendMsg == TRUE)
{
PBCENGINE_MESSAGE msg;
/* Load message parameters */
msg.tMsgType = tMsgType;
msg.hPbc = hPBC;
msg.ulData0 = ulData0;
msg.ulData1 = ulData1;
msg.ulData2 = ulData2;
msg.ulSemID = 0; /* pe callback is never a blocking call */
msg.pulRetVal = NULL;
/* Send message to be processed by the pbc engine task */
if (OS_MsgQSend(hPbcEngine->MsgQID, (char *)&msg, sizeof(PBCENGINE_MESSAGE), OS_NO_WAIT, OS_MSG_PRI_NORMAL) != OS_OK)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcEnginePEiStrmCtrlCallback: Failure sending message!\n"));
tStatus = PE_FAILURE;
}
}
return (tStatus);
}
PLAYCTRL_STATUS pbcEngineSendMessage(PBCENGINE_MSGTYPE tMsgType, PBC_HANDLE *hPBC, ULONG ulData0,
ULONG ulData1, ULONG ulData2, ULONG ulData3, ULONG ulSemID, ULONG* pulRetVal)
{
PBCENGINE_MESSAGE msg;
/* Load message parameters */
msg.tMsgType = tMsgType;
msg.hPbc = hPBC;
msg.ulData0 = ulData0;
msg.ulData1 = ulData1;
msg.ulData2 = ulData2;
msg.ulData3 = ulData3;
msg.ulSemID = ulSemID;
msg.pulRetVal = pulRetVal;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -