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

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 _GIF_RENDER_H
  36. #define _GIF_RENDER_H
  37. // Forward declarations
  38. typedef _INTERFACE IHXStream                        IHXStream;
  39. typedef _INTERFACE IHXPlayer                        IHXPlayer;
  40. typedef _INTERFACE IHXValues                        IHXValues;
  41. typedef _INTERFACE IHXPacket                        IHXPacket;
  42. typedef _INTERFACE IHXBuffer                        IHXBuffer;
  43. typedef _INTERFACE IHXSite                          IHXSite;
  44. typedef _INTERFACE IHXVideoSurface                  IHXVideoSurface;
  45. typedef _INTERFACE IHXMultiInstanceSiteUserSupplier IHXMultiInstanceSiteUserSupplier;
  46. typedef _INTERFACE IHXCommonClassFactory            IHXCommonClassFactory;
  47. typedef _INTERFACE IHXHyperNavigate                 IHXHyperNavigate;
  48. typedef _INTERFACE IHXScheduler                     IHXScheduler;
  49. typedef _INTERFACE IHXStatusMessage                 IHXStatusMessage;
  50. typedef _INTERFACE IHXErrorMessages                 IHXErrorMessages;
  51. typedef _INTERFACE IHXUpdateProperties              IHXUpdateProperties;
  52. class CGIFCodec;
  53. class CResourceLoader;
  54. class PXCallback;
  55. class PXClientAdviseSink;
  56. class CGIFRenderer : public CHXBaseCountingObject,
  57.                      public IHXPlugin, 
  58.                      public IHXRenderer, 
  59.                      public IHXSiteUser,
  60.                      public IHXStatistics,
  61.                      public IHXValues,
  62.                      public IHXUpdateProperties,
  63.                      public PXCallbackResponse,
  64.                      public PXClientAdviseSinkResponse
  65. {
  66. public:
  67.     CGIFRenderer();
  68.     virtual ~CGIFRenderer();
  69.     // IUnknown Methods
  70.     STDMETHOD (QueryInterface)  (THIS_ REFIID ID, void** ppObj);
  71.     STDMETHOD_(UINT32, AddRef)  (THIS);
  72.     STDMETHOD_(UINT32, Release) (THIS);
  73.     // IHXPlugin Methods
  74.     STDMETHOD(GetPluginInfo) (THIS_ REF(BOOL)        rbLoadMultiple,
  75.                                     REF(const char*) rpszDescription,
  76.                                     REF(const char*) rpszCopyright,
  77.                                     REF(const char*) rpszMoreInfoURL,
  78.                                     REF(UINT32)      rulVersionNumber);
  79.     STDMETHOD(InitPlugin)    (THIS_ IUnknown* pContext);
  80.     // IHXRenderer Methods
  81.     STDMETHOD(GetRendererInfo) (THIS_ REF(const char**) rppszStreamMimeType,
  82.                                       REF(UINT32)        rulInitialGranularity);
  83.     STDMETHOD(StartStream)     (THIS_ IHXStream* pStream, IHXPlayer* pPlayer);
  84.     STDMETHOD(EndStream)       (THIS);
  85.     STDMETHOD(OnHeader)        (THIS_ IHXValues* pStreamHeaderObj);
  86.     STDMETHOD(OnPacket)        (THIS_ IHXPacket* pPacket, INT32 lTimeOffset);
  87.     STDMETHOD(OnTimeSync)      (THIS_ UINT32 ulTime);
  88.     STDMETHOD(OnPreSeek)       (THIS_ UINT32 ulTimeBefore, UINT32 ulTimeAfter);
  89.     STDMETHOD(OnPostSeek)      (THIS_ UINT32 ulTimeBefore, UINT32 ulTimeAfter);
  90.     STDMETHOD(OnPause)         (THIS_ UINT32 ulTimeBeforePause);
  91.     STDMETHOD(OnBegin)         (THIS_ UINT32 ulTimeAfterBegin);
  92.     STDMETHOD(OnBuffering)     (THIS_ UINT32 ulReason, UINT16 usPercentComplete);
  93.     STDMETHOD(GetDisplayType)  (THIS_ REF(HX_DISPLAY_TYPE) rDisplayType,
  94.                                       REF(IHXBuffer*)     rpDisplayInfo);
  95.     STDMETHOD(OnEndofPackets)  (THIS);
  96.     // IHXSiteUser Methods
  97.     STDMETHOD(AttachSite)               (THIS_ IHXSite* pSite);
  98.     STDMETHOD(DetachSite)               (THIS);
  99.     STDMETHOD(HandleEvent)              (THIS_ HXxEvent* pEvent);
  100.     STDMETHOD_(BOOL,NeedsWindowedSites) (THIS);
  101.     // IHXStatistics methods
  102.     STDMETHOD(InitializeStatistics) (THIS_ UINT32 ulRegistryID);
  103.     STDMETHOD(UpdateStatistics)     (THIS);
  104.     // IHXValues methods
  105.     STDMETHOD(SetPropertyULONG32)      (THIS_ const char* pName, ULONG32 ulVal);
  106.     STDMETHOD(GetPropertyULONG32)      (THIS_ const char* pName, REF(ULONG32) rulVal);
  107.     STDMETHOD(GetFirstPropertyULONG32) (THIS_ REF(const char*) rpName, REF(ULONG32) rulVal);
  108.     STDMETHOD(GetNextPropertyULONG32)  (THIS_ REF(const char*) rpName, REF(ULONG32) rulVal);
  109.     STDMETHOD(SetPropertyBuffer)       (THIS_ const char* pName, IHXBuffer* pVal);
  110.     STDMETHOD(GetPropertyBuffer)       (THIS_ const char* pName, REF(IHXBuffer*) rpVal);
  111.     STDMETHOD(GetFirstPropertyBuffer)  (THIS_ REF(const char*) rpName, REF(IHXBuffer*) rpVal);
  112.     STDMETHOD(GetNextPropertyBuffer)   (THIS_ REF(const char*) rpName, REF(IHXBuffer*) rpVal);
  113.     STDMETHOD(SetPropertyCString)      (THIS_ const char* pName, IHXBuffer* pVal);
  114.     STDMETHOD(GetPropertyCString)      (THIS_ const char* pName, REF(IHXBuffer*) rpVal);
  115.     STDMETHOD(GetFirstPropertyCString) (THIS_ REF(const char*) rpName, REF(IHXBuffer*) rpVal);
  116.     STDMETHOD(GetNextPropertyCString)  (THIS_ REF(const char*) rpName, REF(IHXBuffer*) rpVal);
  117.     // IHXUpdateProperties methods
  118.     STDMETHOD(UpdatePacketTimeOffset)  (THIS_ INT32 lTimeOffset);
  119.     STDMETHOD(UpdatePlayTimes)        (THIS_
  120.         IHXValues* pProps);
  121.     // PXCallbackResponse methods
  122.     STDMETHOD(HandleCallback) (THIS_ UINT32 ulSchedulerTime, UINT32 ulInstance);
  123.     // PXClientAdviseSinkResponse methods
  124.     STDMETHOD(CASOnPosLength)          (THIS_ UINT32 ulPosition, UINT32 ulLength);
  125.     STDMETHOD(CASOnPresentationOpened) (THIS);
  126.     STDMETHOD(CASOnPresentationClosed) (THIS);
  127.     STDMETHOD(CASOnStatisticsChanged)  (THIS);
  128.     STDMETHOD(CASOnPreSeek)            (THIS_ ULONG32 ulOldTime, ULONG32 ulNewTime);
  129.     STDMETHOD(CASOnPostSeek)           (THIS_ ULONG32 ulOldTime, ULONG32 ulNewTime);
  130.     STDMETHOD(CASOnStop)               (THIS);
  131.     STDMETHOD(CASOnPause)              (THIS_ ULONG32 ulTime);
  132.     STDMETHOD(CASOnBegin)              (THIS_ ULONG32 ulTime);
  133.     STDMETHOD(CASOnBuffering)          (THIS_ ULONG32 ulFlags, UINT16 unPercentComplete);
  134.     STDMETHOD(CASOnContacting)         (THIS_ const char* pHostName);
  135.     // CGIFRenderer methods
  136.     void      HandleClick();
  137.     void      DrawToRMASurface(IHXVideoSurface* pVideoSurface, UINT32 ulX, UINT32 ulY, const HXxSize &size);
  138.     HX_RESULT RMASurfaceUpdate2(IHXSubRectVideoSurface* pSurface,
  139.                                 HXxRect*                 pExtents,
  140.                                 HXxBoxRegion*              pDirtyRegion);
  141.     HX_RESULT UpdateDisplay(UINT32 ulTime);
  142.     // CGIFRenderer static public methods
  143.     static HX_RESULT STDAPICALLTYPE HXCreateInstance(IUnknown** ppIUnknown);
  144. protected:
  145.     enum
  146.     {
  147.         kCallbackInterval      = 30,
  148.         kMinCallbackInterval   = 20,
  149.         kNotFinishedInterval   = 100,
  150.         kTargetBrowser         = 0,
  151.         kTargetPlayer          = 1
  152.     };
  153.     INT32                              m_lRefCount;
  154.     IUnknown*                          m_pContext;
  155.     IHXStream*                        m_pStream;
  156.     HXxSize                            m_cSize;
  157.     IHXMultiInstanceSiteUserSupplier* m_pMISUS;
  158.     IHXSite*                          m_pMISUSSite;
  159.     IHXCommonClassFactory*            m_pCommonClassFactory;
  160.     IHXHyperNavigate*                 m_pHyperNavigate;
  161.     CGIFCodec*                         m_pGIFCodec;
  162.     UINT32                             m_ulBitsPerPixel;
  163.     UINT32                             m_ulBytesPerPixel;
  164.     UINT32                             m_ulPadWidth;
  165.     UINT32                             m_ulCurImg;
  166.     UINT32                             m_ulCurImgRenderTime;
  167.     UINT32                             m_ulCurDelayTime;
  168.     UINT32                             m_ulDataWidth;
  169.     IHXBuffer*                        m_pOutputBuffer;
  170.     BYTE                               m_ucTarget;
  171.     GString                            m_cURL;
  172.     UINT32                             m_ulBackgroundColor;
  173.     IHXScheduler*                     m_pScheduler;
  174.     UINT32                             m_ulLoopsDone;
  175.     IHXStatusMessage*                 m_pStatusMessage;
  176.     INT16                              m_sOldMouseX;
  177.     INT16                              m_sOldMouseY;
  178.     INT32                              m_lLastImg;
  179.     IHXErrorMessages*                 m_pErrorMessages;
  180. #if defined(_WINDOWS)
  181.     HCURSOR                            m_hPreHyperlinkCursor;
  182.     HCURSOR                            m_hHyperlinkCursor;
  183. #elif defined(_MACINTOSH)
  184.     CursHandle                         m_hHyperlinkCursor;
  185.     typedef enum
  186.     {
  187.         CURSOR_ARROW,
  188.         CURSOR_HYPERLINK
  189.     }
  190.     CursorShapes;
  191.     CursorShapes                       m_eCurrentCursor;
  192.     CResourceLoader*                   m_pResourceLoader;
  193. #elif defined(_UNIX) && defined(USE_XWINDOWS)
  194.     Cursor                              m_hHyperlinkCursor;
  195.     Cursor                              m_hCurrentCursor;
  196.     Display*                            m_pDisplay;          
  197.     Window                              m_Window;
  198. #endif
  199.     IHXBuffer*                        m_pStreamHeaderBuffer;
  200.     UINT32                             m_ulStreamHeaderOffset;
  201.     PXCallback*                        m_pCallback;
  202.     UINT32                             m_ulRendererFlags;
  203.     UINT32                             m_ulWidth;
  204.     UINT32                             m_ulHeight;
  205.     IHXValues*                        m_pValues;
  206.     UINT32                             m_ulBackgroundOpacity;
  207.     UINT32                             m_ulMediaOpacity;
  208.     UINT32                             m_ulMediaChromaKey;
  209.     UINT32                             m_ulMediaChromaKeyTolerance;
  210.     UINT32                             m_ulMediaChromaKeyOpacity;
  211.     INT32                              m_lTimeOffset;
  212.     HXTimeval                         m_tSchedulerTimeBase;
  213.     UINT32                             m_ulTimeAtSchedulerTimeBase;
  214.     UINT32                             m_ulCurFrameIndex;
  215.     PXClientAdviseSink*                m_pClientAdviseSink;
  216.     UINT32                             m_ulEndTime;
  217.     // ONLY HX_BITFIELD MEMBERS SHOULD GO BELOW THIS LINE!
  218.     // ALL OTHER MEMBER TYPES SHOULD GO ABOVE THIS LINE!
  219.     HX_BITFIELD                        m_bRowsInverted : 1;
  220.     HX_BITFIELD                        m_bRGBOrdering : 1;
  221.     HX_BITFIELD                        m_bDecompressFinished : 1;
  222.     HX_BITFIELD                        m_bSetHyperlinkCursor : 1;
  223.     HX_BITFIELD                        m_bStatusMsgWillNeedErasing : 1;
  224.     HX_BITFIELD                        m_bFirstTimeSync : 1;
  225.     HX_BITFIELD                        m_bFirstDraw : 1;
  226.     HX_BITFIELD                        m_bSiteAttached : 1;
  227.     HX_BITFIELD                        m_bIgnorePackets : 1;
  228.     HX_BITFIELD                        m_bImageBombed : 1;
  229.     HX_BITFIELD                        m_bMediaChromaKeySpecified : 1;
  230.     HX_BITFIELD                        m_bUsesAlphaChannel : 1;
  231.     HX_BITFIELD                        m_bPreserveMediaRepeat : 1;
  232.     HX_BITFIELD                        m_bPaused : 1;
  233.     HX_BITFIELD                        m_bNoNativeSize : 1;
  234.     HX_BITFIELD                        m_bCanBltSubRects : 1;
  235.     static const char* const           m_pszName;
  236.     static const char* const           m_pszDescription;
  237.     static const char* const           m_pszCopyright;
  238.     static const char* const           m_pszMoreInfoURL;
  239.     static const char* const           m_ppszStreamMimeType[];
  240.     static const UINT32                m_ulHighestSupportedContentVersion;
  241.     static const UINT32                m_ulHighestSupportedStreamVersion;
  242.     HX_RESULT                          GetCurrentMousePos(INT16& rsXPos, INT16& rsYPos);
  243.     void                               OnMouseMove(INT16 fwKeys, INT16 xPos, INT16 yPos);
  244.     HX_RESULT                          CopyBombImage();
  245.     void                               DrawBackgroundColor();
  246.     UINT32                             GetCycleTime();
  247.     UINT32                             GetNextFrameTime(UINT32 ulTime);
  248.     UINT32                             GetTimevalDiff(HXTimeval t1, HXTimeval t2);
  249.     void                               DamageFrameRect(UINT32 i);
  250. };
  251. #endif