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

📄 goto.c

📁 mtkDVD源代码程序4*16 很好玩的内置5.1环绕音效 大家可以玩一下
💻 C
📖 第 1 页 / 共 5 页
字号:
        break;
      }
      if (_bInputPos == 0xFF)
      {
        _bInputPos = 0;
        _bTimeHH = _bTimeMM = _bTimeSS = 0;
        vSetMsgCol4(_bWBGotoMenu, 0, 3, 2, 4);
        vOsdShowStrXY(GOTO_RITEM_X, wY, _bWBGotoMenu, pbStr);
      }
      break;
      
    case IR_NUM0:
    case IR_NUM1:
    case IR_NUM2:
    case IR_NUM3:
    case IR_NUM4:
    case IR_NUM5:
    case IR_NUM6:
    case IR_NUM7:
    case IR_NUM8:
    case IR_NUM9:
      pbStr[1] = '0' + _bTimeHH;
      pbStr[3] = '0' + _bTimeMM / 10;
      pbStr[4] = '0' + _bTimeMM % 10;
      pbStr[6] = '0' + _bTimeSS / 10;
      pbStr[7] = '0' + _bTimeSS % 10;
      bNum = _bIRKey - IR_NUM0;
      if (_bInputPos == 0)
      {
        if (bNum > BCD_LO(bHH))  // exceed range
          break;
        _bTimeHH = bNum;
        pbStr[1] = '0' + bNum;
        _bInputPos++;
      }
      else if (_bInputPos <= 2)
      {
        if (_bInputPos == 1)
        {
          if (bNum > 5)  // invalid input
            break;
          if (_bTimeHH == BCD_LO(bHH) && bNum > BCD_HI(bMM))
            // exceed range
            break;
        }
        else if (_bInputPos == 2)
        {
          if (_bTimeHH == BCD_LO(bHH) &&
              _bTimeMM == BCD_HI(bMM) &&
              bNum > BCD_LO(bMM))  // exceed range
            break;
        }
        _bTimeMM = _bTimeMM * 10 + bNum;
        pbStr[3] = '0' + _bTimeMM / 10;
        pbStr[4] = '0' + _bTimeMM % 10;
        pbStr[_bInputPos + 2] = '0' + bNum;
        _bInputPos++;
      }
      else
      {
        if (_bInputPos == 3)
        {
          if (bNum > 5)  // invalid input
            break;
          if (_bTimeHH == BCD_LO(bHH) &&
              _bTimeMM == BCD2DEC(bMM) &&
              bNum > BCD_HI(bSS))  // exceed range
            break;
        }
        else if (_bInputPos == 4)
        {
          if (_bTimeHH == BCD_LO(bHH) &&
              _bTimeMM == BCD2DEC(bMM) &&
              _bTimeSS == BCD_HI(bSS) &&
              bNum > BCD_LO(bSS))  // exceed range
            break;
        }
        _bTimeSS = _bTimeSS * 10 + _bIRKey - IR_NUM0;
        pbStr[6] = '0' + _bTimeSS / 10;
        pbStr[7] = '0' + _bTimeSS % 10;
        pbStr[_bInputPos + 3] = '0' + bNum;
        _bInputPos++;
      }
      if (_bInputPos <= 2)
        pbStr[_bInputPos + 2] = '_';
      else if (_bInputPos <= 4)
        pbStr[_bInputPos + 3] = '_';
      vSetMsgCol4(_bWBGotoMenu, 0, 3, 2, 4);
      vOsdShowStrXY(GOTO_RITEM_X, wY, _bWBGotoMenu, pbStr);
      
      if (_bInputPos == 5)  // time input completed
      {
        if (fgIsVcdPlay())
        {
          if (bSharedInfo(SI_PBC_SWITCH) == SV_PBC_ON)
          {
            // switch to PBC off first
            vSendUopCmd(UOP_PBC_SWITCH, 0, 0, 0);
          }
          if (_bTimeHH > 0)  // for VCD only, assume max 99:59
          {
            vSendUopCmd(UOP_TIME_PLAY, bUopParam, _bTimeMM + 60, _bTimeSS);
          }
          else
          {
            vSendUopCmd(UOP_TIME_PLAY, bUopParam, _bTimeMM, _bTimeSS);
          }
        }
        else
        {
          vSendUopCmd(bUopId, _bTimeHH, _bTimeMM, _bTimeSS);
        }
        vSetMsgCol4(_bWBGotoMenu, 0, 3, 2, 1);
        vOsdShowStrXY(GOTO_RITEM_X, wY, _bWBGotoMenu, pbStr);
        //_bTimeHH = _bTimeMM = _bTimeSS = 0;
        vGotoBackMain();
        pvFun();
      }
      break;
  }
}

