📄 pe_istreamctrl_interface.cpp
字号:
}
switch (pButton->button_cmd)
{
case BTN_DISABLE:
status = peiStrmSendMessage( ((PEHANDLE *)handle)->iStreamCtrl, PE_SEND_DVD_BUTTON_CMD, BTN_DISABLE, 0, 0, 0, 0, PE_ASYNC);
break;
case BTN_ENABLE:
status = peiStrmSendMessage( ((PEHANDLE *)handle)->iStreamCtrl, PE_SEND_DVD_BUTTON_CMD, BTN_ENABLE,
pButton->color_info, ( (pButton->start_x << 16) | pButton->end_x ), ( (pButton->start_y << 16) | pButton->end_y ), 0, PE_ASYNC);
break;
case BTN_REFRESH:
status = peiStrmSendMessage( ((PEHANDLE *)handle)->iStreamCtrl, PE_SEND_DVD_BUTTON_CMD, BTN_REFRESH, 0, 0, 0, 0, PE_ASYNC);
break;
default:
status = PE_INVALID_PARAM;
break;
}
return (status);
}
/**
* Enable, Disable, and Refresh HDDVD button highlights.
*
* @param handle - iStrmCtrl handle.
* @param pButton - Describes button to be highlighted.
*
* @return PE_STATUS - Error code.
*/
PE_STATUS PEiStreamCtrlSendHDDVDButtonCmd(PE_HANDLE handle, PE_ISTREAMCTRL_HDDVD_BUTTON *pButton)
{
PE_STATUS status;
/* verify input */
if (NULL == handle)
{
return (PE_INVALID_HANDLE);
}
switch (pButton->button_cmd)
{
case BTN_DISABLE:
status = peiStrmSendMessage( ((PEHANDLE *)handle)->iStreamCtrl, PE_SEND_HDDVD_BUTTON_CMD, BTN_DISABLE, 0, 0, 0, 0, PE_ASYNC);
break;
case BTN_ENABLE:
status = peiStrmSendMessage( ((PEHANDLE *)handle)->iStreamCtrl, PE_SEND_HDDVD_BUTTON_CMD, BTN_ENABLE,
(unsigned int)pButton->color_info, ( (pButton->start_x << 16) | pButton->end_x ), ( (pButton->start_y << 16) | pButton->end_y ), 0, PE_ASYNC);
break;
case BTN_REFRESH:
status = peiStrmSendMessage( ((PEHANDLE *)handle)->iStreamCtrl, PE_SEND_HDDVD_BUTTON_CMD, BTN_REFRESH, 0, 0, 0, 0, PE_ASYNC);
break;
default:
status = PE_INVALID_PARAM;
break;
}
return (status);
}
/**
* Send commands to the Interactive Graphics Decoder.
*
* @param handle - iStrmCtrl handle.
* @param pIGParam - Describes the command to be sent.
*
* @return PE_STATUS - Error code.
*/
PE_STATUS PEiStreamCtrlSendIGCmd(PE_HANDLE handle, PE_ISTREAMCTRL_IG_PARAM *pIGParam)
{
/* verify input */
if (NULL == handle)
{
return (PE_INVALID_HANDLE);
}
/* NOTE: we are always sending pg_id and flags as the second and third parameters,
* even though they are only used for SetButtonPage commands
* This is just done to avoid a bunch of extra logic */
/* Send command to iStrmCtrl command task to be processed */
return ( peiStrmSendMessage( ((PEHANDLE *)handle)->iStreamCtrl, PE_SEND_IG_CMD,
pIGParam->cmd, pIGParam->btn_number_id, pIGParam->pg_id, pIGParam->flags, 0, PE_ASYNC) );
}
/**
* PEiStreamCtrlGetIGUserInterfaceModel -- Return the UI Model for the current IG ICS.
*
* @param handle - iStrmCtrl handle.
* @param pUIModel - receives the information
*
* @retval
* PE_SUCCESS - returned information is valid
* PE_FAILURE - returned information is NOT valid
*/
PE_STATUS PEiStreamCtrlGetIGUserInterfaceModel(PE_HANDLE handle, PE_IG_UI_MODEL *pUIModel)
{
ISTREAMCTRLHANDLE *pStrmCtrl = NULL;
PE_STATUS status = PE_FAILURE;
#if BDROM_ENABLE
uint8 uiStreamAndUIModel;
#endif
/* verify input */
if (NULL == handle)
{
return (PE_INVALID_HANDLE);
}
/* get the iStreamCtrl handle */
pStrmCtrl = ((PEHANDLE *)handle)->iStreamCtrl;
#if BDROM_ENABLE
/* only possible for blu-ray content */
if (pStrmCtrl->StreamType == STREAM_TYPE_MPEG2_BDTS)
{
if (IGGetStreamAndUIModel(pStrmCtrl->m_decoders.ig_dec, &uiStreamAndUIModel) == IG_STATUS_SUCCESS)
{
if ( (uiStreamAndUIModel & 0x40) == 0 )
{
*pUIModel = PE_IG_UI_MODEL_ALWAYS_ON;
}
else
{
*pUIModel = PE_IG_UI_MODEL_POPUP;
}
status = PE_SUCCESS;
}
}
#endif
return (status);
}
/**
* PEiStreamCtrlIsPopupOn -- Return the Popup Menu On/Off State.
*
* @param handle - iStrmCtrl handle.
*
* @retval
* FALSE - Pop up is OFF
* TRUE - Pop up is ON
*/
BOOLEAN PEiStreamCtrlIsPopupOn(PE_HANDLE handle)
{
ISTREAMCTRLHANDLE *pStrmCtrl;
/* verify input */
if (NULL == handle)
{
return (FALSE);
}
/* get the iStreamCtrl handle */
pStrmCtrl = ((PEHANDLE *)handle)->iStreamCtrl;
/* only possible for blu-ray content */
if (pStrmCtrl->StreamType != STREAM_TYPE_MPEG2_BDTS)
{
return (FALSE);
}
#if BDROM_ENABLE
return ( IGIsPopupOn(pStrmCtrl->m_decoders.ig_dec) );
#else
return ( FALSE );
#endif
}
/**
* Check if there is an IG button currently selected.
*
* @param handle - iStrmCtrl handle.
*
* @retval
* FALSE - No button in the selected state.
* TRUE - A button is in the selected state.
*/
BOOLEAN PEiStreamCtrlIsButtonSelected(PE_HANDLE handle)
{
ISTREAMCTRLHANDLE *pStrmCtrl;
/* verify input */
if (NULL == handle)
{
return (FALSE);
}
/* get the iStreamCtrl handle */
pStrmCtrl = ((PEHANDLE *)handle)->iStreamCtrl;
/* only possible for blu-ray content */
if (pStrmCtrl->StreamType != STREAM_TYPE_MPEG2_BDTS)
{
return (FALSE);
}
#if BDROM_ENABLE
return ( IGIsButtonSelected(pStrmCtrl->m_decoders.ig_dec) );
#else
return ( FALSE );
#endif
}
/**
* Enable or disable closed caption processing.
*
* @param handle - iStrmCtrl handle.
* @param fEnableClosedCaption - BOOLEAN to enable/disable CC.
*
* @return PE_STATUS - Error code.
*/
PE_STATUS PEiStreamCtrlSetClosedCaption(PE_HANDLE handle, BOOLEAN fEnableClosedCaption)
{
/* verify input */
if (NULL == handle)
{
return (PE_INVALID_HANDLE);
}
return (peiStrmSendMessage( ((PEHANDLE *)handle)->iStreamCtrl, PE_SET_CLOSED_CAPTION, fEnableClosedCaption, 0, 0, 0, 0, PE_ASYNC));
}
/**
* Returns the current state of closed caption processing.
*
* @param handle - iStrmCtrl handle.
* @param pfEnableClosedCaption - Pointer to retuned BOOLEAN indicating CC state.
*
* @return PE_STATUS - Error code.
*/
PE_STATUS PEiStreamCtrlGetClosedCaption(PE_HANDLE handle, BOOLEAN *pfEnableClosedCaption)
{
/* verify input */
if (NULL == handle)
{
return (PE_INVALID_HANDLE);
}
return (peiStrmSendMessage( ((PEHANDLE *)handle)->iStreamCtrl, PE_GET_CLOSED_CAPTION, (ULONG)pfEnableClosedCaption, 0, 0, 0, 0, PE_SYNC));
}
/**
* Returns the current video PTS.
*
* @param handle - iStrmCtrl handle.
* @param pTime45k_PTS - receives the current video PTS value.
* @param pTime45k_STC - receives the current system clock value.
*
* @return PE_STATUS - Error code.
*/
PE_STATUS PEiStreamCtrlGetVidPTS(PE_HANDLE handle, TIME45k* pTime45k_PTS, TIME45k* pTime45k_STC)
{
VDVD_ERROR error = VDVD_SUCCESS;
ISTREAMCTRLHANDLE* iStrmCtrl = NULL;
ICONFIGUREHANDLE* iConfigure = NULL;
DECODE_STATUS_TYPE dstatus;
/* verify input */
if (NULL == handle)
{
return (PE_INVALID_HANDLE);
}
if (NULL == pTime45k_PTS)
{
return (PE_NULL_POINTER);
}
if (NULL == pTime45k_STC)
{
return (PE_NULL_POINTER);
}
iStrmCtrl = ((PEHANDLE *)handle)->iStreamCtrl;
DbgAssert(iStrmCtrl);
iConfigure = ((PEHANDLE *)handle)->iConfigure;
DbgAssert( iConfigure != NULL );
error = iConfigure->primaryDecoder->GetStatus( &dstatus );
if ( VDVD_IS_ERROR(error) )
{
DBGPRINT(DBG_ON(DBG_ERROR), ("%s(%d): Decode GetStatus\n", __FUNCTION__, __LINE__));
return (PE_FAILURE);
}
/* return pts & scr */
*pTime45k_PTS = (uint32)dstatus.video_pts;
*pTime45k_STC = (uint32)dstatus.video_stc;
return (PE_SUCCESS);
}
/**
* Returns the current SCR.
*
* @param handle - iStrmCtrl handle.
* @param pTime45k_STC - receives the current system clock value.
*
* @return PE_STATUS - Error code.
*/
PE_STATUS PEiStreamCtrlGetSCR(PE_HANDLE handle, TIME45k* pTime45k_STC)
{
VDVD_ERROR error = VDVD_SUCCESS;
ISTREAMCTRLHANDLE* iStrmCtrl = NULL;
ICONFIGUREHANDLE* iConfigure = NULL;
DECODE_STATUS_TYPE dstatus;
/* verify input */
if (NULL == handle)
{
return (PE_INVALID_HANDLE);
}
if (NULL == pTime45k_STC)
{
return (PE_NULL_POINTER);
}
iStrmCtrl = ((PEHANDLE *)handle)->iStreamCtrl;
DbgAssert(iStrmCtrl);
iConfigure = ((PEHANDLE *)handle)->iConfigure;
DbgAssert( iConfigure != NULL );
error = iConfigure->primaryDecoder->GetStatus( &dstatus );
if ( VDVD_IS_ERROR(error) )
{
DBGPRINT(DBG_ON(DBG_ERROR), ("%s(%d): Decode GetStatus\n", __FUNCTION__, __LINE__));
return (PE_FAILURE);
}
*pTime45k_STC = dstatus.video_stc;
return (PE_SUCCESS);
}
/*
* PRIVATE FUNCTIONS
********************************************/
static PE_STATUS peiStrmSendMessage(ISTREAMCTRLHANDLE *iStrmCtrl, ISTREAMCTRL_MESSAGE message_id,
ULONG ulData0, ULONG ulData1, ULONG ulData2, ULONG ulData3, ULONG ulData4, BOOLEAN fSynchronous)
{
PE_MESSAGE *pMessage = NULL;
PE_STATUS status;
static BYTE bSemOffset = 0;
BYTE bLocalSemOffset;
DbgAssert(iStrmCtrl);
DbgAssert(iStrmCtrl->pMsgQ);
DbgAssert(iStrmCtrl->msgQSem);
/* Grab an empty message from the queue */
pMessage = (PE_MESSAGE *)iStrmCtrl->pMsgQ->GetMsg(OS_WAIT_FOREVER);
if (pMessage == NULL)
{
return (PE_FAILURE);
}
/* Determine which semaphore to use */
OS_SemTake(iStrmCtrl->sendMsgSem, OS_WAIT_FOREVER);
bSemOffset = (bSemOffset + 1) % (PE_NUM_SEMS);
bLocalSemOffset = bSemOffset;
OS_SemGive(iStrmCtrl->sendMsgSem);
/* Copy the given message into the empty message */
pMessage->ulMsgID = message_id;
pMessage->ulData0 = ulData0;
pMessage->ulData1 = ulData1;
pMessage->ulData2 = ulData2;
pMessage->ulData3 = ulData3;
pMessage->ulData4 = ulData4;
if (fSynchronous == TRUE)
{
pMessage->ulSemID = iStrmCtrl->msgQSem[bLocalSemOffset];
pMessage->ulRetVal = (ULONG)&status;
}
/* Send the new message */
if (iStrmCtrl->pMsgQ->Write( (PVOID)pMessage ) == OS_OK)
{
if (fSynchronous == TRUE)
{
/* wait for the command to complete */
OS_SemTake(iStrmCtrl->msgQSem[bLocalSemOffset],OS_WAIT_FOREVER);
}
else
{
status = PE_SUCCESS;
}
}
else
{
iStrmCtrl->pMsgQ->ReleaseMsg(pMessage);
status = PE_FAILURE;
}
return (status);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -