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

📄 mm_play.c

📁 ct952 source code use for Digital Frame Photo
💻 C
📖 第 1 页 / 共 5 页
字号:
			__bMMStage=MM_STAGE_START_PRESCAN;
			
			// LLY1.06, initial the prescan VOB information cnt as 1
			bPreScanCnt=1;
		}
		break;
		
	case    MM_STAGE_START_PRESCAN:
		// LLY1.10, always "keep current playback item" flow while issue pre-scan command
		// And, don't set __bSameItem value, since it will be set during LINEAR_PlayItem()
		// Otherwise, F/W will think it as same file while current pre-scan action abort --> KEY_PREV
		// Notice: original code is put @ MM_STAGE_SET_PLAYMODE
		__wPrevPlayItem=__wPlayItem;
		__wPrevPlayDir=__MMPlayingItem.wDirID;
		
		
		// LLY1.01, Issue pre-scan command first, and enter polling pre-scan done stage
		// Notice: Must using __bAttrPlayNew instead of __bAttrPlay
		//         Because, UTL_SetPlayMode() is called within MM_STAGE_SET_PLAYMODE
		//         So, __bAttrPlay is not ready
		if(__bAttrPlayNew==ATTR_AVI)
		{
		    // Grievous2.78, must reset sp mode as unknown
		    __bUTLSPTextMode = 2;
			UTL_PreScanAction(PRESCAN_MOTION_INFO, __dwTimeBegin, __dwTimeEnd);
		}
		else if(__bAttrPlayNew & TYPE_CDROM_AV)
		{
			// LLY1.06, parseing multi-audio/ subpicture information for *.VOB/*.DAT/*.MPG together
			// [1] Calculate the desired end sector for source to send data during prescan
			__dwTemp = __dwTimeBegin + (bPreScanCnt*JUMP_SECTOR_FOR_PRESCAN_VOB_INFO);
			
			// (desired end position-gap) < file end < (desired end position)
			if( (__dwTemp>__dwTimeEnd) && ((__dwTemp-JUMP_SECTOR_FOR_PRESCAN_VOB_INFO)<__dwTimeEnd) )
			{
				// Assign range as (desired end position - gap) ~ (file end)
				// Notice: (__dwTemp-JUMP_SECTOR_FOR_PRESCAN_VOB_INFO) maybe == file begin.
				UTL_PreScanAction(PRESCAN_1ST_SCR, (__dwTemp-JUMP_SECTOR_FOR_PRESCAN_VOB_INFO), __dwTimeEnd);
			}
			// desired end position <= file end
			else if( __dwTemp<= __dwTimeEnd )
			{
				// Assign range as (desired end position - gap) ~ desired end position
				UTL_PreScanAction(PRESCAN_1ST_SCR, (__dwTemp-JUMP_SECTOR_FOR_PRESCAN_VOB_INFO), __dwTemp);
			}
			// end position is out-of the playback range
			else
			{
				// Set error while can't find the 1st SCR value
				UTL_SetPreScanError(ERR_1ST_PRESCAN_FAIL);
				
				// Keep the time for enter skip item stage for time-out control
				__dwPreGetTime=OS_GetSysTimer();
				
				// Skip current file
				__bMMStage=MM_STAGE_SKIP_ITEM;
				
				DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_MM_INFOFTR,"1st p-scan fail\n");
				
				// LLY2.50, output message while skip file since pre-scan fail
#ifndef  NO_OUTPUT_INFO_FOR_UNKNOWN_AV_FORMAT
				strcpy(__bMsgString, "Skip File since prescan fail");
				OSD_Output(MSG_STRING, 0, 10);
#endif  // #ifdef  NO_OUTPUT_INFO_FOR_UNKNOWN_AV_FORMAT
				
				break;
			}
#ifdef MM_MOTION_DEBUG
			DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_MM_INFOFTR,"1st PreScan: %lx\n", bPreScanCnt);
#endif //
			
		}
		
		// Set the stage to polling prescan command done
		__bMMStage = MM_STAGE_POLLING_1ST_PRESCAN_DONE;
		break;
		
	case    MM_STAGE_POLLING_1ST_PRESCAN_DONE:
		if (__bAttrPlayNew == ATTR_AVI)
		{
			__bMMrogressCnt++;
			if ((__bMMrogressCnt % MM_MSG_PROGRESS_DIV_NUM) == 1)
			{
				if (__bMMrogressCnt == 1)
					OSD_Output(MSG_PROGRESS, 1, 1);
				else
					OSD_Output(MSG_PROGRESS, 0, 1);
			}
		}
		// [1] Waiting until parser report prescan action done
		if( !PARSER_QueryEvent(0, PARSER_EVENT_COMPLETED, FALSE) )
			break;
		
		// [2] Stop servo first after pre-scan done.
		SrcFilter_Stop(__dwSFStreamID);		
		
		// [3] Check the result of 1st pre-scan command
		if( PARSER_QueryEvent(0, PARSER_EVENT_ERROR, FALSE) )
		{
			// LLY1.06, do another range pre-scan action for *.VOB/ *.DAT/ *.MPG file
			if(__bAttrPlayNew & TYPE_CDROM_AV)
			{
				if(bPreScanCnt<5)
				{
					// Increase the prescan count
					bPreScanCnt++;
					
					// Set the stage to prescan 1st SCR again
					__bMMStage = MM_STAGE_START_PRESCAN;
					
					break;
				}
			}
			
			// If pre-scan action fail
			// Do error procedure while 1st prescan fail
			UTL_SetPreScanError(ERR_1ST_PRESCAN_FAIL);
			
			// Increase the retry count by one
			__bResetRecover++;
			
			// LLY1.02, retry the same file again if 1st pre-decode fail
			// Otherwise, go to the next file.
#ifdef  REDECODE_CURRENT_ITEM
			if(__bResetRecover <= MM_REDECODE_COUNT_LIMIT)
			{
				
				__bMMStage=MM_STAGE_START_PRESCAN;
				
				SRCFilter_EnableCacheFlush();  // F100CSC_102, for flush Servo's cache, i.e. read all sector again
				
#ifdef MM_MOTION_DEBUG
				DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_MM_INFOFTR,"Retry same file, Retry Cnt: %lx\n", __bResetRecover);
#endif //
			}
			else
#endif  // #ifdef REDECODE_CURRENT_ITEM
			{
				// Keep the time for enter skip item stage for time-out control.
				__dwPreGetTime=OS_GetSysTimer();
				__bMMStage=MM_STAGE_SKIP_ITEM;
				
				DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_MM_INFOFTR,"G-up, 1st p-scan fail\n");
				
				// LLY2.50, output message while skip file since pre-scan fail
#ifndef  NO_OUTPUT_INFO_FOR_UNKNOWN_AV_FORMAT
				strcpy(__bMsgString, "Skip File since prescan fail");
				OSD_Output(MSG_STRING, 0, 10);
