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

📄 linear.c

📁 车载电子影音系统dvd播放系统原程序代码
💻 C
📖 第 1 页 / 共 5 页
字号:
//////////////////////////////////////////////////////////////
// ***** Big Modification History Area *****
// LLY.274p, some big modification:
// [1] Rename all MP3 relative info. because module name has changed !!
//  - MP3_ProcessHighLight()  -->  FM_ProcessHighLight()
//  - __wTotalAlbums  --> __wFMTotalDirs;
// Micky2.80a
//  - remove MULTI_DISC_SYSTEM codes
// LLY2.80a
//  - remove ADD_BACKGND_FOR_CDDA codes
/////////////////////////////////////////////////////////////


#include "winav.h"
#include "digest.h"

//ccc
#include "isr.h"
#include "cc.h"
#include "utl.h"
#include "input.h"
#include "hal.h"
#include "osd.h"
#include "cdinfo.h"
#include "linear.h"
#include "chips.h"
#include "dvdinfo.h" // wyc.pro
#include "navigate.h" // wyc.pro
#include "cell.h" // ** TCH1.61a; for REPEAT_AB
//#include "message.h"
//DVD_031, MP3
#include "fmanager.h" //"mp3.h"
#include "servo.h"
#include "thumb.h"  // LLY2.80


//Kevin0.86, program index list array for font mode / GDI mode 
#ifndef CT908_UI 
WORD            __wProgramData [PROGRAM_TRACK]; 
#else
PROG_INDEX      __ProgIdxList[MAX_PROG_ITEM];
#endif

//Kevin1.00, move from cc.c to here
BIT             __btProgram;//Micky2.80, review global variables init.= FALSE;             // Program Mode ON/OFF (Only valid in PBC OFF)
BIT             __btInputProgram;//Micky2.80, review global variables init.= FALSE;        // PROGRAM in INPUT mode
BIT             __btPlayingProgram;//Micky2.80, review global variables init.= FALSE;      // Now is playing PROGRAM
BIT             __btNextPlayProgram;//Micky2.80, review global variables init.= FALSE;     // Ready for play PROPRAM;
#ifdef PRESTOP_BEFORE_SETUP_AND_PROGRAM //XuLi.230
BYTE __bProgramStop;//Xuli1.26, indicate the stop is due to program. if it is not due to program stop, when UTL_InitialMode(), no need to resume.
#endif

//Kevin0.86, move frm cc.c to here
BYTE            __bProgramMaxEntry;//Micky2.80, review global variables init. = 0;
#ifndef CT908_UI //Kevin0.86, for font mode program UI use only
BYTE            __bInputNumIndex;//Micky2.80, review global variables init. = 0;
#endif
// wyc2.80, move the variables' decalre from CC to LINEAR.
BYTE     __bProgramCurrentIndex;
#ifndef CT908_UI //Kevin0.86, for font mode program UI use only
BYTE     __bProgramInputNum[4];
BYTE     __bModifyEntry;
#endif
BYTE     __bProgramPlayingIndex;
extern DWORD    __dwGoToTime;                   // Time that use GOTO position
extern DWORD    __dwResumeTime;             // Time that record final stop point
//extern BIT      __btInputProgram;           // PROGRAM in INPUT mode
//extern BIT      __btPlayingProgram;         // Now is playing PROGRAM
//extern BIT      __btNextPlayProgram;        // Ready for play PROPRAM;
//Kevin0.86, comment
//extern WORD     __wProgramData [PROGRAM_TRACK];  // update max. program entry to PROGRAM_TRACK
#ifndef CT908_UI //Kevin0.86, for font mode program UI use only
//extern BYTE     __bInputNumIndex ;
#endif
//extern BYTE     __bProgramMaxEntry;
extern BYTE     __bTitleNum,__bChapterNum;
extern BYTE     __bNVPlayMode;

// end ..
// wyc.172-CDDA, extern the flag to represent CDDA is play across tracks automatically.
extern BYTE     __bCDDAAutoChTrk;
// DVD_276Micky, bit reduce
///extern BIT      __btTrueKey;
// wyc1.07a. remove this variale.
//extern BYTE     __bKeyRepeat;        // in isr.c
extern DWORD IDATA     __dwTimeKey;          // time reference; First Number Key
extern BIT      __btPlayFromBegin;        // Told F/W it should play Track-Begin first
extern BIT      __btFromStopMode;         // GOTO position comes from a "STOP" mode
extern BIT      __btNewTime;              // A flag that means it's a NEW time
extern  BYTE    __bTimeMin, __bTimeSec;         // GOTOTime Usage
extern  BYTE    __bGoToTimeNO;                  // count the I/P Number in GoToTime
extern  BYTE    __bModePlay;
// LLY.036
extern  BYTE    __bTimeHour;    // GoTo Time usage

