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

📄 mm_ui.c

📁 ct952 source code use for Digital Frame Photo
💻 C
📖 第 1 页 / 共 5 页
字号:
#endif //
                // wyc1.06-909, need to set __bMMResumetoMotion to TRUE to go resume function.
                _dwMMTemp4 = MM_GetFileType(__MMPlayingItem.wDirID, __wPlayItem);
                if (_dwMMTemp4 == EXTNAME_DAT)
                    __bAttrPlay = ATTR_DAT;
                else if (_dwMMTemp4 == EXTNAME_MPG)
                    __bAttrPlay = ATTR_MPG;
                else if (_dwMMTemp4 == EXTNAME_VOB)
                    __bAttrPlay = ATTR_VOB;
                else if (_dwMMTemp4 == EXTNAME_AVI)
                    __bAttrPlay = ATTR_AVI;
                // LLY2.05, support MP3 Disc/ Time resume feature
                else if(_dwMMTemp4 == EXTNAME_MP3)
                    __bAttrPlay = ATTR_MP3;
                else if(_dwMMTemp4 == EXTNAME_WMA)
                    __bAttrPlay = ATTR_WMA;

                if ((__bAttrPlay & TYPE_CDROM_AV))
                {
                    // make system enter play mode but __bCountStop is 1 and system will abnormal. So set __bCountStop to 0 here.
                    __bCountStop = 0;
                    __bMMMenuID = MM_MENU_NONE;
                    OSDMM_Update(OSDMM_MSG_EXIT,0);
                    // LLY2.31, call parser API to check if index table build done.
                    //if (__bNoDivXIndexTbl || (__dwTemp == PARSER_ESFMT_WMA_V1) || (__dwTemp == PARSER_ESFMT_WMA_V2))
                    if (!PARSER_QueryAVIIndexTable())// || (__dwTemp == PARSER_ESFMT_WMA_V1) || (__dwTemp == PARSER_ESFMT_WMA_V2))
                    {
                        return KEY_PLAY;
                    }
                    else
                    {
                        return bKey;
                    }
                }
                // LLY2.05, support MP3 resume
                // LLY2.35, support WMA resume
                else if((__bAttrPlay == ATTR_MP3) || (__bAttrPlay == ATTR_WMA) )
                {
                    // wyc2.36-909S, fix when resume from JPG preview to MP3, then JPG image don't clear problem.
                    if (__dwMMTriggerMode == MM_IMAGE_TRIGGER_MODE)
                    {
                        HAL_ClearScreen(HAL_COLOR_BLACK, HAL_CLEAR_SCREEN_JPEG, HAL_DISP_CURRENTFRAME);
                    }
                    // call this to let OSD time and audio spectrum can running.
                    OSDMM_Update(OSDMM_MSG_PLAYING, 0);

                    // Need set __bMMStage as MM_STAGE_PREPAREINFO
                    // Otherwise, the trigger mechanism can't work
                    __bMMStage = MM_STAGE_PREPAREINFO;

                    // LLY2.11, get playing item range, to keep value @ __dwTimeBegin, __dwTimeEnd
                    // Otherwise, the GoTime action maybe wrong while H/W power on --> resume
                    // LLY2.53, modify the API w/ extra parameter to get desired playback range start/ end
                    // Since, we will not update them into __dwTimeBegin/ __dwTimeEnd directly
                    MM_GetRange(__MMPlayingItem.wDirID, __wPlayItem, &__dwTimeBegin, &__dwTimeEnd);

                    __bCountStop = 0;
                    return bKey;
                }
                else
                {
                    // wyc1.20-909, need to clear JPG buffer when pre-stop -> play from MP3 file because it maybe resume from JPG preview mode.
                    if (__dwMMTriggerMode == MM_IMAGE_TRIGGER_MODE)
                    {
                        HAL_ClearScreen(HAL_COLOR_BLACK, HAL_CLEAR_SCREEN_JPEG, HAL_DISP_CURRENTFRAME);
                    }
                    __dwMMKeyToDo = TRUE;
                    return KEY_PLAY;
                }
            }
        }
        else