#endif  // #ifdef  NO_OUTPUT_INFO_FOR_UNKNOWN_AV_FORMAT
				
			}
			break;
		}
		
		// [4] If pre-scan action success
		// Notice: Must using __bAttrPlayNew instead of __bAttrPlay
		//         Because, UTL_SetPlayMode() is called within MM_STAGE_SET_PLAYMODE
		//         So, __bAttrPlay is not ready
		if( __bAttrPlayNew == ATTR_AVI ) // for DivX, AVI, MP4 file
		{
#ifdef  SUPPORT_MP4
			// LLY1.20, Add procedure to check MP4 header prescan action done or not first
			if(MM_GetFileType(__MMPlayingItem.wDirID, __wPlayItem) == EXTNAME_MP4)
			{
				// Check if MP4 header is ready or not
				if(PARSER_QueryEvent(0, PARSER_EVENT_NOT_READY, TRUE))
				{
					// Update start position again before issue 2nd MP4 header prescan
					__dwTemp = PARSER_GetMP4MoovBoxPosition();
					
					// Continue to 2nd MP4 header prescan action
					UTL_PreScanAction(PRESCAN_MOTION_INFO, __dwTemp, __dwTimeEnd);
					
					// And, let the stage still to polling 1st prescan action done
					// ie. don't change the stage value
					break;
				}
			}
#endif  // #ifdef SUPPORT_MP4
			// Read-back the necessary information
			UTL_Read_PreScan_Info(PRESCAN_MOTION_INFO);
			
			// LLY1.06, skip un-supported video resolution DivX file
#ifndef  DONT_SKIP_UNSUPPORT_V_FORMAT_DIVX
			if(__bVideoID == HAL_THROW_VIDEO)
			{
				__dwPreGetTime=OS_GetSysTimer();
				__bMMStage=MM_STAGE_SKIP_ITEM;
				DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_MM_INFOFTR,"Skip un-support A/V format DivX file\n");
				
				// LLY2.50, output message while skip un-supported video format file
#ifndef NO_OUTPUT_INFO_FOR_UNKNOWN_AV_FORMAT
				strcpy(__bMsgString, "Skip File since not supported video format");
				OSD_Output(MSG_STRING, 0, 10);
                // Winnie2.77, clear the video as black screen if skip video format since it may stay @ dialog box and don't play next file immediately.
#ifdef BLACK_SCREEN_WHILE_THROW_VIDEO                 
                HAL_ClearScreen(HAL_COLOR_BLACK, HAL_CLEAR_SCREEN_MPEG, HAL_DISP_CURRENTFRAME);
#endif //BLACK_SCREEN_WHILE_THROW_VIDEO
#endif //NO_OUTPUT_INFO_FOR_UNKNOWN_AV_FORMAT
				break;
			}
#endif //SKIP_UNSUPPORT_VIDEO_RESOLUTION_DIVX
			
			// LLY1.02, skip DRM/ AES file if not support DRM solution
			// LLY1.50, check DRM play state directly
			if(__bDRMPlayState==DRM_PLAY_STATE_SKIP)
			{
				// Keep the time for enter skip item stage for time-out control.
				__dwPreGetTime=OS_GetSysTimer();
				__bMMStage=MM_STAGE_SKIP_ITEM;
				DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_MM_INFOFTR,"Skip DRM/ AES\n");
				
				// LLY2.50, output message while skip DRM/ AES file
#ifndef NO_OUTPUT_INFO_FOR_UNKNOWN_AV_FORMAT
				strcpy(__bMsgString, "Skip file since not supported DRM/AES");
				OSD_Output(MSG_STRING, 0, 10);
				// Winnie2.77, clear the video as black screen if skip DRM/ AES file since it may stay @ dialog box and don't play next file immediately.
#ifdef BLACK_SCREEN_WHILE_THROW_VIDEO                
				DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_PRINTF, "Black Screen for skip DRM/ AES file\n");
				HAL_ClearScreen(HAL_COLOR_BLACK, HAL_CLEAR_SCREEN_MPEG, HAL_DISP_CURRENTFRAME);
#endif //BLACK_SCREEN_WHILE_THROW_VIDEO
				
#endif //NO_OUTPUT_INFO_FOR_UNKNOWN_AV_FORMAT
				
				break;
			}
			
			// LLY1.10, skip the non support motion file if the A/V all invalid
			if (!UTL_QueryCapability(QUERY_VALID_MOTION))
			{
				// Keep the time for enter skip item stage for time-out control
				__dwPreGetTime=OS_GetSysTimer();
				__bMMStage=MM_STAGE_SKIP_ITEM;
				DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_MM_INFOFTR,"Skip, A/V non-valid\n");
				
				// LLY2.50, output message while skip un-supported video format file
#ifndef NO_OUTPUT_INFO_FOR_UNKNOWN_AV_FORMAT
				strcpy(__bMsgString, "Skip File since not supported A/V format");
				OSD_Output(MSG_STRING, 0, 10);
