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

📄 player.c

📁 mtkDVD源代码程序4*16 很好玩的内置5.1环绕音效 大家可以玩一下
💻 C
📖 第 1 页 / 共 3 页
字号:
#ifdef SHRINK_KEYPROC
  BYTE bScrSaverSwitch;
#endif

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

  /* screen saver */
  if (!fgIsScrSaverOn())
  {
    vScrSaverSetTimeOut(SCR_SAVER_TIMEOUT);
  }
#ifdef SHRINK_KEYPROC
  else
  {
    if (_bIRKey < IR_INTERNAL_KEY_START)
    {
      /* if we turned on the screen saver */
      bScrSaverSwitch = bEepromReadByte(SCR_SAVER_POSITION);
      if (bScrSaverSwitch == EV_ON)
      {
        vBmpScrSaveExit();
      }
      /* enter power active mode */
      vSendPlayerActive();
      vScrSaverSetTimeOut(SCR_SAVER_TIMEOUT);
  
      if (fgIsHiPriorityKey(_bIRKey) || (bScrSaverSwitch != EV_ON))
      {
        /* we need to process the first key */
        fgSetPlayPostKey(_bIRKey);
      }
      _bIRKey = IR_NONE;
      return;
    }
    else /* don't care internal key */
    {
      return;
    }
  }
#endif

  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)
      {
        if (_bPlayPostKey == IR_MANUAL_EJECT)
        {
          _bPlayPostKey = IR_EJECT;
        }
        _bIRKey = _bPlayPostKey;
        _bPlayPostKey = IR_NONE;
      }
      else if (_bPlayPostKey == IR_MANUAL_EJECT)
      /* && ((_bPWRMode == SV_PWR_IDLE_PAUSE) || (_bPWRMode == SV_PWR_IDLE_STOP)) */
      {
        _bIRKey = IR_EJECT;
        _bPlayPostKey = IR_NONE;
      }
      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 (EXIST_VFD_KEY())
    {
      GET_VFD_KEY(_bIRKey);
    }
    /* 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);
      }
    }
  }
}

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

#ifndef SHRINK_KEYPROC
  // Harrison's modified
  _bKeyState = KEY_INIT;
#endif
  vUserInit(fgInit);

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

/***************************************************************************
     Function : void vUITimer(void)
  Dsecription : called from Timer task
    Parameter : None
       Return : None
***************************************************************************/
void vUITimer(void) large
{
  /* non-key dependant event for play module */
  vPlayerTimer();

  /* VFD */
#ifndef HYNIX_VFD
  VfdTimer();
#endif

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

#ifdef PLAYER_GOTO
  if (fgIsInGoto())
  {
    if( (_bPrevNtscPal != bSharedInfo(SI_NTSC_PAL)) && (_bIRKey == IR_NONE) )
    {
    	_bIRKey = IR_GOTO;
    	fgSetPlayPostKey(IR_GOTO); 
    }    
  }
  else
    _bPrevNtscPal = bSharedInfo(SI_NTSC_PAL);
#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 */
  #ifndef PLAYER_NO_VFD
  VfdPowerDownTimer();
  #endif

  /* get current key */
  if (EXIST_VFD_KEY())
  {
    GET_VFD_KEY(_bIRKey);
  }
  /* 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 */
  #ifdef VFDMSG_hello
    VfdMsgDirect(VFDMSG_hello);
  #endif

    /* 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 PLAY_AUDIO_CLIP
  /* vSendUopCmd(UOP_AUDIO_CLIP, SV_ACLIP_FLASH, ACLIP_TADA, 0); */
#endif
#ifndef MT1379_MANUFACTURE_TEST       
  vOsdCoreInit();
  vOsdSetLang(bEepromReadByte(OSD_LANG_POSITION));
#endif
  #ifdef MT1379_MANUFACTURE_TEST       
vShowTestVer();
#endif

  /* 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;

  VfdStop();
}

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

/***************************************************************************
     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 */

⌨️ 快捷键说明

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