#endif  // #ifdef SUPPORT_MP3_RESUME
        {
            // nothing need to do and always return invalid key
            return INVALID_KEY;
        }
        break;

    case    KEY_PAUSE:
        // wyc0.91, don't call MSG_STOP when pause mode, because when call MSG_PLAYING when KEY_PLAY. the MP3 file info will be cleared by call MSG_PLAYING.
        if ((__bModeCmd==KEY_FF) && (__btPause) && (__bScanLevel != 0) && (__bAttrPlay & TYPE_CDROM_AUDIO))
        {
            UTL_TransferCommandID(KEY_PLAY);
            __bKeyMessage=MSG_SCANFORWARD;
            OSD_OUTPUT_MACRO ( __bKeyMessage, __bScanLevel, 0xFF );
            __btPlaying= TRUE;
            __btPause = FALSE;
            return KEY_NO_KEY;
        }
        return bKey;
    case    KEY_PLAY:
        // [1] if selection cursor @ directory list
        if(__MMSelectCursor.bPosition == POS_VOL_DIR_LIST)
        {
            // if cursor @ ROOT postion
            // update selection cursor @ 1st postion of file list
            if(__MMSelectCursor.wIndex==0)
            {
                // wyc2.05-909S, need to modify to check the files in ROOT, not check the active dir. Otherwise will happen can't enter
                // root dir when no files in active dir.
                if(_MM_QueryInfo2(MM_QUERY2_TOTAL_SORT_FILTER_ITEM, __MMSelectCursor.wIndex))
                {
                    // clear selection cursor first
                    OSDMM_Update(OSDMM_MSG_CLEAR_HIGHLIGHT, 0); 

                    // Update final active directory ID as "0"
                    __MMSelectCursor.wDirID=0x0;
                    _bMMNextSelectDir = __MMSelectCursor.wDirID;

                    // Prepare the file info. for file list
                    MM_PreparePage(MM_PREPARE_FILEPAGE,__MMSelectCursor.wDirID, __bMMExtFilterMode, __bMMSortMethod);

                    // Re-draw the menu
                    OSDMM_Update(OSDMM_MSG_UPDATE_CHANGE_DIR_LEVEL, 0); 

                    // Update selection cursor info.
                    __MMSelectCursor.bPosition=POS_FILE_LIST;
                    __MMSelectCursor.wIndex=0x0;

                    // Draw selection cursor on menu
                    OSDMM_Update(OSDMM_MSG_UPDATE_HIGHLIGHT, 0); 

                    if (MM_JPEGPreview())
                        return KEY_NO_KEY;

                    // all thing done, so return no key
                    return KEY_NO_KEY;
                }
                else
                {
                    return KEY_INVALID;
                }
            }
            // only valid while cursor @ UP_DIR position
            // return to up-directory, ie. parent directory !!
            else if(_bMMExistUpDir && __MMSelectCursor.wIndex==1)
            {
                // clear selection cursor first
                OSDMM_Update(OSDMM_MSG_CLEAR_HIGHLIGHT, 0); 

                // update active directory ID first
                // because MM_PreparePage(MM_PREPARE_FILEPAGE,__MMSelectCursor.wDirID) will refer it
                __MMSelectCursor.wDirID=_bMMParentID;
                _bMMNextSelectDir = __MMSelectCursor.wDirID;

                // Prepare the file information
                MM_PreparePage(MM_PREPARE_FILEPAGE,__MMSelectCursor.wDirID, __bMMExtFilterMode, __bMMSortMethod);

                // Re-draw the menu
                OSDMM_Update(OSDMM_MSG_UPDATE_CHANGE_DIR_LEVEL, 0); 

                // Update final selection cursor information
                _MM_SetCursorToActiveDirPos();

                // Draw selection cursor on menu
                OSDMM_Update(OSDMM_MSG_UPDATE_HIGHLIGHT, 0); 

                // all thing done, so return no key
                return KEY_NO_KEY;
            }
            // Otherwise, return invalid key
            else
            {
                // When highlight in dir field and press play, make highlight goto file field
                // wyc0.80, should use sort/filter item to replace old one.
                if(_MM_QueryInfo2(MM_QUERY2_TOTAL_SORT_FILTER_ITEM, __MMSelectCursor.wDirID))
                {
                    // clear the selection cursor first
                    OSDMM_Update(OSDMM_MSG_CLEAR_HIGHLIGHT, 0); 
                    // Update cursor @ 1st file ID
                    __MMSelectCursor.bPosition=POS_FILE_LIST;
                    __MMSelectCursor.wIndex=__wOSDMMStartDrawItem; 
                    MM_JPEGPreview();
                }
                else
                {
                    return INVALID_KEY;
                }
                // Update final cursor on menu
                OSDMM_Update(OSDMM_MSG_UPDATE_HIGHLIGHT, 0); 
                return KEY_NO_KEY;
            }
        }
        // [2] if selection cursor @ file list
        else if(__MMSelectCursor.bPosition == POS_FILE_LIST)
        {
#ifdef SUPPORT_JPEG_AUDIO_PLAYING
            if (__bMMJPEGAudioMode)
            {
                return _MM_SetJPEGAudioPlayItem();                                
            }
            else
#endif //#ifdef SUPPORT_JPEG_AUDIO_PLAYING
            {
                // if cursor @ sub-directory
                // enter the sub-directory, and re-draw Menu
                if(__MMSelectCursor.wIndex < __pMMVolumeDirTree[__MMSelectCursor.wDirID].bNoOfSubDir)
                {
                    // Update selection cursor info. to active directory ID
                    __MMSelectCursor.wDirID=(BYTE)(__pMMVolumeDirTree[__MMSelectCursor.wDirID].b1stSubDirID+__MMSelectCursor.wIndex);
                    _bMMNextSelectDir = __MMSelectCursor.wDirID;
                    
                    // Prepare the file info. of the new directory
                    // Cursor index still @ 1st postion of file list
					MM_PreparePage(MM_PREPARE_FILEPAGE,__MMSelectCursor.wDirID, __bMMExtFilterMode, __bMMSortMethod);
                    
                    // Re-draw the Menu
                    OSDMM_Update(OSDMM_MSG_UPDATE_CHANGE_DIR_LEVEL, 0); 
                    
                    // if exist item within file list window
                    // Update final selection cursor @ 1st position of file list
                    if(_MM_QueryInfo2(MM_QUERY2_TOTAL_SORT_FILTER_ITEM,__MMSelectCursor.wDirID))
                    {
                        __MMSelectCursor.wIndex=0x0;
                    }
                    // else, update the selection cursor @ active directory
                    else
                    {
                        _MM_SetCursorToActiveDirPos();
                    }
                    OSDMM_Update(OSDMM_MSG_UPDATE_HIGHLIGHT, 0); 
                    
                    MM_JPEGPreview();
                    
                    return KEY_NO_KEY;
                }
                else
                {
                    // wyc0.85a, when MP3 pause mode and press KEY_PLAY. Make KEY_PLAY do PLAY to exit pause mode, not to do program edit.
                    // Otherwise no key can do play when MP3 pause mode.
                    // wyc2.51-909P, add code to control the ENCODE FILE menu.
                    if(((__bMMMenuID==MM_MENU_EDITPROG) && (__btPause == FALSE))
#ifdef SUPPORT_COPY_FILE_IN_MM_UI
                        || (__bMMMenuID == MM_MENU_ENCODE_FILE)
#endif //
                        )
                    {
                        // Update selection cursor @ original postion again
                        // Otherwise, selection cursor will disappear !!
                        OSDMM_Update(OSDMM_MSG_UPDATE_HIGHLIGHT, 0); 
                        
                        // Transfer cursor index from absolute to relative coordinate
                        _dwMMTemp2=MM_IndexConvert(MM_INDEX_CONVERT_ABS2REL_FILE_LIST,
                            __MMSelectCursor.wDirID, __MMSelectCursor.wIndex);
                        
                        // Increase index by '1', because we will keep real playing item
                        // value within __ProgIdx[].wSubIndex, ie. same as __wPlayItem
                        // In another ways, cursor index from '0'; __wPlayItem index from '1'
                        _dwMMTemp2++;
                        
                        // Finding if the selection item has exist within the program list
                        // Notice: 2nd parameter is un-necessary for this case
                        __bTemp=LINEAR_ProgramEntryOperation(LINEAR_QUERY_INDEX,
                            (BYTE)NULL, __MMSelectCursor.wDirID, _dwMMTemp2);
                        
                        // if yes, delete the element
                        // if no, add the element
                        if(__bTemp != 0xFF) // exist this content in program list
                        {
                            // Delete the content and re-arrange the list
                            // Notice: 3rd & 4th parameter is un-necessary for this case
                            LINEAR_ProgramEntryOperation(LINEAR_DELETE_ENTRY_BY_INDEX_W_REARRANGE, __bTemp, (BYTE)NULL, (WORD)NULL);
                            
                            // Decrease current program index by '1' for next empty entry
                            __bProgramCurrentIndex--;
                            
                            // Decrease max program entry number by '1' while delete one element
                            __bProgramMaxEntry--;
                        }
                        else // can't find content in program list
                        {
                            // Append the content into the list
                            // wyc1.05-2, we should use __bProgramMaxEntry to veirfy if still can input program entry.
                            // Not use __bProgramCurrentIndex variable.
                            _dwMMTemp5=LINEAR_ProgramEntryOperation(LINEAR_ADD_ENTRY_BY_INDEX, __bProgramMaxEntry, __MMSelectCursor.wDirID, _dwMMTemp2);
                            
                            // if return value != 0xFF, means insert action ok
                            // else, return "invalid key"
                            if(_dwMMTemp5!=0xFF)
                            {
                                // Increase current program index by '1' for next empty entry
                                __bProgramCurrentIndex++;
                                
                                // Increase max program entry by '1' while add one element
                                __bProgramMaxEntry++;
                            }
                            else //exceed the maximum program number
                            {
                                return KEY_INVALID;
                            }
                        }

                        // Draw the program relative cursor
                        OSDMM_Update(OSDMM_MSG_UPDATE_PROGRAM_ITEM, 0); 
                    }
                    else
                    {

⌨️ 快捷键说明

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