#endif  //NO_OUTPUT_INFO_FOR_UNKNOWN_AV_FORMAT
				break;
			}
			
			// LLY1.20, enter parsing char-base SPST stage first
			// Notice: (1) skip this action if same file
			//         (2) can't do it after index table parsing done
			//             since it will destroy index table buffer
			if(__bSameItem)
			{
				__bMMStage = MM_STAGE_SET_PLAYMODE;
			}
			else
			{
#ifdef SUPPORT_CHAR_SUBPICTURE
#ifndef SUPPORT_INTERNAL_AND_CHAR_BASE_SUBPICTURE_TOGETHER
				if(__bSPSTNs == 0)
#endif //SUPPORT_INTERNAL_AND_CHAR_BASE_SUBPICTURE_TOGETHER
				{
#ifdef MM_MOTION_DEBUG
					DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_MM_INFOFTR,"Parser SP File\n");
#endif //MM_MOTION_DEBUG
					CHAR_SP_ParseSPFile();
				}
#endif //SUPPORT_CHAR_SUBPICTURE
				__bMMStage = MM_STAGE_POLLING_SP_PARSING_DONE;
			}			
		}
		else if(__bAttrPlayNew & TYPE_CDROM_AV) // For VOB/ DAT/ MPG file
		{
			// Read-back 1st SCR value
			UTL_Read_PreScan_Info(PRESCAN_1ST_SCR);
			
			__bMMStage = MM_STAGE_PRESCAN_LAST_SCR;
			
			bPreScanCnt=1;
		}
		break;
		
        // LLY1.20, add new stage to polling char base SPST paring done
        case    MM_STAGE_POLLING_SP_PARSING_DONE:
            // waiting char base SP parsing done
			
			__bTemp=UTL_PreScanAction(PRESCAN_MOTION_IDXTBL, __dwTimeBegin, __dwTimeEnd);
			
			// LLY1.05-1, if prescan motion index table command ok, go to polling done stage
			// and, no index table exist will return FALSE
			// wyc2.38a-909s, check if index table parsing hang, if don't update in 10s, we will abort the parsing flow.
			if(__bTemp)
			{
				__dwMMJPEGDisplayTime = OS_GetSysTimer();
				__wMMPreProgressCurrent = (__wProgressCurrent*100)/__wProgressTotal;
				__bMMStage = MM_STAGE_POLLING_IDXTBL_PRESCAN_DONE;
			}
			// Otherwise, go the set playing mode stage
			else
			{
				__bMMStage = MM_STAGE_SET_PLAYMODE;
			}
            break;
			
        case    MM_STAGE_POLLING_IDXTBL_PRESCAN_DONE:
            if (__bAttrPlayNew == ATTR_AVI)
            {
                __bMMrogressCnt++;
                if ((__bMMrogressCnt % MM_MSG_PROGRESS_DIV_NUM) == 1)
                {
                    OSD_Output(MSG_PROGRESS, 0, 1);
                }
            }
            // wyc2.38a-909s, check if index table parsing hang, if don't update in 10s, we will abort the parsing flow.
            if (((OS_GetSysTimer() - __dwMMJPEGDisplayTime) < COUNT_10_SEC*3) || ((((__wProgressCurrent*100)/__wProgressTotal) - __wMMPreProgressCurrent) > 5))
            {
                // [1] Waiting until parser report prescan action done
                if (!PARSER_QueryEvent(0, PARSER_EVENT_COMPLETED, FALSE))
                    break;
            }
            else
            {
                HAL_ControlParser(HAL_PARSER_STOP, 0);
                __bMMIndexTableOK = FALSE;
            }
			
            // [2] Stop servo first after pre-scan done.
            SrcFilter_Stop(__dwSFStreamID);
			
			// Check if MP4 header is ready or not
			if (PARSER_QueryEvent(0, PARSER_EVENT_NOT_READY, TRUE))
			{
				// Continue to 2nd MP4 header prescan action
				UTL_PreScanAction(PRESCAN_MOTION_IDXTBL, __dwTimeBegin, __dwTimeEnd);
				
				// And, let the stage still to polling 1st prescan action done
				// ie. don't change the stage value
				break;
			}
			
            // Query AVI vaild movie end position
            // And, update it to __dwTimeEnd if it reports less value than file end range
            {
                DWORD   dwTmp;

⌨️ 快捷键说明

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