DWORD           __dwPreGetTime= 0;           // Previous get time, time reference
extern DWORD        __dwTimeA, __dwTimeB;           // record the times for repeatAB
//DVD_051Micky, Number >10
extern WORD    __wNumberQueue;
extern WORD __wNumberPrevious;        // record previous valid number key

//**********************************************************************
//  Function    : LINEAR_ChangeTrack
//  Description : Play the next/prev track or the specified track number
//              : the prev/next track is decided according to the REPEAT mode
//              : (Exception PROGRAM->input entries->PLAY)
//  Parameters  : bKey: KEY_NEXT/KEY_PREV
//              :       bTrackNO: 1 Means auto play to next track from LINEAR_Trigger, 0 means press key to next track.
//              :       KEY_NUMBER, must reference bTrackNO
//              :       bTrackNO: specified track number to play(logical track)
//              :                 0, means current __wPlayItem(current track)
//  Return      : TRUE, stay in playing mode
//              : FALSE, stop playing
//  Changed     : __wPlayItem, __bModePlay
//**********************************************************************
BYTE LINEAR_ChangeTrack(BYTE bKey, WORD wTrackNO)
{
    BYTE        bCmd;//unused, bTemp;

    // __btNextPlayProgram=TRUE, is set when PROGRAM->Entries->PLAY
    // When KEY_NEXT is pressed or current track play end
    // it must directly play the first program entry

// test, when repeat none
// play last track, then select track 1 or last
// PROGRAM->ANY TRACK, will cancel program mode????

    // 1. when KEY_NEXT or KEY_PREV is pressed
    // must check the repeat mode!!!
    // 2. for key number, it will directly play the specified track
    // don't care the current repeat mode

    if ( bKey == KEY_NUMBER)
    {
        if ( !wTrackNO) // KEY_N0, play the first track
            wTrackNO = 1;

        // Key number (KEY_Nx) will clear the random mode
// Micky2.79, tune the usage of __bCountStop, don't reference DOUBLE_STOP
// KEY_NUMBER only clear Random mode when playing and real stop.
// __btRandom is on when playing and pre-stop.
        if (__btRandom && (__bCountStop ==0) )
        {
            __btRandom= FALSE;
            OSD_OUTPUT_MACRO(MSG_RANDOM, __btRandom, 3);
        }
    }
    else
    {
        // ** 0.16; Random mode don't care of REPEATMODE
        if ( ! __btRandom )
        {
            // check current repeat mode
            bKey = _CheckRepeatMode( bKey );

            // ** TCH2.81; begin... 
            if  ( bKey == KEY_REPEAT )
            {
                bKey= KEY_NUMBER;       // let's go original path
                wTrackNO= __wPlayItem;
            }
            else
            // ** TCH2.81; end... 
            if ( bKey == KEY_NUMBER )   // REPEAT_ONE, repeat the current track
            {
                // means play current __wPlayItem
                wTrackNO=0; // CD-DA track number same as play item number
            }
            else
            if ( bKey == KEY_STOP)      // REPEAT_NONE, will enter STOP mode
                return FALSE;
        }
    }

    switch ( bKey )
    {
        case    KEY_NEXT:           // play the next track
        case    KEY_PREV:           // play the prev. track
//jyliu.temp
{
extern BYTE __bNextOSD;
__bNextOSD = TRUE;
}
#ifdef  PROGRAM1
            if (__btPlayingProgram)
            {
                if (__btNextPlayProgram)
                {
                    __btNextPlayProgram=FALSE;
                }
                else
                {
                    // wyc.pro __wProgramData[1] -> __bProgramCurrentIndex
                    // merge the key prev and next operation
                    if (bKey == KEY_NEXT)
                        __bProgramPlayingIndex++;
                    else if (bKey == KEY_PREV)
                        __bProgramPlayingIndex--;
                }
#else
            if ( __btProgram )
            {
                // wyc.pro __wProgramData[1] -> __bProgramCurrentIndex
                __bProgramPlayingIndex++;
#endif  //#ifdef    PROGRAM1
                // wyc.pro __wProgramData[0] -> __bProgramMaxEntry , __wProgramData[1] -> __bProgramCurrentIndex
                // and set when __bProgramCurrentIndex >= PROGRAM_TRACK, goto stop mode
                if (( __bProgramPlayingIndex >= __bProgramMaxEntry ) || (__bProgramPlayingIndex < 0))
                {
                    // wyc.101a, to fix when program playing mode, repeae disc is not available problem
                    // wyc1.10, make KEY_NEXT / KEY_PREV repeat playing in program playing mode. Auto play will stop when program playing to last entry.
                    // Also add control to make repeat mode will continue playing and make .
                    // Also make playing program always repeat.
                    if ( (!__btPlayingProgram) && (__bKeySource != KEY_FROM_ISR) && (__bRepeat != REPEAT_DISC) )
                    {
                        // LLY2.37p, assign KEY_STOP from F/W
                        // To avoid IR and F/W key conflict issue
                        //__bISRKey = KEY_STOP;
                        __bFWKey=KEY_STOP;
                        return TRUE;
                    }
                    else
                    {
                        if (bKey == KEY_NEXT)
                            __bProgramPlayingIndex = 0;
                        else if (bKey == KEY_PREV)
                            __bProgramPlayingIndex = __bProgramMaxEntry - 1;
                    }
                }

                // wyc.pro  __wProgramData[1] -> __bProgramCurrentIndex
                // wyc.pro1 check if array is null, if null go to next program entry, and modify the function name
                if (bKey == KEY_NEXT)
                    __bTemp = _LinearEntryOperation(LINEAR_FIND_ENTRY,1);
                else if (bKey == KEY_PREV)
                    __bTemp = _LinearEntryOperation(LINEAR_FIND_ENTRY,0);
                // confirm the porgram has data
                if (__bTemp == 1)
                {
                    if (__wDiscType & BOOK_DVD)
                    {
//Kevin0.86, __bTitle/__wChapter for font mode / GDI mode program UI                       
#ifndef CT908_UI  
                        __wTemp= __wProgramData[__bProgramPlayingIndex];
                        __bTitle = HIBYTE(__wTemp);
                        __wChapter = (WORD)LOBYTE(__wTemp);
#else
						__bTitle = __ProgIdxList[__bProgramPlayingIndex].bMainIndex;					
						__wChapter = __ProgIdxList[__bProgramPlayingIndex].wSubIndex; 
#endif
                        
                        NV_TitlePlay(__bTitle,__wChapter);
                        // wyc.101 add the return code
                        return TRUE;
                    }
                    else					
                    {
//Kevin0.86, __wPlayItem for font mode / GDI mode program UI    
#ifndef CT908_UI
                        __wPlayItem= __wProgramData[ __bProgramPlayingIndex];
#else
                        __bFMPlayingDir = __ProgIdxList[__bProgramPlayingIndex].bMainIndex;   //for FM use only
                        __wPlayItem= __ProgIdxList[__bProgramPlayingIndex].wSubIndex; 
#endif
					}
                }
                else
                {
                    // wyc1.10-3, when select some entries to program playing and then remove them, then system will enter stop mode.
                    // Now make it go normal playing and clear program mode.
                    //__bISRKey = KEY_STOP;
                    LINEAR_Program(LINEAR_PROGRAM_CLEAR,NULL);
                    __wPlayItem++;
                }

                // for VCD, the __wPlayItem=TrackNO+1;
                if  ( __wDiscType & BOOK_VCD )
                    __wPlayItem++;
            }
            else
            {
                // directly play the next play track
                // __wPlayItem value is according to disc type
                // wyc.pro merge key prev and next
                if (bKey == KEY_NEXT)
                {
                    // wyc1.10, because set this __dwTimeKey to 0 will make F/W to clear the input number, so now not to 
                    // clear it to allow user can input number by 10+ without F/W clear
                    //__dwTimeKey= 0;

                    // LLY0.83b-2, Let FM_Action(KEY_NEXT) handle NEXT action
                    // Because, __wPlayItem meaning maybe different between CT9928AF & CT908
                    // CT9928AF: __wPlayItem index from 1 ~ Total files within disc
                    // CT908: __wPlayItem index from 1 ~ Total files within current directory
                    // if nothing is done within this API, then go original flow
                    if(FM_Action(KEY_NEXT, __wPlayItem)==FM_ACTION_CONTINUE)
                    {
                        // wyc1.07a. remove variable __bKeyRepeat, so update code to __wPlayItem++ to play next item.
                        __wPlayItem ++;
                        if ( __wPlayItem > __wTrackEnd )
                        {
                            __wPlayItem= __wTrackBegin;     // roll back
                            // ** 2.76-TCHM; begin... Force to reset ICs for long-time play under VCD title.
                            if ( __wDiscType & BOOK_VCD )
                                __bModePlay= MODE_PLAYUNKNOW;
                            // ** 2.76-TCHM; end...

⌨️ 快捷键说明

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