racodec.h
上传用户:dangjiwu
上传日期:2013-07-19
资源大小:42019k
文件大小:7k
源码类别:

Symbian

开发平台:

Visual 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. #ifdef __MWERKS__
  36. #pragma once
  37. #endif
  38. #ifndef _RACODEC
  39. #define _RACODEC
  40. #include "hxtypes.h"
  41. #include "hxresult.h"
  42. #include "hxcom.h"
  43. /*
  44.  *  CONSTANTS
  45.  */
  46. #define MAX_CODEC_ID_LENGTH  5
  47. #define MAX_CODEC_NAME_LENGTH 32
  48. #define HX_MAX_AUDIO_QUALITY   0
  49. #define HX_MIN_AUDIO_QUALITY   5
  50. // generic error return value from codec
  51. #define HX_CODEC_ERROR -1
  52. /*
  53.  *  DATA TYPES
  54.  */
  55.  
  56. // set struct alignment for Mac
  57. #if defined(_MACINTOSH) || defined(_MAC_UNIX)
  58. #pragma options align=mac68k
  59. #endif
  60. // for Cookie API
  61. typedef void* RACODEC;
  62. typedef struct audio_format
  63. {
  64. UINT16  FormatTag;
  65. UINT32  SamplesPerSec;
  66. UINT16  BitsPerSample;
  67. UINT16  Channels;
  68. } HX_AUDIO_FORMAT;
  69. typedef enum
  70. {
  71.     CONTENT_VOICE_ONLY,
  72.     CONTENT_MUSIC_ONLY,
  73. //  $Comstrip: IF SDK
  74. //    CONTENT_VOICE_AND_MUSIC
  75. //  $Comstrip: ELSE
  76.     CONTENT_VOICE_AND_MUSIC,
  77.     CONTENT_VIDEO_ONLY
  78. //  $Comstrip: ENDIF SDK
  79. } HX_CONTENT_TYPE;
  80. typedef enum
  81. {                                 /* Property Type           */  
  82. //    FLV_PROP_NAME,                /* char[]                  */
  83. //    FLV_PROP_DESCRIPTION,         /* char[]                  */
  84. //    FLV_PROP_STATUS_TEXT,         /* char[]                  */
  85. //    FLV_PROP_BIT_RATE,            /* UINT32                  */
  86. //    FLV_PROP_INPUT_AUDIO_FORMAT,  /* HX_AUDIO_FORMAT         */
  87. //    FLV_PROP_OUTPUT_AUDIO_FORMAT, /* HX_AUDIO_FORMAT         */
  88. //    FLV_PROP_CONTENT_TYPE,        /* HX_CONTENT_TYPE (UINT16)*/
  89. //    FLV_PROP_GRANULARITY,         /* UINT32                  */
  90. //    FLV_PROP_AUDIO_BANDWIDTH,
  91. //    FLV_PROP_COUPLING_BEGIN,
  92. //    FLV_PROP_FRAME_SIZE,
  93. //    FLV_PROP_SAMPLES_IN,
  94. //    FLV_PROP_INTERLEAVE_FACTOR,
  95. //    FLV_PROP_INTERLEAVE_TYPE,
  96. //    FLV_PROP_INTERLEAVE_PATTERN,
  97. //    FLV_PROP_OPAQUE_DATA,
  98. //    FLV_PROP_USER = 1000
  99.     FLV_PROP_NAME,                /* char[]                  */
  100.     FLV_PROP_BIT_RATE,            /* ULONG32                 */
  101.     FLV_PROP_INPUT_AUDIO_FORMAT,  /* HX_AUDIO_FORMAT         */
  102.     FLV_PROP_OUTPUT_AUDIO_FORMAT, /* HX_AUDIO_FORMAT         */
  103.     FLV_PROP_DESCRIPTION,         /* char[]                  */
  104.     FLV_PROP_CONTENT_TYPE,        /* HX_CONTENT_TYPE (UINT16)*/
  105.     FLV_PROP_GRANULARITY,         /* ULONG32                 */
  106.     FLV_PROP_STATUS_TEXT,         /* char[]                  */
  107.     FLV_PROP_RV_NAME,             /* char[]                  */
  108.     FLV_PROP_RV_DESCRIPTION,      /* char[]                  */
  109.     FLV_PROP_RV_STATUS_TEXT,      /* char[]                  */
  110.     FLV_PROP_AUDIO_BANDWIDTH,
  111.     FLV_PROP_COUPLING_BEGIN,
  112.     FLV_PROP_FRAME_SIZE,
  113.     FLV_PROP_SAMPLES_IN,
  114.     FLV_PROP_INTERLEAVE_FACTOR,
  115.     FLV_PROP_INTERLEAVE_TYPE,
  116.     FLV_PROP_INTERLEAVE_PATTERN,
  117.     FLV_PROP_OPAQUE_DATA,
  118.     FLV_PROP_FREQ_RESPONSE,       /* UINT32                  */
  119.     FLV_PROP_BITS_PER_FRAME,
  120.     FLV_PROP_USER = 1000
  121. } HX_FLV_PROPERTY;
  122. // Decoder API
  123. typedef struct radecoder_init_params
  124. {
  125. UINT32 sampleRate;
  126. UINT16 bitsPerSample;
  127. UINT16 channels;
  128. UINT16 audioQuality;
  129. UINT32 bitsPerFrame;
  130. UINT32 granularity;
  131. UINT32 opaqueDataLength;
  132. BYTE* opaqueData;
  133. } RADECODER_INIT_PARAMS;
  134. // Encoder API
  135. typedef struct raencoder_info
  136. {
  137. UINT32 granularity;
  138. UINT32 sampleRate;
  139. UINT16 bitsPerSample;
  140. UINT16 channels;
  141. UINT16 compressionType;
  142. char compressionCode[MAX_CODEC_ID_LENGTH]; /* Flawfinder: ignore */
  143. char displayName[MAX_CODEC_NAME_LENGTH]; /* Flawfinder: ignore */
  144. } RAENCODER_INFO;
  145. typedef struct raencoder_init_params
  146. {
  147. INT32 numSamplesIn;
  148. INT32 numBytesOut;
  149. UINT32 sampleRate;
  150. UINT16 bitsPerSample;
  151. UINT16 channels;
  152. UINT16 flvIndex;
  153. } RAENCODER_INIT_PARAMS;
  154. #if defined(_MACINTOSH) || defined(_MAC_UNIX)
  155. #pragma options align=reset
  156. #endif
  157. /*
  158.  *  PROTOTYPES
  159.  */
  160. extern "C"
  161. {
  162.     HX_RESULT HXEXPORT ENTRYPOINT(RAOpenCodec) (RACODEC* pCodecRef);
  163.     HX_RESULT HXEXPORT ENTRYPOINT(RAOpenCodec2) (RACODEC* pCodecRef, const char* pCodecPath);
  164.     HX_RESULT HXEXPORT ENTRYPOINT(RACloseCodec) (RACODEC codecRef);
  165.     void HXEXPORT ENTRYPOINT(RASetPwd) (RACODEC codecRef, const char* pPwd);
  166.     UINT16 HXEXPORT ENTRYPOINT(RAGetNumberOfFlavors)(RACODEC codecRef);
  167.     UINT16 HXEXPORT ENTRYPOINT(RAGetNumberOfFlavors2)(RACODEC codecRef);
  168.     void * HXEXPORT ENTRYPOINT(RAGetFlavorProperty)(RACODEC codecRef, UINT16 flvIndex, UINT16 propIndex, UINT16* pSize);
  169.     HX_RESULT HXEXPORT ENTRYPOINT(RASetFlavor)(RACODEC codecRef, UINT16 flvIndex);
  170.     HX_RESULT HXEXPORT ENTRYPOINT(RAInitEncoder) (RACODEC codecRef, void* pParam );
  171.     void HXEXPORT ENTRYPOINT(RAEncode) (RACODEC codecRef, UINT16* inBuf, Byte* outBuf);
  172.     void HXEXPORT ENTRYPOINT(RAFreeEncoder) (RACODEC codecRef);
  173.     HX_RESULT HXEXPORT ENTRYPOINT(RAGetBackend) (RACODEC codecRef, void*** pFuncList);
  174.     HX_RESULT HXEXPORT ENTRYPOINT(RAGetGUID) (UCHAR* pGUID);
  175.     HX_RESULT HXEXPORT ENTRYPOINT(RAGetDecoderBackendGUID) (RACODEC codecRef, UCHAR* pGUID);
  176.     HX_RESULT HXEXPORT ENTRYPOINT(RASetComMode) (RACODEC codecRef);
  177.     HX_RESULT HXEXPORT ENTRYPOINT(RAInitDecoder) (RACODEC codecRef, void* pParam);
  178.     HX_RESULT HXEXPORT ENTRYPOINT(RADecode) (RACODEC codecRef, Byte* in, UINT32 inLength, Byte* out, UINT32* pOutLength, UINT32 userData);
  179.     HX_RESULT HXEXPORT ENTRYPOINT(RAFlush) (RACODEC codecRef, Byte* outBuf, UINT32* pOutLength);
  180.     void HXEXPORT ENTRYPOINT(RAFreeDecoder) (RACODEC codecRef);
  181. }
  182. #endif // #ifndef _RACODEC