PE_CD.c
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:46k
- /****************************************************************************************
- * Copyright (c) 2002 ZORAN Corporation, All Rights Reserved
- * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
- *
- * File: $Workfile: PE_CD.c $
- *
- * Description:
- * ============
- *
- *
- * Log:
- * ====
- * $Revision: 87 $
- * Last Modified by $Author: Leslie $ at $Modtime: 04-04-03 14:04 $
- ****************************************************************************************
- * Updates:
- ****************************************************************************************
- * $Log: /I76/I76_Common/I76_Reference/Playcore/Nav_CDDA/PE_CD.c $
- *
- * 87 04-04-03 14:05 Leslie
- * Improve for get drive MSF
- *
- * 86 04-04-02 10:18 Hansenw
- * fix type define
- *
- * 85 04-04-01 23:42 Leslie
- *
- * 84 04-04-01 23:37 Leslie
- * Alco mute SPDIF when call PE_CD_SetMute()
- *
- * 83 04-04-01 9:52 Hansenw
- * fix OSD flashes 00:00 at A-B (VCD)
- *
- * 82 04-04-01 9:42 Hansenw
- * fix type mis-match
- *
- * 81 04-03-30 20:49 Williaml
- * fix the bug 1. press key "fastf" fastly, then press key "play"; 2. It
- * may change to stop state automatically.
- *
- * 80 3/26/04 5:02p Aidenl
- * TF changes 2
- *
- * 79 04-03-24 19:50 Chaol
- * improve _getDecoderSubcodeQ
- *
- * 78 04-03-23 15:09 Leslie
- * Add CLIPS_MPEG_SUPPORT
- *
- * 77 04-03-18 16:23 Leonh
- * For CDDA tracks on SVCD/VCD discs, set the disc type as CDDA
- *
- * 76 04-03-17 11:41 Chaol
- * change PE_CD_GetCdDetectType, we always need to detect CDTS bitstream
- * in a CDDS disc
- *
- * 75 04-03-09 14:42 Fwang
- * Use CC-RAM mode for VCD
- *
- * 74 04-03-03 19:07 Fwang
- * Avoid black screen flashing if sequence header detection failed.
- *
- * 73 2/20/04 4:34p Leonh
- * not start stucktrigger for cdda on vcd
- *
- * 72 04-02-19 15:06 Chaol
- * change DEC_SET_MICROPHONE_ON_OFF
- *
- * 71 04-02-11 17:33 Fwang
- * Enable CPU scaling for DVD/VCD/SVCD.
- *
- * 70 2/05/04 8:40a Leslie
- * Fix MPEG Clip can't start problem
- *
- * 69 1/25/04 8:20 Nmaurer
- * Add drv_ prefix to Drive routines
- *
- * 68 12/30/03 10:24a Chaol
- * fix CDDTS detect
- *
- * 67 12/29/03 2:03p Chaol
- * add subcodeQ support
- *
- * 66 03-12-23 14:46 Fwang
- * Add parameter for scaling
- *
- * 65 12/22/03 4:29p Chaol
- * add function PE_CD_GetCdDetectType to support CDDTS
- *
- * 64 03-12-18 13:22 Fwang
- * modify scaling
- *
- * 63 12/09/03 7:03p Leslie
- * Call DEC_SetDiskType() in function PE_CD_AutoDetectVideoSetting()
- *
- * 62 12/07/03 8:53p Fwang
- * Change marco name for CPU scaling
- *
- * 61 11/28/03 7:24p Leslie
- * Re-Structure disk type setting for PE_CD_PlaySegment()
- *
- * 60 11/28/03 5:49p Fwang
- * Implement manual scaling and clean code.
- *
- * 59 11/24/03 6:24p Fwang
- * Set TV format right after auto detection.
- *
- * 58 11/19/03 11:40a Leslie
- * Add function PE_CD_AutoDetectAudioSetting(0 in order to detect SVCD
- * Audio Sampling Rate
- *
- * 57 11/15/03 7:10p Leslie
- * Replace old Video API Low Level Files with new ones
- *
- * 56 2/11/03 15:29 Rinata
- * PE_CD_UpdateAudioSPDIF - do nothing if ADP_DEMO_TEST is define
- *
- * 55 10/30/03 10:22a Chaol
- * update emphasis & category & SR in function PE_CD_UpdateAudioSPDIF.
- * need to add function HAL_SET_PRE_EMPHASIS()
- *
- * 54 9/29/03 11:56a Chaol
- * remove PS_SET_ANALOG_AUDIO_SETTING()
- *
- * 48 03-08-28 23:59 Leslie
- * Code cleanup
- *
- * 47 03-07-22 18:21 Kennyz
- * Unmute the DAC and amplifier output as enabling the switch :
- * HW_MUTE_FORCE_ON
- *
- * 46 03-07-22 17:08 Mikelv
- * support cdda de_emphasis
- *
- * 45 03-06-30 16:46 Leslie
- * Merge for Alco Step A code
- *
- * 44 03-06-20 13:51 Dingming
- * Roll back, wrong sequence
- *
- * 42 6/04/03 3:31p Clifflv
- * add mute for amplifier
- *
- * 41 03-05-29 11:34 Leslie
- * Add StuckTrigger
- *
- * 40 03-05-20 15:23 Leslie
- * For still picture presentation, use DATA_DUMP mode
- *
- * 39 03-05-19 13:41 Leslie
- * Add drive Play Mode
- * Code cleanup
- *
- * 38 03-04-25 15:53 Kennyz
- * Modified code for AIN function.
- *
- * 37 03-04-16 11:50 Jerryc
- * fix pbe 'logo flashs when playing vcd and decoder is adapting to the
- * encoded TV system.'
- *
- * 36 3/20/03 1:41p Lyncolnc
- * Problem: For CD-DTS, when a track is muted and 'Next' is pressed. The
- * next track will not be muted. This is NG.
- * Solution: Change the condition as shown.
- *
- * 35 3/20/03 10:15a Clifflv
- * Enable AIN for AVReceiver
- *
- * 34 03-03-18 16:17 Leslie
- *
- * 36 03-03-13 18:45 Dingming
- *
- * 35 03-03-13 17:05 Dingming
- * AIN implement
- *
- * 34 03-03-12 14:51 Dingming
- * AIN implement
- *
- * 33 2/26/03 9:46p Tomasp
- * Synchronization with ZCH database
- *
- * 32 2/21/03 7:17a Stephaneh
- * Added Reset subcode functions
- *
- * 31 2/10/03 1:10a Tomasp
- * Fixed external definition of g_bIsAuxModeOn.
- *
- * 30 2/07/03 10:47p Tomasp
- * - changed SW feature selection to compilation switch
- *
- * 29 03-02-06 11:16 Dingming
- * Bug fixing, wrong disc type setting
- *
- * 28 03-02-03 11:03 Dingming
- * comments out CDDA margin
- *
- * 27 1/23/03 4:27a Rinata
- * Change Dacs API name and add more Dacs support
- *
- * 26 1/18/03 6:10p Adamw
- * //temp fix the aux in mut problem
- * still need further check decoder api's mute sequence,
- * to correct to right sequence
- *
- * 25 03-01-18 16:03 Leslie
- * Force Unmute when Aux In Enabled
- *
- * 24 03-01-17 19:33 Leslie
- * AIN supported
- *
- * 23 03-01-16 14:33 Dingming
- * prologic II support
- *
- * 22 03-01-15 19:00 Dingming
- *
- * 21 03-01-15 18:49 Dingming
- * code clean up
- *
- * 20 03-01-14 18:13 Janeg
- *
- * 19 12/09/02 6:07p Leslie
- * Code cleanup
- *
- * 39 3/06/02 20:00 Nirm
- * - Fixed PE_CD_PausePlayback() to better support Pause during FF.
- *
- * 38 3/06/02 11:14 Nirm
- * - Code cleanup.
- *
- * 37 29/05/02 14:44 Nirm
- * - Added Subcode-Q streaming support;
- * - Code cleanup.
- *
- * 36 5/15/02 12:28p Dingming
- * fix the video-compression of svcd ,add a macro to enable it to full
- * screen
- *
- * 35 9/05/02 15:52 Ettim
- * Enabling the function PE_CD_MediaIdentification() although it is still
- * not being used by the media detection sequence.
- *
- * 34 4/30/02 17:11 Rinata
- * CGMS/WSS support
- *
- * 33 29/04/02 16:55 Nirm
- * - Code cleanup.
- *
- * 32 23/04/02 9:31 Nirm
- * - Added dependency in "Config.h".
- *
- * 31 21/04/02 10:48 Ettim
- * Disabling the function PE_CD_MediaIdentification()
- *
- * 30 16/04/02 15:23 Ettim
- * Integration with CDDTS. Work is still im progress.
- *
- * 29 4/14/02 15:16 Rinata
- * Support DTS, CDTS
- *
- * 28 31/03/02 23:17 Nirm
- * -Changes in the prototype of drv_get_msf().
- *
- * 27 3/26/02 18:27 Ettim
- * Removed unneccessary debug printing.
- *
- * 26 3/14/02 11:10 Ettim
- * Setting the drive to search mode in speed 1X before scanning AV streams
- * in PE_CD_SetScan().
- *
- * 25 3/13/02 9:31 Ettim
- * Reading the sequence header in case of random-access play.
- *
- * 24 3/11/02 17:43 Ettim
- * Sending PLAY command to the decoder before the PAUSE in
- * PE_CD_PausePlayback function (in case the decoder was on I-Frame mode)
- *
- * 23 3/10/02 17:30 Ettim
- * Added Motion Digest support.
- *
- * 22 4/03/02 20:49 Nirm
- * Integrated support for Full-Stop.
- *
- * 21 2/18/02 11:01 Ettim
- * Updated Audio SID setting for the channels C0 & C1
- *
- * 20 15/02/02 0:20 Nirm
- * - Temporarily disabled spindown of the drive.
- *
- * 19 31/01/02 16:33 Nirm
- * Addede Logo/Background support.
- *
- * 18 31/01/02 13:49 Nirm
- * Changed CVD support implementation.
- *
- * 17 30/01/02 21:04 Nirm
- * Compilation-Warnings removal.
- *
- * 15 1/21/02 17:46 Ettim
- * Adding the function PE_CD_VideoIsActive().
- *
- * 14 1/17/02 19:14 Ettim
- * Handling the CVD encryption
- *
- * 13 1/17/02 16:39 Ettim
- * removed the include for the stubs.h file
- *
- * 12 16/01/02 11:53 Atai
- * Change debug printing
- *
- * 11 1/13/02 18:18 Ettim
- *
- * 10 1/10/02 18:01 Ettim
- * Implementing the feature SVCD_USE_ABSOLUTE_TIME
- * Fixing the scan - corrected playback resumption from scanning
- *
- * 9 10/01/02 12:52 Nirm
- * Corrected PE_CD_GetDecoderCurrentLocationSCR().
- *
- * 8 9/01/02 15:43 Nirm
- * Corrected Include-Paths.
- *
- * 7 1/09/02 10:01 Ettim
- *
- * 6 1/08/02 17:54 Ettim
- * updating the function PE_CD_GetDecoderCurrentLocationPTS, nad renaming
- * it to PE_CD_GetDecoderCurrentLocationSCR
- *
- * 5 1/07/02 18:06 Ettim
- * Added new compilation switch CDDA_USE_ABSOLUTE_TIME - handles
- * navigation using the absolute time from the beginning of disc instead
- * of the relative time (from the beginning of the current track)
- *
- * 4 1/06/02 19:28 Ettim
- * A fully working version of nav_cdda
- *
- * 3 1/03/02 17:21 Ettim
- *
- * 2 12/31/01 18:09 Ettim
- *
- * 1 12/26/01 19:06 Ettim
- ****************************************************************************************/
- #include "Config.h" // Global Configuration - do not remove!
- #ifdef _DEBUG
- #undef IFTRACE
- #define IFTRACE if (gTracePe)
- #include "DebugDbgMain.h"
- #endif
- #include "IncludeSysDefs.h"
- #include "KernelEventDef.h"
- #include "Drivedrv_api.h"
- #include "DecoderDecoder.h"
- #include "Decoderlow_levelDEC_LL_Info.h"
- #include "Decoderlow_levelDEC_LL_API.h"
- #include "LogoLogo.h"
- #include "PlaycoreCoremaincoregdef.h"
- #include "PlaycoreNav_CDDApe_cd.h"
- #include "Customerdevicedacaudio_dac.h"
- #include "Decoderadp_api.h"
- #ifdef SUPPORT_FLASH_CARD
- #include "DriveFE_Manager.h"
- extern DWORD FlashCard_GetPlaybackSize(void);
- #endif
- extern BYTE g_audio_sid;
- typedef struct ScanPair_TAG {
- UINT16 play;
- UINT16 skip;
- } ScanPair;
- //Function prototypes
- #if AUX_IN_ENABLE
- extern UINT8 g_bIsAuxModeOn;
- #endif
- #ifdef CDDA_ERROR_RECOVERY
- #ifdef SDRAM_2X16MBITS
- #define CDDA_AUDIO_CODED_BUFFER_FULLNESS_THRESHOLD 8000 // 250K
- #else
- #define CDDA_AUDIO_CODED_BUFFER_FULLNESS_THRESHOLD 16000 // 500K
- #endif
- #endif
- static DWORD g_dwCurrentLocaionLBN = 0;
- ///////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_GetTracksCnt
- //
- // Purpose : Getting the number of tracks on the disc.
- //
- // Input Parameters : none
- //
- // Return Value : int
- //
- // Description : Retrieving it from the DRIVE_GLOBALS structure.
- ///////////////////////////////////////////////////////////////////////////////////
- int PE_CD_GetTracksCnt(void)
- {
- return gds.cd_number_of_tracks;
- }
- ///////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_GetTrackInfo
- //
- // Purpose : Retrienving the track information of a given track number.
- //
- // Input Parameters :
- // int iTrackNumber
- // Output Parameters:
- // TrackInfo *o_pInfo - will hold the appropriate track information
- //
- // Return Value : BOOL
- //
- // Description : Using the drive function in order to appraoch the track info.
- ///////////////////////////////////////////////////////////////////////////////////
- BOOL PE_CD_GetTrackInfo (int iTrackNumber, TrackInfo *o_pInfo)
- {
- WORD wDummy, wMin, wSec, wFrm;
- ULONG ulSize;
- drv_get_track_info((WORD)iTrackNumber, &wDummy, &wMin, &wSec, &wFrm, &ulSize);
- o_pInfo->dwStartAddress= drv_msf2lbn(wMin, wSec, wFrm);
- o_pInfo->ulBlocksCnt= ulSize;
- return TRUE;
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_GetTrackInfoEx
- //
- // Purpose : Retrienving the track information of a given track number
- // in the format of mm:ss:ff .
- //
- // Input Parameters :
- // int iTrackNumber
- // WORD *o_pMin
- // WORD *o_pSec
- // WORD *o_pFrm
- //
- // Return Value : BOOL
- //
- // Description : Using the drive function in order to appraoch the track info.
- //////////////////////////////////////////////////////////////////////////////////
- BOOL PE_CD_GetTrackInfoEx(int iTrackNumber, WORD *o_pMin, WORD *o_pSec, WORD *o_pFrm)
- {
- WORD wDummy;
- ULONG ulSize;
- drv_get_track_info((WORD)iTrackNumber, &wDummy, o_pMin, o_pSec, o_pFrm, &ulSize);
- return TRUE;
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_GetTrackTOC
- //
- // Purpose : Retrieving the table of content of a given track number.
- //
- // Input Parameters :
- // int iTrackNumber
- // Output Parameters:
- // BYTE *o_pCtrlField
- // DWORD *o_pStartAddr
- // ULONG *o_pSize
- //
- // Return Value : BOOL
- //
- // Description : Using the drive function in order to appraoch the disc.
- //////////////////////////////////////////////////////////////////////////////////
- BOOL PE_CD_GetTrackTOC(int iTrackNumber, BYTE *o_pCtrlField, DWORD *o_pStartAddr, ULONG *o_pSize)
- {
- unsigned short uCtrlAdr;
- WORD wMin, wSec, wFrm;
- drv_get_track_info((WORD)iTrackNumber, &uCtrlAdr, &wMin, &wSec, &wFrm, o_pSize);
- *o_pCtrlField= (BYTE)(uCtrlAdr >> 4);
- *o_pStartAddr= drv_msf2lbn(wMin, wSec, wFrm);
- return TRUE;
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_GetCDTEXTInfo
- //
- // Purpose : Getting the cd text according to a given track number.
- //
- // Input Parameters :
- // BYTE TrackNum
- //
- // Return Value : void*
- //
- // Description : Using the drive function in order to appraoch the disc.
- //////////////////////////////////////////////////////////////////////////////////
- void* PE_CD_GetCDTEXTInfo(BYTE TrackNum)
- {
- /*
- UINT32 ulStringAddress = 0;
- drv_get_cdtext_info(i_TrackNum, &ulStringAddress);
- return ((void*)ulStringAddress);
- */
- return NULL;
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_GetCurrentLocation
- //
- // Purpose : Retrieving the current location.
- //
- // Input Parameters : none
- //
- // Return Value : DWORD
- //
- // Description : Getting the mm:ss:ff format of the current location.
- //////////////////////////////////////////////////////////////////////////////////
- #ifdef SUPPORT_FLASH_CARD
- extern UINT32 Clips_GetCurrClipSize(void);
- extern UINT32 Clips_GetCurrClipSartAddr(void);
- #endif
- DWORD PE_CD_GetCurrentLocation(void)
- {
- UINT8 wMin, wSec, wFrm;
- #ifdef SUPPORT_FLASH_CARD
- if(IS_PLAYING_CARD)
- {
- DWORD dwPlaySize = FlashCard_GetPlaybackSize();
- if(0xfffffffful == dwPlaySize)
- return Clips_GetCurrClipSartAddr();
- else
- return (Clips_GetCurrClipSartAddr() + (Clips_GetCurrClipSize()>>11) - dwPlaySize);
- }
- #endif
-
- if ( drv_get_msf(&wMin, &wSec, &wFrm) ){
- g_dwCurrentLocaionLBN = drv_msf2lbn(wMin, wSec, wFrm);
- }
- return g_dwCurrentLocaionLBN;
- }
- //#ifdef SUBCODEQ_STREAMING_SUPPORT
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : _getDecoderSubcodeQ
- //
- // Purpose : Reading the sub code Q.
- //
- // Input Parameters :
- // BYTE o_aSubcodeQ[12]
- //
- // Return Value : BOOL
- //
- // Description :
- //////////////////////////////////////////////////////////////////////////////////
- #define MAX_SUBCODEQ_RETRIES 50
- BOOL _getDecoderSubcodeQ(BYTE o_aSubcodeQ[12])
- {
- UINT8 uRetryCnt;
- for(uRetryCnt=0x0;uRetryCnt < MAX_SUBCODEQ_RETRIES; uRetryCnt++)
- {
- if(DEC_GetSubcodeQ(o_aSubcodeQ))
- {
- if (0x01 == (o_aSubcodeQ[0] & 0x0F))
- return TRUE;
- }
- }
-
- return FALSE;
- }
- BOOL _resetDecoderSubcodeQ(void)
- {
- return DEC_ResetSubcodeQ();
- }
- // ZCO SH021903 >>>
- //#endif //SUBCODEQ_STREAMING_SUPPORT
- // <<< ZCO SH021903:Added to reset subcode when full stop
- BOOL PE_CD_ResetDecoderCurrentLocationMSF(void)
- {
- return _resetDecoderSubcodeQ();
- }
- // ZCO SH021903 >>>
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_GetDecoderCurrentLocationMSF
- //
- // Purpose : Retrieving the current location
- //
- // Input Parameters :
- // enLocationType eType
- // UINT32 *o_pMinute
- // UINT32 *o_pSecond
- // UINT32 *o_pFrame
- // int *o_pRelativeSign
- //
- // Return Value : BOOL
- //
- // Description :
- //////////////////////////////////////////////////////////////////////////////////
- BOOL PE_CD_GetDecoderCurrentLocationMSF(enLocationType eType,
- UINT8 *o_pMinute,
- UINT8 *o_pSecond,
- UINT8 *o_pFrame,
- int *o_pRelativeSign)
- {
- BYTE aSubcodeQ[12];
- #ifdef SUBCODEQ_STREAMING_SUPPORT
- if (! _getDecoderSubcodeQ(aSubcodeQ))
- return FALSE;
- #else
- if (!drv_get_subcodeQ(aSubcodeQ))
- return FALSE;
- #endif //SUBCODEQ_STREAMING_SUPPORT
- if (eRelativeLocation == eType) {
- // Extract the Relative MSF (including index information)
- BYTE ucIndex= drv_bcd2bin(aSubcodeQ[2]);
- // Determine the Sign of the Current-Location, according to whether or not this is
- // a Pause-Index.
- if (0 == ucIndex)
- *o_pRelativeSign= -1;
- else
- *o_pRelativeSign= 1;
- // Extract the Relative MSF
- *o_pMinute= drv_bcd2bin(aSubcodeQ[3]);
- *o_pSecond= drv_bcd2bin(aSubcodeQ[4]);
- *o_pFrame= drv_bcd2bin(aSubcodeQ[5]);
- }
- else if (eAbsoluteLocation == eType) {
- // Extract the Absolute MSF
- *o_pMinute= drv_bcd2bin(aSubcodeQ[7]);
- *o_pSecond= drv_bcd2bin(aSubcodeQ[8]);
- *o_pFrame= drv_bcd2bin(aSubcodeQ[9]);
- }
- else {
- dbg_printf(("Unknown Location-Type: %xn", eType));
- }
- dbg_printf(("Current Location (%s): %02d:%02d:%02dn",
- ((eAbsoluteLocation == eType) ? "Absolute" : "Relative"),
- *o_pMinute, *o_pSecond, *o_pFrame));
- return TRUE;
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_GetDecoderCurrentLocationLBN
- //
- // Purpose : Getting the current location in the LBN format.
- //
- // Input Parameters : none
- //
- // Return Value : DWORD
- //
- // Description : Using the function PE_CD_GetDecoderCurrentLocationMSF in
- // order to get the location in the MSF format, and then
- // just transforming it to LBN format.
- //////////////////////////////////////////////////////////////////////////////////
- DWORD PE_CD_GetDecoderCurrentLocationLBN(void)
- {
- UINT8 uMinute, uSecond, uFrame;
- if (PE_CD_GetDecoderCurrentLocationMSF(eAbsoluteLocation, &uMinute, &uSecond, &uFrame, NULL))
- return drv_msf2lbn(uMinute,uSecond, uFrame);
- return PE_CD_GetCurrentLocation();
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_GetDecoderCurrentLocationSCR
- //
- // Purpose : Getting the current location in terms of SCR.
- //
- // Output Parameters:
- // UINT32 *o_pSCR
- //
- // Return Value : BOOL
- //
- // Description :
- //////////////////////////////////////////////////////////////////////////////////
- BOOL PE_CD_GetDecoderCurrentLocationSCR(UINT32 *o_pSCR)
- {
- return DEC_get_current_SCR(o_pSCR);
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_GetDecoderCurrentTrackInfo
- //
- // Purpose : Getting the current track info.
- //
- // Output Parameters :
- // BYTE *o_pCtrl
- // BYTE *o_pTrackNumber
- //
- // Return Value : BOOL
- //
- // Description : Reading the current track info from the Subcode-Q
- //////////////////////////////////////////////////////////////////////////////////
- BOOL PE_CD_GetDecoderCurrentTrackInfo(BYTE *o_pCtrl, BYTE *o_pTrackNumber)
- {
- BYTE aSubcodeQ[12];
- #ifdef SUBCODEQ_STREAMING_SUPPORT
- if (! _getDecoderSubcodeQ(aSubcodeQ))
- return FALSE;
- #else
- if (! drv_get_subcodeQ(aSubcodeQ))
- return FALSE;
- #endif //SUBCODEQ_STREAMING_SUPPORT
- *o_pCtrl= (aSubcodeQ[0] >> 4);
- *o_pTrackNumber= drv_bcd2bin(aSubcodeQ[1]);
- return TRUE;
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_SelectAudioStream
- //
- // Purpose : Setting the audio stream according to the given audio type.
- //
- // Input Parameters :
- // AudioSID iAudioSID
- //
- // Return Value : void
- //
- // Description : Using the decoder function in order to set the audio type.
- //////////////////////////////////////////////////////////////////////////////////
- void PE_CD_SelectAudioStream(AudioSID iAudioSID)
- {
- DEC_SetSID(DEC_SID_TYPE_AUDIO, (BYTE)iAudioSID);
-
- return;
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_UpdateAudioSPDIF
- //
- // Purpose : Updating the digital information of the SPDIF
- //
- // Input Parameters : none
- //
- // Return Value : void
- //
- // Description :
- //////////////////////////////////////////////////////////////////////////////////
- void PE_CD_UpdateAudioSPDIF(void)
- {
- UINT32 emphasis;
- #ifndef ADP_DEMO_TEST
- // Configure the Copy-protection bit
- API_ADP_Set_SPDIF_Chnl_Status(SET_COPYRIGHT_INDICATION, AS_GetSPDIF_Chnl_Status_Setting(SET_COPYRIGHT_INDICATION),NOT_SEND_TO_ADP);
- // Configure the Pre-Emphasis field
- emphasis = AS_GetSPDIF_Chnl_Status_Setting(SET_PRE_EMPHASIS);
- API_ADP_Set_SPDIF_Chnl_Status(SET_PRE_EMPHASIS, emphasis , NOT_SEND_TO_ADP);
-
- //I76 TODO:need to add it.
- //HAL_SET_PRE_EMPHASIS(emphasis);
-
- // Configure the Category field
- API_ADP_Set_SPDIF_Chnl_Status(SET_CATEGORY_CODE, AS_GetSPDIF_Chnl_Status_Setting(SET_CATEGORY_CODE), NOT_SEND_TO_ADP);
- #ifdef EXINO2 //ZMR ML0429 Digital out L_BIT_SET
- API_ADP_Set_SPDIF_Chnl_Status(SET_L_BIT, AS_GetSPDIF_Chnl_Status_Setting(SET_L_BIT), NOT_SEND_TO_ADP);
- #endif
- // Configure the Output Sampling-Rate field
- API_ADP_Set_SPDIF_Chnl_Status(SET_AUDIO_SAMPLE_RATE, AS_GetSPDIF_Chnl_Status_Setting(SET_AUDIO_SAMPLE_RATE), SEND_TO_ADP);
- #endif // ADP_DEMO_TEST
- return;
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_SetMute
- //
- // Purpose :
- //
- // Input Parameters :
- // BOOL bEnable - an indication whether or not to mute the output as well.
- //
- // Return Value : void
- //
- // Description : Sending the request to the ADP and the SPDIF
- //////////////////////////////////////////////////////////////////////////////////
- void PE_CD_SetMute(BOOL bEnable)
- {
- DEC_MuteOutput(MUTE_CORE_REQUEST, bEnable);
- DEC_MuteSPDIF(MUTE_CORE_REQUEST, bEnable);
- return;
- }
- //<<<Leslie_0828_2003_B: Code cleanup
- #if 0
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_ConfigureTVSystem
- //
- // Purpose :
- //
- // Input Parameters : none
- //
- // Return Value : void
- //
- // Description :
- //////////////////////////////////////////////////////////////////////////////////
- void PE_CD_ConfigureTVSystem(void)
- {
- /* EttiM - 25/11/2001
- static OUTPUT_VIDEO_STANDARD ovsCurrSystem= VIDEO_STANDARD_MULTI;
- OUTPUT_VIDEO_STANDARD ovsTvSystem;
- ovsTvSystem= I54_API_GetCodedVideoStandard();
- if (ovsTvSystem != ovsCurrSystem) {
- DEC_UpdateActual_tv_std(((VIDEO_STANDARD_NTSC == ovsTvSystem) ? 0 : 1), DEC_DISC_TYPE_VCD);
- ovsCurrSystem= ovsTvSystem;
- }
- */
- return;
- }
- #endif
- //Leslie_0828_2003_B>>>
- /**************************************************************************
- *
- * Function : PE_CD_AutoDetectVideoSetting
- *
- * In : cVideoSID = the video Stream ID to be set
- * dwStartAddress = the start addr to start playing to get the Video info
- * ulMaxBlocksCnt : Max nbr of block to be read
- * Out : void
- *
- * Return : TRUE if video scaling has been set properly, FALSE otherwise
- *
- * Desc : Use the Vaddis to get the Video size info needed for scaling
- * See Release notes 13.XX - Section 29 "Random access for special VCD Stream".
- *
- ***************************************************************************/
- BOOL PE_CD_AutoDetectVideoSetting(VideoSID cVideoSID, DWORD dwStartAddress,
- ULONG ulMaxBlocksCnt)
- {
- BOOL cReturn = TRUE;
- DEC_LL_DECODED_FRAME_RATE std;
- UINT32 uRetry=0;
- // Set Video Stream ID
- DEC_SetSID(DEC_SID_TYPE_VIDEO, (BYTE)cVideoSID);
- // Set Audio Stream ID for No Audio Stream
- DEC_SetSID(DEC_SID_TYPE_AUDIO, (BYTE)NoAudio);
- if (SI_IS_CURRENT_MPEG_CLIP)
- DEC_SetDiskType(DEC_DISC_TYPE_MPEG);
- else if (g_disc_type == DEC_DISC_TYPE_SVCD)
- DEC_SetDiskType(DEC_DISC_TYPE_SVCD);
- else
- DEC_SetDiskType(DEC_DISC_TYPE_VCD);
-
- DEC_prepare_to_decode();
- // Set Vaddis for playing Seq Header and start playing seq header
- DEC_OnSequenceHeaderPlay();
- // Start the drive to read this seq
- PE_Clips_SetPlaybackRange(dwStartAddress, ulMaxBlocksCnt, UNLIMITED_FILE_SIZE);
- if (IS_DVD_MEDIA)
- drv_play_dvd(dwStartAddress, ulMaxBlocksCnt, DRVF_PLAY_DVD_AV_DATA);
- else
- drv_play_cd_logical(DRVCF_CDSPEED_MAX | DRVF_PLAY_CD_DUMP_DATA, dwStartAddress, ulMaxBlocksCnt);
- if (!drv_is_playing())
- {
- dbg_printf(("PE_CD_AutoDetectVideoSetting, Drvier is not playing, waiting........n"));
- while (1)
- {
- if (drv_is_playing())
- {
- dbg_printf(("Success while waiting for driver spindle up, Waiting time = %x msn",uRetry));
- break;
- }
- else
- {
- usleep(1000UL);
- }
- uRetry++;
- if (uRetry>10000) // 10s
- {
- dbg_printf(("Time out 10s while waiting for driver spindle upn"));
- break;
- }
- }
- }
- // Wait for the Vaddis to be in idle mode (finish reading seq header)
- if (! DEC_WaitForScalingCompletion())
- {
- tr_printf(("W_PE_CD_ADVideoSet - Cannot find seq headern"));
- cReturn = FALSE;
- }
- #ifndef V882_FLASH_CARD
- #ifdef SUPPORT_FLASH_CARD
- if(IS_PLAYING_CARD)
- {
- while(FALSE == drv_is_play_done());
- }
- #endif
- #endif //V882_FLASH_CARD
- drv_abort_play();
- DEC_PlaybackCommand(DEC_PLAYBACK_CMD_STOP, 0);
- usleep(25000UL); //Wait for one field period to make sure CPU received DVP message about video format
- // Configure the approriate TV-Standard, according to the Video-settings just detected
- if (cReturn)
- {
- /*!!!Following sequence is imporatant to avoid video artifact during TV format conversion */
-
- //Get information of new video clip
- DEC_LL_GetCodedVideoStandard( &std );
- //Change display video format according to displaying picture information
- DEC_set_display_video_format( std );
- #ifdef SVCD_SCALING_BY_CPU
- DEC_EnableManualScaling(PROG_SCALER_MODE_CCRAM);
- #else
- DEC_DisableManualScaling();
- #endif
- }
- return cReturn;
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_DisableCGMSData
- //
- // Purpose : Disabling the CGMS and the Microvision
- //
- // Input Parameters : none
- //
- // Return Value : void
- //
- // Description :
- //////////////////////////////////////////////////////////////////////////////////
- void PE_CD_DisableCGMSData(void)
- {
- DEC_on_set_macrovision_mode(0); //set MV off
- DEC_Set_CGMS(0, 0xff, 0, 0); //set CGMS=0
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_PlaySegment
- //
- // Purpose : Playing a given segment.
- //
- // Input Parameters :
- // VideoSID eVideoSID
- // AudioSID eAudioSID
- // DWORD dwStartAddress
- // ULONG ulBlocksCnt
- // enPlaybackType ePBType
- // ULONG ulParam
- //
- // Return Value : BOOL
- //
- // Description :
- //////////////////////////////////////////////////////////////////////////////////
- BOOL PE_CD_PlaySegment(VideoSID eVideoSID, AudioSID eAudioSID, DWORD dwStartAddress,
- ULONG ulBlocksCnt, enPlaybackType ePBType, ULONG ulParam)
- {
- WORD wDriveMode;
- DEC_PLAYBACK_CMD pbCommand = DEC_PLAYBACK_CMD_PLAY;
- dbg_printf(("PE_CD_PlaySegment(Video= %02x, Audio= %02x, StartAddress= 0x%08lx, BlocksCnt= %ul, PlaybackType= %02x)n",
- eVideoSID, eAudioSID, dwStartAddress, ulBlocksCnt, ePBType));
- #ifdef SVCD_SCALING_BY_CPU
- DEC_EnableManualScaling(PROG_SCALER_MODE_CCRAM);
- DEC_set_Display_AspectRatio(gps->tv_shape);
- if (VIEW_MODE_ORIGINAL == gps->view_mode)
- DEC_SetViewMode(VIEW_MODE_FILL);
- else
- DEC_SetViewMode(gps->view_mode);
- //Set information of new video clip for playback
- DEC_set_coded_AR_sourceNav( TRUE );
- DEC_set_coded_AspectRatio(DEC_LL_DECODED_ASPECT_RATIO_4X3); //VCD/SVCD containes only 4:3 picture
- #else
- DEC_DisableManualScaling();
- #endif
- switch (g_disc_type)
- {
- //Leon.He_0318_04:: For CDDA tracks on SVCD/VCD discs, set the disc type as CDDA
- case DEC_DISC_TYPE_VCD:
- if( eAudioSID!= CDDA_SID && eAudioSID!= CDDTS_SID)
- {
- DEC_SetDiskType(DEC_DISC_TYPE_VCD);
- break;
- }
- //fall through
- case DEC_DISC_TYPE_SVCD:
- if( eAudioSID!= CDDA_SID && eAudioSID!= CDDTS_SID)
- {
- DEC_SetDiskType(DEC_DISC_TYPE_SVCD);
- break;
- }
- //fall through
- case DEC_DISC_TYPE_CDDA:
- DEC_ResetSubcodeQ();
- DEC_SetDiskType(DEC_DISC_TYPE_CDDA);
- break;
- }
-
- DEC_prepare_to_decode();
- DEC_SetSID(DEC_SID_TYPE_VIDEO, (BYTE)eVideoSID);
- if ((eScan == ePBType) && (CDDA_SID != eAudioSID) && (CDDTS_SID != eAudioSID))
- {
- DEC_SetSID(DEC_SID_TYPE_AUDIO, (BYTE)0x00);
- DEC_SetCDScan(TRUE);
- DEC_LL_SyncMode(DEC_LL_SYNC_MODE_NO_SYNC);
- }
- else
- {
- DEC_SetSID(DEC_SID_TYPE_AUDIO, (BYTE)eAudioSID);
- DEC_SetCDScan(FALSE);
- DEC_LL_SyncMode(DEF_VIDEO_SYNC);
- }
- if (eAudioSID == CDDA_SID || eAudioSID == CDDTS_SID || CDDETECT_SID == eAudioSID )
- {
- wDriveMode = DRVCF_CDSPEED_1X;
- }
- else
- wDriveMode = DRVCF_CDSPEED_MAX;
- //LX051703: Add AV Data mode for Play CD
- if ( ( STILL_HIRES == eVideoSID ) || ( STILL_LOWRES == eVideoSID ) )
- wDriveMode |= DRVF_PLAY_CD_DUMP_DATA;
- else
- wDriveMode |= DRVF_PLAY_CD_AV_DATA;
-
- // Inform the Decoder of the Playback-Range
- DEC_CD_SetPlaybackRange(dwStartAddress, ulBlocksCnt, UNLIMITED_FILE_SIZE);
- if (! drv_play_cd_logical(wDriveMode, dwStartAddress, ulBlocksCnt))
- return FALSE;
-
- switch (ePBType)
- {
- case eSearch: // Fall-Through!
- case eNormalSpeed:
- pbCommand= DEC_PLAYBACK_CMD_PLAY;
- break;
- case eScan:
- pbCommand= DEC_PLAYBACK_CMD_REF_FRAME_ONLY;
- break;
- case eSlowMotion:
- pbCommand= DEC_PLAYBACK_CMD_SLOW;
- break;
- default:
- dbg_printf(("Unknown Playback-Type: %xn", ePBType));
- break;
- }
- DEC_PlaybackCommand(pbCommand, (DWORD)ulParam);
- if ((eAudioSID == CDDTS_SID) && (gtps.mMute == MUTE_SETTING_OFF)) //ZCO LC032003
- ie_send_ex(IE_CORE_UPDATE_PS, (void *)((((DWORD)PS_UPDATE_VOLUME_SETTING)<<16) + gps->volume));
- #ifdef WATCHDOG_TRIGGERED_BY_FE
- if ((eAudioSID == CDDA_SID) || (IsSegmentPlay() && (eVideoSID != MPEG_2) )){
- PE_CD_CancelNotification( StuckTrigger );
- }else{
- PE_CD_RequestNotification( StuckTrigger );
- }
- #endif
- return TRUE;
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_PausePlayback
- //
- // Purpose : Performing the pause request.
- //
- // Input Parameters :
- // BOOL bEnable - perform pause or resume indication.
- // AudioSID eAudioSID - the current audio sid
- //
- // Return Value : void
- //
- // Description : Performing the pause operation with the option to stay on a
- // stand-by mode.
- //////////////////////////////////////////////////////////////////////////////////
- void PE_CD_PausePlayback(BOOL bEnable, AudioSID eAudioSID)
- {
- if (bEnable) {
- //since the decoder waits for the next I-Frame, it will ignore the PAUSE command.
- //So we first switch it back to PLAY and then send the PAUSE command.
- DEC_PlaybackCommand(DEC_PLAYBACK_CMD_PAUSE, 0);
- }
- else
- DEC_PlaybackCommand(DEC_PLAYBACK_CMD_RESUME, 0);
- return;
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_Step
- //
- // Purpose :
- //
- // Input Parameters : none
- //
- // Return Value : void
- //
- // Description :
- //////////////////////////////////////////////////////////////////////////////////
- void PE_CD_Step(void)
- {
- DEC_PlaybackCommand(DEC_PLAYBACK_CMD_STEP, NULL);
- return;
- }
- void PE_CD_AbortPlayback(BOOL bRemainInStandby)
- {
- drv_abort_play();
- DEC_PlaybackCommand(DEC_PLAYBACK_CMD_STOP, 0);
- if (! bRemainInStandby)
- drv_spindown();
- return;
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_AbortPlaybackEx
- //
- // Purpose : Aborting the current playback.
- //
- // Input Parameters : none
- //
- // Return Value : void
- //
- // Description : Stopping the playback but always remaining in a standby mode
- //////////////////////////////////////////////////////////////////////////////////
- void PE_CD_AbortPlaybackEx(void)
- {
- //The decoder must be stopped before the drive so the I Frame will be displayed.
- DEC_PlaybackCommand(DEC_PLAYBACK_CMD_STOP, 0);
- drv_abort_play();
- return;
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_IsPlaybackFinished
- //
- // Purpose : Getting the indication whether the playback is finished or not.
- //
- // Input Parameters : none
- //
- // Return Value : BOOL
- //
- // Description : Checking all the conditions that show the playback is
- // actually finished.
- //////////////////////////////////////////////////////////////////////////////////
- BOOL PE_CD_IsPlaybackFinished(void)
- {
- if (drv_is_play_done() && DEC_IsPlaybackFinished(FALSE))
- return TRUE;
- return FALSE;
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_RequestNotification
- //
- // Purpose :
- //
- // Input Parameters :
- // NotificationType eType
- //
- // Return Value : void
- //
- // Description :
- //////////////////////////////////////////////////////////////////////////////////
- void PE_CD_RequestNotification(NotificationType eType)
- {
- switch (eType)
- {
- case TriggerBit:
- DEC_NotificationRequest(DECN_TRIGGER_BIT);
- break;
- case IFrame:
- DEC_NotificationRequest(DECN_I_FRAME);
- break;
- case StuckTrigger:
- DEC_Reset_PicDecoding_Stuck_Counter();
- DEC_NotificationRequest(DECN_STUCK_CONDITION);
- break;
- }
- return;
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_CancelNotification
- //
- // Purpose :
- //
- // Input Parameters :
- // NotificationType eType
- //
- // Return Value : void
- //
- // Description :
- //////////////////////////////////////////////////////////////////////////////////
- void PE_CD_CancelNotification(NotificationType eType)
- {
- switch (eType)
- {
- case TriggerBit:
- DEC_NotificationClear(DECN_TRIGGER_BIT);
- break;
- case IFrame:
- DEC_NotificationClear(DECN_I_FRAME);
- break;
- }
-
- return;
- }
- void PE_CD_DisplayLogo(void)
- {
- #ifndef EXTERNAL_LOGO_SOURCE_SETTING
- Logo_selectSource(eStartup);
- #endif //EXTERNAL_LOGO_SOURCE_SETTING
- Logo_display();
- return;
- }
- void PE_CD_DisplayBackground(BOOL bEnable)
- {
- #ifndef EXTERNAL_LOGO_SOURCE_SETTING
- Logo_selectSource(eBackground);
- #endif //EXTERNAL_LOGO_SOURCE_SETTING
- if (bEnable)
- Logo_display();
- else
- Logo_clear();
- return;
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_SetScan
- //
- // Purpose : Switching to scan mode.
- //
- // Input Parameters :
- // BOOL bEnable
- // AudioSID eAudioType
- // int iScanSpeed
- //
- // Return Value : void
- //
- // Description : Setting the approrpiate drive mode according to the given
- // sacn speed, and sending it forward to the drive.
- //////////////////////////////////////////////////////////////////////////////////
- void PE_CD_SetScan(BOOL bEnable, AudioSID eAudioType, int iScanSpeed)
- {
- // Take care of non-AV streams (CDDA, CDDTS, etc.)
- if ((CDDA_SID == eAudioType) || (CDDTS_SID == eAudioType)) {
- UINT8 ucDriveMode;
- UINT16 uAbsoluteSpeed= abs(iScanSpeed);
- if (bEnable && (0 != iScanSpeed)) {
- if ((uAbsoluteSpeed >= 1) && (uAbsoluteSpeed <= 2))
- ucDriveMode= DRVCF_SEARCHSPEED_2X;
- else if ((uAbsoluteSpeed >= 3) && (uAbsoluteSpeed <= 4))
- ucDriveMode= DRVCF_SEARCHSPEED_4X;
- else
- ucDriveMode= DRVCF_SEARCHSPEED_10X;
- }
- else
- ucDriveMode= DRVCF_SEARCHSPEED_1X;
- if (iScanSpeed < 0)
- ucDriveMode |= DRVCF_SEARCH_BW;
- drv_set_cdda_search_mode(ucDriveMode);
- return;
- }
- drv_set_cdda_search_mode(DRVCF_SEARCHSPEED_1X);
- //Stopping the decoder first in order to force synchroniation of the Audio and
- //the Video before the play
- DEC_PlaybackCommand(DEC_PLAYBACK_CMD_STOP, 0);
- DEC_SetCDScan(bEnable);
- // Take care of AV streams
- if (bEnable)
- {
- // When scanning, turn-off Audio, to prevent A/V Sync. interferance
- DEC_SetSID(DEC_SID_TYPE_AUDIO, NoAudio);
- DEC_LL_SyncMode(DEC_LL_SYNC_MODE_NO_SYNC);
- DEC_PlaybackCommand(DEC_PLAYBACK_CMD_REF_FRAME_ONLY, 0);
- }
- else
- {
- // When cancelling a Scan, re-establish the appropriate Audio-SID
- DEC_SetSID(DEC_SID_TYPE_AUDIO, eAudioType);
- DEC_LL_SyncMode(DEF_VIDEO_SYNC);
- DEC_PlaybackCommand(DEC_PLAYBACK_CMD_PLAY, 0);
- }
- return;
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_SetSlowMotion
- //
- // Purpose : Setting the playback to a slow motion mode.
- //
- // Input Parameters :
- // BOOL bEnable
- // UINT8 uSlowSpeed
- //
- // Return Value : void
- //
- // Description :
- //////////////////////////////////////////////////////////////////////////////////
- void PE_CD_SetSlowMotion(BOOL bEnable, UINT8 uSlowSpeed)
- {
- if (bEnable && (0 != uSlowSpeed))
- DEC_PlaybackCommand(DEC_PLAYBACK_CMD_SLOW, (DWORD)uSlowSpeed);
- else
- DEC_PlaybackCommand(DEC_PLAYBACK_CMD_PLAY, 0);
- return;
- }
- #ifdef CVD_ENABLED
- ////////////////////////////////////////////////////////////////////////////
- // Function Name:
- // PE_CD_EnableCVDDecryption
- //
- // Purpose: Enables reading a CVD encrypted disc.
- //
- // Input Parameters:
- // BOOL bEnable - detrmines whether to enable decryption, or not
- // DWORD i_dwEncryptionInfoAddr - encryption address
- // DWORD i_dwEncryptionInfoSize - encryption info size
- //
- // Return Value:
- // BOOL - an indication whether the operation was successful or not.
- //
- // Description:
- // Reading the encrypted data and decoding it.
- /////////////////////////////////////////////////////////////////////////////
- BOOL PE_CD_EnableCVDDecryption(BOOL bEnable, DWORD i_dwEncryptionInfoAddr,
- DWORD i_dwEncryptionInfoSize)
- {
- if (bEnable) {
- if (! DEC_CVD_ProcessDiskID(i_dwEncryptionInfoAddr, i_dwEncryptionInfoSize))
- return FALSE;
- }
- DEC_CVD_EnableDecryption(bEnable);
- return TRUE;
- }
- #endif // CVD_ENABLED
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_VideoIsActive
- //
- // Purpose : Getting an indication whether the decoder already displayed
- // some video data.
- //
- // Input Parameters : none
- //
- // Return Value : BOOL - FALSE in case nothing is currently displayed by the video.
- //
- // Description : Checking the state of the decoder whether it is idle or
- // it has no video to display.
- //////////////////////////////////////////////////////////////////////////////////
- BOOL PE_CD_VideoIsActive(void)
- {
- return DEC_IsVideoActive();
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_StreamPortion
- //
- // Purpose : Playing a given unit of stream.
- //
- // Input Parameters :
- // DWORD dwAddress
- // ULONG uSize
- //
- // Return Value : void
- //
- // Description : approaching the drive andplaying the given stream.
- //////////////////////////////////////////////////////////////////////////////////
- void PE_CD_StreamPortion(DWORD dwAddress, ULONG uSize)
- {
- //LX051703: Add AV Data mode for Play CD
- drv_play_cd_logical(DRVCF_CDSPEED_MAX | DRVF_PLAY_CD_AV_DATA, dwAddress, uSize);
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_ADP_isSyncPointEstablished
- //
- // Purpose : Getting the indication from the ADP has a sync point for
- // CDDTS stream been established.
- //
- // Input Parameters : none
- //
- // Return Value : BOOL - TRUE in case a sync point was established, FALSE otherwise.
- //
- // Description : Checking the DTS status reply of the ADP - if the ADP is on running
- // mode and input underflow is not occurring.
- //////////////////////////////////////////////////////////////////////////////////
- BOOL PE_CD_ADP_isSyncPointEstablished(void)
- {
- return DEC_ADP_isSyncPointEstablished();
- }
- //////////////////////////////////////////////////////////////////////////////////
- // Function name : PE_CD_ADP_isStreamValid
- //
- // Purpose : Checking if the current played stream is a valid CDDTS stream.
- //
- // Input Parameters : none
- //
- // Return Value : BOOL
- //
- // Description : Getting the ADP status and checking that both the global status
- // and the DTS decode status report no errors.
- //////////////////////////////////////////////////////////////////////////////////
- BOOL PE_CD_isAudioStreamValid(void)
- {
- return DEC_ADP_isStreamValid();
- }
- //SeanLiu_0902_2004
- #ifdef AUDIO_IN_SUPPORT
- void PE_CD_AUDIO_IN_MODE(AUDIO_IN_MODE_SETTING audio_in_mode)
- {
- switch(audio_in_mode)
- {
- case AUDIO_IN_MODE_ANALOG :
- // if ((MP3_SID == g_audio_sid) || (WMA_SID == g_audio_sid) || (NoAudio == g_audio_sid)) //add by wl111104
- DEC_SetSID(DEC_SID_TYPE_AUDIO, CDDA_SID); //add by wl111104
- DEC_SetDiskType(DEC_DISC_TYPE_AIN);
- DEC_PlaybackCommand(DEC_PLAYBACK_CMD_PLAY, NULL);
- DEC_PlaybackCommand(DEC_PLAYBACK_CMD_STOP, NULL);
- ADP_GlobalPlay();
-
- DEC_SetSID(DEC_SID_TYPE_VIDEO, NoVideo);
- DEC_SetSID(DEC_SID_TYPE_AUDIO, ANALOG_IN_SID);
- DEC_MuteOutput(MUTE_CORE_REQUEST, MUTE_SETTING_OFF);
- DEC_MuteSPDIF(MUTE_CORE_REQUEST, MUTE_SETTING_OFF);
-
- break;
- case AUDIO_IN_MODE_COAXIAL :
- case AUDIO_IN_MODE_OPTICAL :
- #ifdef D_ENABLE_SPDIF_IN_PORT
- if(AUDIO_IN_MODE_OPTICAL == audio_in_mode)
- {
- IO_Select_SPDIFIN_Pin(FALSE);
- }
- else
- {
- IO_Select_SPDIFIN_Pin(TRUE);
- }
- #endif
- DEC_SetDiskType(DEC_DISC_TYPE_AIN);
- DEC_PlaybackCommand(DEC_PLAYBACK_CMD_PLAY, NULL);
- DEC_PlaybackCommand(DEC_PLAYBACK_CMD_STOP, NULL);
- ADP_GlobalPlay();
-
- DEC_SetSID(DEC_SID_TYPE_VIDEO, NoVideo);
- DEC_SetSID(DEC_SID_TYPE_AUDIO, DIGITAL_IN_SID);
- DEC_MuteOutput(MUTE_CORE_REQUEST, MUTE_SETTING_OFF);
- DEC_MuteSPDIF(MUTE_CORE_REQUEST, MUTE_SETTING_OFF);
- break;
- default :
- DEC_SetSID(DEC_SID_TYPE_VIDEO, NoVideo);
- DEC_SetSID(DEC_SID_TYPE_AUDIO, NoAudio);
- }
- }
- void PE_CD_SelectAINMode(void)
- {
- /*
- BYTE bAinMode = gps->ain_mode;
- switch (bAinMode)
- {
- case M_Mode_OFF:
- PS_SET_ANALOG_AUDIO_SETTING(AUDIO_STREAM_PCM,ANALOG_AUDIO_2CH);
- PE_CD_AIN_Play(0);
- PE_CD_AIN_Play(1);
- break;
-
- case M_Mode_Prologic_EMU:
- PS_SET_ANALOG_AUDIO_SETTING(AUDIO_STREAM_PCM,ANALOG_AUDIO_6CH);
- PE_CD_AIN_Play(0);
- PE_CD_AIN_Play(1);
- break;
-
- default:
- break;
- }
- */
- }
- void PE_CD_SelectAINChannelMode(void)
- {
- /*
- BYTE bAinMode = gps->ain_mode;
- switch (bAinMode)
- {
- case M_Mode_OFF:
- PS_SET_ANALOG_AUDIO_SETTING(AUDIO_STREAM_PCM,ANALOG_AUDIO_2CH);
- break;
- case M_Mode_Prologic_EMU:
- PS_SET_ANALOG_AUDIO_SETTING(AUDIO_STREAM_PCM,ANALOG_AUDIO_6CH);
- break;
- default:
- PS_SET_ANALOG_AUDIO_SETTING(AUDIO_STREAM_PCM,ANALOG_AUDIO_6CH);
- }
- */
- }
- #endif //AUDIO_IN_SUPPORT
- //<<<SeanLiu_0902_2004
- #ifdef CDDA_DEEMPHASIS_ENABLE
- /**************************************************************************
- *
- * Function : PE_CD_SetDeemphasis
- *
- * In : DeEmphasis or not
- * Out : void
- *
- * Return : void
- *
- * Desc : Indicate IO_HAL to implement the de-emphasis
- *
- ***************************************************************************/
- void PE_CD_SetDeemphasis(BOOL DeEmphasis)
- {
- #ifndef INTERNAL_DAC
- if (DeEmphasis)
- DEC_EX_SetDeemphasis(TRUE);
- else
- DEC_EX_SetDeemphasis(FALSE);
- #endif
- }
- #endif
- //SeanLiu_0902_2004
- #ifdef D_ENABLE_SVCD_SAMPLE_RATE_DETECTION
- /**************************************************************************
- *
- * Function :
- *
- * In :
- * Out :
- *
- * Return :
- *
- * Desc :
- *
- ***************************************************************************/
- UINT32 PE_CD_AutoDetectAudioSetting( AudioSID cAudioSID, DWORD dwStartAddress, ULONG ulMaxBlocksCnt)
- {
- UINT32 SampleRate = 0;
- dbg_printf(("On Audio Sampling Rate Detectingn"));
- DEC_MuteOutput(MUTE_DETECT_REQUEST, MUTE_SETTING_ON);
- DEC_MuteSPDIF(MUTE_DETECT_REQUEST, MUTE_SETTING_ON);
-
- DEC_SetSID( DEC_SID_TYPE_VIDEO, (BYTE)NoVideo);
- DEC_SetSID( DEC_SID_TYPE_AUDIO, (BYTE)cAudioSID);
- //We already set the Decoder Disc Type correctly
- DEC_PlaybackCommand(DEC_PLAYBACK_CMD_PLAY, NULL);
- /* Start the drive to read this seq */
- drv_play_cd_logical(DRVCF_CDSPEED_MAX, dwStartAddress, ulMaxBlocksCnt);
-
- SampleRate = DEC_Get_MPEG_Audio_SamplingRate();
- DEC_PlaybackCommand(DEC_PLAYBACK_CMD_STOP, NULL);
- drv_abort_play();
- DEC_MuteOutput(MUTE_DETECT_REQUEST, MUTE_SETTING_OFF);
- DEC_MuteSPDIF(MUTE_DETECT_REQUEST, MUTE_SETTING_OFF);
-
- return SampleRate;
- }
- #endif //D_ENABLE_SVCD_SAMPLE_RATE_DETECTION
- //<<<SeanLiu_0902_2004
- /**************************************************************************
- *
- * Function : PE_CD_GetCdDetectType
- *
- * In : none
- * Out : none
- *
- * Return : return the results of the cd-detection
- *
- * Desc : detect CDDTS
- *
- ***************************************************************************/
- CD_DETECT_RESULT PE_CD_GetCdDetectType(void)
- {
- return API_ADP_GetCdDetectType();
- }
- #ifdef CDDA_ERROR_RECOVERY
- /**************************************************************************
- *
- * Function : PE_CD_CheckAudioBufferFullness
- *
- * In : void
- * Out : TRUE if fullness
- *
- * Return : Size in term of 32 bytes
- *
- * Desc : Check if current Audio Coded Buffer is more than Threshold
- *
- ***************************************************************************/
- BOOL PE_CD_CheckAudioBufferFullness(void)
- {
- UINT16 uiAudioCodedBufferLevel;
- uiAudioCodedBufferLevel = DEC_ReadCodeBufferFullness(DEC_AUDIO_CODE_BUFFER, DEC_FULLNESS_IN_KILOBYTES);
- if ( uiAudioCodedBufferLevel >= CDDA_AUDIO_CODED_BUFFER_FULLNESS_THRESHOLD )
- return TRUE;
- else
- return FALSE;
- }
- #endif
- /**************************************************************************
- *
- * Function : PE_CD_SetCurrentLocationLBN_Bakcup
- *
- * In :
- * Out :
- *
- * Return :
- *
- * Desc :
- *
- ***************************************************************************/
- void PE_CD_SetCurrentLocationLBN_Bakcup(DWORD dwCurrentLocation)
- {
- g_dwCurrentLocaionLBN = dwCurrentLocation;
- }