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

📄 osdshow.c

📁 MTK 1389E SOURCE CODE
💻 C
📖 第 1 页 / 共 2 页
字号:
/**********************************************************************/
/***************    MTK CONFIDENTIAL & COPYRIGHTED     ****************/
/***************                                       ****************/
/***************  $Modtime:: 05/10/04 10:09a   $       ****************/
/***************  $Revision:: 7                $       ****************/
/***************                                       ****************/
/***************   Description : OSD                   ****************/
/***************                                       ****************/
/***************       Company : MediaTek Inc.         ****************/
/***************    Programmer : Peter Huang           ****************/
/**********************************************************************/

#define _OSDSHOW_C_

#if defined(PC_EMULATION)
#define _C_MAIN_
#endif

#pragma NOAREGS

#include "general.h"
#include "osdshow.h"

// *********************************************************************
// Position table
// *********************************************************************
#define _OSDSHOW_MAIN_C_

#include "posi.h"
#include ".\show\progshow.h"
#include ".\show\markshow.h"
#include ".\show\dgstshow.h"
#include ".\show\upgshow.h"
#include ".\show\ainshow.h"

#ifdef PLAYER_GOTO
#include ".\show\gotoshow.h"
#endif

#ifdef PLAYER_FLMENU // temp method, should be provided by FLMENU modufle
  //#include ".\fslist\flspec.h"
  #include ".\fslist\fslist.h"
#else
  #define OSD_POS_FS_MAX    0
  #define pwPosFsInfo       0
#endif

typedef struct
{
  BYTE bTblSz;
  strucOsdPos *prPosTbl;
}
structOsdPosTbl;

static code structOsdPosTbl prOsdPosTbl[OSD_POS_TBL_MAX] = {
  { OSD_POS_LAYER1_MAX, pwPosLayer1 },   /* 0:OSD_POS_TBL_LAYER1 */
  { OSD_POS_LAYER2_MAX, pwPosLayer2 },   /* 1:OSD_POS_TBL_LAYER2 */
#if(defined(PLAYER_PROGRAM) || defined(PLAYER_DIGEST))
  { OSD_POS_PROG_MAX,   pwPosProg },     /* 2:OSD_POS_TBL_PROG   */
#endif
#ifdef PLAYER_BOOKMARK
  { OSD_POS_MARK_MAX,   pwPosMark },     /* 3:OSD_POS_TBL_MARK   */
#endif
#ifdef PLAYER_DIGEST
  { OSD_POS_DGST_MAX,   pwPosDgst },     /* 4:OSD_POS_TBL_DGST   */
#endif
  { OSD_POS_UPG_MAX,    pwPosUpg },      /* 5:OSD_POS_TBL_UPG    */
#ifdef AUDIO_IN_EN
  { OSD_POS_AIN_MAX,    pwPosAin },      /* 6:OSD_POS_TBL_AIN    */
#endif
  { OSD_POS_FS_MAX,     pwPosFsInfo }   /* 7:OSD_POS_TBL_FLMENU */
#ifdef PLAYER_GOTO
  ,{ OSD_POS_GOTO_MAX,   pwPosGoto }      /* 8:OSD_POS_TBL_GOTO   */
#endif
};

// *********************************************************************
// Position Table Related Macros
// *********************************************************************
#define fgIsPosValid(wPos)         ((bOsdPosTbl(wPos) < OSD_POS_TBL_MAX) && \
                                    (bOsdPosIdx(wPos) < (prOsdPosTbl[bOsdPosTbl(wPos)]).bTblSz))

#define bPosWB(wPos)               (((prOsdPosTbl[bOsdPosTbl(wPos)]).prPosTbl[bOsdPosIdx(wPos)]).bWB)
#define wPosX(wPos)                (((prOsdPosTbl[bOsdPosTbl(wPos)]).prPosTbl[bOsdPosIdx(wPos)]).wX)
#define wPosY(wPos)                (((prOsdPosTbl[bOsdPosTbl(wPos)]).prPosTbl[bOsdPosIdx(wPos)]).wY)
#define wPosH(wPos)                (((prOsdPosTbl[bOsdPosTbl(wPos)]).prPosTbl[bOsdPosIdx(wPos)]).wHeight)
#define wPosW(wPos)                (((prOsdPosTbl[bOsdPosTbl(wPos)]).prPosTbl[bOsdPosIdx(wPos)]).wWidth)


//extern xdata DWRD _dCreatedWB;

