www.pudn.com > 6027_HD65.rar > logo_cap.c


/**********************************************************************/ 
/***************    MTK CONFIDENTIAL & COPYRIGHTED     ****************/ 
/***************                                       ****************/ 
/***************  $Modtime:: 04/04/19 3:01p    $       ****************/ 
/***************  $Revision:: 1                $       ****************/ 
/***************                                       ****************/ 
/***************   Description : Logo capture          ****************/ 
/***************                 control module        ****************/ 
/***************                                       ****************/ 
/***************       Company : MediaTek Inc.         ****************/ 
/***************    Programmer :                       ****************/ 
/**********************************************************************/ 
 
#include "general.h" 
 
#pragma NOAREGS 
 
#ifdef SUPPORT_CAPTURE_LOGO 
 
typedef struct structBookmark 
{ 
  BYTE bState:4; 
  BYTE Reserve:4; 
} strucLogoCap; 
 
static xdata strucLogoCap _rLogoCap; 
 
#define LCAP_START        1 
#define LCAP_WAIT_UOP     2 
#define LCAP_WAIT_ENC     3 
#define LCAP_WAIT_WRITE   4 
#define LCAP_FINISH       5 
 
// ********************************************************************* 
// Function : void vLogoCapStart(void) 
// Description : 
// Parameter : 
// Return    : None 
// ********************************************************************* 
static void vLogoCapStart(void) large 
{ 
  // update OSD first 
  // should we wait OSD finished? Or RISC will flsuh the OSD queue? 
  // NOTE: when writing flash, RISC could not access flash 
  // NOTE: since we do not have OSD core timer here, use direct OSD command here 
 
  // switch UI state 
  _rUI.bState = UI_LOGO_CAPTURE; 
} 
 
// ********************************************************************* 
// Function : void vLogoCapEncode(void) 
// Description : this is callded from UI_LOGO_CAPTURE 
// Parameter : 
// Return    : None 
// ********************************************************************* 
void vLogoCapEncode(void) large 
{ 
  BYTE bEncState = bSharedInfo(SI_CAP_LOGO_ST); 
 
  if (_rLogoCap.bState == LCAP_WAIT_ENC) 
  { 
    if (bEncState == SV_LCAP_WRITE) 
    { 
      // update OSD 
       
      // switch to next state 
      _rLogoCap.bState = LCAP_WAIT_WRITE; 
    } 
  } 
  else if (_rLogoCap.bState == LCAP_WAIT_WRITE) 
  { 
    if (bEncState == SV_LCAP_IDLE) 
    { 
      // update OSD 
 
      // switch UI state 
      _rUI.bState = UI_RUN; 
 
      // switch to next state 
      _rLogoCap.bState = LCAP_FINISH; 
 
      fgSetPlayPostKey(IR_TIME_OUT); 
    } 
  } 
  else 
  { 
    return; 
  } 
} 
 
// ********************************************************************* 
// Function : void vLogoCapInit(BYTE fgInit) 
// Description : this is callded from UI_RUN 
// Parameter : 
// Return    : None 
// ********************************************************************* 
void vLogoCapInit(BYTE fgInit) large 
{ 
  if (!fgIsLogoCaptureAllow()) 
  { 
    vSetExitInputState(); 
    return; 
  } 
 
  vOsdPosShow(OSD_POS_NORMAL, OSD_MSG_WAIT_CAPTURE_LOGO, OSD_NO_DISAPPEAR); 
 
  // for state transition 
  fgSetPlayPostKey(IR_TIME_OUT); 
 
  _rLogoCap.bState = LCAP_START; 
 
  vSetOsdRefreshNow(); 
} 
 
// ********************************************************************* 
// Function : BOOL fgLogoCapState(void) 
// Description : 
// Parameter : 
// Return    : None 
// ********************************************************************* 
BOOL fgLogoCapState(void) large 
{ 
  switch (_rLogoCap.bState) 
  { 
    case LCAP_START: 
      vSendUopCmd(UOP_CAPTURE, 0, 0, 0); 
      // set servo stop flag 
      _bUISrvStatus = PLAYER_SRV_STOP; 
      _rLogoCap.bState = LCAP_WAIT_UOP; 
      break; 
 
    case LCAP_WAIT_UOP: 
      if (_bIRKey == IR_CAPTURE) 
      { 
        vLogoCapStart(); 
        // switch to next state 
        _rLogoCap.bState = LCAP_WAIT_ENC; 
      } 
      else /* if (_bIRKey == IR_TIME_OUT) */ 
      { 
        // other key cancel the capture logo 
        vSetExitInputState(); 
      } 
      break; 
 
    case LCAP_WAIT_ENC: 
      break; 
 
    case LCAP_WAIT_WRITE: 
      break; 
 
    case LCAP_FINISH: 
    default: 
      vSetExitInputState(); 
      break; 
  } 
 
  return(TRUE); 
} 
 
// ********************************************************************* 
// Function : void vLogoCapExit(void) 
// Description : 
// Parameter : 
// Return    : None 
// ********************************************************************* 
void vLogoCapExit(void) large 
{ 
  // clear OSD here 
  if (_rLogoCap.bState == LCAP_FINISH) 
  { 
    vOsdPosClear(OSD_POS_NORMAL); 
  } 
  else 
  { 
    vOsdShowError(SV_ERR_INVALID_OPERATION, OSD_TIMEOUT_SHORT); 
  } 
} 
 
// ********************************************************************* 
// Function : BOOL fgIsLogoCaptureAllow(void) 
// Description : 
// Parameter : 
// Return    : None 
// ********************************************************************* 
BOOL fgIsLogoCaptureAllow(void) large 
{ 
  BYTE bPbcState; 
   
  // DVD-Audio? some special VCD? CD-G? 
  //if (fgIsNonPlay() || fgIsCddaPlay() || fgIsIsoPlay()) 
  if (fgIsNonPlay()) 
  { 
    return (FALSE); 
  } 
  else if (fgIsCddaPlay()) 
  { 
    if (bSharedInfo(SI_DISC_TYPE) != SV_CDG) 
    { 
      return (FALSE); 
    } 
  } 
 
  bPbcState = bSharedInfo(SI_PBC_STATE); 
 
  if (!fgIsDiscPlay(bPbcState)) 
  { 
    return (FALSE); 
  } 
 
  return (TRUE); 
} 
 
#endif /* SUPPORT_CAPTURE_LOGO */