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

📄 fmanager.c

📁 车载电子影音系统dvd播放系统原程序代码
💻 C
📖 第 1 页 / 共 5 页
字号:
            else
                //return ERR_ERROR;
                return; //CoCo1.21

//Alex1.10,20031105 System will support MP2 format audio

            W99AV_ReadDM(W99AV_DM_CRC_ENABLE,  &__dwTemp);
            
            // wyc1.10-3, modify code to avoid error enter follow code when file is VOB or DAT. Otherwise VOB won't enter next file.
            //alex1.10,20031118 check mp2 noise begin        
            // we only use bit1 to determine Mp2 or mp3  0->mp2 , 2->mp3
            // only mp2 or mp3 will run this work flow, other audio format will not 
            /* --CoCo1.21
            if (!( __dwTemp & 0x0002)) 
                __bTemp=ATTR_MP2;
            else if (__dwTemp & 0x0002) 
                __bTemp=ATTR_MP3; 
            */
            //CoCo1.21, use this statement to reduce code size
            if (__dwTemp & 0x0002)
                __bTemp=ATTR_MP3;
            else
                __bTemp=ATTR_MP2;

            if ( (__bTemp!=__bAttrPlay) &&  (__bAttrPlay==ATTR_MP2 ||__bAttrPlay==ATTR_MP3) )
            //alex1.10,20031118 check mp2 noise end        
            {            
                __bAttrPlayNew=__bTemp;            
                UTL_SetPlayMode(MODE_PLAYAUDIO);                            
                __dwTimeNow= __dwTimeBegin;
                __btPlayEnd= FALSE;                            
                CHIPS_OpenAudio (TRUE);    // VCD_071                
                UTL_PlayFromTime ( __dwTimeNow );
                
            }
            else
            {
                __dwTimeNow= __dwTimeBegin;
                __btPlayEnd= TRUE;            
                __bFMStage=STAGE_NEXT_ITEM;
                CHIPS_OpenAudio (FALSE);    // VCD_071
            }        			
        }
        break;

    // LLY.275, polling INT_IFSC to prepare display picture
    case    STAGE_DISPLAY:
        // Check if decoding OK !!
        // LLY0.83b-2, using same API to check decoding status for CT9928AF/ CT908
        //if(HAL_CheckInterrupt(INT_IFSC))
		//CoCo1.22, modify JPEG flow
#ifdef JPG_DEBUG_INFO
		_printf("\n Query Decode Command"); //CoCo1.22a, for JPEG debug
		
		_FM_DebugInfo(); //CoCo1.22a, for JPEG debug
#endif
		__bTemp = HAL_QueryStatus(HAL_JPEG_DECODE_STATUS);
        if (__bTemp == HAL_QUERY_RESULT_OK)
        {
#ifdef JPG_DEBUG_INFO
            __bTemp=FM_GetFileType(__wPlayItem);
            
            if (__bTemp != EXTNAME_JPG) //CoCo1.22a, for JPEG test
            {
                _printf("\n__wPlayItem = %x   ", __wPlayItem);
                _printf("__bFMActiveDir = %hx", __bFMActiveDir);							
                _printf("\nNot JPEG after JPEG decode OK.");
            }
#endif //JPG_DEBUG_INFO

            // Clear INT_IFSC, because decoding ok will turn-on this flag on CT9928AF
#ifdef  _DEBUG_TWO_BUFFER
            printf("Display OK at %u frame buffer !! \n", __btActiveFrame);
#endif  // #ifdef _DEBUG_TWO_BUFFER

// LLY.276p-4, the necessary thing for two buffer case :
// [1] Issue display command to specify the desired frame buffer
// [2] Toggle the frame buffer variable
#ifndef JPEG_SINGLE_BUFFER

            /*--CoCo1.21, remove __bDecodeMode
#ifdef  _DEBUG_DECODING_MODE
                printf("#### Decoding mode is %u ;\n", __bDecodeMode);
#endif  // #ifdef _DEBUG_DECODEING_MODE
            */
            // wyc1.24, initial these value when decode & display OK.
            __wMonitorLackIFD = 0;
            __bDoActionInStage = TRUE;
            __bFMJPGNext = 0;
            __dwFMJPGNextGap = 0;

#ifdef SUPPORT_JPEG_3_FRAMES
            HAL_JPEGOperation();

            __dwCheckTime  = UTL_GetSysTimer();
            while ((UTL_GetSysTimer() - __dwCheckTime ) < COUNT_100_MSEC)    
            {
                if (HAL_QueryStatus(HAL_JPEG_DECODE_STATUS) == HAL_QUERY_RESULT_OK)
                    break;
            }
#endif

            // LLY.276p-4, the API spec. has updated
            //HAL_Display(HAL_DISPLAY_JPEG, __bDecodeMode);
            HAL_Display(HAL_DISPLAY_JPEG, HAL_JPEG_DECODE); //CoCo1.21, remove __bDecodeMode

            // LLY.276p-4, enable video display
            HAL_Display(HAL_DISPLAY_VIDEO, TRUE);

            // LLY.275, swap the frame buffer after display ok
#ifndef SUPPORT_JPEG_3_FRAMES
            __btActiveFrame=!__btActiveFrame;
#endif

#endif  // #ifndef JPEG_SINGLE_BUFFER

            // Check if enter idle mode or polling time-out
            _FM_IdleCheck();
        }
		else if (__bTemp == HAL_QUERY_RESULT_FAIL) //CoCo1.22
		{
#ifdef JPG_DEBUG_INFO //CoCo1.22a, for JPEG debug
            __bTemp=FM_GetFileType(__wPlayItem);
            
            if (__bTemp != EXTNAME_JPG)
            {
                _printf("\n__wPlayItem = %x   ", __wPlayItem);
                _printf("__bFMActiveDir = %hx", __bFMActiveDir);							
                _printf("\nNot JPEG after JPEG decode fail.");
            }
#endif
            
#if defined(JPG_DEBUG_INFO) || defined(_DEBUG_INFO) //CoCo1.22a, for JPEG debug
            OSD_OUTPUT_MACRO(MSG_ERRCODE, FM_JPEG_DECODE_FAIL, 0x1);
#endif //JPG_DEBUG_INFO|| _DEBUG_INFO
            
			_FM_JPEGRedecode();
			return;
		}
        break;

    case    STAGE_POLLING_TIMEOUT:
        // wyc0.90, make zoom and pause mode enter IDLE mode to avoid entering next picture.
        if((__bZoomFactor != VIEW_NORMAL) || __btPause)
        {
            // Stop time-out counting, and enter idle mode
            __bFMStage=STAGE_IDLE;
#ifdef  _DEBUG_JPEG_IDLE
            printf("Enter Idel Mode !!\n");
#endif  // #ifdef _DEBUG_JPEG_IDLE_STATE
        }
        else
        {
            // wyc1.07, use a key to adjust the timeout of JPG slide show.
            if( (UTL_GetSysTimer()-__dwTimeJPEGDisplay) > (__bFMJPGShowTime*COUNT_2_SEC) )
            {
                __bFMStage=STAGE_NEXT_ITEM;
            }
        }
        break;

    case    STAGE_NEXT_ITEM:
        // LLY.275a, clear the stage to none, if decoding & display ok
        // UTL_PlayItem() will set the stage to 1st step
        // To avoid, play to end track of title, but nobody to clear this value
        // wyc2.30, fix SCB to file begin, then pause is invalid.
        __bScanLevel = 0;
        __bFMStage=STAGE_NONE;
        __btPlaying=FALSE;
        // LLY.275, swap the frame buffer after display ok : STAGE_PLAYEND
        //__btActiveFrame=!__btActiveFrame;
        
        // LLY.274p-2, update __bISRKey value to let flow can through FM_ProcessKey()
        // Otherwise, nobody to redraw OSD menu while JPG --> MP3
        // LLY2.37p, assign KEY_NEXT from F/W
        // To avoid IR and F/W key conflict issue
        //__bISRKey=KEY_NEXT;
        __bFWKey=KEY_NEXT;
        
        // wyc1.24a, move the counting to here to avoid STOP -> PLAY in JPG will make video black.
        if (__bAttrPlay == ATTR_JPG)
            __wFMJPGPlayCount++;

        //LINEAR_ChangeTrack(KEY_NEXT, 0);
        break;

    case    STAGE_IDLE:
        // Check if exit idle mode
        _FM_IdleCheck();
        break;

    // LLY2.80, always return, ie. nothing need to do
    // while unknow stage or stage_none
    case    STAGE_NONE:
    default:
        //return ERR_ERROR;
        return; //CoCo1.21
        //break;
    }

    // LLY.276p-4, check INT_IFSC during JPG decoding unfinish
    // Becasue, current F/W don't decode all bitstream for progressive JPG
    // ie. DSP/ RISC will stop while decode ok
    // So, F/W can't polling to track end and enter STAGE_PLAYEND/ STAGE_DISPLAY
    // Thus, it's no chance to display the progressive JPEG w/ STAGE_DISPLAY
    if( (__bAttrPlay==ATTR_JPG) &&
        (__bFMStage>STAGE_DECODE && __bFMStage<STAGE_DISPLAY) )
    {
        // LLY0.83b-2, using same API to check decoding status for CT9928AF/ CT908
        //if(W99AV_GetPSRDW() & INT_IFSC)
        if(HAL_QueryStatus(HAL_JPEG_DECODE_STATUS) == HAL_QUERY_RESULT_OK)
        {
            HAL_ControlCDIF(HAL_CDIF_CLOSE);
            __btPlayEnd=TRUE;   //data input end, but not playing end
            __bFMStage=STAGE_DISPLAY;
        }
    }


    // Check if system hang procedure
    UTL_GetCurrentTime ();

    // every 0.5 sec check the remainder
    // can't shorten the perion, or will do at normal
    //Kevin1.08, WMA needs more than 0.5 sec
    //if ((__dwCountSystem-__dwPreGetTime) > COUNT_500_MSEC)
    if ((__dwCountSystem-__dwPreGetTime) > COUNT_1_SEC)
    {
        __dwPreGetTime=__dwCountSystem;
        if(__bAttrPlay==ATTR_MP3
//Alex1.10, 20031105 System will support MP2 format audio
            || (__bAttrPlay == ATTR_MP2)
            )
        {
            W99AV_ReadInfo(W99AV_INFO_AUDIO_REMAIN, &__dwTemp);
            if ((dwPreTime==__dwTimeNow) && (dwPreRemain==__dwTemp))
            {
#ifdef  _DEBUG_INFO
                //OSD_OUTPUT_MACRO(MSG_ERRCODE, DECODE_MP3_PROCEDURE_HANG, 0x1);
				OSD_OUTPUT_MACRO(MSG_ERRCODE, FM_MP3_DECODE_HANG, 0x1); //CoCo1.22, modify the error message definition.
#endif  // #ifdef _DEBUG_INFO
#ifdef  ERROR_CONCEAL
                // after 150 msec, data stay unchanged
                __bModePlay=MODE_PLAYUNKNOW;
                // LLY.274p, must give playing mode attribute before UTL_SetPlayMode()
                //UTL_SetPlayMode(MODE_PLAYMP3);
                __bAttrPlayNew=ATTR_MP3;

//Alex1.10, 20031105 System will support MP2 format audio
                __bAttrPlayNew=__bAttrPlay;
                
                UTL_SetPlayMode(MODE_PLAYAUDIO);
                __btPause=1;
                CC_KeyCommand(KEY_PLAY);    // will only set corresponding setting
                // if do this, must care time now < remain
                // 1 sectors=? sec. 2048*8/128000
                // 1 sec=44100/1152 frames
                // 1 sectors=? frame
                // be care of overflow
                // remain is double words
                // don't multiply 4 as *(5/4)
                dwPreRemain*=5; // the main data ratio is 4/5
                __dwTimeNow-=(dwPreRemain/2048);
                if (__dwTimeNow <= __dwTimeBegin)
                    __dwTimeNow=__dwTimeBegin;
                __dwTimeNow +=MP3_SKIP_SECTORS;
                // (2048*441)/(160*1152L)=441/90;
                // sectors* frame count
                __dwTemp=((__dwTimeNow-__dwTimeBegin)*(441*4L))/(90*5L);
                W99AV_WriteDM(W99AV_DM_FRAME_COUNT, __dwTemp);

                UTL_PlayItem(__wPlayItem, __dwTimeNow+1L);
                //__btFreeze=0;
                __dwPreGetTime=0;
                dwPreTime=0xffffffff;
#endif  // #ifdef ERROR_CONCEAL
            }
            else
            {
                dwPreTime=__dwTimeNow;
                dwPreRemain=__dwTemp;
            }   // if((dwPreTime==__dwTimeNow) && (dwPreRemain==__dwTemp))
        } // if(__btAttrPlay == ATTR_MP3)
#ifdef SUPPORT_WMA
        //Kevin1.08, no sync bitstream within WMA file except file header 
        else if(__bAttrPlay==ATTR_WMA)
        {
            //Kevin1.22, DRM can't decode  
            W99AV_ReadDM(W99AV_DM_WMA_FREQ_READ_FLAG, &__dwTemp);  //DM[0xe9d]=2: DRM can't decode 
            if (__dwTemp==2)
            {
                CT_strcpy(__bMsgString, "Cannot decode");
                OSD_Output(MSG_STRING, NULL, 0x1);
#ifdef WMA_DEBUG 
                _printf(" DRM cannot decode\n");
#endif                
            }            

            W99AV_ReadInfo(W99AV_INFO_AUDIO_REMAIN, &__dwTemp);
            if ((dwPreTime==__dwTimeNow) && (dwPreRemain==__dwTemp))
            {
#ifdef  _DEBUG_INFO
                //OSD_OUTPUT_MACRO(MSG_ERRCODE, DECODE_WMA_PROCEDURE_HANG, 0x1);
				OSD_OUTPUT_MACRO(MSG_ERRCODE, FM_WMA_DECODE_HANG, 0x1); //CoCo1.22, modify the error message definition.											
#endif  

#ifdef WMA_DEBUG //Kevin1.22
                _printf(" FM_WMA_DECODE_HANG\n");
#endif                

#ifdef  ERROR_CONCEAL
                __bFMStage=STAGE_NONE;
                __btPlaying=FALSE;
                // LLY2.37p, assign KEY_NEXT from F/W
                // To avoid IR and F/W key conflict issue
                //__bISRKey=KEY_NEXT;
                __bFWKey=KEY_NEXT;
                dwPreTime=0xffffffff;
#endif  // #ifdef ERROR_CONCEAL
            }
            else
            {
                dwPreTime=__dwTimeNow;
                dwPreRemain=__dwTemp;
            }   
        } //if(__bAttrPlay==ATTR_WMA)
#endif //#ifdef SUPPORT_WMA
        else if(__bAttrPlay==ATTR_JPG)
        {

⌨️ 快捷键说明

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