AVI.c
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:131k
- /****************************************************************************************
- * Copyright (c) 2003 ZORAN Corporation, All Rights Reserved
- * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
- *
- * File: $Workfile: AVI.c $
- *
- * Description:
- * ============
- *
- *
- * Log:
- * ====
- * $Revision: #12 $
- * $Change: 57739 $
- * Last Modified by $Author: callie.cai $ at $DateTime: 2005/09/29 15:10:23 $
- ****************************************************************************************
- * Updates:
- ****************************************************************************************
- * $Log: /I76/I76_Common/I76_Reference/Playcore/Nav_Clips/AVI.c $
- *
- * 79 4/03/04 1:58p Robinj
- * avoid calculation overflow
- *
- * 78 04-04-02 15:01 Fwang
- * Fix green screen by MPP.
- *
- * 77 04-04-01 19:19 Fwang
- * Fix AVI AB repeat goes to start of clip.
- *
- * 76 3/30/04 10:04p Robinj
- * support special 3ivx clip, "fccHandler" is "mp4v"/"rmp4" and
- * "biCompression" is "rmp4", it's same as "XVID"
- *
- * 75 04-03-30 15:51 Fwang
- * Fix pause after scan.
- *
- * 74 04-03-29 11:09 Leonh
- * keep the zoom when scan
- *
- * 73 3/25/04 7:52p Robinj
- * fix wrong number display when change subtitle/audio stream
- *
- * 72 3/25/04 7:28p Rond
- * added watchdog for divx 3.11
- *
- * 71 3/24/04 5:35p Robinj
- * support special divx clip, "fccHandler" is "DX50" and "biCompression"
- * is "DX50", it's same as "Divx 5"
- * playback without audio output when DIVX audio is PCM/ADPCM/WMA
- *
- * 70 3/22/04 10:20a Robinj
- * special divx clip, "fccHandler" is "MSVC" and "biCompression" is
- * "DIVX", it's same as "Divx 4.12"
- *
- * 69 3/21/04 8:49p Lotan
- * merge 4 with certification DB
- *
- * 68 3/21/04 8:00p Hamadk
- * Removed DRV_SET_BIT_RATE macro
- *
- * 67 3/10/04 4:21p Lotan
- * Merge with Divx Certification DB 3
- *
- * 66 04-03-09 21:50 Leslie
- * Mem reduction for DRM
- *
- * 65 3/08/04 4:14p Hamadk
- * Merging with DivX certification DB - Optimized AVI file info memory
- *
- * 64 3/04/04 10:22p Lotan
- * Second merge with Divx Certification DB,
- * including 2x16 SDram
- *
- * 63 3/01/04 6:29p Lotan
- * merge with Divx certification DB
- *
-
- * From Divx Certification DB
- * DRM - add casting - just to make sure it is done correctly
- * chage DRM indication, according to Divx's request
- * Corrected calculation of time in idx proccessing for VBR
- * Removed looking for Nandub - treat all clips with audio scale of 1152
- * as VBR
- * update Divx DRM rental screen parameters
- * - Added support for different I spaces in the IDX for different clips
- * - Code cleanup.
- * Added error handling for DivX (Drive & Demux)
- * Corrected getStatus() when IP FF is not supported
- * Corrected saving/reading idx entries
- * Replaced the autoplay patch
- * patch to prevent index proccessing on auto play
- * remove UI temp screen
- * add DRM rental check and screen
- * - Corrected Idx calculation for CBR to be more accurate.
- * - Replaced printfs with dbg_printfs.
- * No IP support
- * Removed FIFO_destruct()
- * add Reading Index message
- * - Corrected bug in FB.
- * - Code cleanup.
- * fixed bug of more than one audio stream
- * add DRM trick mode support
- * divX Version for Certification
- * drive speed up is ON
-
- ====================
- * 62 2/27/04 7:06p Robinj
- * Prohibit "FF/FB" when "idx1" not found
- *
- * 61 2/19/04 10:47p Robinj
- * fix the problem of chunk size is zero
- *
- * 60 2/17/04 3:09p Lotan
- *
- * 58 2/15/04 7:40p Lotan
- * update DRM process. Add registration check, etc.
- *
- * 57 2/13/04 12:09a Rond
- * moved speed for High bit rate clips
- *
- * 56 04-02-11 17:33 Fwang
- * Enable CPU scaling for DVD/VCD/SVCD.
- *
- * 55 2/11/04 12:41a Lotan
- * new Divx DRM handling method.
- *
- * 54 2/10/04 8:44p Rond
- * mpeg layer 2
- *
- * 53 3/02/04 10:36 Lotan
- * rollback, due to bug in VBR processing
- *
- * 51 20/01/04 12:12 Lotan
- * change DRM flag for DVP from false to true - for DRM support
- *
- * 50 1/13/04 12:11 Hamadk
- * Merged with CES DB
- *
- * 49 12/26/03 14:08 Hamadk
- *
- * 48 12/26/03 13:45 Hamadk
- * - Added support for changing the start of the idx processing.
- * - Fixed bug in idx processing not to regard audio for non-audio clips.
- * - Fixed bug in resuming from FF I only to FF IP.
- *
- * 47 12/25/03 15:50 Hamadk
- * - Fixed bug in processing time to address.
- * - Changed idx processing not to hangup in case of there's many audio
- * chunks before key frames.
- *
- * 46 12/25/03 11:15 Hamadk
- * - Corrected updating of the time.
- * - Corrected resuming from FF I only.
- * - Corrected clearing DVPGen2 in resuming from FF IP.
- *
- * 45 12/24/03 19:27 Hamadk
- *
- * 44 12/24/03 17:41 Hamadk
- * FF & GoTo time basically work
- *
- * 43 12/24/03 9:38 Eyalr
- * removed 512 width of Aharon temp slot machine
- *
- * 42 12/23/03 12:31p Chaol
- * for compilation pass
- *
- * 41 12/23/03 12:12p Chaol
- * modify MPP implement
- *
- * 40 03-12-23 11:07 Fwang
- * Workaround for video garbage when skip between clips.
- *
- * 39 12/22/03 5:35p Chaol
- * add MPP support for Divx
- *
- * 38 22/12/03 14:53 Lotan
- * solve special clip14 problem --> supports "mp43" (divx3.11) encoder
- *
- * 37 12/18/03 19:14 Hamadk
- * - Corrected FF operation.
- * - Corrected GoTo time operation.
- * - Removed code orginization
- *
- * 36 03-12-18 13:22 Fwang
- * Implement CC-RAM scaling.
- *
- * 35 12/18/03 12:41 Hamadk
- * Changed getTime function not to check the SCLK in case the DVP is still
- * not in NSPB
- *
- * 34 12/18/03 11:15 Hamadk
- * - Replaced sending the demux fixed video/audio stream numbers to the
- * actual played ones.
- * - Code cleanup.
- *
- * 33 12/18/03 9:46 Nmaurer
- * Adjust the Drive speed according to the clip bitrate
- *
- * 32 12/17/03 18:08 Eyalr
- * fixed 512 width Divx problem
- *
- * 31 16/12/03 14:37 Lotan
- * fix subtitle bug (picture of clips with subtitle was wrong)
- *
- * 30 12/14/03 19:27 Eyalr
- * added two parameters to set files
- *
- * 29 12/14/03 18:31 Eyalr
- *
- * 28 12/12/03 16:33 Eyalr
- *
- * 27 12/12/03 14:02 Eyalr
- *
- * 26 12/11/03 10:06 Eyalr
- *
- * 25 12/09/03 17:20 Eyalr
- * changed SEt file param
- *
- * 24 12/08/03 3:49p Fwang
- * To avoid uninitialized scaling parameter.
- *
- * 23 12/07/03 8:51p Fwang
- * Scaling by CPU
- *
- * 22 12/04/03 1:11p Leslie
- * Abort drive each time after we finish parse AVI File Header information
- *
- * 21 11/30/03 10:05 Eyalr
- *
- * 20 11/27/03 18:40 Eyalr
- *
- * 19 11/27/03 18:19 Eyalr
- *
- * 18 11/26/03 17:24 Eyalr
- * Zooming & Scalling on CPU
- *
- * 17 11/26/03 15:55 Eyalr
- *
- * 16 11/26/03 11:59 Eyalr
- * playing XVID
- *
- * 15 25/11/03 18:07 Lotan
- * fix playback range calculation bug
- *
- * 14 11/24/03 18:59 Eyalr
- * display logo on stop
- *
- * 13 11/18/03 9:29 Eyalr
- * added SID for Decoder & UI
- *
- * 12 11/17/03 14:10 Eyalr
- *
- * 11 11/06/03 15:16 Eyalr
- * added new features for Divx
- *
- * 10 10/29/03 17:46 Eyalr
- *
- * 9 10/22/03 19:04 Hamadk
- * - Moved AVI Clip navigator info in the global navigation union.
- * - Changed the clip's get status function to be like generic clip.
- * - Updated function names.
- * - Added support for XVID.
- * - Code cleanup.
- *
- * 8 10/20/03 14:34 Eyalr
- *
- * 7 10/12/03 15:12 Hamadk
- * - Fixed idx processing.
- * - Added documentation.
- * - Code cleanup.
- *
- * 6 10/12/03 9:06 Hamadk
- * Corrected processing of the Idx
- *
- * 5 10/02/03 18:47 Hamadk
- * Corrected calculating the requested entry from the IDX
- *
- * 4 10/02/03 17:46 Hamadk
- * Corrected reaching the end of the idx table while scanning
- *
- * 3 10/02/03 10:35 Hamadk
- * - Corrected calculation of end address and end offset
- * - Added support for FF/FB
- *
- * 2 9/29/03 8:18 Hamadk
- *
- ****************************************************************************************/
- #include "Config.h" // Global Configuration - do not remove!
- #ifdef _DEBUG
- #undef IFTRACE
- #define IFTRACE if (gTraceNavigator)
- #include "Debugdbgmain.h"
- #endif
- #include "Decoderadp_api.h"
- #include "Decoderlow_levelDEC_LL_API.h"
- #include "Decoderlow_levelDEC_LL_Def.h"
- #include "Drivedrv_api.h"
- #include "Includestring_ex.h"
- #include "KernelEventDef.H"
- #include "KernelKer_API.h"
- #include "LogoLogo.h"
- #include "PlaycoreCoremainCoreDefs.h"
- #include "PlaycoreCoremainCoreGDef.h"
- #include "PlaycoreAuxCacheAuxCache.h"
- #include "PlaycoreNav_CDDAPE_CD.h"
- #include "PlaycoreNav_ClipsAVI.h"
- #include "PlaycoreNav_ClipsAVI_private.h"
- #include "PlaycoreNav_ClipsClip_Impl.h"
- #include "PlaycoreNav_ClipsGenericClip.h"
- #include "PlaycoreNav_ClipsPE_Clips.h"
- #include "PlaycorePlayModePlayMode.h"
- #include "PlaycorePSPS.h"
- #include "DecoderDec_Avi_Drm.h"
- #include "Decoderlow_levelDEC_LL_Reg.h"
- #include "PlaycoreNav_ClipsAviDrmLibDrmCommonDrmErrors.h"
- #include "PlaycoreNav_ClipsMpeg4ClipsCommon.h"
- #ifdef USE_AUX_SUBTITLES
- #include "PlaycoreNav_ClipsAuxSubtitles.h"
- #endif
- #ifdef AVI_DRM_SUPPORT
- #include "Playcore/Nav_Clips/AviDrm/libDrmDecrypt/DrmAdpApi.h"
- #endif
- #ifdef _DEBUG
- #include "CPUTimefunc.h"
- #endif
- #ifdef SUPPORT_FLASH_CARD
- #include "drivefe_manager.h"
- #include "mediacardsincluderegister.h"
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // Globals and Singletions
- #define CALC_IDX_ENTRY_ADDRESS(address, offset) (address - (offset >> 1) - sizeof(IndexEntry)/2)
- static AVIIndexEntry* _idxEntries = NULL;
- static UINT16 _aviIdxIDiff;
- /* DRM info */
- #ifdef AVI_DRM_SUPPORT
- extern UINT16 uiAviDrmFrameKeyIndex;
- extern keyInstance* pMasterKeyInstance;
- WORD g_ScAviDrm_KeysOffset = SC_AVI_DRM_KEYS_ADDR;
- BOOL g_bDivxRentanSelection;
- BOOL g_bUserAck;
- UINT16 g_DivxRentalsLeft=0;
- UINT16 g_DivxRentalsTotal=0;
- #endif //AVI_DRM_SUPPORT
- // RB_TBD
- // Robin_1003_2004_D
- //static BOOL bVideoBeforeAudio = FALSE;
- // Robin_1003_2004_C
- static BOOL bVideoAudioInterleave = TRUE;
- #ifdef NO_AUTO_PLAY_FOR_CLIPS
- BOOL g_patch_4_auto_play;
- #endif
- extern CURRENT_STATES gcst; /* Global current status */
- extern BOOL change_pallet;
- // Robin_1119_2004, display AVI audio/subtitle language
- static CONST LanguageCode DIVX_LANGUAGE_CODE_LUT[] =
- {
- {"