📄 utl.c
字号:
// LLY2.51 create ...// ******************************************************************************************// Function : UTL_ShowJPEG_Slide// Description : Do Single JPEG Slide playback control// Arguments : bFrameIdx, specify the desired frame buffer index for JPEG slide show// And, the index from '0'// Return : TRUE, the action is ok// FALSE, the action is fail// ******************************************************************************************BYTE UTL_ShowJPEG_Slide(BYTE bType, BYTE bFrameIdx) //CoCo2.78, add "bType" parameter{ DWORD dwTemp; BYTE bResult=0xFF; // LLY2.51, don't set JPEG effect as none since screen save mode by JPEG Slide Show case // will enable JPEG effect feature. // LLY2.60, clear JPEG effect as none // otherwise we will see abnormal LOGO or JPEG screen saver while come from playback JPEG /w Effect __bHALJPEGEffect = HALJPEG_EFFECT_NONE; // Clear playback mode and attribe value // since it will be set as JPEG before call UTL_PlayItem() or UTL_SetPlayMode() __bModePlay = MODE_PLAYUNKNOW; __bAttrPlay = ATTR_NONE; HALJPEG_Reset(); // LLY2.56, base on user specified frame index // Since, 32M/64M solution will use frame 0 or 1 __HALJPEGSetting.bFrameBuffer=bFrameIdx; __HALJPEGSetting.bOperation = HALJPEG_OPERATION_I; __HALJPEGSetting.wDisplayStartH = MM_JPEG_FRAME_START_H; __HALJPEGSetting.wDisplayStartV = MM_JPEG_FRAME_START_V; __HALJPEGSetting.wDisplayWidth = MM_JPEG_FRAME_WIDTH; __HALJPEGSetting.wDisplayHeight = MM_JPEG_FRAME_HEIGHT; __HALJPEGSetting.dwBackgroundColor = HALJPEG_SLIDESHOW_BACKGROUND_COLOR; // Issue parsing JPEG header //HALJPEG_ParseHeader(JPEG_PARSE_TYPE_NORMAL, __HALJPEGSetting.bFrameBuffer); HALJPEG_ParseHeader(bType, __HALJPEGSetting.bFrameBuffer); //CoCo2.78, add "bType" parameter // Waiting parsing header done dwTemp=OS_GetSysTimer(); while( (OS_GetSysTimer()-dwTemp) < COUNT_3_SEC*2 ) { bResult = HALJPEG_Status(HALJPEG_PARSE_HEADER); if( bResult == JPEG_STATUS_OK ) { break; } } if( bResult != JPEG_STATUS_OK ) {#ifdef DEBUG_JPEG_SHOW DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_PRINTF, "parsing header fail, status: %lx\n", bResult);#endif // #ifdef DEBUG_JPEG_SHOW return FALSE; } // Issue JPEG decoding command HALJPEG_Decode(); // Waiting JPEG decoding done dwTemp=OS_GetSysTimer(); while( (OS_GetSysTimer()-dwTemp) < COUNT_5_SEC ) { bResult = HALJPEG_Status(HALJPEG_DECODE); if( bResult == JPEG_STATUS_OK ) { break; } } if( bResult != JPEG_STATUS_OK ) {#ifdef DEBUG_JPEG_SHOW DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_PRINTF, "JPEG decode fail, status: %lx\n", bResult);#endif // #ifdef DEBUG_JPEG_SHOW return FALSE; } // Issue display command bResult = HALJPEG_Display(__HALJPEGSetting.bFrameBuffer); if(bResult != SLIDESHOW_RET_OK) {#ifdef DEBUG_JPEG_SHOW printf("JPEG display fail, status: %lx\n", bResult);#endif // #ifdef DEBUG_JPEG_SHOW return FALSE; }#ifdef DEBUG_JPEG_SHOW printf("JPEG display ok\n");#endif // #ifdef DEBUG_JPEG_SHOW return TRUE;}// LLY1.06, modify the procedure to support LOGO from flash directly.// ******************************************************************************************// Function : UTL_ShowLogo// Description : Issue the necessary action to show LOGO// Argument : None// Return : TRUE, background LOGO is display ok// FALSE, LOGO decoding is not complete// Notice : Must turn-on cache mode while access PROM in DWORD unit// ******************************************************************************************#define LOGO_DATA_OFFSET_BYTE 8 // Define the offset bytes of logo real data (ie. not include header)#ifdef SUPPORT_LOGO_AUTO_FULL_SCREENBYTE DisplayLogoFlag=FALSE;#endifBYTE UTL_ShowLogo(void){#ifndef NO_LOGO DWORD dwCnt; DWORD dwSize; DWORD dwTemp; DWORD dwPreVisStill; //Aron2.51 fix repeat KEY_SETUP soon leads NV RSM wrong (go to the last vobu with video)//Micky2.11a DWORD dwSaveInt; BYTE bLogoType; // Keep logo type, ex. MPEG Still, Motion, JPEG BYTE bBitFormat; // Keep bitstream format, ex. NTSC or PAL#ifdef LOGO_FROM_FLASH // Must using DWORD unit for access flash data, since H/W limitation. // LLY2.15, using new method to find logo address //volatile PDWORD pdwPtr = (PDWORD)LOGO_START_ADDR; volatile PDWORD pdwPtr; ULONG_UNION ulunData; PSECTION_ENTRY pLogoTbl;#else // #ifdef LOGO_FROM_FLASH PDWORD pdwPtr;#endif // #ifdef LOGO_FROM_FLASH#ifdef SUPPORT_LOGO_AUTO_FULL_SCREEN DisplayLogoFlag=TRUE;#endif // Don't re-draw LOGO while background LOGO is same as requirement //if(__bLOGO == LOGO_DEFAULT) if(LOGO_TYPE() == LOGO_DEFAULT) // LLY0.80 { #ifdef SUPPORT_LOGO_AUTO_FULL_SCREEN DisplayLogoFlag=FALSE; #endif return TRUE; } // LLY2.51, do parser & source stop earily before start LOGO show. // wyc2.53-909P, SrcFilter_Stop(__dwSFStreamID); HAL_ControlParser(HAL_PARSER_STOP, 0); // LLY0.68, base on LOGO design spec. to get logo related information, ex. // bit[31:24]: LOGO Type // bit[23:16]: Bitstream format // bit[15:0]: data length (DWORD unit)#ifdef LOGO_FROM_FLASH // LLY2.51, remove __bLOGOIndex reference. // LLY2.38, porting CoCo's code to support multi-LOGO#if 0 switch (__bLOGOIndex) { case 1: pLogoTbl = ROMLD_GetSectionByName(0, "LOG1"); break; case 2: pLogoTbl = ROMLD_GetSectionByName(0, "LOG2"); break; case 0: default: pLogoTbl = ROMLD_GetSectionByName(0, "LOGO"); break; }#endif // #if 0 #ifdef SUPPORT_POWER_ON_DISPLAY_LOGO { extern BYTE _bPowerOnFlag; if(_bPowerOnFlag) { pLogoTbl = ROMLD_GetSectionByName(0, "LOG3"); } else { pLogoTbl = ROMLD_GetSectionByName(0, "LOGO"); }}#else pLogoTbl = ROMLD_GetSectionByName(0, "LOGO");#endif if(!pLogoTbl) { DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_PRINTF, "Can't find LOGO data\n");#ifdef SUPPORT_LOGO_AUTO_FULL_SCREEN DisplayLogoFlag=FALSE;#endif return (FALSE); } pdwPtr = (PDWORD) pLogoTbl->dwRMA; // Read-back 1st DWORD data from flash ulunData.dw32bit=pdwPtr[0]; bLogoType=ulunData.b8bit[0]; bBitFormat=ulunData.b8bit[1]; dwSize=ulunData.b8bit[2]*256 + ulunData.b8bit[3]; // Set the pointer to logo data start address // Notice: must /4, since pdwPtr is DWORD unit pdwPtr += LOGO_DATA_OFFSET_BYTE/4;#else // #ifdef LOGO_FROM_FLASH bLogoType=aLogoData[0]; bBitFormat=aLogoData[1]; dwSize=aLogoData[2]*256 + aLogoData[3]; // Set the pointer to logo data start address pdwPtr = (PDWORD) &aLogoData[LOGO_DATA_OFFSET_BYTE];#endif // #ifdef LOGO_FROM_FLASH // Specify the bitstream format as NTSC or PAL if(bBitFormat==0xFF) // PAL { __btNTSCBitStream=FALSE; } else // NTSC { __btNTSCBitStream=TRUE; } HAL_AdjustTFT_DigitalMode(TRUE); // LLY0.80, clear bit[3:0] as zero for __bLOGO // Otherwise, __bLOGO |= LOGO_DEFAULT action maybe no effect while LOGO_JPEG --> KEY_OPEN_CLOSE // Notice: don't change bit[7:4] value since LOGO attribute maybe clear __bLOGO &= 0xF0; // LLY0.70, enable the LOGO_DEFAULT as LOGO type first // Since, decoder will call HAL_AdjustTVMode() after sequence header detected. // So, it will go wrong path within _AspectRatio() __bLOGO |= LOGO_DEFAULT; // For MPEG still Logo if(bLogoType==0x4D) { // LLY0.72, create the MPEG thread if it doesn't exist if( !(OS_PeekFlag(&__fThreadInit) & INIT_DEC_THREAD_MPEG_DONE) ) { INITIAL_ThreadInit(THREAD_MPEG_DECODER); // LLY0.95, the waiting time is absolute time // wait the thread initial done //cyg_flag_timed_wait( &__fThreadInit, INIT_DEC_THREAD_MPEG_DONE, CYG_FLAG_WAITMODE_AND, COUNT_50_MSEC); OS_TimedWaitFlag( &__fThreadInit, INIT_DEC_THREAD_MPEG_DONE, FLAG_WAITMODE_AND, (COUNT_50_MSEC) ); // print-out the warning message if the thread initial fail. if( !(OS_PeekFlag(&__fThreadInit) & INIT_DEC_THREAD_MPEG_DONE) ) { DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_PRINTF, "MPEG thread not initial done, value: %lx\n", OS_PeekFlag(&__fThreadInit)); #ifdef SUPPORT_LOGO_AUTO_FULL_SCREEN DisplayLogoFlag=FALSE; #endif return (FALSE); } // LLY2.21, remove turn-off main video procedure into UTL_Config_FrameBuffer() // LLY0.85a, reset the mainvideo frame buffer address as MPEG mode after create MPEG thread ok // Otherwise, MPEG LOGO will be displayed abnormal while JPEG --> KEY_OPEN_CLOSE // Notice: // (1) Must turn-off the display first to avoid seeing un-except screen // (2) Don't put these control before MPEG thread create routine // Since __bLOGO type is not LOGO_JPEG while JPEG preview --> MP3 playing --> KEY_OPEN_CLOSE // So, F/W don't turn-off the display first to avoid the un-except screen //DISP_DisplayCtrl(DISP_MAINVIDEO, FALSE); //kevin1.00, JPEG & MPEG use diff. gains __bTVE_JPEG = FALSE; //MPEG Display will call HAL_AdjustTVMode#ifdef SUPPORT_TFT // Alan1.06, force to set VP underlying registers; otherwise Logo when TV mode=PAL will not be shown (TFT_Init set N as default) until main loop ~sec later // Notice: Need to doble check why put here // Since, bitstream format is ready until decoder decoding done, // So call it @ HAL_AdjustTVMode() is better. TFT_Trigger();#endif // #ifdef SUPPORT_TFT } // Chuan2.61, Set MainVideo Frame Buffer Address even though MPEG thread always exist. // Since, CDG will set its Frame Buffer Setting, so we need set it back now. // LLY2.17, collect frame buffer setting procedure into UTL_Config_FrameBuffer() // Chuan2.22, LOGO always do BFR. It major avoid to set the wrong BFR info at the following flow. // AVI(no BFR) -> LOGO -> DVD // Because nobody set the information at DVD/SVCD/VCD UTL_BFRModeSet(TRUE); UTL_Config_FrameBuffer(UTL_FRAMEBUF_MOTION); // LLY0.64, Issue update sequence header HAL_Reset(HAL_RESET_VIDEO);#ifdef SUPPORT_POWER_SAVING // Micky2.11a, integrate VDEC power down into a API. HAL_PowerControl(HAL_POWER_VDEC, HAL_POWER_NORMAL);#endif // LLY0.64-1, set playing mode and attribute // Must check how to do for reasonable method. __bModePlay=MODE_PLAYUNKNOW; __bAttrPlay=ATTR_NONE; // Micky2.11a, integrate fill data to video buffer procedure into a API HAL_FillVideoBuffer(HAL_VIDEOBUF_NORMAL, pdwPtr, dwSize); // Micky2.11a, integrate video decoder reset procedure into a API. HAL_ResetVideoDecoder(HAL_VIDEO_DECODER1|HAL_VIDEO_DECODER2 ); //Aron2.51 fix repeat KEY_SETUP soon leads NV RSM wrong (go to the last vobu with video) //Check the last video is still or not. HAL_ReadInfo(HAL_INFO_STILL, &dwPreVisStill); // LLY0.70, clear still flag first // Otherwise, still ack will be get quickly while still --> LOGO HAL_PlayCommand(COMMAND_V_CLEAR_STILL, 0); HAL_PlayCommand(COMMAND_PLAY, 0); dwCnt=0; dwTemp=OS_GetSysTimer(); while( (OS_GetSysTimer() - dwTemp) < COUNT_2_SEC) { HAL_ReadInfo(HAL_INFO_STILL, &dwCnt); // LOGO display OK if(dwCnt) { // LLY0.70, read-back the desired frame buffer index, and enable the video display // Fix, LOGO can't display while Still --> KEY_OPEN_CLOSE // Since, vsync not enable the display, and decode receive the stop command. HAL_ReadInfo(HAL_INFO_DECFRAME, &dwCnt); HAL_PlayCommand(COMMAND_STOP, 0); DISP_Display(dwCnt, DISP_MAINVIDEO); // LLY0.75, must force enable the display !! DISP_DisplayCtrl(DISP_MAINVIDEO, TRUE);#ifdef SUPPORT_TFT TFT_Trigger(); //force to set VP underlying registers; otherwise Logo when TV mode=PAL will not be shown (TFT_Init set N as default) until main loop ~sec later#endif // #ifdef SUPPORT_TFT//Aron2.51 fix repeat KEY_SETUP soon leads NV RSM wrong (go to the last vobu with video) //Check the last video is still or not. //If previous one is not still, clear it. if(!dwPreVisStill) { HAL_PlayCommand(COMMAND_V_CLEAR_STILL, 0); } #ifdef SUPPORT_LOGO_AUTO_FULL_SCREEN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -