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

📄 player.c

📁 mtk1389L latest sourcecode enjoy
💻 C
📖 第 1 页 / 共 3 页
字号:
  {
    _bSetupCounter --;
  }
#ifdef SUPPORT_DRM
  if(_bDrmCounter != 0)
  {
    _bDrmCounter--;
  }
#endif
}

// *********************************************************************
// Function : void vIrTimer(void)
// Description :
// Parameter : None
// Return    : None
// *********************************************************************
static void vIrTimer(void) large
{
  BOOL fgRet = UOP_OK;

  /* error check */
  if (_bIRKey >= IR_KEY_MAX)
  {
    _bIRKey = IR_NONE;
    return;
  }

  /* screen saver */
  if (!fgIsScrSaverOn())
  {
    vScrSaverSetTimeOut(SCR_SAVER_TIMEOUT);
  }

  vPlayerKeyProc();
}

/***************************************************************************
     Function : void vGetCurrKey(void)
  Dsecription :
    Parameter : None
       Return : None
***************************************************************************/
static void vGetCurrKey(void) large
{
  /* TODO: the emergency key should abort ther current key operation */

#ifdef IR_CHECK_KEY_LOCK
  if (fgIsIrKeyLock())
  {
    vIrKeyPressTimeoutCheck();
  }
#endif

  if (_bIRKey == IR_NONE) /* check this to prevent command conflict */
  {
    /* note the internal state transition priority is higher than user operation */
    if (_bPlayPostKey != IR_NONE)
    {
      if ((_bPWRMode == SV_PWR_ACTIVE) || (_bPlayPostKey == IR_ESCAPE_SCRSAV))
      {
        _bIRKey = _bPlayPostKey;
        _bPlayPostKey = IR_NONE;
#ifdef MT1389HD_NO_SERVO
        if (_bIRKey == IR_EJECT)
        {
          _bIRKey = IR_NONE;
        }
#endif //MT1389HD_NO_SERVO        
      }
      else if (_bPlayPostKey == IR_MANUAL_EJECT)
      /* && ((_bPWRMode == SV_PWR_IDLE_PAUSE) || (_bPWRMode == SV_PWR_IDLE_STOP)) */
      {
        _bIRKey = IR_EJECT;
        _bPlayPostKey = IR_NONE;
#ifdef MT1389HD_NO_SERVO
        if (_bIRKey == IR_EJECT)
        {
          _bIRKey = IR_NONE;
        }
#endif //MT1389HD_NO_SERVO        
      }
      else if (_bPlayPostKey == IR_POWER)
      /* && ((_bPWRMode == SV_PWR_IDLE_PAUSE) || (_bPWRMode == SV_PWR_IDLE_STOP)) */
      {
        _bIRKey = IR_POWER;
        _bPlayPostKey = IR_NONE;
      }
    }
    /* for UI timer */
    else if (_bIrTimer == IR_TIMER_TIMEOUT)
    {
      _bIRKey = IR_TIME_OUT;
      _bIrTimer = IR_TIMER_VOID;
    }
    /* note here must be the only one entry point for user operation input */
    /* VFD key's priority is higher than IR key */
    else if (_bVfdKeyScan != IR_NONE)
    {
      _bIRKey = _bVfdKeyScan;
      _bVfdKeyScan = IR_NONE;
    }
    /* note the _bIRKey0 is put in the IR interrupt */
    else if (EXIST_IR_KEY())
    {
#ifdef IR_CHECK_KEY_LOCK
      if (fgIsIrKeyLock())
      {
        if (_bIRKeyPressCnt == 0)
        {
          // already timeoute
          vIrKeyForceRelease();

          GET_IR_KEY(_bIRKey);

          _bIRKey = bHandleIRKeyPressTimeout(TRUE, _bIRKey);
        }
        else // not timeout yet
        {
          if (bHandleIRKeyPressTimeout(FALSE, _bIRKey0) != IR_NONE)
          {
            // no need to wait timeout
            vIrKeyForceRelease();

            GET_IR_KEY(_bIRKey);
          }
        }
      }
      else
#endif // IR_CHECK_KEY_LOCK
      {
        // original routine
        GET_IR_KEY(_bIRKey);
#ifdef MT1389HD_NO_SERVO
        if (_bIRKey == IR_EJECT)
        {
          _bIRKey = IR_NONE;
        }
#endif //MT1389HD_NO_SERVO
      }
    }
#ifdef MT8302_MANUFACTURE_TEST
    else if (bTstPeekKey()!= IR_NONE) {
      _bIRKey = bTstGetKey();
    }
#endif
  }
}

/***************************************************************************
     Function : void vUIInit(BOOL fgInit)
  Dsecription : called from Timer task before RISC start
    Parameter : None
       Return : None
***************************************************************************/
void vUIInit(BOOL fgInit) large
{

// Harrison's modified
  _bKeyState = KEY_INIT;

  vUserInit(fgInit);

  // - Reset Player
  vPlayerInit();
  SmInit();
}

/***************************************************************************
     Function : void vUITimer(void)
  Dsecription : called from Timer task
    Parameter : None
       Return : None
***************************************************************************/
void vUITimer(void) large
{

#ifdef SUPPORT_USB_COPY //yan 070409
  _bUSBCounter++;
  if((_bUSBCounter >= 25) && (_bUSBUIState != USBUI_MAX_ST)) 
    {
      _bUSBCounter = 0;
  vUSBSaverTimer();
     }  
#endif
#ifdef FLASH_DMA_TEST    
  /* non-key dependant event for play module */
  if((bSharedInfo(SI_FLASH_DMA_TRAP) & SV_FLASH_DMA_TRAP_8032_TIMER) == SV_FLASH_DMA_TRAP_8032_TIMER)
  {
    MDisableTimer2();                   // Disable timer 2 interrupt
    while(TRUE)
    {
      if((bSharedInfo(SI_FLASH_DMA_TRAP) & SV_FLASH_DMA_TRAP_8032_TIMER) != SV_FLASH_DMA_TRAP_8032_TIMER)
      {
        MEnableTimer2();                    // Enable timer 2 interrupt
        MTrgTimer2Cnt();                    // Enable Timer2 Counter
        break;
      }  
    };
  }    
#endif
  
  /* non-key dependant event for play module */
  vPlayerTimer();

  /* VFD */
#ifndef HYNIX_VFD
  vVfdTimerState(FALSE);
#endif

  /* To Check TV System Change--SY */
  if(fgIsInGoto())
  {
    if(_fgOldTvSystem != bSharedInfo(SI_NTSC_PAL) )
    {
    	_bIRKey = IR_GOTO;
    	_bPlayPostKey = IR_GOTO;
      _fgOldTvSystem = bSharedInfo(SI_NTSC_PAL);
    }
  }
  else
  {
    _fgOldTvSystem = bSharedInfo(SI_NTSC_PAL);
  }

#ifdef SUPPORT_SACD
  if (_fgPsedoTrayIn)
  {
    vSendUopCmd(UOP_OPEN_CLOSE, SV_PSEUDO_CLOSE, 0, 0);
    _fgPsedoTrayIn = FALSE;
  }
#endif

  /* note this must be placed after VfdTimer() and before vIrTimer() */
  vGetCurrKey();

#ifdef USE_SUBTITLE_KEY_AS_USBCOPY_KEY
if(_bIRKey==IR_SUB_TITLE)
{
#ifdef SUPPORT_ONLY_AUDIO_TPYE
if(fgFlMnOnAudio())
#endif
_bIRKey=IR_USB_COPY;
}
#endif

#ifdef FLASH_DMA_TEST
  if(_bIRKey == IR_ANGLE)
  {
    vSetSharedInfo(SI_FLASH_DMA_TRAP, 
                   SV_FLASH_DMA_TRAP_8032_MAIN+SV_FLASH_DMA_TRAP_8032_TIMER+SV_FLASH_DMA_TRAP_RISC);
    _bIRKey = IR_NONE;               
  }  
#endif

  /* TODO: check if it is safe to execute UOP command here */
  if (_bIRKey != IR_NONE)
  {
    vIrTimer();
  }

  /* Take care share memory here */
#ifdef ACCEL_SI_PROC
  _bShmUpdCnt = SHM_PROC_CNT;
#endif

#ifdef ACCEL_SI_PROC
  while (_bShmUpdCnt > 0)
#endif
  {
    SmTimer();
  }

  /* Handle OSD return here */
  vOsdCoreTimer();

  /* check player error code */
  if (_bPlayerErrCode != PLAYER_ERR_NO_ERROR)
  {
#ifdef SHOW_ERROR_CODE
    vOsdShowError(OSD_ERROR_CODE, _bPlayerErrCode);
#endif
    _bPlayerErrCode = PLAYER_ERR_NO_ERROR;
  }
}

#ifdef PLAYER_POWERDOWN
/***************************************************************************
     Function : void vUIPowerDownTimer(void)
  Dsecription : called from Timer task when power down
    Parameter : None
       Return : None
***************************************************************************/
void vUIPowerDownTimer(void) large
{
  /* VFD */
  vVfdTimerState(TRUE);

  /* get current key */
  if (_bVfdKeyScan != IR_NONE)
  {
    _bIRKey = _bVfdKeyScan;
    _bVfdKeyScan = IR_NONE;
  }
  /* note the _bIRKey0 is put in the IR interrupt */
  else if (EXIST_IR_KEY())
  {
    GET_IR_KEY(_bIRKey);

    if (_bIRKey != IR_POWER)
    {
      _bIRKey = IR_NONE;;
    }
  }

  /* only power key and eject key is valid */
  if ((_bIRKey != IR_POWER) && (_bIRKey != IR_EJECT))
  {
    _bIRKey = IR_NONE;
  }
  else /* if (_bIRKey == IR_POWER) */
  {
    /* update VFD immediately */

    /* stop UI task */
    vUIStop();
  }
}
#endif
#ifdef MT1379_MANUFACTURE_TEST
extern void vShowTestVer() large;
#endif

/***************************************************************************
     Function : void vUIStart(void)
  Dsecription : called from Timer task after RISC start
    Parameter : None
       Return : None
***************************************************************************/
void vUIStart(void) large
{
  #ifdef SUPPORT_MODE_SWITCH_MENU //yan 070409
  _bSmsPlugOut = FALSE;
  _bSmsPower1stOn = 0;
  fgSetPlayPostKey(IR_MUTE);
  #endif

#ifdef PLAY_AUDIO_CLIP
  /* vSendUopCmd(UOP_AUDIO_CLIP, SV_ACLIP_FLASH, ACLIP_TADA, 0); */
#endif
#ifdef MT1379_MANUFACTURE_TEST
  vShowTestVer();
#endif

  vOsdCoreInit();
  vOsdSetLang(bEepromReadByte(OSD_LANG_POSITION));

  /* power on is mute, remember turn on volume */
  vAdspVolume(AUD_DEFAULT_VOL);

  // Check EEPROM size
#ifdef I2C_EEPROM
  if (EEPROM_TOTAL_SIZE > EEPROM_MAX_SIZE)
  {
    _bPlayerErrCode = PLAYER_ERR_EEPROM_CONFIG;
  }
#endif

  // Check user share memory size
  if ((SH_USER_DATA_MAX - SI_USER_START) >= SI_USER_DATA_GRP_NO * 32)
  {
    _bPlayerErrCode = PLAYER_ERR_USER_DATA;
  }
}

/***************************************************************************
     Function : void vUIStop(void)
  Dsecription : called from Timer task before RISC stop
    Parameter : None
       Return : None
***************************************************************************/
void vUIStop(void) large
{
  _rUI.bState = UI_STOP;

}

/***************************************************************************
     Function : void vUIExit(void)
  Dsecription : called from Timer task after RISC stop
    Parameter : None
       Return : None
***************************************************************************/
void vUIExit(void) large
{
  vVfdBrightSwitch(VFD_BRIGHT_OFF);
}

/***************************************************************************
     Function : BYTE bGetPlayPostKeyPriority(BYTE bKey)
  Dsecription :
    Parameter : None
       Return : None
***************************************************************************/
static BYTE bGetPlayPostKeyPriority(BYTE bKey)
{
  BYTE bPriority = 0xff;

  switch (bKey)
  {
    case IR_POWER:
    case IR_EJECT:
    case IR_MANUAL_EJECT:
      bPriority = 0;

    case IR_PASSWORD:
    case IR_HDN_PASSWORD:
      bPriority = 1;
      break;

    case IR_CMD_DONE:
    case IR_TIME_OUT:
    case IR_DONE:
    case IR_UPG:
    case IR_SELECT_DONE:
      bPriority = 2;
      break;

    default:
      if (bKey < IR_KEY_MAX)
      {
        bPriority = 3;
      }
      break;
  }

  return (bPriority);
}

