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

📄 mm_play.c

📁 ct952 source code use for Digital Frame Photo
💻 C
📖 第 1 页 / 共 5 页
字号:
//////////////////////////////////////////////////////////////
// ****** All necessary including files Area ******
#include    "winav.h"
// wyc0.60-909, include ctkav.h and <cyg/kernel/kapi.h> for thread control.
#include "ctkav.h"
#include    <string.h>
#include    "input.h"
#include    "infofilter.h"
#include    "cc.h"
#include    "osd.h"
#include    "mmanager.h"
#include    "utl.h"
#include    "initial.h" 
#include    "SrcFilter.h"
#include    "monitor.h"
#include    "setup.h"
#include    "chips.h"
#include    "hal.h"
#include    "linear.h"
#include    "thumb.h" 
#include    "osdmm.h"
#include    "panel.h"
#include    "parser.h"
#include    "disp.h"
#include    "jpegdec.h"
#include    "disp.h" 
#include    "media.h"
#include    "osddlg.h"

#ifdef SUPPORT_POWERON_MENU
#include "poweronmenu.h"
#endif //SUPPORT_POWERON_MENU

#ifdef SUPPORT_CHAR_SUBPICTURE
#include "char_subpict.h"
#endif

#include "gdi.h" 
#include    "comutl.h"
#ifdef SUPPORT_ENCODE_JPG_PICTURE
#include "jpegenc.h"
#endif //

#include "debug.h"
#undef PRINTF
#undef printf
// Micky2.17c
#ifdef	APPLICATION_WINDOWS
#define PRINTF		DBG_Printf_Simple
#define printf		DBG_Printf_Simple
#else
#define PRINTF(x, y...)     DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_MM_INFOFTR, x, ## y)
#define printf(x, y...)     DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_PRINTF, x, ## y)
#endif //APPLICATION_WINDOWS

//////////////////////////////////////////////////////////////
BYTE __dwMMJPEGPreview = FALSE; //CoCo0.72, support JPEG Preview
BYTE __bMMJPGDecEncMode;
//////////////////////////////////////////////////////////////
BYTE _bMMPlayable;
BYTE __bMMJPGStatus;
//////////////////////////////////////////////////////////////
BYTE __bMMStage;
DWORD __dwMMTriggerMode;
BYTE __bMMAtiveFrame;
DWORD __dwMMJPEGDisplayTime;
BYTE __bMMEffectIdx;
DWORD __dwFMJPGShowTime;
DWORD __dwMMJPGDispOK;
CHAR __cMMJPEGFMTExifDate[11];
//////////////////////////////////////////////////////////////
DWORD __dwBuffEmptyTime;
DWORD _dwMMTriggerEmptyTime;
DWORD __dwMMJPGBuffEmptyTime;
//////////////////////////////////////////////////////////////
BYTE __bMMCountStopBak;
DWORD __dwMMZoomMode;
BYTE __bMMEnterRealStop;
//////////////////////////////////////////////////////////////
BYTE __bLastPlayItem;
BYTE __bPBReady;
//////////////////////////////////////////////////////////////
BYTE __bMMrogressCnt;
WORD __wMMPreProgressCurrent;
//////////////////////////////////////////////////////////////
BYTE _bMMAudioDisplayInfo = FALSE; //CoCo0.77, add audio info.
//////////////////////////////////////////////////////////////

// wyc2.38a-909s, record the AVI failed count. 
BYTE _bMMAVIFailCnt;
BYTE __bMMIndexTableOK;
// LLY1.20, add a new variable to keep motion state
BYTE __bMotionState;
//////////////////////////////////////////////////////////////
// LLY2.50, add a new variable to keep current file is un-supported format
BYTE __bUnknownFormat;
//////////////////////////////////////////////////////////////
//Define the variables for JPEG+MP3 mode
DWORD __dwMMAudioPreGetTime;
BYTE __bMMJPEGAudioMode = FALSE; 
CURSOR_INFO __MMBackgroundPlayingItem;  //The background playing item.
BYTE _bMMAudioSameItem;
BYTE __bMMAudioPlayEnd;
BYTE __bMMAudioStage;                   //The stage needs to be changed to MM_STAGE_PREPAREINFO when start to play.
WORD __wMMCurrentPlayingJPEGFileIndex;
WORD __wMMCurrentPlayingAudioFileIndex;
WORD __MMFirstJPEGPlayingIndex; 
WORD __wMMTotalJPEGFileInDir;
WORD __wMMTotalAudioFileInDir;
BYTE __bMMStartJPEGAudioTrigger = FALSE;
BYTE __bMMSkipAudio = FALSE;
BYTE __bMMVideoStreamPause = FALSE;
BYTE __bMMAudioStreamPause = FALSE;
///////////////////////////////////////////////////////////
#ifdef SUPPORT_WMA
DWORD dwSample;
DWORD dwPreSample;
#endif //SUPPORT_WMA