void vDealGotoTime(BYTE fgDeal) large
{
  BYTE bTotalTimeHH = bSharedInfo(SI_TIME_TOTAL_HH);
  BYTE bTotalTimeMM = bSharedInfo(SI_TIME_TOTAL_MM);
  BYTE bTotalTimeSS = bSharedInfo(SI_TIME_TOTAL_SS);
  BYTE pbStr[] = { 7, '_', ':', '0', '0', ':', '0', '0' };
  BYTE bYPos = (fgIsDvdPlay() ? STGOTO_DVD_TIME : STGOTO_VCD_TIME) -
                _bGotoBeg;
                
  vTimeInputHandler(fgDeal, bTotalTimeHH, bTotalTimeMM, bTotalTimeSS,
                    bYPos, UOP_TIME_PLAY, vShowGotoTime);
}

void vDealGotoTimeCH(BYTE fgDeal) large
{
  BYTE bTotalTimeHH = bSharedInfo(fgIsDvdPlay() ? SI_TIME_TOTAL_CHAPTER_HH : SI_TIME_TOTAL_TRACK_HH);
  BYTE bTotalTimeMM = bSharedInfo(fgIsDvdPlay() ? SI_TIME_TOTAL_CHAPTER_MM : SI_TIME_TOTAL_TRACK_MM);
  BYTE bTotalTimeSS = bSharedInfo(fgIsDvdPlay() ? SI_TIME_TOTAL_CHAPTER_SS : SI_TIME_TOTAL_TRACK_SS);
  BYTE bYPos = (fgIsDvdPlay() ? STGOTO_DVD_TIME_CH : STGOTO_VCD_TIME_CH) -
                _bGotoBeg;
                
  vTimeInputHandler(fgDeal, bTotalTimeHH, bTotalTimeMM, bTotalTimeSS,
                    bYPos, UOP_PTT_TIME_PLAY, vShowGotoTimeCH);
}


void vDealGotoRepeat(BYTE fgDeal) large
{
  BYTE bMode = bSharedInfo(SI_REPEAT_MODE);
  BYTE bDom = bSharedInfo(SI_DVD_DOM);
  WORD wMsgIdx;
  BYTE bCntI;
  BYTE bRptModeNum = (fgIsDvdPlay() ? 4 : 3);
  BYTE bCurRptModeNo;
  BYTE pbReptModeDVD[] = { SV_REPEAT_CHAPTER,
                           SV_REPEAT_TITLE,
                           SV_REPEAT_ALL,
                           SV_REPEAT_NONE };
  BYTE pbReptModeVCD[] = { SV_REPEAT_TRACK,
                           SV_REPEAT_ALL,
                           SV_REPEAT_NONE };

  switch (bMode)
  {
    case SV_REPEAT_ALL:
      wMsgIdx = OSD_MSG_ICON_RPT_ALL;
      bCurRptModeNo = fgIsDvdPlay() ? 2 : 1;
      break;

    case SV_REPEAT_TRACK:
    case SV_REPEAT_LIST:
      wMsgIdx = OSD_MSG_ICON_RPT_TRK;
      bCurRptModeNo = 0;
      break;

    case SV_REPEAT_TITLE:
      wMsgIdx = OSD_MSG_ICON_RPT_TT;
      bCurRptModeNo = 1;
      break;

    case SV_REPEAT_CHAPTER:
      wMsgIdx = OSD_MSG_ICON_RPT_CH;
      bCurRptModeNo = 0;
      break;

    case SV_REPEAT_NONE:
    case SV_REPEAT_ABNONE:
      wMsgIdx = OSD_MSG_OFF;
      bCurRptModeNo = fgIsDvdPlay() ? 3 : 2;
      break;

    default:
      break;
  }
    
  if (fgIsDvdPlay() && bDom != SV_VTSTT_DOM)  // force repeat mode off in non-VTSTT domain
    wMsgIdx = OSD_MSG_OFF;
  
  if (!fgDeal)  // show current repeat setting
  {
    vShowGotoRepeat(wMsgIdx);
    return;
  }
  
  switch (_bIRKey)
  {
    case IR_ENTER:
    case IR_PLAY:
    case IR_PLAY_ENTER:
      if (fgIsDvdPlay() && bDom != SV_VTSTT_DOM)
      // force no repeat mode selection in non-VTSTT domain
      {
        vGotoBackMain();
        break;
      }
      if (_bInputPos == 0xFF)  // just enter by pressing PLAY
      {
        _bInputBeg = 0;
        _bInputPos = bCurRptModeNo;
        vRedrawGotoReptItem(bRptModeNum);
        vGotoReptHLItem(TRUE);
        break;
      }
      else  // switch to current repeat setting
      {
        if (fgIsDvdPlay())
        {
          vSendUopCmd(UOP_REPEAT, pbReptModeDVD[_bInputPos], 0, 0);
        }
        else if (fgIsVcdPlay())
        {
          vSendUopCmd(UOP_REPEAT, pbReptModeVCD[_bInputPos], 0, 0);
        }
        vGotoBackMain();
        break;
      }
  }
  
  _pvHLFun = vGotoReptHLItem;
  _pvRedrawFun = vRedrawGotoReptItem;
  _bTotal = bRptModeNum;
  vPullDownMenuHandler();
}


void vDealGotoTimedisp(BYTE fgDeal) large
{
  BYTE bMode = 0 + _rOsdStateCtx.bGotoTimeType;
  WORD wMsgIdx;
  BYTE bCntI;
  WORD pwMsgIdx[4] = { OSD_MSG_TITLE_ELAPSED,
                       OSD_MSG_TITLE_REMAIN,
                       OSD_MSG_CHAPTER_ELAPSED,
                       OSD_MSG_CHAPTER_REMAIN };

  if (fgIsVcdPlay())
  {
    pwMsgIdx[0] = OSD_MSG_TOTAL_ELAPSED;
    pwMsgIdx[1] = OSD_MSG_TOTAL_REMAIN;
    pwMsgIdx[2] = OSD_MSG_SINGLE_ELAPSED;
    pwMsgIdx[3] = OSD_MSG_SINGLE_REMAIN;
  }

  wMsgIdx = pwMsgIdx[bMode];
    
  if (!fgDeal)  // show current time-display setting
  {
    vShowGotoTimedisp(wMsgIdx);
    return;
  }
  
  switch (_bIRKey)
  {
    case IR_ENTER:
    case IR_PLAY:
    case IR_PLAY_ENTER:
      if (_bInputPos == 0xFF)  // just enter by pressing PLAY
      {
        _bInputBeg = 0;
        _bInputPos = bMode;
        vRedrawGotoTimedispItem(4);
        vGotoTimedispHLItem(TRUE);
        break;
      }
      else  // switch to current time-display setting
      {
        _rOsdStateCtx.bGotoTimeType = _bInputPos;
#ifdef GOTO_STATUS_NO_TTCH
        if (bSharedInfo(SI_NTSC_PAL) == SV_PAL)
        {
          vOsdPosClear(OSD_POS_GOTO_DISP_P);
        }
        else
        {
          vOsdPosClear(OSD_POS_GOTO_DISP);
        }
#endif
        vUpdateGotoShow(GOTO_SHOW_PANEL_TIME);
        vGotoBackMain();
        break;
      }
  }
  
  _pvHLFun = vGotoTimedispHLItem;
  _pvRedrawFun = vRedrawGotoTimedispItem;
  _bTotal = 4;
  vPullDownMenuHandler();
}


void vRedrawGotoItem(BYTE fgClear) large
{
  BYTE bCntI;
  BYTE bCI;
  WORD wMsgIdx;
  void (*vFun)(BYTE bYPos) large;
  
  if (fgClear)
  {
    // draw the top green rectangle and paste menu title
    vSolidRect(_bWBGotoMenu, GOTO_LITEM_X, 0,
               GOTO_WINDOW_END_X - 17, GOTO_ITEM_BEGIN_Y - 3, 0);
    vSetMsgCol4(_bWBGotoMenu, 0, 0, 2, 4);
    vOsdPasteMsgXY(GOTO_LITEM_X, 3,
                   _bWBGotoMenu, OSD_MSG_MENU);

    // clear all pasted messages
    vSolidRect(_bWBGotoMenu, GOTO_PANEL_WIDTH + 11, GOTO_ITEM_BEGIN_Y - 2,
               GOTO_WINDOW_END_X, GOTO_ITEM_BEGIN_Y + LINE_HEIGHT * 4 + 5, 3);
  }

  vSetMsgCol4(_bWBGotoMenu, 0, 3, 2, 1);
  for (bCntI = 0; bCntI < GOTO_PAGE_ITEM_NUM; bCntI++)
  {
    if (fgClear)
    {
      wMsgIdx = _prGotoItem[bCntI + _bGotoBeg].wItemNameMsg;
      vOsdPasteMsgXY(GOTO_LITEM_X, GOTO_ITEM_BEGIN_Y + LINE_HEIGHT * bCntI,
                     _bWBGotoMenu, wMsgIdx);
    }
    //if (!fgDrawAll && (bCntI + _bGotoBeg == _bGotoCurItem))
    //  continue;  // skip current pointed-to item
    // using function ptrs in the following block is better, but it will
    // introduce strange bugs!!!!!
    vInvokeFun(bCntI + _bGotoBeg, FALSE);
  }

  vGotoShowUDMark(_bGotoBeg, bGotoTotalItem());
}


void vGotoHLItem(BYTE fgShow) large
{
  BYTE bYPos = _bGotoCurItem - _bGotoBeg;
  BYTE bColor;
  WORD wMsgIdx;
  
  wMsgIdx = _prGotoItem[_bGotoCurItem].wItemNameMsg;
    
  if (fgShow)
    bColor = 5;  // highlight this item
  else
    bColor = 3;  // unhighlight this item
    
  vSolidRect(_bWBGotoMenu,
             GOTO_LITEM_X - 23, GOTO_ITEM_BEGIN_Y + LINE_HEIGHT * bYPos,
             GOTO_RITEM_X - 14, GOTO_ITEM_BEGIN_Y + LINE_HEIGHT * (bYPos + 1) - 1,
             bColor);
  vSetMsgCol4(_bWBGotoMenu, 0, bColor, 2, 1);

  vOsdPasteMsgXY(GOTO_LITEM_X, GOTO_ITEM_BEGIN_Y + LINE_HEIGHT * bYPos,
                 _bWBGotoMenu, wMsgIdx);
}


// this function will be called in UOP return routines
void vUpdateGotoShow(BYTE bShowType) large
{
  BYTE bDom = bSharedInfo(SI_DVD_DOM);
  BYTE bTtNo = bSharedInfo(fgIsDvdPlay() ? SI_TT_NO : SI_TRACK_NO);
  BYTE bTtNs = bSharedInfo(fgIsDvdPlay() ? SI_TT_NS : SI_TRACK_NS);
  BYTE bChNo = bSharedInfo(fgIsDvdPlay() ? SI_CHAP_NO : SI_PTT_NO);
  BYTE bChNs = bSharedInfo(fgIsDvdPlay() ? SI_CHAP_NS : SI_PTT_NO);
  BYTE bType = bSharedInfo(SI_DISC_TYPE);
  BYTE bHour, bMin, bSec;
  BYTE bBitrate0 = bSharedInfo(SI_V_BITRATE0);
  BYTE bBitrate1 = bSharedInfo(SI_V_BITRATE1);
  WORD wBitrate = (bBitrate1 << 8) | bBitrate0;
  BYTE pbStr[8] = { 7, '0', ':', '0', '0', ':', '0', '0' };
  BYTE bPbcState = bSharedInfo(SI_PBC_STATE);
  BYTE fgShowAll;
  BYTE bCntI;
  WORD wMsgIdx;

  if (fgIsDvdPlay() && bDom != SV_VTSTT_DOM)
  {
    bTtNo = bChNo = 0;
  }
  
  if (bShowType == GOTO_SHOW_PANEL_ALL)
    fgShowAll = TRUE;
  else
    fgShowAll = FALSE;
  
  if (bShowType == GOTO_SHOW_PANEL_CHAPTER)
    bShowType = GOTO_SHOW_PANEL_TITLE;
    
#ifdef GOTO_STATUS_NO_TTCH
  if (bShowType == GOTO_SHOW_PANEL_ALL || bShowType == GOTO_SHOW_PANEL_TITLE)
    bShowType = GOTO_SHOW_PANEL_TIME;
#endif

  switch (bShowType)
  {
    case GOTO_SHOW_PANEL_ALL:
    case GOTO_SHOW_PANEL_TITLE:
      // show current playing title and chapter
      pbStr[0] = 4;
      pbStr[1] = bTtNo / 10 + '0';
      pbStr[2] = bTtNo % 10 + '0'; 
      pbStr[3] = bChNo / 10 + '0';
      pbStr[4] = bChNo % 10 + '0';
      if (fgIsDvdPlay())
      {
        wMsgIdx = OSD_MSG_TT_CH_G;
      }
      else
      {
#ifdef GOTO_VCD_SEGMENT
        wMsgIdx = OSD_MSG_TK_SG_G;
#else
        wMsgIdx = OSD_MSG_TK_G;
        pbStr[0] = 2;
#endif
      }
      vSetMsgCol4(_bWBGotoMenu, 0, 0, 2, 1);
      if (bSharedInfo(SI_NTSC_PAL) == SV_PAL)
      {
        vOsdPosPasteArg(OSD_POS_GOTO_DISP_P, wMsgIdx, pbStr, 0);
      }
      else
      {
        vOsdPosPasteArg(OSD_POS_GOTO_DISP, wMsgIdx, pbStr, 0);
      }
      if (!fgShowAll)
        break;
  
    case GOTO_SHOW_PANEL_TIME:
      // get time info
      switch (_rOsdStateCtx.bGotoTimeType)
      {
        case GOTO_SHOW_TITLE_ELAPSED:
          bHour = bSharedInfo(SI_TIME_HH);
          bMin  = bSharedInfo(SI_TIME_MM);
          bSec  = bSharedInfo(SI_TIME_SS);
          if (fgIsDvdPlay())
            wMsgIdx = OSD_MSG_TITLE_ELAPSED;
          else
            wMsgIdx = OSD_MSG_TOTAL_ELAPSED;
          break;

⌨️ 快捷键说明

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