/***************************************************************************
     Function : void fgSetPlayPostKey(BYTE bKey)
  Dsecription :
    Parameter : None
       Return : None
***************************************************************************/
BOOL fgSetPlayPostKey(BYTE bKey) large
{
  BYTE bNewPri, bCurrPri;

  if (bKey == _bPlayPostKey)
  {
    return (TRUE);
  }

  bNewPri = bGetPlayPostKeyPriority(bKey);
  bCurrPri = bGetPlayPostKeyPriority(_bPlayPostKey);

  if (bNewPri > bCurrPri)
  {
    return (FALSE);
  }

  if (fgIsNoInputState() == FALSE)
  {
    if (bNewPri == 1)
    {
      vSetExitInputState();
    }
  }

  _bPlayPostKey = bKey;

  return (TRUE);
}

#ifdef AUDIO_STREAM_CHANGE_MUTE
/***************************************************************************
     Function : void vSetAudioStreamChange(BYTE bOpt1, BYTE bOpt2, BYTE bOpt3) large
  Dsecription :
    Parameter : None
       Return : None
***************************************************************************/
void vSetAudioStreamChange(BYTE bCnt, BYTE bOpt1, BYTE bOpt2, BYTE bOpt3) large
{
  vSetSharedInfo(SH_CHG_AST_CNT, bCnt);
  vSetSharedInfo(SH_CHG_AST_OPT1, bOpt1);
  vSetSharedInfo(SH_CHG_AST_OPT2, bOpt2);
  vSetSharedInfo(SH_CHG_AST_OPT3, bOpt3);

  _fgAstChg = TRUE;
}
#endif /* AUDIO_STREAM_CHANGE_MUTE */

#ifdef EN_DISC_ID_CHK
/***************************************************************************
     Function : void vSetAudioStreamChange(BYTE bOpt1, BYTE bOpt2, BYTE bOpt3) large
  Dsecription : call from main loop
    Parameter : fgFound, TRUE: ID is found, FALSE: ID is not found
       Return : None
***************************************************************************/
#pragma disable
void vSetDiscIDCheckResult(BOOL fgFound) large
{
  vSetDiscInitFlag(DISC_INIT_LOCK_CHK);

  if (fgFound)
  {
    _rOsdStateCtx.bDiscIDFound = TRUE;
  }
  else
  {
    _rOsdStateCtx.bDiscIDFound = FALSE;

    // since no ID id found, no need to check password
    vSetDiscInitFlag(DISC_INIT_WAIT_PWD_IN);
    vSetDiscInitFlag(DISC_INIT_PWD_OK);
  }
}
#endif /* EN_DISC_ID_CHK */

#ifdef SUPPORT_HDMI
//  *************************************************************************
//  Function    : vHDCPTimer
//  Description : Handle HDCP time-out control procedure
//  Argument    : None
//  Return      : None
//  Notice      : This function must be put the same bank of vPlayerTimer()
//                Otherwise, the system will hang !!
//                Don't know the reason !!
//  *************************************************************************
void vHDCPTimer(void) large
{
  // nothing need to do while time-out value is zero
  // ie. nobody is waiting time-out
  if(_wHDMICtrlTimer != 0)
  {
    _wHDMICtrlTimer--;
  }
  if(_wHDCPTimer != 0)
  {
    // decrease timer by 1 while end one loop beep count
    _wHDCPTimer--;
  }
  if(_bHDMIHPDTimer != 0)
  {
    // decrease timer by 1 while end one loop beep count
    _bHDMIHPDTimer--;
  }
  if(_wHDCPTimer == 0)
  {
    // handle time-out procedure
    // Notice: don't checking waiting value status: bCheckStatus()
    // and changing state: vSetHDCPState() here
    // Otherwise, it will cause "Multiple Call To Segment" warning
    // ie. these two APIs will be called by main flow and interrupt
    // So, it's dangerous !!
    _rHDCPStateCtx.fgTimeOut=TRUE;
  }
  if(_wHDMICtrlTimer == 0)
  {
    _rHDMICtrl.fgTimeOut=TRUE;
  }
  if(_bHDMIHPDTimer == 0)
  {     
    _rHDMICtrl.fgHPDTimeOut=TRUE;
  }  
}
#endif  // #ifdef SUPPORT_HDMI

⌨️ 快捷键说明

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