RealMediaWindowlessSite.h

00001 /* 
00002  *      Copyright (C) 2003-2005 Gabest
00003  *      http://www.gabest.org
00004  *
00005  *  This Program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2, or (at your option)
00008  *  any later version.
00009  *   
00010  *  This Program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013  *  GNU General Public License for more details.
00014  *   
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with GNU Make; see the file COPYING.  If not, write to
00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
00018  *  http://www.gnu.org/copyleft/gpl.html
00019  *
00020  */
00021 
00022 #pragma once
00023 
00024 #include "..\..\..\include\RealMedia\pntypes.h"
00025 #include "..\..\..\include\RealMedia\pnwintyp.h"
00026 #include "..\..\..\include\RealMedia\pncom.h"
00027 #include "..\..\..\include\RealMedia\rmapckts.h"
00028 #include "..\..\..\include\RealMedia\rmacomm.h"
00029 #include "..\..\..\include\RealMedia\rmamon.h"
00030 #include "..\..\..\include\RealMedia\rmafiles.h"
00031 #include "..\..\..\include\RealMedia\rmaengin.h"
00032 #include "..\..\..\include\RealMedia\rmacore.h"
00033 #include "..\..\..\include\RealMedia\rmaclsnk.h"
00034 #include "..\..\..\include\RealMedia\rmaerror.h"
00035 #include "..\..\..\include\RealMedia\rmaauth.h"
00036 #include "..\..\..\include\RealMedia\rmawin.h"
00037 #include "..\..\..\include\RealMedia\rmasite2.h"
00038 #include "..\..\..\include\RealMedia\rmaausvc.h"
00039 #include "..\..\..\include\RealMedia\rmavsurf.h"
00040 #include "..\..\..\include\RealMedia\rmaevent.h"
00041 
00042 namespace DSObjects
00043 {
00044 
00045 struct REGION
00046 {
00047         REGION() : rects(0), pOSRegion(0) {}
00048         long size;
00049         long numRects;
00050         PNxRect* rects;
00051         PNxRect extents;
00052         void* pOSRegion;
00053 };
00054 
00055 void ExtractRects(REGION* pRegion);
00056 REGION* RMACreateRectRegion(int left, int top, int right, int bottom);
00057 void RMASubtractRegion(REGION* regM, REGION* regS, REGION* regD);
00058 void RMAUnionRegion(REGION* reg1, REGION* reg2, REGION* regD);
00059 void RMAIntersectRegion(REGION* reg1, REGION* reg2, REGION* regD);
00060 BOOL RMAEqualRegion(REGION* reg1, REGION* reg2);
00061 void RMADestroyRegion(REGION* reg);
00062 REGION* RMACreateRegion();
00063 
00064 class CRealMediaWindowlessSite;
00065 
00066 //
00067 // CRealMediaVideoSurface
00068 //
00069 
00070 class CRealMediaWindowlessSite;
00071 
00072 class CRealMediaVideoSurface
00073         : public CUnknown
00074         , public IRMAVideoSurface
00075 {
00076     void IntersectRect(PNxRect* pRect, PNxRect* pBox, PNxRect* pRetVal);
00077 
00078 protected:
00079     CComPtr<IUnknown> m_pContext;
00080     CRealMediaWindowlessSite* m_pSiteWindowless;
00081     RMABitmapInfoHeader m_bitmapInfo;
00082     RMABitmapInfoHeader m_lastBitmapInfo;
00083 
00084 public:
00085     CRealMediaVideoSurface(IUnknown* pContext, CRealMediaWindowlessSite* pSiteWindowless);
00086     virtual ~CRealMediaVideoSurface();
00087 
00088     DECLARE_IUNKNOWN;
00089     STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
00090 
00091         // IRMAVideoSurface
00092 
00093         STDMETHODIMP Blt(UCHAR* /*IN*/ pImageData, RMABitmapInfoHeader* /*IN*/ pBitmapInfo, REF(PNxRect) /*IN*/ inDestRect, REF(PNxRect) /*IN*/ inSrcRect);
00094         STDMETHODIMP BeginOptimizedBlt(RMABitmapInfoHeader* /*IN*/ pBitmapInfo);
00095         STDMETHODIMP OptimizedBlt(UCHAR* /*IN*/ pImageBits, REF(PNxRect) /*IN*/ rDestRect, REF(PNxRect) /*IN*/ rSrcRect);
00096         STDMETHODIMP EndOptimizedBlt();
00097         STDMETHODIMP GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
00098     STDMETHODIMP GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
00099 };
00100 
00101 //
00102 // CRealMediaWindowlessSite
00103 //
00104 
00105 class CRealMediaWindowlessSite
00106         : public CUnknown
00107         , public IRMASite
00108         , public IRMASite2
00109         , public IRMASiteWindowless
00110         , public IRMAVideoSurface
00111 {
00112         CComQIPtr<IRMACommonClassFactory, &IID_IRMACommonClassFactory> m_pCCF;
00113     CComPtr<IUnknown> m_pContext;
00114     CComPtr<IRMAValues> m_pValues;
00115 
00116     CComPtr<IRMASiteUser> m_pUser;
00117 
00118         CRealMediaWindowlessSite* m_pParentSite;
00119         CInterfaceList<IRMASite, &IID_IRMASite> m_pChildren;
00120 
00121     CComPtr<IRMASiteWatcher> m_pWatcher;
00122         CInterfaceList<IRMAPassiveSiteWatcher, &IID_IRMAPassiveSiteWatcher> m_pPassiveWatchers;
00123 
00124     PNxSize m_size;
00125     PNxPoint m_position;
00126         bool m_fDamaged, m_fInRedraw, m_fIsVisible;
00127         INT32 m_lZOrder;
00128 
00129         //
00130 
00131     REGION* m_pRegion;
00132     REGION* m_pRegionWithoutChildren;
00133 
00134         void RecomputeRegion();
00135         void InternalRecomputeRegion();
00136         void ComputeRegion();
00137         void SubtractSite(REGION* pRegion);
00138 
00139         void UpdateZOrder(CRealMediaWindowlessSite* pUpdatedChildSite, INT32 lOldZOrder, INT32 lNewZOrder);
00140     void SetInternalZOrder(INT32 lZOrder);
00141 
00142 public:
00143         CRealMediaWindowlessSite(HRESULT& hr, IUnknown* pContext, CRealMediaWindowlessSite* pParentSite = NULL, IUnknown* pUnkOuter = NULL);
00144         virtual ~CRealMediaWindowlessSite();
00145 
00146     DECLARE_IUNKNOWN;
00147     STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
00148 
00149         void GetTopLeft(PNxPoint* pPoint);
00150     REGION* GetRegion();
00151 
00152     // IRMASiteWindowless
00153 
00154     STDMETHODIMP EventOccurred(PNxEvent* /*IN*/ pEvent);
00155     STDMETHODIMP_(PNxWindow*) GetParentWindow();
00156 
00157     // IRMASite
00158 
00159     STDMETHODIMP AttachUser(IRMASiteUser* /*IN*/ pUser);
00160     STDMETHODIMP DetachUser();
00161     STDMETHODIMP GetUser(REF(IRMASiteUser*) /*OUT*/ pUser);
00162 
00163     STDMETHODIMP CreateChild(REF(IRMASite*) /*OUT*/ pChildSite);
00164         STDMETHODIMP DestroyChild(IRMASite* /*IN*/ pChildSite);
00165 
00166     STDMETHODIMP AttachWatcher(IRMASiteWatcher* /*IN*/ pWatcher);
00167     STDMETHODIMP DetachWatcher();
00168 
00169     STDMETHODIMP SetPosition(PNxPoint position);
00170     STDMETHODIMP GetPosition(REF(PNxPoint) position);
00171         STDMETHODIMP SetSize(PNxSize size);
00172     STDMETHODIMP GetSize(REF(PNxSize) size);
00173 
00174     STDMETHODIMP DamageRect(PNxRect rect);
00175     STDMETHODIMP DamageRegion(PNxRegion region);
00176     STDMETHODIMP ForceRedraw();
00177 
00178         // IRMASite2
00179 
00180         STDMETHODIMP UpdateSiteWindow(PNxWindow* /*IN*/ pWindow);
00181     STDMETHODIMP ShowSite(BOOL bShow);
00182         STDMETHODIMP_(BOOL) IsSiteVisible();
00183     STDMETHODIMP SetZOrder(INT32 lZOrder);
00184     STDMETHODIMP GetZOrder(REF(INT32) lZOrder);
00185     STDMETHODIMP MoveSiteToTop();
00186         STDMETHODIMP GetVideoSurface(REF(IRMAVideoSurface*) pSurface);
00187     STDMETHODIMP_(UINT32) GetNumberOfChildSites();
00188 
00189     STDMETHODIMP AddPassiveSiteWatcher(IRMAPassiveSiteWatcher* pWatcher);
00190     STDMETHODIMP RemovePassiveSiteWatcher(IRMAPassiveSiteWatcher* pWatcher);
00191 
00192         STDMETHODIMP SetCursor(PNxCursor cursor, REF(PNxCursor) oldCursor);
00193 
00194 private:
00195     void IntersectRect(PNxRect* pRect, PNxRect* pBox, PNxRect* pRetVal);
00196 
00197 protected:
00198     RMABitmapInfoHeader m_bitmapInfo;
00199     RMABitmapInfoHeader m_lastBitmapInfo;
00200 
00201         CComPtr<IRMAVideoSurface> m_pBltService;
00202 
00203 public:
00204     bool GetBltService(IRMAVideoSurface** ppBltService);
00205     void SetBltService(IRMAVideoSurface* ppBltService);
00206 
00207         // IRMAVideoSurface
00208 
00209         STDMETHODIMP Blt(UCHAR* /*IN*/ pImageData, RMABitmapInfoHeader* /*IN*/ pBitmapInfo, REF(PNxRect) /*IN*/ inDestRect, REF(PNxRect) /*IN*/ inSrcRect);
00210         STDMETHODIMP BeginOptimizedBlt(RMABitmapInfoHeader* /*IN*/ pBitmapInfo);
00211         STDMETHODIMP OptimizedBlt(UCHAR* /*IN*/ pImageBits, REF(PNxRect) /*IN*/ rDestRect, REF(PNxRect) /*IN*/ rSrcRect);
00212         STDMETHODIMP EndOptimizedBlt();
00213         STDMETHODIMP GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
00214     STDMETHODIMP GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
00215 };
00216 
00217 }
00218 using namespace DSObjects;

Generated on Tue Dec 13 14:47:03 2005 for guliverkli by  doxygen 1.4.5