#ifdef DOLBY_CERTIFICATION
BYTE bShowDolbySurrFlag;
#endif //DOLBY_CERTIFICATION
///////////////////////////////////////////////////////////
#ifdef SUPPORT_COPY_FILE_IN_SLIDE_SHOW
BYTE __bMMSlideShowCopyDeleteMode;
#endif //SUPPORT_COPY_FILE_IN_SLIDE_SHOW

#ifdef SUPPORT_AUTO_ROTATION
BYTE __bMMPhotoAutoRoate = FALSE;
BYTE __bMMPhotoDoRoate = FALSE;
DWORD _dwMMAutoRotateCount;
BYTE _bMMPhotoAutoRoateOperation;
#endif //SUPPORT_AUTO_ROTATION

#ifdef SUPPORT_PLAY_MEDIA_DIRECTLY_POWER_ON
BYTE __bMMPlayMediaDirectlyMode = FALSE;
#endif //SUPPORT_PLAY_MEDIA_DIRECTLY_POWER_ON
///////////////////////////////////////////////////////////
// wyc2.51-909P, some define and variables for JPG encode mode.
#ifdef SUPPORT_ENCODE_JPG_PICTURE
BYTE    __bMMJPGEncodeEntry, __bMMJPGEncodeNum;
BYTE    __bMMJPGEncodeList[SRCFTR_SUPPORT_JPG_ENCODE_NUM];
BYTE    __bMMJPGEncodeJPGStatus[SRCFTR_SUPPORT_JPG_ENCODE_NUM] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
#endif //SUPPORT_ENCODE_JPG_PICTURE
BYTE    __bMMSaveProgress;
///////////////////////////////////////////////////////////
#ifdef IMAGE_FRAME_SETUP 
BYTE __bMMFirstJPEGPlaying = TRUE;
#endif //IMAGE_FRAME_SETUP

#ifdef IMAGE_FRAME_SETUP
BYTE __bMMAutoPlay = FALSE;
#else
#ifdef MMANAGER_AUTO_PLAY
BYTE __bMMAutoPlay = TRUE;
#else
BYTE __bMMAutoPlay = FALSE;
#endif //MMANAGER_AUTO_PLAY
#endif //IMAGE_FRAME_SETUP
///////////////////////////////////////////////////////////
#ifdef SUPPORT_PHOTO_BROWSE_MODE
BYTE __bMMPhotoBrowseMode = FALSE;
BYTE __bMMEnterBrowseFromJPEGAudioMode = FALSE;
#endif //SUPPORT_PHOTO_BROWSE_MODE
///////////////////////////////////////////////////////////
// ****** Extern Other Module's Variable Area ******
extern DWORD __dwPreGetTime;  
extern BYTE __bResetRecover; 
extern WORD __wProgressCurrent;
extern WORD __wProgressTotal;
extern CHAR __cJPEGFMTExifDate[11];
///////////////////////////////////////////////////////////

// elmer2.78, add for DMP error concealment
DWORD __dwMMJPGCount = 1, __dwMMPreJPGCount;

//  *********************************************************************
//  Function    :   MM_Trigger
//  Description :   Check PlayEnd if player is playing...
//  Arguments   :   NONE
//  Return      :   TRUE, the stage finish ok
//                  FALSE, the stage fail
//  Side Effect :
//  *********************************************************************
void MM_Trigger(void)
{
    if (__bThumbnailMode)
        return;

#ifdef SUPPORT_JPEG_AUDIO_PLAYING
    if (__bMMJPEGAudioMode && __bMMStartJPEGAudioTrigger)
    {        
        if (__btPause == FALSE)
        {
            MM_AudioTrigger();                
            _MM_ImageTrigger();
        }
    }
    else
#endif //SUPPORT_JPEG_AUDIO_PLAYING
    {        
        // wyc1.10-909, when pause mode, need to reset __dwBuffEmptyTime to UTL_GetSysTimer to avoid timer continue going and
        // follow condition will FALSE after pause 3-5 minutes.
        if ((__btPause) && (__bMMStage == MM_STAGE_PLAYEND) && (__btPlayEnd == TRUE))
		{
            __dwBuffEmptyTime = OS_GetSysTimer();
		}
        
        // LLY1.02, let it always go _MM_MotionTrigger() for CDROM motion file
        // LLY1.20, must check motion state since __bAttrPlay is not set ready during prescan mode
        if ((__bAttrPlay & TYPE_CDROM_AV) || (__bMotionState != MOTION_STATE_NONE))
        {
            // LLY1.10, don't check __bPBReady value while STOP mode
            // Otherwise, _MM_MotionTrigger() will be called while STOP mode.
            // Bug: progress bar will always be displayed during STOP mode.
            if (__bModeCmd != KEY_STOP)
            {
                // LLY1.02, don't do motion trigger if playback ready w/ non-playing or puase mode
                // Notce: Can't using __bMMStage==STAGE_PLAYEND as checking flag, because following bugs:
                // (1) forever trap @ NEXT_ITEM stage while 1st file playend w/o repeat mode
                //     Since current solution is to assign F/W key by KEY_STOP not to issue command directly
                // (2) it maybe polling end time-out and try to playback next item (since __btPlayEnd==TRUE)
                //     while user press KEY_STOP during parser report data sending done or presee KEY_STOP three times
                // Also can't using __bMMStage==STAGE_NEXT as checking flag
                // Otherwise, the pre-scan fail next file action can't work
                if (__bPBReady && (!__btPlaying || __btPause))
				{
                    return;
				}
            }
            else
            {
                if (!__btPlaying || __btPause)
				{
                    return;
				}
            }
            
            _MM_MotionTrigger();
        }
        
        if (!(__wDiscType & CDROM_M1) || (!__btPlaying) || __btPause)
        {
            if (__btPause && (__bAttrPlay == ATTR_JPG))
                ;
            else
                return;
        }

        if (__bAttrPlay & TYPE_CDROM_VIDEO)
		{
            _MM_ImageTrigger();
		}
        else if (__bAttrPlay & TYPE_CDROM_AUDIO)
		{
            MM_AudioTrigger();
		}
    }
}

