📄 pbc_pbscenario.cpp
字号:
* when we get the first vsync and send a playmark change event, even if we haven't
* change playmarks. There was a test on JTD300 that was failing because we were not
* sending a PlaybackMarkEvent when we linked to the same mark we were already on, so
* this change will allow the test to pass.
*/
hPBC->usCurPLMarkID = 0xffff;
}
else
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioLinkMark: specified entry mark not found!\n"));
return (PLAYCTRL_FAILURE);
}
return (PLAYCTRL_SUCCESS);
}
/**
* PbcPbScenarioPlayPLTime -- Start playback of playlist at specified time
*
* @param
* hPBC -- handle to playback control engine private data
* data1 -- playlist number
* data2 -- time into title (in seconds)
* data3 -- indicates user op or navigation command
*
* @retval
* PLAYCTRL_STATUS
*/
PLAYCTRL_STATUS PbcPbScenarioPlayPLTime(PBC_HANDLE *hPBC, ULONG data1, ULONG data2, ULONG data3)
{
uint32 uiPlaylistID = data1;
uint32 uiTime = data2;
BOOLEAN fIsUserOp = (BOOLEAN)(data3);
PLAYITEM *pPlayitem = NULL;
APPINFOPLAYLIST_TABLE *pAppInfoPL = NULL;
UBYTE ubRandomShuffle = 0xff;
uint16 uiNumPlayitems;
uint32 uiPlayitemID;
uint32 uiCurrentPlayitem;
uint32 uiTimeCount;
uint32 uiTimeDiff;
uint32 uiLastPlaylistID;
BOOLEAN fNewPlaylist;
PE_ISTREAMCTRL_STATE tPEState;
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcPbScenarioPlayPLTime: ENTER\n"));
/* check for valid handle */
if (hPBC == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioPlayPLTime: NULL handle!\n"));
return (PLAYCTRL_NULL_POINTER);
}
/* If playlist playback is active, stop playback */
if (hPBC->tState != PLAYCTRL_STATE_STOP)
{
/* stop the playlist */
if (PbcPLCtrlStopPL(hPBC, TRUE) != PLAYCTRL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioPlayPLTime: Failed to stop playlist\n"));
return (PLAYCTRL_FAILURE);
}
/* enter stop state */
hPBC->tState = PLAYCTRL_STATE_STOP;
}
/* Load the Movie Playlist Database */
if (MPLSLoad(uiPlaylistID) != MPLS_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioPlayPLTime: Could not parse playlist\n"));
return (PLAYCTRL_FAILURE);
}
/* Get number of playitems */
if (MPLSGetNumberOfPlayItems(&uiNumPlayitems) != MPLS_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioPlayPLTime: Failed to get number of playitems!\n"));
return (PLAYCTRL_FAILURE);
}
/* Search for playitem containing time to search to */
uiTimeCount = 0;
uiTimeDiff = 0;
uiPlayitemID = INVALID_PLAYITEM;
for (uint16 i = 0; i < uiNumPlayitems; i++)
{
/* Get the playitem info */
if (MPLSGetPlayItem(i, &pPlayitem) != MPLS_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioPlayPLTime: Failed to get playitem info\n"));
return (PLAYCTRL_FAILURE);
}
/* increment time count */
uiTimeDiff = uiTime - uiTimeCount;
uiTimeCount += (pPlayitem->OUT_time - pPlayitem->IN_time) / 45000;
/* if time to search to is in playitem range, then playitem is found */
if (uiTime < uiTimeCount)
{
uiPlayitemID = i;
break;
}
}
if (uiPlayitemID != INVALID_PLAYITEM)
{
PLAYLISTMARK_TABLE *pPLMark = NULL;
/* Get playlist info */
if (MPLSGetAppInfo(&pAppInfoPL) != MPLS_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioPlayPLTime: Failed to get playlist info!\n"));
return (PLAYCTRL_FAILURE);
}
/* If playlist is random/shuffle playback type, then initialize random/shuffle status */
if ( (pAppInfoPL->PlayList_playback_type == MPLS_RANDOM_PLAYLIST) ||
(pAppInfoPL->PlayList_playback_type == MPLS_SHUFFLE_PLAYLIST) )
{
/* Time Search UO is not allowed during random/shuffle playback */
if (fIsUserOp == TRUE)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioPlayPLTime: Time Search not allowed!\n"));
return (PLAYCTRL_FAILURE);
}
/* If playback count is 0, no playitems should be played */
if (pAppInfoPL->playback_count == 0)
{
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcPbScenarioPlayPLTime: Random/shuffle playback count is 0!\n"));
return (PLAYCTRL_SUCCESS);
}
else
{
PbcPLCtrlInitRandomShuffle();
ubRandomShuffle = 0;
}
}
/* Get PSR for current playitem id */
PbcRegGetPSR(PLAYCTRL_PSR_PLAYITEM, &uiCurrentPlayitem);
/* Pull out current playitem id from PSR value */
uiCurrentPlayitem &= 0x0000ffff;
/* Get playlist mark from database */
if (MPLSGetPlayMark(&pPLMark) != MPLS_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioPlayPLTime: Failed to get playlist mark!\n"));
return (PLAYCTRL_FAILURE);
}
/* Get ID of last playlist to be played */
PbcRegGetPSR(PLAYCTRL_PSR_PLAYLIST, &uiLastPlaylistID);
/* Get the PE run state */
PEiStreamCtrlGetState(hPBC->hPE, &tPEState);
/* Determine if this is a new playlist */
fNewPlaylist = (uiLastPlaylistID != uiPlaylistID) || (tPEState != PE_ISTREAMCTRL_STATE_RUN);
/*
* If this is UO and the playitem's random access flag is set, then cannot allow access into
* the playitem and must start from the beginning of the playitem.
*/
if ( (fIsUserOp == TRUE) && (pPlayitem->PlayItem_random_access_flag == 1) )
{
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcPbScenarioPlayPLTime: Playitem Random Access flag is set, so playing from beginning of playitem!\n"));
/*
* Start the playlist at the beginning of the playitem
*/
if (PbcPLCtrlStartPL(hPBC, uiPlaylistID, (uint16)(uiPlayitemID), pPlayitem->IN_time, ubRandomShuffle, fNewPlaylist) != PLAYCTRL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioPlayPLTime: pbcpbscenarioPlayPL() FAILED!\n"));
return (PLAYCTRL_FAILURE);
}
}
else
{
/*
* Start the playlist at the specified time in the playitem.
*/
if (PbcPLCtrlStartPL(hPBC, uiPlaylistID, (uint16)(uiPlayitemID), (pPlayitem->IN_time + (uiTimeDiff * 45000) ),
ubRandomShuffle, fNewPlaylist) != PLAYCTRL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioPlayPLTime: pbcpbscenarioPlayPL() FAILED!\n"));
return (PLAYCTRL_FAILURE);
}
}
/* Update Playback Control Engine State */
hPBC->tState = PLAYCTRL_STATE_PLAY;
}
else
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioPlayPLTime: Time out of range of title!\n"));
return (PLAYCTRL_FAILURE);
}
return (PLAYCTRL_SUCCESS);
}
/**
* PbcPbScenarioLinkTime -- Change playback position to the specified title time.
*
* @param
* hPBC -- handle to playback control engine private data
* data1 -- title time (seconds)
* data2 -- indicates user op or navigation command
* data3 -- not used
*
* @retval
* PLAYCTRL_STATUS
*/
PLAYCTRL_STATUS PbcPbScenarioLinkTime(PBC_HANDLE *hPBC, ULONG data1, ULONG data2, ULONG data3)
{
uint32 uiTime = data1;
BOOLEAN fIsUserOp = (BOOLEAN)(data2);
PLAYITEM *pPlayitem = NULL;
APPINFOPLAYLIST_TABLE *pAppInfoPL = NULL;
uint16 uiNumPlayitems;
uint32 uiPlayitemID;
uint32 uiTimeCount;
uint32 uiTimeDiff;
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcPbScenarioLinkTime: ENTER\n"));
/* check for valid handle */
if (hPBC == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioLinkTime: NULL handle!\n"));
return (PLAYCTRL_NULL_POINTER);
}
/* Check that playback is active */
if (hPBC->tState == PLAYCTRL_STATE_STOP)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioLinkTime: Playback is stopped!\n"));
return (PLAYCTRL_FAILURE);
}
/* Get number of playitems */
if (MPLSGetNumberOfPlayItems(&uiNumPlayitems) != MPLS_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioLinkTime: Failed to get number of playitems!\n"));
return (PLAYCTRL_FAILURE);
}
/* Search for playitem containing time to search to */
uiTimeCount = 0;
uiTimeDiff = 0;
uiPlayitemID = INVALID_PLAYITEM;
for (uint16 i = 0; i < uiNumPlayitems; i++)
{
/* Get the playitem info */
if (MPLSGetPlayItem(i, &pPlayitem) != MPLS_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioLinkTime: Failed to get playitem info\n"));
return (PLAYCTRL_FAILURE);
}
/* increment time count */
uiTimeDiff = uiTime - uiTimeCount;
uiTimeCount += (pPlayitem->OUT_time - pPlayitem->IN_time) / 45000;
/* if time to search to is in playitem range, then playitem is found */
if (uiTime < uiTimeCount)
{
uiPlayitemID = i;
break;
}
}
if (uiPlayitemID != INVALID_PLAYITEM)
{
/* Get playlist info */
if (MPLSGetAppInfo(&pAppInfoPL) != MPLS_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioLinkTime: Failed to get playlist info!\n"));
return (PLAYCTRL_FAILURE);
}
/* Time Search UO is not allowed during random/shuffle playback */
if ( ( (pAppInfoPL->PlayList_playback_type == MPLS_RANDOM_PLAYLIST) ||
(pAppInfoPL->PlayList_playback_type == MPLS_SHUFFLE_PLAYLIST) ) &&
(fIsUserOp == TRUE) )
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioLinkTime: Time Search not allowed!\n"));
return (PLAYCTRL_FAILURE);
}
/*
* If this is UO and the playitem's random access flag is set, then cannot allow access into
* the playitem and must start from the beginning of the playitem.
*/
if ( (fIsUserOp == TRUE) && (pPlayitem->PlayItem_random_access_flag == 1) )
{
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcPbScenarioLinkTime: Playitem Random Access flag is set, so playing from beginning of playitem!\n"));
/*
* Start the playlist at the beginning of the playitem
*/
if (pbcpbscenarioLink(hPBC, uiPlayitemID, pPlayitem->IN_time, 0) != PLAYCTRL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioLinkTime: pbcpbscenarioLink() FAILED!\n"));
return (PLAYCTRL_FAILURE);
}
}
else
{
/*
* Start the playlist at the specified time in the playitem.
*/
if (pbcpbscenarioLink(hPBC, uiPlayitemID, (pPlayitem->IN_time + (uiTimeDiff * 45000) ), 0) != PLAYCTRL_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioLinkTime: pbcpbscenarioLink() FAILED!\n"));
return (PLAYCTRL_FAILURE);
}
}
}
else
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioLinkTime: Time out of range of title!\n"));
return (PLAYCTRL_FAILURE);
}
return (PLAYCTRL_SUCCESS);
}
/**
* PbcPbScenarioStop -- Terminate playback of a playlist.
*
* @param
* hPBC -- handle to playback control engine private data
* data1 -- not used
* data2 -- not used
* data3 -- not used
*
* @retval
* PLAYCTRL_STATUS
*/
PLAYCTRL_STATUS PbcPbScenarioStop(PBC_HANDLE *hPBC, ULONG data1, ULONG data2, ULONG data3)
{
DBGPRINT(DBG_ON(DBG_TRACE), ("PbcPbScenarioStop: ENTER\n"));
/* check for valid handle */
if (hPBC == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("PbcPbScenarioStop: NULL handle!\n"));
return (PLAYCTRL_NULL_POINTER);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -