mediaplayerfunc.c

来自「M3355的源代码」· C语言 代码 · 共 2,203 行 · 第 1/5 页

C
2,203
字号
			wPlayNum=PPtemp.wTTN-1;
	    	if(PPtemp.wTTN-1<0)
	    		wPlayNum=wTmpCount-1;		
		}
		RemovedNumPlay(wPlayNum, 0);
        break;
	case UI_PLAYBACKRANGE_REPEATNONE:
	
    	if(bNextPrev)
    	{ 
			wPlayNum=PPtemp.wTTN+1;
			if(bUserOp)
			{
	    		if(wPlayNum+1>=wTmpCount)
	    			wPlayNum=0;  
			}
			else
			{
		    	if(wPlayNum+1>=wTmpCount)
		    	{
		    		MPF_Stop(C_USEROP);	
		    		break;
	    		}
    		}
		}
		else
		{
			wPlayNum=PPtemp.wTTN-1;
			if(bUserOp)
			{
			 	if(PPtemp.wTTN-1<0)
	    			wPlayNum=wTmpCount-1;	
			}
			else
			{
		    	if(PPtemp.wTTN-1<0)
		    	{
		    		MPF_Stop(C_USEROP);	
		    		break;
	    		}
    		}
	    		
		}
		RemovedNumPlay(wPlayNum, 0);
		break;
	default:
		MPF_Stop(C_USEROP);
		break;
    }
    ;
}

/*--------------------------------------------------------------------
 * Function_Name CheckFileCanPlay
 *
 * Description: Check if the next item can play 
 *    .
 * Arguments: Type: BYTE bNextPrev :PLAY_NEXT or PLAY_PREV
 *					BOOL bUserOp : C_USEROP or  C_NOUSER
 *
 *------------------------------------------------------------------*/

BOOL CheckFileCanPlay(BYTE bNextPrev,BOOL bUserOp)
{
    tPositionInfo tMPFCurPosition;
    MPO_GetPositionInfo(&tMPFCurPosition);

	if(DiscType==C_FILEOPENDISC)
	{
		wNowDirStartNum=FileOpenGetDirStartNum();
		if((g_bCurSessionNum!=g_bPrevSessionNum||wNowDirStartNum!=wPrevDirStartNum))
		{
			if(g_bCurSessionNum!=g_bPrevSessionNum)
			{
        		MPF_Stop(C_USEROP);
            	return FALSE;
			}
			
	        if(g_pListTab[tMPFCurPosition.iListHighlightIndex].bType==C_DIR && (tMPFCurPosition.iFocusObj==OBJ_LIST||tMPFCurPosition.iFocusObj==OBJ_EDITBTN))
	        {
#ifndef	RemovedPlayTemp
				//support play in the dir that is not the current dir
				RemovedPlayBackManager(bNextPrev,bUserOp);	  
				return FALSE;
#else						
	        	if(bNextPrev)
	        	{
		        	if(bUserOp==C_NOUSER)
		        	{
		        		MPF_Stop(C_USEROP);
		            	return FALSE;
		            }
		            else
		            {
					    return FALSE;
		            }
	            }
	            else
	            {
	            	return FALSE;
	            }
#endif	            
	        }
#ifndef	RemovedPlayTemp	        
	        else if(g_pListTab[tMPFCurPosition.iListHighlightIndex].bType!=C_DIR && (tMPFCurPosition.iFocusObj==OBJ_LIST||tMPFCurPosition.iFocusObj==OBJ_EDITBTN))
	        {
				if(tMPFCurPosition.iFocusObj==OBJ_LIST)
					MPF_Play(C_USEROP);
				else
					MPF_NumPlay(tMPFCurPosition.wListHighlightIndex-(MPF_Attr.wItemCount - MPF_Attr.wFileCount)+1, C_USEROP, PLAY_NEXT, C_NOJUMP, C_FOLLOW);
				UiClearPlaybckMd();
                NVPlayModeChg(C_NV_Play, 0);
                g_UiCoreState = UI_CORE_PLAY;
                bActionCtl = 0;

            	MPO_RefreshOutlook( RT_PLAYMODE_CHG, &iRefreshParam);
            	MPO_RefreshOutlook( RT_PLAYBACK_CHG, &iRefreshParam);
            	SendVFDPart1Show();
				return FALSE;
	        }
#endif	        
		}
		return TRUE;
	}
	else
	{
		return TRUE;
	}
}


//////////////////////////////////////////////////////////////////////
//
//	the below functions are Mediaplayer function flow   
//	
//////////////////////////////////////////////////////////////////////


void FileOpenActive();
void FileOpenInit();
static BOOL bMPNormallyClosed=TRUE;

void UiFuncFileOpenInit( void )
{
    g_UiCrntFunc = UI_FUNC_FILEOPEN;
    ChangeLogoData(2);
    if(OSD_Setup_Parameter.bTVOutPut==C_AUTO&&DiscType!=C_VCD10&&DiscType!=C_VCD20&&DiscType != C_SVCD)
    {
	 bShowLOGOAsSysOption=TRUE;
    }
    ShowLogo(C_LOGO_FRAME);

    if(bMPNormallyClosed)
        FileOpenInit();
    else
        FileOpenActive();

    bMPNormallyClosed=FALSE;

    
}
#ifdef _MUTE_ENABLE_
extern BOOL GetMuteVolumeStatus();
extern void SetMuteVolumeStatus(BOOL bStatus);

BOOL (*ptr_GetMuteVolumeStatus)();
void (*ptr_SetMuteVolumeStatus)(BOOL bStatus);

extern void MuteVolumeRespondTimer(DWORD MsgInput);
void (*ptr_MuteVolumeRespondTimer)(DWORD MsgInput);
#endif
#ifdef _BRIGHT_ENABLE_
extern BYTE BrightContrastSharpRespondTimer(DWORD MsgInput);
BYTE (*ptr_BrightContrastSharpRespondTimer)(DWORD MsgInput);
#endif
void ShowMuteVolume(BYTE VolType);
void (*ptr_ShowMuteVolume)(BYTE VolType);

BOOL bLeaveFromBtn=FALSE;
void FileOpenActive()
{
    tPositionInfo tMPFCurPosition;
    int iNum;        
	extern HDC	gui_hdc, gMPOdc;

    MPO_GetPositionInfo(&tMPFCurPosition);
	NVPlayModeChg(C_NV_Stop,C_STOP_SHOWLOGO);//in jpg ,it is call vobu to peabort
    
#if(_VCD_PROGRAM_MODE==_VCD_PROGRAM_ENABLE_)
    if(VirDiscType==C_VCD10)
    {
		VCDEntry();
    	if(g_UiCoreState==UI_CORE_STOP&&bIsSecondStop)
	        MPF_Attr.dwPlaytime=NVGetTotalTime();
        else
        	MPF_Attr.dwPlaytime=NVGetVideoTime(C_TRACK_TM);
		MPO_GetPositionInfo(&tMPFCurPosition);
    }
	else
#endif
	FileOpenGetItemInfo( g_pListTab, tMPFCurPosition.wListHighlightIndex-tMPFCurPosition.iListHighlightIndex, C_ITEMPERCOL, MPF_Attr.wFilter, MPF_Attr.wItemCount-MPF_Attr.wFileCount );

		MPO_RefreshOutlook(RT_ACTIVE, &iRefreshParam);

		MPO_RefreshOutlook(RT_PROGPLAY_ONOFF, &iRefreshParam);

		

//#if(_VCD_PROGRAM_MODE==_VCD_PROGRAM_ENABLE_) comment by chena
//    if(VirDiscType==C_VCD10)
    {
		ptr_GetMuteVolumeStatus = GetMuteVolumeStatus;
		if((*ptr_GetMuteVolumeStatus)() == MUTEVOLUME_STATUS_MUTE)
		{
			MPO_GetPositionInfo(&tMPFCurPosition);
			MPO_RefreshOutlook(RT_HIGHLIGHT_INOUT, &iRefreshParam);
			gui_hdc=gMPOdc;
			ptr_ShowMuteVolume = ShowMuteVolume;
			(*ptr_ShowMuteVolume)(MUTEVOLUME_STATUS_MUTE);
			g_UiCrntSubFunc = UI_SUBFUNC_MUTEVOLUME;
		}
    }
//#endif

    if(DiscType != C_VCD20 && DiscType != C_SVCD && DiscType != C_VCD10)
        SendVFDPart1Show();

    if(g_UiCoreState == UI_CORE_STOP && bIsSecondStop == TRUE)
    	ScrSaver(SCRSAVER_ACTIVE);
}

/*--------------------------------------------------------------------
 * Function_Name FileOpenInit
 *
 * Description: Mediaplyer first entry
 *    .
 *------------------------------------------------------------------*/

void FileOpenInit()
{
    tPositionInfo tMPFCurPosition;
    BYTE i;
	extern HDC	gui_hdc, gMPOdc;
    
    OSD_Setup_Parameter.bSlideShow=2;
    SetSlideShowTime( &OSD_Setup_Parameter.bSlideShow );
    
    bDrawSlideShowHelp=TRUE;
	emptyProgList();
	if(DiscType==C_CDDA||DiscType==C_HDCDDA||DiscType==C_DTSCD)
		NVGetDiscISRC(DISCLASTPLAYINFO.u.dwDiscISRC);
    if(DiscType == C_FILEOPENDISC)
    {
	/************************************************************************/
	/* Following two parameter also used for record DVD lastplay infomation: PGCN           */
	/* When MediaPlayer first on, must reset them.		David 03-11-17				*/
	/************************************************************************/
	DISCLASTPLAYINFO.LASTPLAYPOINT.PlayInfo.bProPlay = FALSE;
	DISCLASTPLAYINFO.LASTPLAYPOINT.PlayInfo.bMixPlay = FALSE;
		bsetuplastplay = 0;//benjamin add

        FileOpenGetMediaType( &MPF_Attr.gMediaType, C_SUPPORTMP3|C_SUPPORTWMA|C_SUPPORTJPG|C_SUPPORTMPG|C_SUPPORTAVI|C_SUPPORTASF);
		OSD_Setup_Parameter.bSlideShow = 2;
        if (g_bSessionCount <= 1)
        {
            g_bCurSessionNum = 0;
            FileOpenReset(g_szCurDisPath);
        }
        else	//multi-session
        {
            FileOpenResetToSession(g_szCurDisPath);
        }
		g_bPrevSessionNum = g_bCurSessionNum;
		wPrevDirStartNum=FileOpenGetDirStartNum();
        for(i=0;i<C_DIRDEPTH;i++)
        {
			wMemoryBeginIndex[i]=0;
        }
        pwDirDepth=wMemoryBeginIndex;
        MixPlayNum[0] = MPF_NOTHING;                    
        MixPlayNum[1] = MPF_NOTHING;
        MPF_Attr.wDiscFileCount[0]=MPF_NOTHING;
        MPF_Attr.wDiscFileCount[1]=MPF_NOTHING;        
    }
    else//cd
    {
        MPF_Attr.gMediaType=(1<<C_CDFILE);
        strcpy(g_szCurDisPath,"");
    }

    if(VirDiscType!=C_VCD10)
    	NVPlayModeChg(C_NV_Stop, C_STOP_SHOWLOGO);
    SendVFDPart2Show(0);
    g_UiCoreState=UI_CORE_STOP;
    if(VirDiscType!=C_VCD10)
    	bIsSecondStop=TRUE;
    VfdOpenLongKey(2);

    if(DiscType == C_FILEOPENDISC)
        MPF_Attr.dwPlaytime = 0;
    else
    {
    	if(g_UiCoreState==UI_CORE_STOP&&bIsSecondStop)
	        MPF_Attr.dwPlaytime=NVGetTotalTime();
        else
        	MPF_Attr.dwPlaytime=NVGetVideoTime(C_TRACK_TM);
    }

    MPF_Attr.wSurMode=0;
    MPF_Attr.bIntroMode=FALSE;
    AP2PEOprParam.VirtualSurroundMode = FALSE;
    
    if((bCddaLastPlay==FALSE)||(DiscType==C_FILEOPENDISC))
    {
	    MPF_Attr.wListPlayingIndex=0;
	    MPF_Attr.wListBeginIndex=0;
    }
    InitMediaPlayer(MPF_Attr.gMediaType, 0);
    MPF_Attr.wFilter=GetCurrentMediaType();
    MPF_Attr.wFileCount=FileOpenGetFileCount(MPF_Attr.wFilter);
    MPF_Attr.wItemCount=FileOpenGetItemCount(MPF_Attr.wFilter);

    if(DiscType != C_VCD20 && DiscType != C_SVCD && DiscType != C_VCD10)
	    g_UiPlaybackList = UI_PLAYBACKLIST_NORMAL;
    OSD_Setup_Parameter.bSlideShow=0;

    // assign RefreshParam pointer
    iRefreshParam.iDiscMediaType=&MPF_Attr.gMediaType;
    iRefreshParam.wPlayMode=&g_UiCoreState;
    iRefreshParam.bIsSecondStop=&bIsSecondStop;
    iRefreshParam.bActionCtl=&bActionCtl;
    iRefreshParam.dwPlayTime=&MPF_Attr.dwPlaytime;
    iRefreshParam.wListFileCount=&MPF_Attr.wFileCount;
    iRefreshParam.wListItemCount=&MPF_Attr.wItemCount;
    iRefreshParam.wRepeatMode=&g_UiPlaybackRepeatRange;
    iRefreshParam.wRandomMode=&g_UiPlaybackMethod;
    iRefreshParam.wSurMode=&MPF_Attr.wSurMode;
    iRefreshParam.bIntroMode=&MPF_Attr.bIntroMode;
    
    iRefreshParam.szPathName=g_szCurDisPath;
    iRefreshParam.wSlideShowSpeed=&OSD_Setup_Parameter.bSlideShow;
    iRefreshParam.bMixPlay = &bMixPlay;
    iRefreshParam.iFocusObj = &MPF_Attr.iFocusObj;
    iRefreshParam.iPlayingObj= &MPF_Attr.iPlayingObj;
    iRefreshParam.wTransCurTrack= & MPF_Attr.wTransCurTrack;
    iRefreshParam.wListPlayingIndex=&MPF_Attr.wListPlayingIndex;
    iRefreshParam.wListBeginIndex=&MPF_Attr.wListBeginIndex;
    iRefreshParam.wListHighlightIndex=&MPF_Attr.wListHighlightIndex;
    iRefreshParam.diListTable = g_pListTab;


#if(_VCD_PROGRAM_MODE==_VCD_PROGRAM_ENABLE_)
    if(VirDiscType==C_VCD10)
    {
        VCDEntry();
        MPO_RefreshOutlook(RT_PLAYMODE_CHG, &iRefreshParam);
    }
    else
#endif
    FileOpenGetItemInfo( g_pListTab, 0, MPF_Attr.wItemCount>C_ITEMPERCOL?C_ITEMPERCOL:MPF_Attr.wItemCount, MPF_Attr.wFilter,MPF_Attr.wItemCount-MPF_Attr.wFileCount);
    MPO_RefreshOutlook(RT_INIT, &iRefreshParam);
	MPO_GetPositionInfo(&tMPFCurPosition);
    if(DiscType != C_VCD20 && DiscType != C_SVCD && DiscType != C_VCD10)
    {
	    if(tMPFCurPosition.iPlayerFocused==	MPLR_MUSIC)
	    {
	    	if((MPF_Attr.gMediaType) & (0x0002))
	        	g_VFD_ShowInfo.FileType = C_MP3FILE;
	    }
	    else if(tMPFCurPosition.iPlayerFocused==MPLR_PHOTO)
	        g_VFD_ShowInfo.FileType = C_JPGFILE;
	    else if(tMPFCurPosition.iPlayerFocused==MPLR_CD)
	        g_VFD_ShowInfo.FileType = C_CDFILE;
	    else
	        g_VFD_ShowInfo.FileType = C_UNKOWN_FILE;
	    //301020-03mi for it will show total time and track before lastplay
	      if(DiscType==C_CDDA||DiscType==C_HDCDDA||DiscType==C_DTSCD)
	      	{
            		if(!bCddaLastPlay&&!OSD_Setup_Parameter.bAutoPlay)
	            	{
			     g_VFD_ShowInfo.FPState = C_FP_DTEND;
			    CmdFPMsg(VFD_REFRESH_PART1_SHOW);
	            	}
	      	}
            	else
            	{
			g_VFD_ShowInfo.FPState = C_FP_DTEND;
			CmdFPMsg(VFD_REFRESH_PART1_SHOW);
            	}
	    //301020-03mi for it will show total time and track before lastplay
    }
#if(_VCD_PROGRAM_MODE==_VCD_PROGRAM_ENABLE_)
	else
	{
		ptr_GetMuteVolumeStatus = GetMuteVolumeStatus;
		if((*ptr_GetMuteVolumeStatus)() == MUTEVOLUME_STATUS_MUTE)
		{
		    MPO_GetPositionInfo(&tMPFCurPosition);
			MPO_RefreshOutlook(RT_HIGHLIGHT_INOUT, &iRefreshParam);
	        gui_hdc=gMPOdc;
			ptr_ShowMuteVolume = ShowMuteVolume;
			(*ptr_ShowMuteVolume)(MUTEVOLUME_STATUS_MUTE);
			g_UiCrntSubFunc = UI_SUBFUNC_MUTEVOLUME;
		}
	}
#endif     
	if(g_UiCoreState == UI_CORE_STOP && bIsSecondStop == TRUE)
    	ScrSaver(SCRSAVER_ACTIVE);
    	
}


/*--------------------------------------------------------------------
 * Function_Name 
 *
 * Description:
 *    
 *    .
 * Arguments: Type: 
 * 
 * Return Value: 
 *------------------------------------------------------------------*/

void UiFuncFileOpenProc( WORD MsgType, DWORD MsgInput )
{
    tPositionInfo tMPFCurPosition;
	extern HDC	gui_hdc, gMPOdc;
	if (bOutOfMPO)
	{
		if(g_UiCrntSubFunc == UI_SUBFUNC_MUTEVOLUME)
		{
#ifdef _MUTE_ENABLE_
			MuteVolume_Proc(MsgType, MsgInput);
#endif
		}
#ifdef _BRIGHT_ENABLE_
		else if( g_UiCrntSubFunc == UI_SUBFUNC_BRIGHTCONTRASTSHARP)
			BrightContrastSharp_Proc(MsgType, MsgInput);
#endif
#ifdef  _KARAOKE_ENABLE_
		else if( g_UiCrntSubFunc == UI_SUBFUNC_VOLUM)

⌨️ 快捷键说明

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