void    _MM_MotionTrigger(void)
{
    static BYTE bPreScanCnt=0;

#ifdef  SUPPORT_PSNR_TEST
    extern DWORD   __dwDecodeCnt;
#endif  // #ifdef SUPPORT_PSNR_TEST

#ifdef IMAGE_FRAME_SETUP 
    __bMMFirstJPEGPlaying = TRUE;
#endif //IMAGE_FRAME_SETUP

    // LLY2.36, process DRM Playback State first
    // Otherwise, it maybe continue go other stage during waiting user input period
    // [1] If wait user action, don't go trigger
    if(__bDRMPlayState == DRM_PLAY_STATE_WAIT)
    {
        return;
    }
    // [2] Go wait play stage directly if user abort the action
    //     and current file is not finish index table/ SP parsing.
    //     Otherwise, user will see parscan action continue then stop after abort
    else if ((__bDRMPlayState == DRM_PLAY_STATE_ABORT) && (__bMMStage==MM_STAGE_POLLING_SP_PARSING_DONE))
    {
        __bMMStage = MM_STAGE_WAIT_PLAY;
    }

    switch(__bMMStage)
    {
        // LLY1.02, abstract issue pre-scan action into a new stage
        // Since, it's un-necessary to do pre-scan action for the same play item
	case    MM_STAGE_PREPAREINFO:
		__bLOGO = LOGO_NONE;
		__dwMMTriggerMode = MM_MOTION_TRIGGER_MODE;
		
		// LLY2.50, initial unknow format as FALSE
		__bUnknownFormat = FALSE;
		
		// wyc1.50-909, need to complete JPG effect here, other motion file will be abnormal in video.
		MM_CompleteJPGEffect(TRUE);
		// wyc2.17-909S, clear JPG effect mode when changing to motion files to avoid motion file image will keep in JPG effect slide show mode.
		__bHALJPEGEffect=HALJPEG_EFFECT_NONE;
		__bMMEffectIdx = HALJPEG_EFFECT_NONE;
		// wyc1.01-909, modify the audio time out to LSF mode, because some LSF file need more time to wait audio buffer empty to play completed file.
		// 32 is using LSF 32K to compute, the computed time mul 1000 is the unit of timer is ms. So need to transfer second to ms.
		// LLY1.20, AVI buffer setting is different from other motion file
		if (__bAttrPlayNew == ATTR_AVI)
		{
			_dwMMTriggerEmptyTime = ((((DS_AD0BUF_END_AVI-DS_AD0BUF_ST_AVI)*8)/(64*1000))+5)*COUNT_1_SEC;
		}
		else
		{
			_dwMMTriggerEmptyTime = ((((DS_AD0BUF_END-DS_AD0BUF_ST)*8)/(64*1000))+5)*COUNT_1_SEC;
		}
		
		// LLY1.02, initial the playback ready flag as FALSE
		__bPBReady=FALSE;
		__bMMrogressCnt = 0;
		
		// LLY1.02, freeze the STC value to avoid OSD time keep previous file last time
		// during open/cose --> play.
		// Since STC value don't clear to zero show LOGO (STC is unknow, decoder do nothing)
		// Notice: the STC will continue to go while next right STC update by decoder or DSP
		DISP_STCFreeze(0, DISP_WAIT_NEXT_STC);
		
		// Also set the STC value as zero, since UTL_TriggerShowTime()
		// don't readback the STC value while !__btPlaying
		// Fix OSD time not reset to zero while NEXT/PREV action.
		__dwSTCValue=0;
		
		__bMMIndexTableOK = TRUE;
		
		// If same play item & not copy protection file, set the playmode directly
		// Otherwise, start the pre-scan action.
		if(__bSameItem && !__PARSER_gbl.BitsContent.fCopyProtection)
		{
			__bMMStage=MM_STAGE_SET_PLAYMODE;
		}
		else
		{

⌨️ 快捷键说明

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