xmdtypes.h
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:8k
源码类别:

Symbian

开发平台:

C/C++

  1. /* ***** BEGIN LICENSE BLOCK ***** 
  2.  * Version: RCSL 1.0/RPSL 1.0 
  3.  *  
  4.  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  5.  *      
  6.  * The contents of this file, and the files included with this file, are 
  7.  * subject to the current version of the RealNetworks Public Source License 
  8.  * Version 1.0 (the "RPSL") available at 
  9.  * http://www.helixcommunity.org/content/rpsl unless you have licensed 
  10.  * the file under the RealNetworks Community Source License Version 1.0 
  11.  * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
  12.  * in which case the RCSL will apply. You may also obtain the license terms 
  13.  * directly from RealNetworks.  You may not use this file except in 
  14.  * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
  15.  * applicable to this file, the RCSL.  Please see the applicable RPSL or 
  16.  * RCSL for the rights, obligations and limitations governing use of the 
  17.  * contents of the file.  
  18.  *  
  19.  * This file is part of the Helix DNA Technology. RealNetworks is the 
  20.  * developer of the Original Code and owns the copyrights in the portions 
  21.  * it created. 
  22.  *  
  23.  * This file, and the files included with this file, is distributed and made 
  24.  * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
  25.  * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
  26.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
  27.  * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
  28.  * 
  29.  * Technology Compatibility Kit Test Suite(s) Location: 
  30.  *    http://www.helixcommunity.org/content/tck 
  31.  * 
  32.  * Contributor(s): 
  33.  *  
  34.  * ***** END LICENSE BLOCK ***** */ 
  35. #ifndef _XMDTYPES_H_
  36. #define _XMDTYPES_H_
  37. #include "hxtypes.h"
  38. // Colorspace types supported by Colorspace converter
  39. typedef enum XMDColorSpaceTag
  40. {
  41.     eXMDColorSpaceMCS3,
  42.     eXMDColorSpaceMC12,
  43.     eXMDColorSpaceYV12,
  44.     eXMDColorSpaceYUY2,
  45.     eXMDColorSpaceUYVY,
  46.     eXMDColorSpaceVBPL,
  47.     eXMDColorSpaceCLPL,
  48.     eXMDColorSpaceCLJR,
  49.     eXMDColorSpaceRGB8,
  50.     eXMDColorSpaceRGB555,
  51.     eXMDColorSpaceRGB565,
  52.     eXMDColorSpaceRGB24,
  53.     eXMDColorSpaceRGB32,
  54.     eXMDColorSpaceNone
  55. } XMDColorSpace;
  56. // The order (value) of these frame type enums must be this way.
  57. // This maps directly to the MPEG spec
  58. typedef enum XMDFrameTypeTag
  59. {
  60.     eXMDFrameTypeNone   = 0,
  61.     eXMDFrameTypeI      = 1,
  62.     eXMDFrameTypeP      = 2,
  63.     eXMDFrameTypeB      = 3,
  64.     eXMDFrameTypeD      = 4
  65. } XMDFrameType;
  66. // Used as return values for API calls
  67. typedef enum XMDErrorTag
  68. {
  69.     eXMDErrorOk,                    // No error
  70.     eXMDErrorError,                 // Generic error
  71.     eXMDErrorInvalidParameter,      // Invalid parameter to function
  72.     eXMDErrorDecoderNotFound,       // Decoder DLL not found or not ready
  73.     eXMDErrorInvalidWindow,         // Invalid window handle
  74.     eXMDErrorDecodeError,           // Error decoding
  75.     eXMDErrorInvalidDecoderVersion, // Incorrect decoder dll
  76.     eXMDErrorCurrentlyOpen,         // Already open
  77.     eXMDErrorDecoderNotReady,       // Decoder probably busy
  78.     eXMDErrorNotEnoughData,         // Ran out of data
  79.     eXMDErrorHardware,              // Hardware failure
  80.     eXMDErrorFileRead,              // File read error
  81.     eXMDErrorInvalidFile,           // Bad MPEG file
  82.     eXMDErrorOutOfRange             // Parameter out of range
  83. } XMDError;
  84. // Used to describe the state of the YUV buffers during decode
  85. typedef struct XMDBufferDescriptionTag
  86. {
  87.     BYTE            *pDestBufy;
  88.     BYTE            *pDestBufuv;
  89.     BYTE            *pRefForwardBufy;
  90.     BYTE            *pRefForwardBufuv;
  91.     BYTE            *pRefBackBufy;
  92.     BYTE            *pRefBackBufuv;
  93.     XMDFrameType    eDestBufType;
  94.     XMDFrameType    eForwardBufType;
  95.     XMDFrameType    eBackBufType;
  96.     INT16           iDestBufNum;
  97.     LONG32          lDestBufOrd;
  98.     INT16           iForwardBufNum;
  99.     LONG32          lForwardBufOrd;
  100.     INT16           iBackBufNum;
  101.     LONG32          lBackBufOrd;
  102.     ULONG32         dwNumI;
  103.     ULONG32         dwNumP;
  104.     ULONG32         dwNumB;
  105.     INT16           iShowBufNum;
  106.     LONG32          lShowBufOrd;
  107.     INT16           iWidth;
  108.     INT16           iHeight;
  109. }XMDBufferDescription;
  110. typedef enum
  111. {
  112.     NO_CODE                 = 0xFFFFFFFF,
  113.     SEQUENCE_HEADER_CODE    = 0x000001B3,
  114.     SEQUENCE_END_CODE       = 0x000001B7,
  115.     GOP_START_CODE          = 0x000001B8,
  116.     USER_DATA_START_CODE    = 0x000001B2,
  117.     EXTENSION_START_CODE    = 0x000001B5,
  118.     PACK_START_CODE         = 0x000001BA,
  119.     PIC_START_CODE          = 0x00000100,
  120.     FIRST_SLICE_CODE        = 0x00000101,
  121.     START_CODE_SIGNTR       = 0x00000001
  122. }eStartCode;
  123. enum
  124. {
  125.     SEQUENCE_DISPLAY_EXT = 0x2,
  126.     PICTURE_DISPLAY_EXT  = 0x7
  127. };
  128. // MPEG2 Bit Flags
  129. enum
  130. {
  131.     PIC_EXT_TOP_FIELD_FIRST = 0x80,
  132.     PIC_EXT_FRAME_PRED_FRAME_DCT = 0x40,
  133.     PIC_EXT_CONCEALMENT_MOTION_VECTORS = 0x20,
  134.     PIC_EXT_Q_SCALE_TYPE = 0x10,
  135.     PIC_EXT_INTRA_VIC_FORMAT = 0x08,
  136.     PIC_EXT_ALTERNATE_SCAN = 0x04,
  137.     PIC_EXT_REPEAT_FIRST_FIELD = 0x02,
  138.     PIC_EXT_PROGRESSIVE_FRAME = 0x01,
  139.     PIC_INTRA_DC_PREC =         0x0C000,
  140.     PIC_STRUCT =                0x03000,
  141.     PIC_TYPE =                  0x00C00,
  142.     PIC_DCT_TYPE =              0x00100,
  143.     PIC_STRUCT_TOP_FIELD =      0x01000,
  144.     PIC_STRUCT_BOTTOM_FIELD =   0x02000
  145. };
  146. enum
  147. {
  148.     TIME_STAMP_UNITS =          10000000,
  149.     UNITS_CONVERSION_MS =       10000
  150. };
  151. enum
  152. {
  153.     MPEG_BITS_PER_PEL =         12
  154. };
  155. #define ALIGNED_HEIGHT(h) ((h + 15) & 0xFFF0)
  156. #define UNITS_TO_MS(x)  (x) / UNITS_CONVERSION_MS
  157. const INT64 PictureTimes[16] =
  158. {
  159.     0,
  160.     (INT64)((double)TIME_STAMP_UNITS / 23.976),
  161.     (INT64)((double)TIME_STAMP_UNITS / 24),
  162.     (INT64)((double)TIME_STAMP_UNITS / 25),
  163.     (INT64)((double)TIME_STAMP_UNITS / 29.97),
  164.     (INT64)((double)TIME_STAMP_UNITS / 30),
  165.     (INT64)((double)TIME_STAMP_UNITS / 50),
  166.     (INT64)((double)TIME_STAMP_UNITS / 59.94),
  167.     (INT64)((double)TIME_STAMP_UNITS / 60)
  168. };
  169. struct tMPEG_SEQ_HDR
  170. {
  171.     INT32           display_pels_width;
  172.     INT32           display_pels_height;
  173.     INT32           pel_aspect_ratio;
  174.     INT32           picture_rate;
  175.     UINT32          bit_rate;
  176.     INT32           vbv_buf_size;
  177.     INT32           constrained_stream_flag;
  178.     INT32           intra_q_matrix_flag;
  179.     UINT8           intra_q_matrix[64];
  180.     INT32           non_intra_q_matrix_flag;
  181.     UINT8           non_intra_q_matrix[64];
  182.     INT32           ext_data_flag;          // not part of MPEG spec
  183.     UINT32          ext_buf_size;           // not part of MPEG spec
  184.     INT8            ext_data[32];
  185.     UINT32          ext_data_size;          // not part of MPEG spec
  186.     UINT32          user_buf_size;          // not part of MPEG spec
  187.     INT32           user_data_flag;
  188.     INT8            user_data[32];
  189.     UINT32          user_data_size;         // not part of MPEG spec
  190.     UINT8           bEncrypted;             // Is this an encrypted ReelMagic file?
  191.     INT64           picture_time;           // In 90 Nano Seconds
  192. };
  193. typedef struct
  194. {
  195.     UINT8           *pSurface,
  196.                     *pY, *pUV,
  197.                     *pYDisplay,
  198.                     *pUVDisplay,
  199.                     bDecodeSuccess;
  200.     INT32           lPitch;
  201.     UINT32          lPts;
  202.     INT16           nBufferIndex;           // The buffer index of this buffer
  203.     INT16           nShowBufferIndex;       // If this buffer decoded successfully,
  204.                                             //   the number of the buffer that should be shown
  205. } tDisplayObj;
  206. typedef struct
  207. {
  208.     XMDFrameType    eFrame;
  209.     
  210.     UCHAR           *pData;
  211.     UINT32          ulFrameSize,
  212.                     ulWidth,
  213.                     ulHeight,
  214.     ulTimeStamp;
  215.     UINT8           bRepeatField,
  216.                     bDynamicChange,
  217.                     bSequenceEnd,
  218.                     bSequenceHeader,
  219.                     bStillFrame;
  220.     tMPEG_SEQ_HDR   seqHdr;
  221. } tFrameObj;
  222. typedef enum 
  223. {
  224.     eNoError,
  225.     eOutOfData,
  226.     eOutOfMemory,
  227.     eInvalidData,
  228.     eDecoderNotInitialized,
  229.     eBufferNotAvailable,
  230.     eUnknown
  231. } eErr;
  232. #endif