// *********************************************************************
// Function : void vOsdSetInputField(WORD wPosIndex)
// Description : not export outside this module
// Parameter : None
// Return    : None
// *********************************************************************
void vOsdSetInputField(WORD wPosIndex) large
{
  BYTE bWB;

  if (fgIsPosValid(wPosIndex) == FALSE)
  {
    return;
  }

  bWB = bPosWB(wPosIndex);

#ifdef NUI_OSD_STYLE
  vSetInputMsgCol4(bWB, 0, 3, 3, 2);
#else
  vSetInputMsgCol4(bWB, 0, 15, 15, 3);
#endif

  if (fgOsdCoreChgColEn(wPosIndex, bWB) == TRUE)
  {
    vCreateWB(bWB,TRUE);
    vInMsgColEn(bWB);
  }
}

// *********************************************************************
// Function : void vOsdClearInputField(WORD bPosIndex)
// Description : not export outside this module
//               assume this is called before paste and show command
// Parameter : None
// Return    : None
// *********************************************************************
void vOsdClearInputField(WORD wPosIndex) large
{
  BYTE bWB;

  if (fgIsPosValid(wPosIndex) == FALSE)
  {
    return;
  }

  bWB = bPosWB(wPosIndex);

  if (fgOsdCoreChgColDis(wPosIndex, bWB) == TRUE)
  {
    vInMsgColDis(bWB);
  }
}


// *********************************************************************
// Function : void vOsdPosClear(WORD wPosIndex) large
// Description :
// Parameter :
// Return    : None
// *********************************************************************
void vOsdPosClear(WORD wPosIndex) large
{
  BYTE bWb;

  if (fgIsPosValid(wPosIndex) == FALSE)
  {
    return;
  }

  bWb = bPosWB(wPosIndex);

#ifdef POS_CLEAR_DISABLE_WB
  if (fgIsLayer1(wPosIndex))
  {
    vDisableWB(bWb);
  }
#endif

  vOsdClearPosXY(wPosX(wPosIndex), wPosY(wPosIndex), bWb,
                 wPosW(wPosIndex), LINE_HEIGHT);

#ifdef POS_CLEAR_DISABLE_WB
  if (fgIsLayer1(wPosIndex))
  {
    vOsdCoreLayer1WbRestore(bWb);
  }
#endif

  if (fgIsLayer2(wPosIndex))
  {
    vSetSharedInfo(SH_OSD_TIMER_START + wPosIndex - OSD_POS_LAYER2_LINE1, 0);
    vSetLayer2Change(TRUE);
  }
}

// *********************************************************************
// Function : void vOsdPosShow(BYTE bMsgIndex)
// Description :
// Parameter : None
// Return    : None
// *********************************************************************
void vOsdPosShow(WORD wPosIndex, WORD wMsgIndex, BYTE bTime) large
{
  vOsdPosShowArg(wPosIndex, wMsgIndex, bTime, NULL);
#if 0  
  WORD wTmp;

  if (fgIsPosValid(wPosIndex) == FALSE)
  {
    return;
  }
  
  vCreateWBEx(bPosWB(wPosIndex));

  vWaitBusy();
  vBeginWriteSharedGrp(SI_OSD_CMD_PRM_GRP, OSD_CMD_SHOW_MSG);
  vWriteNextSharedItem(bPosWB(wPosIndex));
  wTmp = wPosX(wPosIndex);
  vWriteNextSharedItem(bLoByte(wTmp));
  vWriteNextSharedItem(bHiByte(wTmp));
  wTmp = wPosY(wPosIndex);
  vWriteNextSharedItem(bLoByte(wTmp));
  vWriteNextSharedItem(bHiByte(wTmp));
  vWriteNextSharedItem(bLoByte(wMsgIndex));
  vWriteNextSharedItem(bHiByte(wMsgIndex));
  vWriteNextSharedItem(bTime);
  vWriteNextSharedItem(0);
  vSendOsdCmd();

  if (fgIsLayer2(wPosIndex)
#ifdef PLAYER_GOTO
      && !fgIsInGoto()
#endif
     )
  {
    vSetSharedInfo(SH_OSD_TIMER_START + wPosIndex - OSD_POS_LAYER2_LINE1, bTime);
    vSetLayer2Change(TRUE);
  }
#endif
}

// *********************************************************************
// Function : void vOsdPosPaste(WORD wPosIndex, WORD wMsgIndex)
// Description :
// Parameter : None
// Return    : None
// *********************************************************************
void vOsdPosPaste(WORD wPosIndex, WORD wMsgIndex) large
{
  vOsdPosPasteArg(wPosIndex, wMsgIndex, NULL, 0);
#if 0
  WORD wTmp;

  if (fgIsPosValid(wPosIndex) == FALSE)
  {
    return;
  }

  vWaitBusy();
  vBeginWriteSharedGrp(SI_OSD_CMD_PRM_GRP, OSD_CMD_PASTE_MSG);
  vWriteNextSharedItem(bPosWB(wPosIndex));
  wTmp = wPosX(wPosIndex);
  vWriteNextSharedItem(bLoByte(wTmp));
  vWriteNextSharedItem(bHiByte(wTmp));
  wTmp = wPosY(wPosIndex);
  vWriteNextSharedItem(bLoByte(wTmp));
  vWriteNextSharedItem(bHiByte(wTmp));
  vWriteNextSharedItem(bLoByte(wMsgIndex));
  vWriteNextSharedItem(bHiByte(wMsgIndex));
  vSendOsdCmd();

  if (fgIsLayer2(wPosIndex))
  {
    vSetSharedInfo(SH_OSD_TIMER_START + wPosIndex - OSD_POS_LAYER2_LINE1, OSD_NO_DISAPPEAR);
    vSetLayer2Change(TRUE);
  }
#endif
}

// *********************************************************************
// Function : void vOsdPosShow(BYTE bMsgIndex)
// Description :
// Parameter : None
// Return    : None
// *********************************************************************
void vOsdPosShowArg(WORD wPosIndex, WORD wMsgIndex, BYTE bTime, BYTE *pbStr) large
{
  WORD wTmp;
  BYTE i;

  if (fgIsPosValid(wPosIndex) == FALSE)
  {
    return;
  }

  vCreateWBEx(bPosWB(wPosIndex));

  vWaitBusy();
  vBeginWriteSharedGrp(SI_OSD_CMD_PRM_GRP, OSD_CMD_SHOW_MSG);
  vWriteNextSharedItem(bPosWB(wPosIndex));
  wTmp = wPosX(wPosIndex);
  vWriteNextSharedItem(bLoByte(wTmp));
  vWriteNextSharedItem(bHiByte(wTmp));
  wTmp = wPosY(wPosIndex);
  vWriteNextSharedItem(bLoByte(wTmp));
  vWriteNextSharedItem(bHiByte(wTmp));
  vWriteNextSharedItem(bLoByte(wMsgIndex));
  vWriteNextSharedItem(bHiByte(wMsgIndex));
  if (bTime == OSD_NO_DISAPPEAR)
  {
    vWriteNextSharedItem(bTime);
  }
  else
  {
    // 20050414, IS00002356, when RISC timeout, RISC will clear the message, but the timer in RISC and 8032 are not same.
    // 8032 timer is slower about 1 second
    // 20050429, add 1 more second so that time can appear immediately after message disappear
    vWriteNextSharedItem((bTime+4));
  }
  if (pbStr && pbStr[0])
  {
    for(i=0; i<pbStr[0]; i++)
    {
      vWriteNextSharedItem(pbStr[i+1]);
    }
  }
  vSendOsdCmd();

  if (fgIsLayer2(wPosIndex)
#ifdef PLAYER_GOTO
      && !fgIsInGoto()
#endif
     )
  {
    vSetSharedInfo(SH_OSD_TIMER_START + wPosIndex - OSD_POS_LAYER2_LINE1, bTime);
    vSetLayer2Change(TRUE);
  }
}

// *********************************************************************
// Function : void vOsdPosPasteArg(WORD wPosIndex, WORD wMsgIndex, BYTE *pbStr, BYTE bOffset)
// Description :
// Parameter : None
// Return    : None
// *********************************************************************
void vOsdPosPasteArg(WORD wPosIndex, WORD wMsgIndex, BYTE *pbStr, BYTE bOffset) large
{
  WORD wTmp;
  BYTE i;

  if (fgIsPosValid(wPosIndex) == FALSE)
  {
    return;
  }

  vWaitBusy();
  vBeginWriteSharedGrp(SI_OSD_CMD_PRM_GRP, OSD_CMD_PASTE_MSG);
  vWriteNextSharedItem(bPosWB(wPosIndex));
  wTmp = wPosX(wPosIndex) + bOffset * EFONT_WIDTH;
  vWriteNextSharedItem(bLoByte(wTmp));
  vWriteNextSharedItem(bHiByte(wTmp));
  wTmp = wPosY(wPosIndex);
  vWriteNextSharedItem(bLoByte(wTmp));
  vWriteNextSharedItem(bHiByte(wTmp));
  vWriteNextSharedItem(bLoByte(wMsgIndex));
  vWriteNextSharedItem(bHiByte(wMsgIndex));
  if (pbStr && pbStr[0])
  {
    for(i=0; i<pbStr[0]; i++)
    {
      vWriteNextSharedItem(pbStr[i+1]);
    }
  }
  vSendOsdCmd();

  if (fgIsLayer2(wPosIndex))
  {
    vSetSharedInfo(SH_OSD_TIMER_START + wPosIndex - OSD_POS_LAYER2_LINE1, OSD_NO_DISAPPEAR);
    vSetLayer2Change(TRUE);
  }
}

#if (defined(PLAYER_GOTO) || defined(MT1379_MANUFACTURE_TEST)||defined(SUPPORT_DRM))
// *********************************************************************
// Function : void vOsdPasteMsgXYArg(WORD wX, WORD wY, BYTE bWbIdx, WORD wMsgIdx, BYTE *pbStr)
// Description :
// Parameter : None
// Return    : None
// *********************************************************************
void vOsdPasteMsgXYArg(WORD wX, WORD wY, BYTE bWbIdx, WORD wMsgIdx, BYTE *pbStr) large
{
  WORD wTmp;
  BYTE i;

  vWaitBusy();
  vBeginWriteSharedGrp(SI_OSD_CMD_PRM_GRP, OSD_CMD_PASTE_MSG);
  vWriteNextSharedItem(bWbIdx);
  vWriteNextSharedItem(bLoByte(wX));
  vWriteNextSharedItem(bHiByte(wX));
  vWriteNextSharedItem(bLoByte(wY));
  vWriteNextSharedItem(bHiByte(wY));
  vWriteNextSharedItem(bLoByte(wMsgIdx));
  vWriteNextSharedItem(bHiByte(wMsgIdx));
  if (pbStr[0])
  {
    for(i=0; i<pbStr[0]; i++)
    {
      vWriteNextSharedItem(pbStr[i+1]);
    }
  }
  vSendOsdCmd();
}
#endif

#if (defined(PLAYER_BOOKMARK) || defined(PLAYER_PROGRAM) || defined(PLAYER_DIGEST))
// *********************************************************************
// Function : void vOsdPosHili(BYTE bMode, WORD wPosIndex, BYTE bWidth)
// Description : show SELECT message,
// Parameter :
// Return    : None
// *********************************************************************
void vOsdPosHili(BYTE bMode, WORD wPosIndex, BYTE bWidth) large
{
  BYTE bWB;
  WORD wEndX;
  BYTE i;

#ifndef HILI_USE_OSD  
  vHideHL(HL_1);
#endif

  if (fgIsPosValid(wPosIndex) == FALSE)
  {
    return;
  }

  bWB = bPosWB(wPosIndex);
  if (bMode == OSD_POS_HILI_CLEAR)
  {
#ifdef HILI_USE_OSD
    switch(bWB)
    {
      case WB_MARK: // WB_SELMENU,
        if(fgIsInputStateValid(INPUT_STATE_BOOKMARK))
        {
          for(i=0;i<BOOKMARK_NS;i++)
          {
            if (bWidth == 0)
            {
              wEndX = wPosX(OSD_POS_MARK_ITEM_1+i) + wPosW(OSD_POS_MARK_ITEM_1+i);
            }
            else
            {
              wEndX = wPosX(OSD_POS_MARK_ITEM_1+i) + bWidth * EFONT_WIDTH;
            }            
            _wStartX = wPosX(OSD_POS_MARK_ITEM_1+i);
            _wStartY = wPosY(OSD_POS_MARK_ITEM_1+i);
            _wEndX = wEndX;
            _wEndY = wPosY(OSD_POS_MARK_ITEM_1+i) + LINE_HEIGHT - 1;
            vChgColRep(bWB, 7, 0);
          }
          break;
        }

        if(fgIsInputStateValid(INPUT_STATE_PROGRAM))
        {
           for(i=0;i<14;i++)
          {
            if (bWidth == 0)
            {
              wEndX = wPosX(OSD_POS_PROG_ITEM_1+i) + wPosW(OSD_POS_PROG_ITEM_1+i);
            }
            else
            {
              wEndX = wPosX(OSD_POS_PROG_ITEM_1+i) + bWidth * EFONT_WIDTH;
            }            
            _wStartX = wPosX(OSD_POS_PROG_ITEM_1+i);
            _wStartY = wPosY(OSD_POS_PROG_ITEM_1+i);
            _wEndX = wEndX;
            _wEndY = wPosY(OSD_POS_PROG_ITEM_1+i) + LINE_HEIGHT - 1;
            vChgColRep(bWB, 7, 0);     
          }
          break;                
        }

      default:
        break;      
    }
#endif   
    return;
  }

  if (bWidth == 0)
  {
    wEndX = wPosX(wPosIndex) + wPosW(wPosIndex);
  }
  else
  {
    wEndX = wPosX(wPosIndex) + bWidth * EFONT_WIDTH;
  }

  
#ifdef HILI_USE_OSD
  _wStartX = wPosX(wPosIndex);
  _wStartY = wPosY(wPosIndex);
  _wEndX = wEndX;
  _wEndY = wPosY(wPosIndex) + LINE_HEIGHT - 1;
  switch(bWB)
  {
    case WB_MARK:  // WB_SELMENU,
      vChgColRep(bWB, 0, 7);
      break;
    
    default:
    break;
  }
  
#else
  vShowWbHiliXY(bWB, HL_1,
                wPosX(wPosIndex), wPosY(wPosIndex),
                wEndX, wPosY(wPosIndex) + LINE_HEIGHT - 1);

  vSetHLRng(HL_1, bWB);
  vShowHL(HL_1);
#endif
}
#endif /* PLAYER_BOOKMARK || PLAYER_PROGRAM || PLAYER_DIGEST */

#if (defined(PLAYER_BOOKMARK) || defined(PLAYER_PROGRAM) || defined(PLAYER_DIGEST))
// *********************************************************************
// Function : void vOsdPosHead(WORD wPosIndex, BYTE bBtnIndex, WORD wMsg, char cOffset, BYTE bWidth)
// Description : show SELECT message,
// Parameter :
// Return    : None
// *********************************************************************
#define BTN_MSG_Y_OFST        0

void vOsdPosHead(WORD wPosIndex, BYTE bBtnIndex, WORD wMsg, char cOffset, BYTE bWidth) large
{
  vSetBtnCol(bPosWB(wPosIndex), 0, 1, 3, 3);

  vCreateMsgButtonXY(bPosWB(wPosIndex),
                     bBtnIndex, 2, wMsg, 0xffff, BTN_MSG_Y_OFST,
                     wPosX(wPosIndex) + cOffset,
                     wPosY(wPosIndex),
                     wPosX(wPosIndex) + cOffset + bWidth,
                     wPosY(wPosIndex) + LINE_HEIGHT - 1);

  vSelButton(bPosWB(wPosIndex), bBtnIndex);
}
#endif /* PLAYER_BOOKMARK || PLAYER_PROGRAM */

// *********************************************************************
// Function : void vOsdPosShowStr(WORD wPosIndex, BYTE *pbStr)
// Description :
// Parameter :
// Return    : None
// *********************************************************************
void vOsdPosShowStr(WORD wPosIndex, BYTE *pbStr) large
{
#if 0 // fix for some strange bug???
  WORD wX, wY;
  BYTE bWB;

  wX = wPosX(wPosIndex);
  wY = wPosY(wPosIndex);
  bWB = bPosWB(wPosIndex);

  vOsdShowStrXY(wX, wY, bWB, pbStr);
#else
  vOsdShowStrXY(wPosX(wPosIndex), wPosY(wPosIndex), bPosWB(wPosIndex), pbStr);
#endif 
}

// *********************************************************************
// Function : WORD wOsdGetLcdMsg(BYTE bLcd0, BYTE bLco1)
// Description :
// Parameter :  bState
// Return    : None
// *********************************************************************
WORD wOsdGetLcdMsg(BYTE bLcd0, BYTE bLcd1) large
{
  WORD wMsgId = DVD_SP_UNKNOWN_LCD_MSG;

  switch (bLcd0)
  {
    case 'c':
    {
      switch (bLcd1)
      {
        case 's':
//#ifdef OSD_MSG_AU_CZECH
#ifndef PLAYER_2_CHANNEL
          wMsgId = OSD_MSG_AU_CZECH;
#endif
          break;
      }

⌨️ 快捷键说明

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