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

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 __CODECLIB_H__
  36. #define __CODECLIB_H__
  37. #include "hxcodec.h"
  38. typedef HX_RESULT (HXEXPORT_PTR FPCODECOPEN)(HX_MOFTAG moftFormatTag,HXCODEC *codecRef);
  39. typedef HX_RESULT (HXEXPORT_PTR FPCODECCLOSE)(HXCODEC codecRef);
  40. typedef HX_RESULT (HXEXPORT_PTR FPCODECGETUINAME)(HXCODEC codecRef,char *nameBuf);
  41. typedef HX_RESULT (HXEXPORT_PTR FPCODECGETVERSION)(HXCODEC codecRef, ULONG32 *pVersion);
  42. typedef HX_RESULT (HXEXPORT_PTR FPCODECOPENSETTINGSBOX)(HXCODEC codecRef, void * platformData);
  43. typedef HX_RESULT (HXEXPORT_PTR FPCODECQUERYMEDIAFORMAT)(HXCODEC codecRef,HX_MOF * pmofIn,
  44.         HX_MOF * pmofOut, UINT16 ioDirection);
  45. typedef HX_RESULT (HXEXPORT_PTR FPCODECPREFERREDMEDIAFORMAT)(HXCODEC codecRef,HX_MOF * pmofIn,
  46.         HX_MOF * pmofOut, UINT16 ioDirection);
  47. typedef HX_RESULT (HXEXPORT_PTR FPCODECGETMEDIAFORMATS)(HXCODEC codecRef,HX_MOF **pFormats,
  48.         ULONG32 * numFormats,UINT16 oDirection);
  49. typedef HX_RESULT (HXEXPORT_PTR FPCODECSTREAMOPEN)(HXCODEC codecRef,HXSTREAM *streamRef,HXCODEC_INIT
  50.         *params);
  51. typedef HX_RESULT (HXEXPORT_PTR FPSTREAMCLOSE)(HXSTREAM streamRef);
  52. typedef HX_RESULT (HXEXPORT_PTR FPSTREAMSETDATACALLBACK)(HXSTREAM streamRef,HXSTREAM callbackRef,
  53.         HXMEMORY memoryRef, FP_STREAM_DATA data_callback);
  54. typedef HX_RESULT (HXEXPORT_PTR FPSTREAMGETSTREAMHEADERSIZE)(HXSTREAM streamRef, ULONG32 *puSize);
  55. typedef HX_RESULT (HXEXPORT_PTR FPSTREAMGETSTREAMHEADER)(HXSTREAM streamRef, HX_MOF *pHeader);
  56. typedef HX_RESULT (HXEXPORT_PTR FPSTREAMINPUT)(HXSTREAM streamRef,HXSTREAM      fromStreamRef,
  57.         HXCODEC_DATA *pData);
  58. typedef HX_RESULT (HXEXPORT_PTR FPSTREAMSETOUTPUTPACKETSIZE)(HXSTREAM streamRef,ULONG32 prefSize,
  59.         ULONG32 maxSize,ULONG32 *actualSize);
  60. typedef HX_RESULT (HXEXPORT_PTR FPSTREAMGETINPUTBUFFERSIZE)(HXSTREAM streamRef,ULONG32 *puSize);
  61. typedef HX_RESULT (HXEXPORT_PTR FPSTREAMGETPROPERTY)(HXSTREAM streamRef,ULONG32 prop, void *pValue);
  62. typedef HX_RESULT (HXEXPORT_PTR FPSTREAMSETPROPERTY)(HXSTREAM streamRef,ULONG32 prop, void *pValue);
  63. // XXXKB: This needs to be modified to support the postfilter ROI:
  64. typedef HX_RESULT (HXEXPORT_PTR FPSTREAMPOSTPROCESS)
  65.                                 (HXSTREAM               streamRef,
  66.                                  HXCODEC_DATA           *pncData,
  67.                                  ULONG32                uCurrentTime,
  68.                                  UCHAR                  *pDestBuffer,
  69.                                  UINT32                 uDestPitch,
  70.                                  INT32                  cidDestColorFormat);
  71. typedef HX_RESULT (HXEXPORT_PTR FPSTREAMRELEASEFRAME)
  72.                                 (HXSTREAM               streamRef,
  73.                                  HXCODEC_DATA   *pncData);
  74. typedef PIHXUnknown (HXEXPORT_PTR FPGETHXUNKNOWN)(HXSTREAM streamRef);
  75. typedef PIHXUnknown (HXEXPORT_PTR FPCODECGETHXUNKNOWN)(HXCODEC codecRef);
  76. typedef HX_RESULT (HXEXPORT_PTR FPCODECINPUT) (HXCODEC codecRef, HXCODEC_DATA *pData);
  77. typedef HX_RESULT (HXEXPORT_PTR FPCODECQUERYMEDIAFORMAT) (HXCODEC codecRef, 
  78.                                          HX_MOF * pmofIn, 
  79.  HX_MOF * pmofOut, 
  80.  UINT16 ioDirection);
  81. class DLLAccessBridge;
  82. class CRADynamicCodecLibrary
  83. {
  84. // Construction & Destruction
  85. public:
  86.     CRADynamicCodecLibrary(IUnknown* pContext = NULL, BOOL bDummy = FALSE);
  87.     virtual ~CRADynamicCodecLibrary();
  88.     virtual HX_RESULT   LoadCodecLib(HX_MOFTAG moftFormatTag, const char* szCodecDLL=NULL);
  89.     virtual HX_RESULT   PNCodec_Open(HX_MOFTAG moftFormatTag,HXCODEC *codecRef) const;
  90.     virtual HX_RESULT   PNCodec_Close(HXCODEC codecRef) const;
  91.     virtual HX_RESULT   PNCodec_StreamOpen(HXCODEC codecRef,HXSTREAM *streamRef,HXCODEC_INIT *params) const;
  92.     virtual HX_RESULT   PNStream_Close(HXSTREAM streamRef);
  93.     virtual HX_RESULT   PNStream_SetDataCallback(HXSTREAM streamRef, HXSTREAM callbackRef,
  94.                                                  HXMEMORY memoryRef, FP_STREAM_DATA data_callback) const;
  95.     virtual HX_RESULT   PNStream_GetStreamHeaderSize(HXSTREAM streamRef,ULONG32 *puSize) const;
  96.     virtual HX_RESULT   PNStream_GetStreamHeader(HXSTREAM streamRef,HX_MOF *pHeader) const;
  97.     virtual HX_RESULT   PNStream_Input(HXSTREAM streamRef,HXSTREAM    fromStreamRef,HXCODEC_DATA *pData);
  98.     virtual HX_RESULT   PNStream_SetOutputPacketSize(HXSTREAM streamRef,ULONG32 prefSize,
  99.                                                      ULONG32 maxSize, ULONG32 *actualSize) const;
  100.     virtual HX_RESULT   PNStream_GetInputBufferSize(HXSTREAM streamRef,ULONG32 *puSize) const;
  101.     virtual HX_RESULT   PNStream_GetProperty(HXSTREAM streamRef,ULONG32 prop, void *pValue) const;
  102.     virtual HX_RESULT   PNStream_SetProperty(HXSTREAM streamRef,ULONG32 prop, void *pValue) const;
  103.     virtual HX_RESULT   PNStream_PostProcess(HXSTREAM      streamRef,
  104.                                              HXCODEC_DATA* pncData,
  105.                                              ULONG32       uCurrentTime,
  106.                                              UCHAR*        pDestBuffer,
  107.                                              UINT32        uDestPitch,
  108.                                              INT32         cidDestColorFormat,
  109.                                              UINT32        roiX,
  110.                                              UINT32        roiY,
  111.                                              UINT32        roiWidth,
  112.                                              UINT32        roiHeight);
  113.     virtual HX_RESULT   PNStream_ReleaseFrame(HXSTREAM      streamRef,
  114.                                               HXCODEC_DATA* pncData);
  115.     virtual PIHXUnknown PNStream_GetIPNUnknown(HXSTREAM streamRef) const;
  116.     virtual HX_RESULT   PNCodec_GetUIName(HXCODEC codecRef,char *nameBuf) const;
  117.     virtual HX_RESULT   DoAutoUpdate(BOOL bSigErr = TRUE) { return HXR_OK; }
  118.     HX_RESULT           PNCodec_Input(HXCODEC codecRef,HXCODEC_DATA *pData);    
  119.     virtual PIHXUnknown PNCodec_GetIPNUnknown(HXCODEC codecRef) const;
  120.     
  121. virtual HX_RESULT PNCodec_QueryMediaFormat(HXCODEC codecRef, 
  122.                                          HX_MOF * pmofIn, 
  123.  HX_MOF * pmofOut, 
  124.  UINT16 ioDirection);
  125. protected:
  126.     IUnknown* m_pContext;
  127.     DLLAccessBridge*                  m_pCodecAccess;
  128.     FPCODECOPEN                 m_fpHXCodec_Open;
  129.     FPCODECCLOSE                m_fpHXCodec_Close;
  130.     FPCODECSTREAMOPEN           m_fpHXCodec_StreamOpen;
  131.     FPSTREAMCLOSE               m_fpHXStream_Close;
  132.     FPSTREAMSETDATACALLBACK     m_fpHXStream_SetDataCallback;
  133.     FPSTREAMGETSTREAMHEADERSIZE m_fpHXStream_GetStreamHeaderSize;
  134.     FPSTREAMGETSTREAMHEADER     m_fpHXStream_GetStreamHeader;
  135.     FPSTREAMINPUT               m_fpHXStream_Input;
  136.     FPSTREAMSETOUTPUTPACKETSIZE m_fpHXStream_SetOutputPacketSize;
  137.     FPSTREAMGETINPUTBUFFERSIZE  m_fpHXStream_GetInputBufferSize;
  138.     FPSTREAMGETPROPERTY         m_fpHXStream_GetProperty;
  139.     FPSTREAMSETPROPERTY         m_fpHXStream_SetProperty;
  140.     FPSTREAMPOSTPROCESS         m_fpHXStream_PostProcess;
  141.     FPSTREAMRELEASEFRAME        m_fpHXStream_ReleaseFrame;
  142.     FPGETHXUNKNOWN              m_fpHXStream_GetIHXUnknown;
  143.     FPCODECGETUINAME            m_fpHXCodec_GetUIName;
  144.     FPCODECINPUT                m_fpHXCodecInput;
  145.     FPCODECGETHXUNKNOWN         m_fpHXCodec_GetIHXUnknown;
  146.     FPCODECQUERYMEDIAFORMAT m_fpHXCodec_QueryMediaFormat;
  147.     
  148. #ifdef _MACINTOSH
  149.     INT16                       m_CodecResFileNum;
  150.     BOOL                        m_bNeedToUseResourceFile;
  151. #endif
  152.     BOOL                        OS_ValidModule (ULONG32 modHandle);
  153.     BOOL                        OS_BuildLibName (HX_MOFTAG tag, char *libName);
  154.     BOOL                        OS_BuildOldLibName (HX_MOFTAG tag, char *libName);
  155.     void                        ClearFunctionPointers();
  156.     BOOL GetAlternateMoftCodecTag(HX_MOFTAG& alternateMoftCodecTag, 
  157.  HX_MOFTAG moftCodecTag, 
  158.  UINT32& ulAttemptCounter);
  159. };
  160. #endif // __CODECLIB_H__