📄 o_playmode.c
字号:
{
BOOL bChangeMode = (pPlayMode->moParam.mwPlaymode != _GetPlayModeInCore());
if(bChangeMode)
{
if(PLAYMODE_PBC == pPlayMode->moParam.mwPlaymode)
CoreAPI_SetPBCMode(1);
else if(PLAYMODE_PROGRAM != pPlayMode->moParam.mwPlaymode)
{
if(CoreAPI_IsPBCOn())
{
CoreAPI_SetPBCMode(FALSE);
CoreAPI_ChangePlaybackMode();
}
if(PLAYMODE_NORMAL == pPlayMode->moParam.mwPlaymode)
CoreAPI_SetPlaybackMode(PM_PLAYBACK_NORMAL);
else if(PLAYMODE_SHUFFLE == pPlayMode->moParam.mwPlaymode)
{
CoreAPI_InitializeProgramList();
CoreAPI_SetPlaybackMode(PM_PLAYBACK_SHUFFLE);
}
}
}
if(PLAYMODE_PROGRAM == pPlayMode->moParam.mwPlaymode)
{
if(bSetProgramMode)
{
if(CoreAPI_IsPBCOn())
{
CoreAPI_SetPBCMode(FALSE);
CoreAPI_ChangePlaybackMode();
}
// if not playing should full stop to play program list
if(CoreAPI_IsResumeStop())
{
CoreAPI_Stop();
}
_SetCoreProgramList();
CoreAPI_SetPlaybackMode(PM_PLAYBACK_PROGRAM);
}
else if (0 == _GetUIProgramListSize())
{
if (!bChangeMode)
{
bChangeMode = TRUE;
CoreAPI_SetPlaybackMode(PM_PLAYBACK_NORMAL);
}
else//keep previous playmode
bChangeMode = FALSE;
}
}
if (bChangeMode)
CoreAPI_ChangePlaybackMode();
}
#endif//D_CUSTOM__SetPlayMode
#ifndef D_CUSTOM__GetPlayMode
//only return PBC, NORMAL, SHUFFLE, PROGRAM
//others return invalid value.
static UINT16 _GetPlayModeInCore(void)
{
if(CoreAPI_IsPBCOn())
return PLAYMODE_PBC;
else if(CoreAPI_IsNormalPlayback())
return PLAYMODE_NORMAL;
else if (CoreAPI_IsShufflePlayback())
return PLAYMODE_SHUFFLE;
else if (CoreAPI_IsProgramPlayback())
return PLAYMODE_PROGRAM;
//for other unsupport playmode return invalid
else return PLAYMODE_INVALID;
}
#endif//_GetPlayMode
/***************************************************************************************
* Function : _SetRepeat
*
* In : pPlayMode = Pointer to the MSO_PLAYMODE component.
*
* Out : None.
*
* Return : None.
*
* Desc : Set the repeat mode.
****************************************************************************************/
#ifndef D_CUSTOM__SetRepeat
static void _SetRepeat(MSO_PLAYMODE __NEAR* pPlayMode)
{
if(REPEAT_SINGLE == pPlayMode->moParam.mwRepeat)
CoreAPI_SetRepeatMode(PM_REPEAT_SINGLE);
else if(REPEAT_ALL == pPlayMode->moParam.mwRepeat)
CoreAPI_SetRepeatMode(PM_REPEAT_ALL);
else
CoreAPI_SetRepeatMode(PM_REPEAT_OFF);
}
#endif//D_CUSTOM__SetRepeat
/***************************************************************************************
* Function : _IsTrackEntryValid
*
* In : pProgramEntry = Pointer to a MSO_PROGRAM_ENTRY object.
*
* Out : None.
*
* Return : TRUE if the program entry is valid, otherwise returns FALSE.
*
* Desc : Checks if this program entry is valid. If invalid, the program entry is cleared.
****************************************************************************************/
#ifndef D_CUSTOM__IsTrackEntryValid
STATIC BOOL _IsTrackEntryValid(MSO_PROGRAM_ENTRY __NEAR* pProgramEntry)
{
if(NULL != pProgramEntry)
{
if((pProgramEntry->moParam.mwValue > CoreAPI_GetTotalChapterTrackNum(0)) || (pProgramEntry->moParam.mwValue < 1))
{
pProgramEntry->moParam.mwValue = INVALID_TRACK;
MS_SendOperation((MSO_OBJECT __NEAR*)pProgramEntry, MS_OP_BUILD_TEXT_STRING, (UINT32)pProgramEntry->moParam.mwValue);
MS_DisplayAddObject((MSO_OBJECT __NEAR*)pProgramEntry);
return FALSE;
}
else
return TRUE;
}
return FALSE;
}
#endif//D_CUSTOM__IsTrackEntryValid
/**********************************************************************************
* Name : _IsTitleChapterValid
*
* Purpose : Check whether the title num and the chapter num are in the range.
*
* Input : wTitleNum = group/title number
* wChapterNum = track/chapter number
*
* Return Value : TRUE: The title num and the chapter num are in the range. FALSE: The title num and the chapter num are out of the range.
*
* Description : refer to purpose
*
* Comments : None.
*
**********************************************************************************/
#ifndef D_CUSTOM__IsTitleChapterValid
STATIC BOOL _IsTitleChapterValid(MSO_DVD_PROGRAM_ENTRY __NEAR* pProgramEntry)
{
if(NULL != pProgramEntry)
{
if((pProgramEntry->moParam.mwTitle < 1) ||(pProgramEntry->moParam.mwTitle > CoreAPI_GetTotalTitleGroupNum()))
{
MSO_OBJECT __NEAR* pObject = MS_FindDescendant((MSO_OBJECT __NEAR*)pProgramEntry, &oProgramTitleEntryDescriptor);
pProgramEntry->moParam.mwTitle = INVALID_TRACK;
MS_SendOperation(pObject, MS_OP_BUILD_TEXT_STRING, (UINT32)pProgramEntry->moParam.mwTitle);
MS_DisplayAddObject(pObject);
return FALSE;
}
else
{
if((pProgramEntry->moParam.mwChapter < 1) || (pProgramEntry->moParam.mwChapter > CoreAPI_GetTotalChapterTrackNum(pProgramEntry->moParam.mwTitle)))
{
MSO_OBJECT __NEAR* pObject = MS_FindDescendant((MSO_OBJECT __NEAR*)pProgramEntry, &oProgramChapterEntryDescriptor);
pProgramEntry->moParam.mwChapter = INVALID_TRACK;
MS_SendOperation(pObject, MS_OP_BUILD_TEXT_STRING, (UINT32)pProgramEntry->moParam.mwChapter);
MS_DisplayAddObject(pObject);
return FALSE;
}
}
return TRUE;
}
return FALSE;
}
#endif//D_CUSTOM__IsTitleChapterValid
/***************************************************************************************
* Operation functions
****************************************************************************************/
/***************************************************************************************
* Function : _ClearProgramButtonOperation
*
* In :
*
* Out :
*
* Desc : The Clear Program button operation function.
****************************************************************************************/
#ifndef D_CUSTOM__ClearProgramButtonOperation
STATIC MS_OP _ClearProgramButtonOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
// Pre-processing.
switch(MsOp)
{
case MS_OP_ENTER:
{
MSO_PLAYMODE __NEAR* pPorgramKit = (MSO_PLAYMODE __NEAR*)MS_FindAncestor(pThis, &oPlaymodeDescriptor);
if(PLAYMODE_PROGRAM != pPorgramKit->moParam.mwPlaymode)
{
PROHIBIT(MSG_PROHIBIT_INVALID_OPERATION);
break;
}
if(_GetUIProgramListSize())
{
MSO_VLIST __NEAR* pList = (MSO_VLIST __NEAR*)MS_FindAncestor(pThis, &oProgramVListDescriptor);
// Clear the program list.
OPLAYMODE_ClearUIProgramList();
pList->moParam.mwFirstDisplayItem = 0; // CHECK !!!
}
//for DVD if only set title or chapter we should also clear it.
// Send a refresh to all the objects within the playmode component.
MS_SEND_OP_OBJECT(pPorgramKit, MS_OP_REFRESH, 0);
}
break;
default:
break;
}
return OBUTTON_Operation(pThis, MsOp, lParam);
}
#endif//D_CUSTOM__ClearProgramButtonOperation
/***************************************************************************************
* Function : _PlayProgramButtonOperation
*
* In :
*
* Out :
*
* Desc : The Play Program button operation function.
****************************************************************************************/
#ifndef D_CUSTOM__PlayProgramButtonOperation
STATIC MS_OP _PlayProgramButtonOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
// Pre-processing.
if(MS_OP_ENTER == MsOp)
{
MSO_PLAYMODE __NEAR* pPorgramKit = (MSO_PLAYMODE __NEAR*)MS_FindAncestor(pThis, &oPlaymodeDescriptor);
if(PLAYMODE_PROGRAM != pPorgramKit->moParam.mwPlaymode)
{
MsOp = MS_OP_NONE;
PROHIBIT(MSG_PROHIBIT_INVALID_OPERATION);
}
}
return OBUTTON_Operation(pThis, MsOp, lParam);
}
#endif//D_CUSTOM__PlayProgramButtonOperation
/***************************************************************************************
* Function : _PlaymodeOperation
*
* In :
*
* Out :
*
* Desc : MSO_PLAYMODE user operation function.
****************************************************************************************/
#ifndef D_CUSTOM__PlaymodeOperation
STATIC MS_OP _PlaymodeOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
switch(MsOp)
{
case MS_OP_OPEN:
{
if(PST_STOP == CoreAPI_GetPlayState())
{
// Create and add the program list.
MS_CreateAndAddObject((MS_DESCRIPTOR*)&oProgramListDescriptor, (MSO_CONTAINER __NEAR*)pThis);
}
}
break;
case MS_OP_INIT:
{
MSO_PLAYMODE __NEAR* pPlayMode = (MSO_PLAYMODE __NEAR*)pThis;
MSO_OBJECT __NEAR* pProgramList = MS_FindDescendant(pThis, &oProgramListDescriptor);
if(CoreAPI_IsPBCOn())
pPlayMode->moParam.mwPlaymode = PLAYMODE_PBC;
else if(CoreAPI_IsShufflePlayback())
pPlayMode->moParam.mwPlaymode = PLAYMODE_SHUFFLE;
else if(CoreAPI_IsProgramPlayback())
pPlayMode->moParam.mwPlaymode = PLAYMODE_PROGRAM;
else if(CoreAPI_IsNormalPlayback())
pPlayMode->moParam.mwPlaymode = PLAYMODE_NORMAL;
if(CoreAPI_IsRepeatSingle())
pPlayMode->moParam.mwRepeat = REPEAT_SINGLE;
else if(CoreAPI_IsRepeatFolderOrALL())
pPlayMode->moParam.mwRepeat = REPEAT_ALL;
else
pPlayMode->moParam.mwRepeat = REPEAT_OFF;
MS_SEND_OP_OBJECT(pProgramList, MS_OP_REFRESH, 0);
MS_ComponentInitFocus((MSO_COMPONENT __NEAR*)pThis);
}
break;
default:
break;
}
MsOp = MS_ComponentBasicOperation(pThis, MsOp, lParam);
switch(MsOp)
{
case MS_OP_EJECT: // Fall through !!!
case MS_OP_REPEAT: // Fall through !!!
case MS_OP_SKIPF: // Fall through !!!
case MS_OP_SKIPB: // Fall through !!!
case MS_OP_LR: // Fall through !!!
case MS_OP_KARAOKE: // Fall through !!!
case MS_OP_PLAY: // Fall through !!!
case MS_OP_STOP: // Fall through !!!
case MS_OP_SLOWF: // Fall through !!!
case MS_OP_SLOWB: // Fall through !!!
case MS_OP_FASTF: // Fall through !!!
case MS_OP_FASTB: // Fall through !!!
case MS_OP_PAUSE: // Fall through !!!
case MS_OP_MARKAB: // Fall through !!!
case MS_OP_PLAY_MODE: // Fall through !!!
case MS_OP_TITLE: // Fall through !!!
case MS_OP_MENU: // Fall through !!!
case MS_OP_PBC:
{
// Set the program mode and store the program list if the playmode component is closed by pressing either the PLAY or MODE keys.
BOOL bSetProgramMode =( ((MS_OP_PLAY == MsOp) || (MS_OP_PLAY_MODE == MsOp)) &&( _GetUIProgramListSize())) ? TRUE : FALSE;
_SetPlayMode((MSO_PLAYMODE __NEAR*)pThis, bSetProgramMode);
_SetRepeat((MSO_PLAYMODE __NEAR*)pThis);
MS_SendOperation(pThis, MS_OP_CLOSE_PARENT, 0);
if(MS_OP_PLAY_MODE == MsOp
||(MS_OP_PLAY == MsOp
&& ((PLAYMODE_PROGRAM == ((MSO_PLAYMODE __NEAR*)pThis)->moParam.mwPlaymode && 0 == _GetUIProgramListSize())
//avoid prohibit message when press Play key to close the component
||PST_PLAY == CoreAPI_GetPlayState())
)
)
{
MsOp = MS_OP_NONE;
}
break;
}
default:
break;
}
return MsOp;
}
#endif//D_CUSTOM__PlaymodeOperation
/***************************************************************************************
* Function : _PlaymodeKitOperation
*
* In :
*
* Out :
*
* Desc : The Playmode kit operation function.
****************************************************************************************/
#ifndef D_CUSTOM__PlaymodeKitOperation
#pragma argsused
STATIC MS_OP _PlaymodeKitOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
//Pre-processing
switch(MsOp)
{
case MS_OP_OPEN:
{
// Resize the Playmode kit.
if(PST_STOP == CoreAPI_GetPlayState())
pThis->moArea.mwW = AREA_PLAYMODE_STOP_W;
}
break;
default:
break;
}
MsOp = VScrollListOperation(pThis, MsOp, lParam);
// Post-processing
switch(MsOp)
{
case MS_OP_REFRESH:
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -