📄 mm_file.c
字号:
_MM_ConvertName(MM_CONVERT_FILENAME, (WORD)(_dwMMTemp2+1));
}
#endif // #ifdef CONVERT_UNKNOWN_NAME
// Step 14: Update and save information if exist files within current directory
if( _MMFileLog.wActualNO )
{
// LLY2.80, Save file relative information within this directory into DRAM
// Save file name information
__pMMFileRecord += _MMFileLog.wActualNO;
// wyc0.50-909, record the entry file and last file that in this directory.
__pMMDirNameList[_bMMIdx].wMMFileRecordEntry = __wMMTotalFiles;
__wMMTotalFiles+= _MMFileLog.wActualNO;
_MMFileLog.wTotalNO = __wMMTotalFiles;
__pMMDirNameList[_bMMIdx].wMMFileRecordEnd = __wMMTotalFiles - 1;
// elmer
if(__bMP4SPFileCnt - _dwMMTemp9 > 0)
{
_pMMMP4SPIndex[_bMMIdx].wMMSPRecordEntry = _dwMMTemp9;
//__pMMDirNameList[_bMMIdx].wMMSPRecordEnd = __bTotalSRTFiles - 1;
_pMMMP4SPIndex[_bMMIdx].wMMSPRecordEnd = __bMP4SPFileCnt - 1;
}
if (__wMMTotalFiles >= MM_MAX_FILE_NO_ONE_TITLE)
break;
__pMMDirNameList[_bMMIdx].bMMLinkStatus &= ~MM_SORT_FILTER_LINK_READY;
}
if (_MMFileLog.wStartNO == 0xFFEE)
break;
} // for(_bMMIdx=0 ~ __bMMTotalDirs)
}
}
#ifdef SUPPORT_UDF_FILE_SYSTEM
else if (__bFileSystem == FILE_SYSTEM_UDF)
{
_MMUDFDirLog.wMaxDirNO = MM_MAX_DIR_NO;
_MMUDFDirLog.bMaxStringLen = MM_MAX_DIRNAME_LENGTH;
_MMUDFDirLog.pDirNameList = __pMMDirNameList;
_MMUDFDirLog.pFilesOfDir = __pMMFilesOfDir;
_MMUDFDirLog.pVolumeDirTree =(PTREE_INFO)__pMMVolumeDirTree;
_MMUDFDirLog.pDirLoc = (PDIR_LOC)__pMMFilterFilesOfDir;
//_MMFileLog.wAttrFilter= FILE_FLAG_FILE;
_MMFileLog.bMaxStringLen= MM_MAX_FILENAME_LENGTH;
_MMFileLog.bGapbyString= sizeof(FILE_RECORD);
_MMFileLog.wMaxNO = MM_MAX_FILE_NO_ONE_TITLE;
_MMFileLog.pFileRecord=(PFILE_RECORD) __pMMFileRecord;
UDF_BuildFileSystem(&_MMUDFDirLog, &_MMFileLog);
__bMMTotalDirs = _MMUDFDirLog.bActualDirNO;
__wMMTotalFiles = _MMFileLog.wActualNO;
// wyc2.31-909S, add UDF in convert unknown code.
#ifdef CONVERT_UNKNOWN_NAME
if (__bMMTotalDirs != 0)
{
for(_dwMMTemp2=0; _dwMMTemp2<__wMMTotalFiles; _dwMMTemp2++)
{
_pMMTempNameList=(PFILENAMEINFO)(&__pMMFileRecord[_dwMMTemp2].FileName);
__bMMUniFile = __pMMFileRecord[_dwMMTemp2].bFileAttr & IF_UNICODE_FILE_TAG;
_MM_ConvertName(MM_CONVERT_FILENAME, (WORD)(_dwMMTemp2+1));
}
}
#endif // #ifdef CONVERT_UNKNOWN_NAME
}
#endif //SUPPORT_UDF_FILE_SYSTEM
// wyc1.01-909, file system will be detected after function INFOFILTER_GetFileSystem. So can parse the file structure here.
// wyc1.07-909, FAT32 file system also need to enter follow code to parse files.
else if ((__bFileSystem == FILE_SYSTEM_FAT12) || (__bFileSystem == FILE_SYSTEM_FAT16) || (__bFileSystem == FILE_SYSTEM_FAT32))
{
#else
{
#endif //#ifndef NO_DISC_MODE //++CoCo2.37p
#ifdef SUPPORT_FAT_FILE_SYSTEM
if (!FAT_AssignFATTableMem((DWORD*)_pMMFATTable))
return FALSE;
// use this structure to record the pointer address of dir relative record and pass to FAT function to build value.
_MMFATDirLog.wMaxDirNO = MM_MAX_DIR_NO;
_MMFATDirLog.bMaxStringLen = MM_MAX_DIRNAME_LENGTH;
_MMFATDirLog.pDirNameList = __pMMDirNameList;
_MMFATDirLog.pFilesOfDir = __pMMFilesOfDir;
_MMFATDirLog.pVolumeDirTree = (PTREE_INFO)__pMMVolumeDirTree;
// because __pMMFilesOfDir and _pMMDirLoc use same DRAM space, so let pDirLoc to use space of __pMMFilterFilesOfDir temply.
// MM_Initial will re-assign __pMMFilesOfDir to __pMMFilterFilesOfDir, so it is OK to borrow its space here.
_MMFATDirLog.pDirLoc = (PDIR_LOC)__pMMFilterFilesOfDir;//(PDIR_LOC)_pMMDirLoc;
_MMFileLog.wAttrFilter= FILE_FLAG_FILE;
_MMFileLog.bMaxStringLen= MM_MAX_FILENAME_LENGTH;
_MMFileLog.bGapbyString= sizeof(FILE_RECORD);
_MMFileLog.wMaxNO = MM_MAX_FILE_NO_ONE_TITLE;
_MMFileLog.pFileRecord=(PFILE_RECORD) __pMMFileRecord;
_MMFileLog.pMP4SPRecord = (PMP4SP_RECORD)__pMMMP4SPRecord;
__wMMTotalFiles = 0;
FAT_BuildFileSystem(__SF_SourceGBL[__dwSFStreamID].bSourceIndex, &_MMFATDirLog, &_MMFileLog, (PMP4SP_INDEX)_pMMMP4SPIndex);
if (_MMFATDirLog.bActualDirNO != 0)
__bMMTotalDirs = _MMFATDirLog.bActualDirNO;
else
return FALSE;
if (_MMFileLog.wActualNO != 0)
{
__wMMTotalFiles = _MMFileLog.wActualNO;
#ifdef CONVERT_UNKNOWN_NAME
for(_dwMMTemp2=0; _dwMMTemp2<__wMMTotalFiles; _dwMMTemp2++)
{
_pMMTempNameList=(PFILENAMEINFO)(&__pMMFileRecord[_dwMMTemp2].FileName);
__bMMUniFile = __pMMFileRecord[_dwMMTemp2].bFileAttr & IF_UNICODE_FILE_TAG;
_MM_ConvertName(MM_CONVERT_FILENAME, (WORD)(_dwMMTemp2+1));
}
#endif // #ifdef CONVERT_UNKNOWN_NAME
}
else
return FALSE;
#endif //SUPPORT_FAT_FILE_SYSTEM
}
#ifdef SUPPORT_CHAR_SUBPICTURE
//elmer
//_MMFileLog.pFileRecord = (PFILE_RECORD)__pMMFileRecordStart;
_MM_GetMP4SP(&_MMFileLog);
__pMMMP4SPRecord = __pMMMP4SPRecordStart;
#endif //
// Step 17: Scan & remove the empty directory
#ifdef DISCARD_EMPTY_DIRECTORY
while(_MM_ExistEmptyFolder())
{
_dwMMTemp6=__bMMTotalDirs; // used to keep real directory number
_dwMMTemp5=FALSE; // used to keep "find next un-zero action" flag
for(_bMMIdx=0; _bMMIdx<__bMMTotalDirs; _bMMIdx++)
{
if((__pMMFilesOfDir[_bMMIdx]) ||(__pMMVolumeDirTree[_bMMIdx].bNoOfSubDir))
{
// If enable "find next un-zero flag" is on & current directory's file is non-zero
// ie. we find the next un-zero directory
// There are empty directory within them, so can remove them
if(_dwMMTemp5)
{
// LLY.274p-3, use "MM_MAX_DIRNAME_LENGTH" for directory name
// Otherwise, the 7th char of directory name will be cut
strncpy(__pMMDirNameList[_dwMMTemp7].cName, __pMMDirNameList[_bMMIdx].cName, MM_MAX_DIRNAME_LENGTH);
__pMMDirNameList[_dwMMTemp7].cName[MM_MAX_DIRNAME_LENGTH]=NULL;
__pMMFilesOfDir[_dwMMTemp7] = __pMMFilesOfDir[_bMMIdx];
// __pMMFilesOfDir[_bMMIdx] = 0;
__pMMVolumeDirTree[_dwMMTemp7].b1stSubDirID=__pMMVolumeDirTree[_bMMIdx].b1stSubDirID;
__pMMVolumeDirTree[_dwMMTemp7].bNoOfSubDir=__pMMVolumeDirTree[_bMMIdx].bNoOfSubDir;
__pMMVolumeDirTree[_dwMMTemp7].bParentID=__pMMVolumeDirTree[_bMMIdx].bParentID;
if(__pMMVolumeDirTree[_dwMMTemp7].bNoOfSubDir!=0)
{
for(_dwMMTemp4=0;_dwMMTemp4<__pMMVolumeDirTree[_dwMMTemp7].bNoOfSubDir;_dwMMTemp4++)
__pMMVolumeDirTree[__pMMVolumeDirTree[_dwMMTemp7].b1stSubDirID+_dwMMTemp4].bParentID=_dwMMTemp7;
}
if(__pMMVolumeDirTree[__pMMVolumeDirTree[_dwMMTemp7].bParentID].b1stSubDirID==_bMMIdx)
__pMMVolumeDirTree[__pMMVolumeDirTree[_dwMMTemp7].bParentID].b1stSubDirID=_dwMMTemp7;
// Increase next ready index for copy next non-empty entry
_dwMMTemp7++;
}
continue;
}
else
{
// If total files of current directory is zero & "finding next un-zero flag" is not on
// ie. we meet the 1st empty directory
// Enable this flag, and keep the ready index for copy next non-zero entry
if(!_dwMMTemp5)
{
_dwMMTemp5=TRUE;
_dwMMTemp7=_bMMIdx;
}
_dwMMTemp6--;
// Modify its parent ID info.
if( __pMMVolumeDirTree[__pMMVolumeDirTree[_bMMIdx].bParentID].bNoOfSubDir==1)
{
__pMMVolumeDirTree[__pMMVolumeDirTree[_bMMIdx].bParentID].b1stSubDirID= 0xFF;
}
else if( __pMMVolumeDirTree[__pMMVolumeDirTree[_bMMIdx].bParentID].b1stSubDirID==_bMMIdx) //xuli0609 add
{
__pMMVolumeDirTree[__pMMVolumeDirTree[_bMMIdx].bParentID].b1stSubDirID++;
}
__pMMVolumeDirTree[__pMMVolumeDirTree[_bMMIdx].bParentID].bNoOfSubDir--;
}
}
__bMMTotalDirs=_dwMMTemp6;
}
#endif // #ifdef DISCARD_EMPTY_DIRECTORY
// Step 18: Convert the unknown directory name into DIRXXX
#ifdef CONVERT_UNKNOWN_NAME
// LLY0.84, check if exist "ROOT" directory first
// if yes, do the convert procedure from index '1'
// if no, do the convert procedure from index '0'
// Notice: __pMMDirNameList[] index from '0'
// Otherwise, 1st unknown sub-directory name will be convert as "DIR002"
if( ! strcmp(__pMMDirNameList[0].cName, "ROOT") ) // exist "ROOT" directory
_dwMMTemp5=1;
else
_dwMMTemp5=0;
for(_bMMIdx=_dwMMTemp5; _bMMIdx<__bMMTotalDirs; _bMMIdx++)
{
// Specify the desired buffer address that stored directory name first
// Because, _MM_ConvertName() will use "__bFMNameList" for reference
_pMMTempNameList=(PFILENAMEINFO)&__pMMDirNameList[_bMMIdx];
__bMMUniFile = __pMMDirNameList[_bMMIdx].bMMLinkStatus & IF_UNICODE_FILE_TAG;
// Specify the desired index while final convert name
// if exist "ROOT", 1st sub-directory (index 1) is "DIR001"
// if un-exist "ROOT", 1st directory (index 0) is "DIR001"
_MM_ConvertName(MM_CONVERT_DIRNAME, (WORD)(_bMMIdx+1-_dwMMTemp5));
}
#endif // #ifdef CONVERT_UNKNOWN_NAME
// wyc2.21-909S, update code to share FW buffer to SP when don't use so memory.
// wyc2.35-909S, need to use DS_CHAR_BASED_SP_OUTBUF_ST.
// LLY2.36, keep current F/W buffer used address end
// Since, remove SP buffer start address and size setting to UTL.
if ((DS_FW_BUFFER_ST_MM + __wMMTotalFiles*sizeof(FILE_RECORD) + __bMMTotalDirs*sizeof(DIRNAMEINFO)) >= DS_FW_BUFFER_END_MM)
{
//__dwMMSPBuffST = DS_CHAR_BASED_SP_OUTBUF_ST;
__dwMMFWBuffEnd = DS_CHAR_BASED_SP_OUTBUF_ST;
}
else
{
// wyc2.32-909S, update to using MM_MAX_DIR_NO to fix SP output data putting wrong position problem.
__dwMMFWBuffEnd = DS_FW_BUFFER_ST_MM + __wMMTotalFiles*sizeof(FILE_RECORD) + MM_MAX_DIR_NO*sizeof(DIRNAMEINFO);
}
// Step 19: Update the begin/ end track information
__wTrackBegin=1;
__wTrackEnd=__wMMTotalFiles;
// wyc1.05, initial to 1 because 0 is not valid play item.
// wyc1.05, need to initial active cursor to position -> 0 and index to 0xffff to avoid OSDFM to draw active color in file name.
__MMPlayingItem .bPosition = 0;
__MMPlayingItem .wIndex = 0xFFFF;
_bMMIdx = 0;
if (!__wMMTotalFiles)
return FALSE;
#ifdef DEBUG_MESSAGE
DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_PRINTF,"\nTotal %d directories, %d Files", __bMMTotalDirs, __wMMTotalFiles);
#endif //#ifdef DEBUG_MESSAGE
// LLY.274p-1, must check more ??
__wDiscType |= CDROM_M1;
// wyc1.10-DVDR, set disc type to BOOK_M1 when DVD-ROM title for easily to porting the code.
if (__bDVDROM)
__wDiscType = BOOK_M1;
return TRUE;
}
// ************************************************************************
// Function : MM_AccessJPGStatus
// Description : Get/ store the desired JPG status from/ into DRAM
// Arguments : bMode, the get/ store operation
// bIdx, the desired item, index from '1'
// Return : None
// Side Effect : __bMMJPGStatus[] used to store the desired JPEG file's status
// Global : _dwMMTemp2
// ************************************************************************
void MM_AccessJPGStatus(BYTE bMode, WORD wIdx)
{
BYTE bTemp;
// decrease wIndex by 1, because the array index is from '0'
wIdx--;
// LLY0.83b-2, calculate the corresponding index by "disc view"
// Because, disc JPG status is stored into DRAM together in "disc view"
#ifdef SUPPORT_ENCODE_JPG_PICTURE
if(__SF_SourceGBL[0].bSourceIndex == SOURCE_SPI)
{
wIdx = MM_EncodeFile_GetFileID(wIdx);
switch(bMode)
{
case MM_GET_JPG_STATUS:
__bMMJPGStatus = __bMMJPGEncodeJPGStatus[wIdx];
break;
case MM_STORE_JPG_STATUS:
__bMMJPGEncodeJPGStatus[wIdx] = __bMMJPGStatus;
HAL_WriteStorage(SETUP_ADDR_JPG_ENCODE_FILE_STATUS, __bMMJPGEncodeJPGStatus, SRCFTR_SUPPORT_JPG_ENCODE_NUM);
break;
}
}
else
#endif //
{
wIdx=MM_ID_RelativeToAbsolute(__MMPlayingItem.wDirID, wIdx);
// wyc1.25, only file name access can use __pMMFileRecord, but why access bFileAttr also use __pMMFileRecord in follow code.
// This is because only JPG will access the bFileAttr, before to display files, F/W will call MM_PreparePage to get file lists.
// So __pMMFileRecord will get correct file lists and that's why the bFileAttr access can use __pMMFileRecord to record.
// Chuan0.85, Use the definition of CTKAV.H
__pMMFileRecord = __pMMFileRecordStart;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -