📄 o_aux_subtitleselection.c
字号:
case MS_OP_EMPTY:
if(NULL_HANDLE != ((MSO_LISTITEM __NEAR*)pThis)->moParam.mwData)
{
OSDR_FreeScFormUniStr(((MSO_LISTITEM __NEAR*)pThis)->moParam.mwData);
((MSO_LISTITEM __NEAR*)pThis)->moParam.mwData = NULL_HANDLE;
}
break;
case MS_OP_FOCUS_CHANGE:
MS_DisplayAddObject(pThis);
break;
case MS_OP_PLAY:
case MS_OP_ENTER:
case MS_OP_CLEAR:
if (MS_OP_CLEAR == MsOp)
_SelectExtSubtFile(pThis, 0);
else
_SelectExtSubtFile(pThis, 1);
return MS_OP_SUBT_SELECTION_FINISHED;//MS_OP_PLAY_AFTER_DIVX_SUBT_SELECTION;
default:
break;;
}
return MsOp;
}
#endif
/***************************************************************************************
* Function : _ListItemFillOSDSeg
*
* In : pThis = Pointer to subtitle file list item objects.
* pAbsArea = Absolute area of pThis object.
*
* Out : None.
*
* Return : None.
*
* Desc : draw external subtitle file list item objects represented by
* oSubtListDescriptor descriptor.
****************************************************************************************/
#ifndef D_CUSTOM__ListItemFillOSDSeg
static BOOL _ListItemFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea)
{
MSO_LISTITEM __NEAR* pItem = (MSO_LISTITEM __NEAR*)pThis;
FORMATED_UNICODE_STRING oFormUniStr;
UINT16 wColor = CIDX_2;
OSDR_GetFormUniStr_ScFormatted((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, (UINT32)pItem->moParam.mwData);
OSDR_FillOsdSegUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, pAbsArea,
12,
(pAbsArea->mwH >> 1) + 2,
ALIGN_H_LEFT,
ALIGN_V_CENTER,
wColor);
if (MS_IsFocused(pThis))
OSDR_FillOsdSegBitmapFitArea(BMP_FG_FOCUS, pAbsArea);
return FALSE;
}
#endif // D_CUSTOM
/***************************************************************************************
* Function : OpenAuxSubtSelection
*
* In :
*
* Out : None.
*
* Return : None.
*
* Desc :
****************************************************************************************/
#ifndef D_CUSTOM_OpenAuxSubtSelection
MSO_OBJECT __NEAR* OpenAuxSubtSelection(MSO_CONTAINER __NEAR* pContainer, UINT16 wClipNum, UINT16 wDirIndex)
{
MSO_AUX_SUBT_SELECTION __NEAR* pAuxSubtSele;
PtrToActionEngineObject pActionEngine;
UINT16 wTotalNumFile;
pAuxSubtSele = (MSO_AUX_SUBT_SELECTION __NEAR*)MS_CreateAndAddObject((MS_DESCRIPTOR*)&oDescriptorAuxSubtSelection,
pContainer);
pAuxSubtSele->moParam.mwClipNum = wClipNum;
MS_SetInvisible((MSO_OBJECT __NEAR*)pAuxSubtSele);
//create directory browser
pActionEngine = (PtrToActionEngineObject)ActionEngine_Construct(eObjectDirectoryBrowser, (UiIdentifier)pAuxSubtSele);
pAuxSubtSele->moParam.mpActionEngine = pActionEngine;
DirBrowser_SetFileTypes((PtrToDirBrowser)pActionEngine, CLIPTYPE_SUBTITLE);
DirBrowser_OpenDirectoryByIndex((PtrToDirBrowser)pActionEngine, wDirIndex);
// Wait for the directory caching to finish
DirBrowser_WaitCompletion((PtrToDirBrowser)pActionEngine);
//for solution1 we only count subtitle files which name is same as file name.
//wTotalNumFile = ActionEngine_GetDvixTotalExternalAUXSubtitleNum(pActionEngine, wClipNum);
//for solution2 count all subtitle files
wTotalNumFile = DirBrowser_GetTotalClipsInDir((PtrToDirBrowser)pActionEngine);
if (0==wTotalNumFile)
{
//Set external subtitle off
ActionEngine_CurrItemSetExternalAUXSubtitle(pActionEngine, NULL_INDEX);
//Need to destruct subtitle ActionEngine before track ActionEngine_GotoEntry() when core are busy.
//Otherwise will have 10 seconds blank screen when play DRM divx
_DestructSubtActionEngine((MSO_OBJECT __NEAR*)pAuxSubtSele);
MS_SEND_OP_OBJECT(pAuxSubtSele, MS_OP_CLOSE, 0);
return NULL;
}
MS_ClearInvisible((MSO_OBJECT __NEAR*)pAuxSubtSele);
MS_SEND_OP_OBJECT(pAuxSubtSele, MS_OP_INIT, 0);
return (MSO_OBJECT __NEAR*)pAuxSubtSele;
}
#endif //D_CUSTOM
/***************************************************************************************
* Function : _SubtSelectWindInitOp
*
* In : pThis = point to subtitle selection window object.
*
* lParam = Parameter associated with an MS_OP if any.
*
* Out : None.
*
* Return : None.
*
* Desc : handle MS_OP_INIT operation of subtitle selection window
* object represented by oDescriptorVScrollList descriptor.
****************************************************************************************/
#ifndef D_CUSTOM__SubtSelectWindInitOp
static void _SubtSelectWindInitOp(MSO_OBJECT __NEAR* pThis, UINT32 lParam)
{
MSO_OBJECT __NEAR* pObject = MS_CreateAndAddObject((MS_DESCRIPTOR *)&oDescriptorVScrollList, (MSO_CONTAINER __NEAR*)pThis);
MS_SendOperation(pObject, MS_OP_OPEN, lParam);
((MSO_AUX_SUBT_SELECTION __NEAR*)pThis)->moParam.mwTimeOut = 400; // 40 seconds
}
#endif // D_CUSTOM
/***************************************************************************************
* Function : _ComponentOperation
*
* In : pThis = Pointer to the subtitle select window (MSO_AUX_SUBT_SELECTION) object.
*
* MsOp = Operation ID.
*
* lParam = Parameter associated with an MS_OP if any.
*
* Out : None.
*
* Return : ID of the operation that is to be propagated once processing is done,
* otherwise MS_OP_NONE.
*
* Desc : This function processes all operations/events of the subtitle selection window
* (MSO_AUX_SUBT_SELECTION) object represented by the
* oSubSelectWindowDescriptor descriptor.
****************************************************************************************/
#ifndef D_CUSTOM__ComponentOperation
static MS_OP _ComponentOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
MSO_AUX_SUBT_SELECTION __NEAR* pAuxSubtSele = (MSO_AUX_SUBT_SELECTION __NEAR*)pThis;
switch (MsOp)
{
case MS_OP_INIT:
_SubtSelectWindInitOp(pThis, lParam);
break;//return MS_OP_NONE;
case MS_OP_TICK:
{
UINT16 *wTimeOut = &((MSO_AUX_SUBT_SELECTION __NEAR*)pThis)->moParam.mwTimeOut;
if (*wTimeOut)
{
if (--(*wTimeOut) == 0)
{
//close subtitle select window and not select any subtitle
MsOp = MS_SendOperation(pThis, MS_OP_CLEAR, 0);
MS_SEND_OP(MsOp, 0);
//return MS_OP_NONE;
}
}
}
break;
case MS_OP_CLOSE:
MsOp = MS_OP_CLOSE_PARENT;
break;
case MS_OP_EMPTY:
{
_DestructSubtActionEngine(pThis);
}
break;
default:
break;
}
MsOp = MS_ComponentBasicOperation(pThis, MsOp, lParam);
if (MS_OP_SUBT_SELECTION_FINISHED == MsOp)
{
//Need to destruct subtitle ActionEngine before track ActionEngine_GotoEntry() when core are busy.
//Otherwise will have 10 seconds blank screen when play DRM divx
_DestructSubtActionEngine((MSO_OBJECT __NEAR*)pAuxSubtSele);
MS_SEND_OP_OBJECT(pThis, MS_OP_CLOSE_PARENT, lParam);
}
// Prohibit user operation (such as MS_OP_SEARCH)
else if (MS_IS_USER_OP(MsOp) && (MsOp != MS_OP_POWER) && (MsOp != MS_OP_EJECT))
{
PROHIBIT(MSG_PROHIBIT_NOT_ALLOWED_NOW);
return MS_OP_NONE;
}
return MsOp;
}
#endif //D_CUSTOM
/***************************************************************************************
* Function : _ComponentFillOSDSeg
*
* In : pThis = Pointer to subtitle file list item objects.
* pAbsArea = Absolute area of pThis object.
*
* Out : None.
*
* Return : None.
*
* Desc : draw subtitle selection window objects represented by
* oSubSelectWindowDescriptor descriptor.
****************************************************************************************/
#ifndef D_CUSTOM__ComponentFillOSDSeg
#pragma argsused
static BOOL _ComponentFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea)
{
FORMATED_UNICODE_STRING oFormUniStr;
oFormUniStr.mtFontIndex = FONT_0;
OSDR_FillOsdSegBitmapFitArea(BMP_BG_2, pAbsArea);
OSDR_GetFormUniStr_OsdMessage((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, S_EXTERNAL_SUBTITLE_SELECTION);
OSDR_FillOsdSegUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, pAbsArea,
(pAbsArea->mwW)>>1, // 40
12,
ALIGN_H_CENTER,
ALIGN_V_TOP,
CIDX_2);
return FALSE;
}
#endif //D_CUSTOM__ComponentFillOSDSeg
/***************************************************************************************
* Function : _SelectExtSubtFile
*
* In : pThis = Pointer to the subtitle file list item (MSO_LISTITEM) object.
*
* lParam = if not equal 0 then set external subtitle file number
* otherwise turn off external subtitle.
*
* Out : None.
*
* Return : number of the external subtitle file selected by user
*
* Desc : This function select divx clip's external subtitle file.
* The file number starts from 0 and end to less than
* maximum file num (not care file type) in current directory.
****************************************************************************************/
#ifndef D_CUSTOM__SelectExtSubtFile
static UINT16 _SelectExtSubtFile(MSO_OBJECT __NEAR* pThis, BOOL bSubtitleOn)
{
UINT16 wSubFileIndex;
PtrToActionEngineObject pActionEngine;
MSO_AUX_SUBT_SELECTION __NEAR* pObject;
MSO_LISTITEM __NEAR* pSubtItem = (MSO_LISTITEM __NEAR*)pThis;
wSubFileIndex = pSubtItem->moParam.mwIndex;
pObject =(MSO_AUX_SUBT_SELECTION __NEAR*)MS_FindParentFromDescriptor(pThis, (MS_DESCRIPTOR*)&oDescriptorAuxSubtSelection);
pActionEngine = pObject->moParam.mpActionEngine;
if(!bSubtitleOn)//turn off external subtitle
wSubFileIndex = NULL_INDEX;
ActionEngine_CurrItemSetExternalAUXSubtitle(pActionEngine, wSubFileIndex);
return wSubFileIndex;
}
#endif //D_CUSTOM
/***************************************************************************************
* Function : _DestructSubtActionEngine
*
* In : pAuxSubtSele = Pointer to aux subtitle selection list.
*
* Out : None.
*
* Return : None.
*
* Desc : Destructs the action engine used for getting the subtitle files.
****************************************************************************************/
#ifndef D_CUSTOM__DestructSubtActionEngine
static void _DestructSubtActionEngine(MSO_OBJECT __NEAR* pThis)
{
MSO_AUX_SUBT_SELECTION __NEAR* pAuxSubtSele = (MSO_AUX_SUBT_SELECTION __NEAR*)pThis;
if(NULL != pAuxSubtSele->moParam.mpActionEngine)
{
//((PtrToDirBrowser)pAuxSubtSele->moParam.mpActionEngine)->mClipsDirTable.wIdxWorkDir = NULL_INDEX;
ActionEngine_Destruct(pAuxSubtSele->moParam.mpActionEngine);
pAuxSubtSele->moParam.mpActionEngine = NULL;
}
}
#endif // D_CUSTOM
#endif // USE_AUX_SUBTITLES
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -