⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fmanager.c

📁 车载电子影音系统dvd播放系统原程序代码
💻 C
📖 第 1 页 / 共 5 页
字号:
            // LLY0.83b-2, re-adjust the procedure to check if JPEG decoding hang
            // Because, it's different between CT9928AF & CT908
            // [1] Under PLAYEND or DISPLAY stage, ie. decoding JPEG procedure
            // wyc0.90, make pause mode don't enter follow code because follow code will issuing UTL_PlayItem 
            // and make system to play next picture after several times rotate.
            if(( __bFMStage>=STAGE_PLAYEND && __bFMStage<=STAGE_DISPLAY) && !__btPause)
            {
                // Notice: Try to integrate "checking decoding hang procedure"
                // together, ie. collect them into W99AV or HAL module ??
                // [2] RISC decoding state keep same for CT908 case
                // LLY0.85-2, need 20030603 RISC code support
                W99AV_ReadDRAMData(W99AV_DRAM_JPEG_CHECK_HANG, &__dwTemp);
                if(dwPreRemain == __dwTemp)
                {
                    
#ifdef JPG_DEBUG_INFO //CoCo1.22a, for JPEG debug                    
                    _printf("\n__wPlayItem = %x   ", __wPlayItem);
                    _printf("__bFMActiveDir = %hx", __bFMActiveDir);							
                                       
                    _printf("\nJPEG hang.");
                    _ShowDebug();	
                    _FM_DebugInfo();
#endif //JPG_DEBUG_INFO
                    
#if defined(JPG_DEBUG_INFO) || defined(_DEBUG_INFO) //CoCo1.22a, for JPEG debug
                    OSD_OUTPUT_MACRO(MSG_ERRCODE, FM_JPEG_DECODE_HANG, 0x1); //CoCo1.22, modify the error message definition.
#endif
                    
                    __dwCheckTime=UTL_GetSysTimer();
                    while((UTL_GetSysTimer()-__dwCheckTime) < COUNT_1_SEC)
                    {
                        W99AV_ReadDRAMData(W99AV_DRAM_JPEG_CHECK_HANG, &__dwTemp);
                        if(dwPreRemain != __dwTemp)
                        {
#ifdef JPG_DEBUG_INFO                    
                            _printf("\nJPEG from hang to not hang");
#endif //JPG_DEBUG_INFO
                            break;
                        }
                    }
                    
                    if (dwPreRemain == __dwTemp)
                    {
#ifdef JPG_DEBUG_INFO                    
                        _printf("\nJPEG still hang");
#endif
                    }
                    else
                        dwPreRemain = __dwTemp;

                    // Do error concealment procedure
#ifdef  ERROR_CONCEAL
                    // LLY.275a, handle the error recover method:
                    // [1] Re-decode the same item while decoding errror
                    // [2] Prepare to decode next item
#ifdef  REDECODE_CURRENT_ITEM
                    if(__bResetRecover < REDECODE_COUNT_LIMIT)
                    {
                        __bResetRecover++;
                        // LLY.276, let it go through main flow
                        HAL_ControlCDIF(HAL_CDIF_CLOSE);
                        UTL_PlayItem(__wPlayItem, 0);
                    }
                    else
#endif  // #ifdef REDECODE_CURRENT_ITEM
                    {
                        __bFMStage=STAGE_NEXT_ITEM;
                    }

#endif  // #ifdef ERROR_CONCEAL
                }
                else
                {
                    // Keep decoding status as next time reference for CT9928AF
                    dwPreRemain=__dwTemp;
                }
            }
        }   // else if(__bAttrPlay==ATTR_JPG)
    }   // if ((__dwCountSystem-__dwPreGetTime) > COUNT_500_MSEC)


    // All stage finish OK !!
    //return ERR_NOERR; //CoCo1.21
}


//#######################################################################
//  Function    :   FM_CheckPlayableCDROM
//  Description :   This function check if the disc contain playable files
//                  and will prepare all necessary information of these files
//  Parameters  :   None.
//              :
//  Return      :   TRUE,   a playable CDROM disc
//              :   FALSE,  not a playable CDROM disc
//  Changed     :
//  Side Effect :
//#######################################################################
BYTE FM_CheckPlayableCDROM(void)
{
    // wyc1.07, extern these variables for detect if CDROM detecting error.
    BYTE   *__bFMBuf;
    extern  DWORD   _dwSectorMPath;
    extern  BYTE    __bJolietTitle;
// the following information will be available
// 1. __pFMDirNameList      // each directory name list
// 2. __pFMFileNameList     // each file name list
// 3. _pFMFileTOC           // each file starting sector and length
// 4. _bAblum1stID          // 1st song ID of each album
// 5. __pwFMFilesOfDir       // total songs of each album

#ifndef NO_MP3
    // wyc1.07, detect if CDROM detecting error, if error use ISO mode to re-try again.
    if ( !_FM_PrepareInfo() )
    {
        CD_PrepareISO9660();
        HAL_DumpUserData ( (BYTE * )__cSector3, (WORD) M2F1_DATASECTOR, 0 );
        __bFMBuf= (BYTE * ) __cSector3;
        _dwSectorMPath= ((DWORD)( __bFMBuf [148] )<<24);
        _dwSectorMPath+= ((DWORD)( __bFMBuf [149] )<<16);
        _dwSectorMPath+= ((DWORD)( __bFMBuf [150] )<<8);
        _dwSectorMPath+= (DWORD)( __bFMBuf [151] );
        __bJolietTitle = FALSE;       
        if ( !_FM_PrepareInfo() )
            return FALSE;
    }

    return TRUE;

#else   // #ifndef NO_MP3
    return FALSE;
#endif  //#ifndef   NO_MP3
}


// LLY0.84 create
//  ***************************************************************************
//  Function    :   FM_RecoverMenu
//  Description :   Recover the file manager UI
//  Argument    :   bMode, specify the desired recover mode
//                  FM_RESTORE_MENU, restore original menu base on __bFMMenuID
//                  ex. Equalizer/ Setup --> File Manager UI
//                  FM_DEFAULT_MENU, set default menu, ie. normal mode UI
//                  ex. thumbnail --> File Manager UI
//  Return      :   None
//  Side Effect :
//  Notice      :   if __bFMMenuID & __FMSelectCursor info have been cleared
//                  ex, enter thumbnail mode, must call FM_DEFAULT_MENU
//  Global      :
//  ***************************************************************************
void FM_RecoverMenu(BYTE bMode)
{
#ifndef NO_MP3
    // Specify __bFMMenuID & __FMSelectCursor info. while default mode
    if(bMode==FM_DEFAULT_MENU)
    {
        __FMSelectCursor.bPosition=POS_FILE_LIST;
        __FMSelectCursor.wIndex=0x0;
        // LLY0.86, specify desired Menu mode ID
        // Otherwise, it always re-draw normal mode UI
        // Notice: Must check __btInputProgram first, because __btProgram
        //         & __btInputProgram all be TRUE for input program mode
        if(__btInputProgram)
        {
            _FM_InitialMenu(FM_MENU_EDITPROG|FM_CLEAR_BACKGROUND, FALSE);
        }
#ifdef  SUPPORT_FM_BUTTONS
        else if(__btProgram)
        {
            _FM_InitialMenu(FM_MENU_PROGLIST|FM_CLEAR_BACKGROUND, FALSE);
        }
        else
        {
            _FM_InitialMenu(FM_MENU_NORMAL|FM_CLEAR_BACKGROUND, FALSE);
        }
#endif //CoCo1.21, thumb mode can enter FM only when "edit program" mode.   
    }
    else // restore the original menu base on __bFMMenuID
    {
        //CoCo1.10, for changing to other UI and return to recover original UI.
#ifdef  SUPPORT_FM_BUTTONS
        if (__bFMMenuID == FM_MENU_PROGLIST)
        {
            OSDPL_Update(OSDPL_MSG_SHOW); 
        }
        else
#endif // SUPPORT_FM_BUTTONS
        {
            OSDFM_Update(OSDFM_MSG_SHOW);
        }
    }
#endif  // #ifndef NO_MP3
}


// LLY0.84 create
//  *************************************************************************
//  Function    :   _FM_InitialMenu
//  Description :   Initial the File Manager UI for different mode
//  Arguments   :   bMode[6:0], specify the desired mode
//                  FM_MENU_NORMAL, normal mode UI
//                  FM_MENU_EDITPROG, input program mode UI
//                  FM_MENU_PROGLIST, program list UI
//                  bMode[7], specify if it's necessary to clear background
//                  FM_CLEAR_BACKGROUND
//  Return      :   None
//  Side Effect :
//  Global      :
//  Notice      :   Must update desired information first for this API reference
//                  [1] directory ID @ __bFMActiveDir
//                  [2] selection cursor info. @ __wSelectCursor
//  *************************************************************************
void _FM_InitialMenu(BYTE bMode, BYTE bRecover)
{
#ifndef NO_MP3

    // LLY0.86, clear background while display File Manager Menu
    // if don't support MP3 with LOGO
#ifndef SUPPORT_MP3_WITH_LOGO
    if(bMode & FM_CLEAR_BACKGROUND)
    {
        // disable video output to let background as border color
        HAL_Display(HAL_DISPLAY_VIDEO, FALSE);

        // Clear this API to clear __bLOGO as LOGO_NONE
        // Otherwise, Logo --> UI --> open : no logo display
        OSD_Output(MSG_LOGO, OSD_LOGO_CLEAR, NULL);

    }
#endif  // #ifndef SUPPORT_MP3_WITH_LOGO

    // wyc2.30-16M
#ifdef  SHOW_LOGO_FM_STOP_MODE    
    OSD_OUTPUT_MACRO(MSG_LOGO, NULL, 0xff);
#endif //

    // wyc1.07, need to AND 0xF is because high nibble are used to do other checking, for example, decide to clear active cursor or not.
    // wyc1.10, when initial menu from JPG (or DAT / VOB) playing and slide show mode. We need to initial the UI instead of recover UI. 
    // So set bRecover to 0 to re-initial FM UI.
    if ((__bFMMenuID == FM_MENU_NONE) && (__bCountStop == 0))
        bRecover = 0;
    __bFMMenuID=bMode & 0xF;

    switch(__bFMMenuID)
    {
    case    FM_MENU_NORMAL:
        // [1] Initial value for control button list
#ifdef  SUPPORT_FM_BUTTONS
        FM_InitialBTNList(NORMAL_BTN_LIST);
#endif // SUPPORT_FM_BUTTONS

        // [2] Prepare the necessary file info. of current directory
        //       Give 2nd parameter as non-zero, so it don't draw button
        FM_PreparePage(FM_PREPARE_FILEPAGE, DONT_DRAW_BUTTON);

        if (bRecover)
            OSDFM_Update(OSDFM_MSG_CHANGE_MODE);
        else
        {
            // [3] Display 1st Menu
            OSDFM_Update(OSDFM_MSG_INITIAL);
        }

        // [4] Update & Draw all button
#ifdef  SUPPORT_FM_BUTTONS
        FM_UpdateBTNStatus(CTL_BTN_PREV, 0x0);
        FM_UpdateBTNStatus(CTL_BTN_NEXT, 0x0);
        FM_UpdateBTNStatus(CTL_BTN_PLAY, TRUE);
        FM_UpdateBTNStatus(CTL_BTN_PROG, 0x0);
        FM_UpdateBTNStatus(CTL_BTN_THUMB, 0x0);
#endif //  SUPPORT_FM_BUTTONS
		
        // [5] Update the desired cursor
        OSDFM_Update(OSDFM_MSG_UPDATE_SELECTION);
        break;

    case    FM_MENU_EDITPROG:
#ifdef  SUPPORT_FM_BUTTONS
        // [1] Initial control button list as program mode
        FM_InitialBTNList(PROG_BTN_LIST);
#endif // SUPPORT_FM_BUTTONS

        // [2] Prepare the necessary file info. of current directory
        //       Give 2nd parameter as non-zero, so it don't draw button
        FM_PreparePage(FM_PREPARE_FILEPAGE, DONT_DRAW_BUTTON);

        if (bRecover)
            OSDFM_Update(OSDFM_MSG_CHANGE_MODE);
        else
        {
            // [3] Draw the input program mode UI
            OSDFM_Update(OSDFM_MSG_INITIAL);
        }

#ifdef  SUPPORT_FM_BUTTONS //CoCo1.21
        // [4] Update & draw final button status
        FM_UpdateBTNStatus(CTL_BTN_PREV, 0x0);
        FM_UpdateBTNStatus(CTL_BTN_NEXT, 0x0);
#endif //SUPPORT_FM_BUTTONS
        // wyc1.07, when press BTN_PLAY from program list mode and enter program edit mode to program playing, then we need to clear original active cursor color
        // because of program playing will draw a new active cursor color.
        if (bMode & FM_CLEAR_ACTIVE_CURSOR)
            OSDFM_Update(OSDFM_MSG_CLEAR_ACTIVE_PLAYING_FILE);

#ifdef  SUPPORT_FM_BUTTONS //CoCo1.21
        // wyc1.07, when there are program entres and in program edit mode (not playing mode), then we enable BTN_PLAY
        // we don't allow press BTN_PLAY when program playing mode, it will make program flow confused and not easy to design.
        if ((__bProgramMaxEntry) && (!__btPlayingProgram))
            FM_UpdateBTNStatus(CTL_BTN_PLAY, TRUE);
        else
            FM_UpdateBTNStatus(CTL_BTN_PLAY, FALSE);
        FM_UpdateBTNStatus(CTL_BTN_RETURN, 0x0);
        FM_UpdateBTNStatus(CTL_BTN_PROG_LIST, 0x0);
        FM_UpdateBTNStatus(CTL_BTN_THUMB, 0x0);
#endif
        // [5] Update selection cursor
        OSDFM_Update(OSDFM_MSG_UPDATE_SELECTION);
        break;

#ifdef  SUPPORT_FM_BUTTONS //CoCo1.21
    case    FM_MENU_PROGLIST:
        // [1] Update control button list as program mode
        FM_InitialBTNList(PROGLIST_BTN_LIST);

        // [2] Prepare the filename for progrqam list

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -