📄 mm_play.c
字号:
DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_MM_INFOFTR,"E_C: Time-out\n");
#endif //
}
#ifdef MM_MOTION_DEBUG
DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_MM_INFOFTR,"E_C: Do Error Conceal for AVI\n");
#endif //
// Freeze STC value before decoder stop
// Otherwise, OSD will become zero.
HAL_ReadInfo(HAL_INFO_STC, &__dwSTCValue);
DISP_STCFreeze(__dwSTCValue, DISP_WAIT_NEXT_STC);
// Stop source/ parser/ decoder
HAL_PlayCommand(COMMAND_STOP, NULL_0);
SrcFilter_Stop(__dwSFStreamID);
HAL_ControlParser(HAL_PARSER_STOP, 0);
// Reset A/V buffer before new data sending
HAL_Reset(HAL_RESET_AVSPST);
if(__bModeCmd==KEY_SCF || __bModeCmd==KEY_SCB)
{
__dwTimeNow=UTL_JumpGroove(__bModeCmd, 0);
}
// Find next jump position just like scan forward mode (while non scan mode)
// Notice: Must set value within __wScanGap & __dwScanBaseTime first
// since UTL_JumpGroove() will reference it.
// And, restore __wScanGap after UTL_JumpGroove() calling
// __dwScanBaseTime is un-necessary to restore since new value will be set within it
else
{
__wScanGap=2; // jump 2 sec.
// __dwScanBaseTime is msec format, and parser report video time in sec format
__dwScanBaseTime=PARSER_GetContainerCurVideoTime();
__dwTimeNow=UTL_JumpGroove(KEY_SCF, 0);
}
// if next jump position is out of current file range
if ( __bModeCmd == KEY_SCB )
{
if (__dwTimeNow <= __dwTimeBegin) //SCB reach track begin
{
// LLY.101-2, must same as PBC on mode's flow while enable following define
// otherwise, it will issue KEY_PREV action
// ** TCH1.55-1; begin... FORCE_CHANGE_TRACK_NORMAL_PLAY can do it simpler.
#ifdef FORCE_CHANGE_TRACK_NORMAL_PLAY
wTemp= __wPlayItem;
// reset the play state
//Kevin1.07, fix "In program playing, SCB to track begin will clear program mode"
// CC_DoKeyAction (KEY_STOP) will clear program mode
// SCF to track end also calls CC_KeyCommand(KEY_STOP)
CC_KeyCommand ( KEY_STOP );
__wPlayItem= wTemp;
// next will normal play from the frist track
CC_DoKeyAction ( KEY_PLAY );
#else //FORCE_CHANGE_TRACK_NORMAL_PLAY
// SCANBACK to first track, system will become normal play
if ( __wPlayItem == __wTrackBegin )
{
// reset the play state
//Kevin1.07, fix "In program playing, SCB to track begin will clear program mode"
// CC_DoKeyAction (KEY_STOP) will clear program mode
// SCF to track end also calls CC_KeyCommand(KEY_STOP)
//CC_DoKeyAction ( KEY_STOP );
CC_KeyCommand ( KEY_STOP );
// next will normal play from the frist track
CC_DoKeyAction ( KEY_PLAY );
}
else // will Scan back previous track
{
// must check repeat mode then decide to play next
// modify for use by LINEAR_ChangeTrack call
LINEAR_ChangeTrack(KEY_PREV, (BYTE)NULL);
} // NOT BeginTrack
#endif //FORCE_CHANGE_TRACK_NORMAL_PLAY
return;
} // SCB reach to the Begin of the range
} // KEY_SCB
else // Non SCAN backword mode
{
if ( (__dwTimeNow+ __wScanGap) >= __dwTimeEnd )
{
#ifdef MM_MOTION_DEBUG
DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_MM_INFOFTR,"E_C: Change to next track\n");
#endif //MM_MOTION_DEBUG
// must check repeat mode then decide to play next
// modify for use by LINEAR_ChangeTrack call
LINEAR_ChangeTrack(KEY_NEXT, (BYTE)NULL);
return;
}
}
#ifdef MM_MOTION_DEBUG
DBG_Printf(DBG_THREAD_CHEERDVD, DBG_INFO_MM_INFOFTR,"E_C: Jump to next position\n");
#endif //MM_MOTION_DEBUG
// Start to playback the desired range
// LLY2.35, give start and end time for UTL_PlayFromTime() since the API is updated
UTL_PlayFromTime(__dwTimeNow, __dwTimeEnd);
// Issue playback command by calling CC_KeyCommand()
// Notice: must set some flags first before calling CC_KeyCommand()
// 1. __btPause=TRUE, Otherwise, NPF can't work
// 2. __bScan=SCAN_NONE, Otherwise, Scan mode can't work
__btPause=TRUE;
__bScan=SCAN_NONE;
CC_KeyCommand(__bModeCmd);
// Resotre the stage to polling playend after error concealment done
__bMMStage=MM_STAGE_PLAYEND;
}
break;
// LLY1.02, add new case to handle skip current item issue
// Before time-out,
// If no input key, continue to loop in this stage.
// Otherwise, to the input key directly.
// Used to fix KEY_PREV no action while pressing previous key during 3th file
// (1st file : playable; 2nd file: not support; 3th file: playable)
// ie. twice KEY_PREV immediate can previous from 3th file to 1st file
case MM_STAGE_SKIP_ITEM:
// LLY2.50, enlarge the time-out from 500msec to 1 sec to let user can see error message
if( (OS_GetSysTimer()-__dwPreGetTime) > COUNT_1_SEC )
{
__bMMStage = MM_STAGE_NEXT_ITEM;
}
break;
case MM_STAGE_NEXT_ITEM:
#ifndef NO_OUTPUT_INFO_FOR_UNKNOWN_AV_FORMAT
// LLY2.50, change stage to skip item let it handle time-out mechanism
if(__bUnknownFormat)
{
__bUnknownFormat = FALSE;
__bMMStage = MM_STAGE_SKIP_ITEM;
break;
}
#endif // #ifdef NO_OUTPUT_INFO_FOR_UNKNOWN_AV_FORMAT
__btPlaying=FALSE;
// LLY1.02, reset the re-try counter as zero
__bResetRecover=0;
// LLY0.85, must stop after playback to file end for PSNR testing.
#if defined (SUPPORT_PSNR_TEST) || defined (SUPPORT_DIVX_CERTIFICATION)
// LLY1.05, repeat mode or program playing mode, let it go next item path
// Otherwise, auto stop current item.
if(__bRepeat!=REPEAT_NONE || __btPlayingProgram)
{
__bFWKey=KEY_NEXT;
}
else
{
__bFWKey=KEY_STOP;
}
#else // #ifdef SUPPORT_PSNR_TEST
__bFWKey=KEY_NEXT;
#endif // #ifdef SUPPORT_PSNR_TEST
// Transfer the stage to NONE, otherwise, it always trap into NEXT_ITEM stage
__bMMStage = MM_STAGE_NONE;
#ifdef SUPPORT_MP4
{
// LLY1.50, reset chapter information before change to next item
// Since, the correct value only be updated while prescan action successfully.
// So, it maybe wrong while playback one file w/ __dwChater_Ns_Title != 0 first
// Then, playback a un-support file ==> KEY_NEXT will let it to find next chapter (MP4 only)
extern WORD __wChapter_Ns_Title;
extern WORD __wChapter;
__wChapter_Ns_Title=0;
__wChapter=1;
}
#endif //SUPPORT_MP4
break;
default:
break;
}
}
void MM_AudioTrigger(void)
{
#ifdef SUPPORT_JPEG_AUDIO_PLAYING
BYTE bAudioType;
DWORD dwTemp, dwTemp1;
WORD wBackupPlayingItemDir;
WORD wBackupPlayingItemIndex;
#endif //SUPPORT_JPEG_AUDIO_PLAYING
BYTE bMMStage;
static DWORD dwTimeStamp;
#ifdef SUPPORT_PHOTO_BROWSE_MODE
if (__bMMPhotoBrowseMode)
{
return;
}
#endif //SUPPORT_PHOTO_BROWSE_MODE
#ifdef IMAGE_FRAME_SETUP
#ifdef SUPPORT_JPEG_AUDIO_PLAYING
if (!__bMMJPEGAudioMode)
#endif //SUPPORT_JPEG_AUDIO_PLAYING
{
__bMMFirstJPEGPlaying = TRUE;
}
#endif //IMAGE_FRAME_SETUP
#ifdef SUPPORT_JPEG_AUDIO_PLAYING
if (__bMMJPEGAudioMode)
{
if (__bMMSkipAudio)
return;
bMMStage = __bMMAudioStage;
}
else
#endif //SUPPORT_JPEG_AUDIO_PLAYING
{
bMMStage = __bMMStage;
}
switch (bMMStage)
{
#ifdef SUPPORT_JPEG_AUDIO_PLAYING
case MM_STAGE_AUDIO_STAGE_INIT:
__bMMAudioPlayEnd=FALSE;
// Get desired play item range
UTL_GetPlayRange_BGItem(__wBGPlayItem, &dwTemp, &dwTemp1);
// Get desired playitem audio mode
bAudioType = UTL_CheckBGPlayItemMode(__wBGPlayItem);
// Configurate audio only playback mode, and issue command
if(bAudioType==ATTR_WMA)
{
UTL_PlayAudio(HAL_AUDIO_WMA);
}
else if (bAudioType==ATTR_MP2)
{
UTL_PlayAudio(HAL_AUDIO_MP2);
}
else
{
UTL_PlayAudio(HAL_AUDIO_MP3);
}
// Call another API to send the bitstream of background item
UTL_PlayFromTime_BGItem(dwTemp, dwTemp1);
// Change stage to play
__bMMAudioStage = MM_STAGE_AUDIO_STAGE_PLAY;
break;
case MM_STAGE_AUDIO_STAGE_PLAY:
if(__bCheckAudioType & CHECK_AUDIO_FREQ)
{
// Check if audio frequency is ready.
if(HAL_ReadInfo(HAL_INFO_AUDIOFREQ, &dwTemp))
{
// If ready, base on it to set audio DAC
HAL_SetAudioDAC((BYTE)dwTemp);
// Continue audio decoder procedure
HAL_WriteAM(HAL_AM_START_DECODE, 1);
// Clear the check audio frequency flag
__bCheckAudioType &= ~CHECK_AUDIO_FREQ;
}
}
else
{
// Change stage to polling playend
__bMMAudioStage = MM_STAGE_PREPAREINFO;
}
break;
#endif //#ifdef SUPPORT_JPEG_AUDIO_PLAYING
case MM_STAGE_PREPAREINFO:
#ifdef DOLBY_CERTIFICATION
if (__bAttrPlay==ATTR_AC3)
bShowDolbySurrFlag=TRUE;
else
bShowDolbySurrFlag=FALSE;
#endif
// 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.
_dwMMTriggerEmptyTime = ((((DS_AD0BUF_END_MM-DS_AD0BUF_ST_MM)*8)/(32*1000))+5)*COUNT_1_SEC;
_bMMAudioDisplayInfo = FALSE;
#ifdef SUPPORT_JPEG_AUDIO_PLAYING
if (!__bMMJPEGAudioMode)
#endif //SUPPORT_JPEG_AUDIO_PLAYING
{
__bLOGO = LOGO_NONE;
}
#ifdef SUPPORT_JPEG_AUDIO_PLAYING
if (!__bMMJPEGAudioMode)
#endif //SUPPORT_JPEG_AUDIO_PLAYING
{
__dwMMTriggerMode = MM_AUDIO_TRIGGER_MODE;
}
#ifdef SUPPORT_JPEG_AUDIO_PLAYING
if (__bMMJPEGAudioMode)
{
__bMMAudioStage = MM_STAGE_PLAYEND;
}
else
#endif //SUPPORT_JPEG_AUDIO_PLAYING
{
__bMMStage = MM_STAGE_PLAYEND;
}
// This is used for wait 1s more after audio remainder alomst empty.
__dwMMAudioPreGetTime = 0xFFFFFFFF;
#ifdef SUPPORT_WMA
dwSample = 0xFFFFFFFF;
dwPreSample = 0xFFFFFFFF;
#endif //
// wyc2.35-909S, add code to support disable program list mode when playing mode.
#ifndef NO_MM_BUTTON
if (__bMMMenuID == MM_MENU_EDITPROG)
{
OSDMM_Update(OSDMM_MSG_DISABLE_BUTTON, MM_BTN_PROG_LIST);
}
#endif //
// LLY1.05-1, keep desired playing item & directory while not same item
// Notice: can set it after playback CMD done.
#ifdef SUPPORT_JPEG_AUDIO_PLAYING
if (!__bMMJPEGAudioMode)
#endif //SUPPORT_JPEG_AUDIO_PLAYING
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -