RealMediaWindowlessSite.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:7k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /* 
  2.  * Copyright (C) 2003-2005 Gabest
  3.  * http://www.gabest.org
  4.  *
  5.  *  This Program is free software; you can redistribute it and/or modify
  6.  *  it under the terms of the GNU General Public License as published by
  7.  *  the Free Software Foundation; either version 2, or (at your option)
  8.  *  any later version.
  9.  *   
  10.  *  This Program is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13.  *  GNU General Public License for more details.
  14.  *   
  15.  *  You should have received a copy of the GNU General Public License
  16.  *  along with GNU Make; see the file COPYING.  If not, write to
  17.  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  18.  *  http://www.gnu.org/copyleft/gpl.html
  19.  *
  20.  */
  21. #pragma once
  22. #include "......includeRealMediapntypes.h"
  23. #include "......includeRealMediapnwintyp.h"
  24. #include "......includeRealMediapncom.h"
  25. #include "......includeRealMediarmapckts.h"
  26. #include "......includeRealMediarmacomm.h"
  27. #include "......includeRealMediarmamon.h"
  28. #include "......includeRealMediarmafiles.h"
  29. #include "......includeRealMediarmaengin.h"
  30. #include "......includeRealMediarmacore.h"
  31. #include "......includeRealMediarmaclsnk.h"
  32. #include "......includeRealMediarmaerror.h"
  33. #include "......includeRealMediarmaauth.h"
  34. #include "......includeRealMediarmawin.h"
  35. #include "......includeRealMediarmasite2.h"
  36. #include "......includeRealMediarmaausvc.h"
  37. #include "......includeRealMediarmavsurf.h"
  38. #include "......includeRealMediarmaevent.h"
  39. namespace DSObjects
  40. {
  41. struct REGION
  42. {
  43. REGION() : rects(0), pOSRegion(0) {}
  44. long size;
  45. long numRects;
  46. PNxRect* rects;
  47. PNxRect extents;
  48. void* pOSRegion;
  49. };
  50. void ExtractRects(REGION* pRegion);
  51. REGION* RMACreateRectRegion(int left, int top, int right, int bottom);
  52. void RMASubtractRegion(REGION* regM, REGION* regS, REGION* regD);
  53. void RMAUnionRegion(REGION* reg1, REGION* reg2, REGION* regD);
  54. void RMAIntersectRegion(REGION* reg1, REGION* reg2, REGION* regD);
  55. BOOL RMAEqualRegion(REGION* reg1, REGION* reg2);
  56. void RMADestroyRegion(REGION* reg);
  57. REGION* RMACreateRegion();
  58. class CRealMediaWindowlessSite;
  59. //
  60. // CRealMediaVideoSurface
  61. //
  62. class CRealMediaWindowlessSite;
  63. class CRealMediaVideoSurface
  64. : public CUnknown
  65. , public IRMAVideoSurface
  66. {
  67.     void IntersectRect(PNxRect* pRect, PNxRect* pBox, PNxRect* pRetVal);
  68. protected:
  69.     CComPtr<IUnknown> m_pContext;
  70.     CRealMediaWindowlessSite* m_pSiteWindowless;
  71.     RMABitmapInfoHeader m_bitmapInfo;
  72.     RMABitmapInfoHeader m_lastBitmapInfo;
  73. public:
  74.     CRealMediaVideoSurface(IUnknown* pContext, CRealMediaWindowlessSite* pSiteWindowless);
  75.     virtual ~CRealMediaVideoSurface();
  76.     DECLARE_IUNKNOWN;
  77.     STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
  78. // IRMAVideoSurface
  79. STDMETHODIMP Blt(UCHAR* /*IN*/ pImageData, RMABitmapInfoHeader* /*IN*/ pBitmapInfo, REF(PNxRect) /*IN*/ inDestRect, REF(PNxRect) /*IN*/ inSrcRect);
  80. STDMETHODIMP BeginOptimizedBlt(RMABitmapInfoHeader* /*IN*/ pBitmapInfo);
  81. STDMETHODIMP OptimizedBlt(UCHAR* /*IN*/ pImageBits, REF(PNxRect) /*IN*/ rDestRect, REF(PNxRect) /*IN*/ rSrcRect);
  82. STDMETHODIMP EndOptimizedBlt();
  83. STDMETHODIMP GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
  84.     STDMETHODIMP GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
  85. };
  86. //
  87. // CRealMediaWindowlessSite
  88. //
  89. class CRealMediaWindowlessSite
  90. : public CUnknown
  91. , public IRMASite
  92. , public IRMASite2
  93. , public IRMASiteWindowless
  94. , public IRMAVideoSurface
  95. {
  96. CComQIPtr<IRMACommonClassFactory, &IID_IRMACommonClassFactory> m_pCCF;
  97.     CComPtr<IUnknown> m_pContext;
  98.     CComPtr<IRMAValues> m_pValues;
  99.     CComPtr<IRMASiteUser> m_pUser;
  100. CRealMediaWindowlessSite* m_pParentSite;
  101. CInterfaceList<IRMASite, &IID_IRMASite> m_pChildren;
  102.     CComPtr<IRMASiteWatcher> m_pWatcher;
  103. CInterfaceList<IRMAPassiveSiteWatcher, &IID_IRMAPassiveSiteWatcher> m_pPassiveWatchers;
  104.     PNxSize m_size;
  105.     PNxPoint m_position;
  106. bool m_fDamaged, m_fInRedraw, m_fIsVisible;
  107. INT32 m_lZOrder;
  108. //
  109.     REGION* m_pRegion;
  110.     REGION* m_pRegionWithoutChildren;
  111. void RecomputeRegion();
  112. void InternalRecomputeRegion();
  113. void ComputeRegion();
  114. void SubtractSite(REGION* pRegion);
  115. void UpdateZOrder(CRealMediaWindowlessSite* pUpdatedChildSite, INT32 lOldZOrder, INT32 lNewZOrder);
  116.     void SetInternalZOrder(INT32 lZOrder);
  117. public:
  118. CRealMediaWindowlessSite(HRESULT& hr, IUnknown* pContext, CRealMediaWindowlessSite* pParentSite = NULL, IUnknown* pUnkOuter = NULL);
  119. virtual ~CRealMediaWindowlessSite();
  120.     DECLARE_IUNKNOWN;
  121.     STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
  122. void GetTopLeft(PNxPoint* pPoint);
  123.     REGION* GetRegion();
  124.     // IRMASiteWindowless
  125.     STDMETHODIMP EventOccurred(PNxEvent* /*IN*/ pEvent);
  126.     STDMETHODIMP_(PNxWindow*) GetParentWindow();
  127.     // IRMASite
  128.     STDMETHODIMP AttachUser(IRMASiteUser* /*IN*/ pUser);
  129.     STDMETHODIMP DetachUser();
  130.     STDMETHODIMP GetUser(REF(IRMASiteUser*) /*OUT*/ pUser);
  131.     STDMETHODIMP CreateChild(REF(IRMASite*) /*OUT*/ pChildSite);
  132. STDMETHODIMP DestroyChild(IRMASite* /*IN*/ pChildSite);
  133.     STDMETHODIMP AttachWatcher(IRMASiteWatcher* /*IN*/ pWatcher);
  134.     STDMETHODIMP DetachWatcher();
  135.     STDMETHODIMP SetPosition(PNxPoint position);
  136.     STDMETHODIMP GetPosition(REF(PNxPoint) position);
  137. STDMETHODIMP SetSize(PNxSize size);
  138.     STDMETHODIMP GetSize(REF(PNxSize) size);
  139.     STDMETHODIMP DamageRect(PNxRect rect);
  140.     STDMETHODIMP DamageRegion(PNxRegion region);
  141.     STDMETHODIMP ForceRedraw();
  142. // IRMASite2
  143. STDMETHODIMP UpdateSiteWindow(PNxWindow* /*IN*/ pWindow);
  144.     STDMETHODIMP ShowSite(BOOL bShow);
  145. STDMETHODIMP_(BOOL) IsSiteVisible();
  146.     STDMETHODIMP SetZOrder(INT32 lZOrder);
  147.     STDMETHODIMP GetZOrder(REF(INT32) lZOrder);
  148.     STDMETHODIMP MoveSiteToTop();
  149. STDMETHODIMP GetVideoSurface(REF(IRMAVideoSurface*) pSurface);
  150.     STDMETHODIMP_(UINT32) GetNumberOfChildSites();
  151.     STDMETHODIMP AddPassiveSiteWatcher(IRMAPassiveSiteWatcher* pWatcher);
  152.     STDMETHODIMP RemovePassiveSiteWatcher(IRMAPassiveSiteWatcher* pWatcher);
  153. STDMETHODIMP SetCursor(PNxCursor cursor, REF(PNxCursor) oldCursor);
  154. private:
  155.     void IntersectRect(PNxRect* pRect, PNxRect* pBox, PNxRect* pRetVal);
  156. protected:
  157.     RMABitmapInfoHeader m_bitmapInfo;
  158.     RMABitmapInfoHeader m_lastBitmapInfo;
  159. CComPtr<IRMAVideoSurface> m_pBltService;
  160. public:
  161.     bool GetBltService(IRMAVideoSurface** ppBltService);
  162.     void SetBltService(IRMAVideoSurface* ppBltService);
  163. // IRMAVideoSurface
  164. STDMETHODIMP Blt(UCHAR* /*IN*/ pImageData, RMABitmapInfoHeader* /*IN*/ pBitmapInfo, REF(PNxRect) /*IN*/ inDestRect, REF(PNxRect) /*IN*/ inSrcRect);
  165. STDMETHODIMP BeginOptimizedBlt(RMABitmapInfoHeader* /*IN*/ pBitmapInfo);
  166. STDMETHODIMP OptimizedBlt(UCHAR* /*IN*/ pImageBits, REF(PNxRect) /*IN*/ rDestRect, REF(PNxRect) /*IN*/ rSrcRect);
  167. STDMETHODIMP EndOptimizedBlt();
  168. STDMETHODIMP GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
  169.     STDMETHODIMP GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
  170. };
  171. }
  172. using namespace DSObjects;