RealMediaGraph.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 "BaseGraph.h"
00025 
00026 #include "DX7AllocatorPresenter.h"
00027 #include "DX9AllocatorPresenter.h"
00028 
00029 #include "..\..\..\include\RealMedia\pntypes.h"
00030 #include "..\..\..\include\RealMedia\pnwintyp.h"
00031 #include "..\..\..\include\RealMedia\pncom.h"
00032 #include "..\..\..\include\RealMedia\rmapckts.h"
00033 #include "..\..\..\include\RealMedia\rmacomm.h"
00034 #include "..\..\..\include\RealMedia\rmamon.h"
00035 #include "..\..\..\include\RealMedia\rmafiles.h"
00036 #include "..\..\..\include\RealMedia\rmaengin.h"
00037 #include "..\..\..\include\RealMedia\rmacore.h"
00038 #include "..\..\..\include\RealMedia\rmaclsnk.h"
00039 #include "..\..\..\include\RealMedia\rmaerror.h"
00040 #include "..\..\..\include\RealMedia\rmaauth.h"
00041 #include "..\..\..\include\RealMedia\rmawin.h"
00042 #include "..\..\..\include\RealMedia\rmasite2.h"
00043 #include "..\..\..\include\RealMedia\rmaausvc.h"
00044 #include "..\..\..\include\RealMedia\rmavsurf.h"
00045 
00046 namespace DSObjects
00047 {
00048 
00049 class CRealMediaGraph;
00050 
00051 class CRealMediaPlayer
00052         : public CUnknown
00053         , public IRMAErrorSink
00054         , public IRMAClientAdviseSink
00055         , public IRMAAuthenticationManager
00056         , public IRMASiteSupplier
00057         , public IRMAPassiveSiteWatcher
00058         , public IRMAAudioHook
00059 
00060 {
00061 protected:
00062         friend class CRealMediaGraph;
00063         CRealMediaGraph* m_pRMG; // IMPORTANT: do not ever AddRef on this from here
00064 
00065         HWND m_hWndParent;
00066         CSize m_VideoSize;
00067         bool m_fVideoSizeChanged;
00068 
00069         //
00070 
00071         DWORD m_wndStyle;
00072         CPlayerWindow m_wndWindowFrame, m_wndDestFrame;
00073 
00074         //
00075 
00076         FPRMCREATEENGINE                m_fpCreateEngine;
00077         FPRMCLOSEENGINE                 m_fpCloseEngine;
00078         FPRMSETDLLACCESSPATH    m_fpSetDLLAccessPath;
00079         HMODULE                                 m_hRealMediaCore;
00080 
00081         CComPtr<IRMAClientEngine> m_pEngine;
00082     CComPtr<IRMAPlayer> m_pPlayer;
00083         CComQIPtr<IRMAAudioPlayer, &IID_IRMAAudioPlayer> m_pAudioPlayer;
00084         CComPtr<IRMAVolume> m_pVolume;
00085     CComQIPtr<IRMASiteManager, &IID_IRMASiteManager> m_pSiteManager;
00086     CComQIPtr<IRMACommonClassFactory, &IID_IRMACommonClassFactory> m_pCommonClassFactory;
00087 
00088         CComQIPtr<IRMASite, &IID_IRMASite> m_pTheSite;
00089         CComQIPtr<IRMASite2, &IID_IRMASite2> m_pTheSite2;
00090         CMap<UINT32, UINT32&, IRMASite*, IRMASite*&> m_CreatedSites;
00091 
00092         //
00093 
00094         OAFilterState m_State, m_UserState;
00095         REFERENCE_TIME m_nCurrent, m_nDuration;
00096 
00097         UINT16 m_unPercentComplete;
00098 
00099         //
00100 
00101 public:
00102         CRealMediaPlayer(HWND hWndParent, CRealMediaGraph* pRMG);
00103         virtual ~CRealMediaPlayer();
00104 
00105     DECLARE_IUNKNOWN;
00106     STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
00107 
00108         bool Init();
00109         void Deinit();
00110 
00111         virtual CSize GetVideoSize() {return(m_VideoSize);}
00112         virtual void SetWindowRect(CRect r) {}
00113         virtual void SetDestRect(CRect r) {}
00114         virtual bool CreateSite(IRMASite** pSite) = 0;
00115         virtual void DestroySite(IRMASite* pSite) = 0;
00116 
00117         // IRMAErrorSink
00118     STDMETHODIMP ErrorOccurred(const UINT8 unSeverity, const UINT32 ulRMACode, const UINT32 ulUserCode, const char* pUserString, const char* pMoreInfoURL);
00119 
00120     // IRMAClientAdviseSink
00121     STDMETHODIMP OnPosLength(UINT32 ulPosition, UINT32 ulLength);
00122     STDMETHODIMP OnPresentationOpened();
00123     STDMETHODIMP OnPresentationClosed();
00124     STDMETHODIMP OnStatisticsChanged();
00125     STDMETHODIMP OnPreSeek(UINT32 ulOldTime, UINT32 ulNewTime);
00126     STDMETHODIMP OnPostSeek(UINT32 ulOldTime, UINT32 ulNewTime);
00127     STDMETHODIMP OnStop();
00128     STDMETHODIMP OnPause(UINT32 ulTime);
00129     STDMETHODIMP OnBegin(UINT32 ulTime);
00130     STDMETHODIMP OnBuffering(UINT32 ulFlags, UINT16 unPercentComplete);
00131     STDMETHODIMP OnContacting(const char* pHostName);
00132 
00133         // IRMAAuthenticationManager
00134     STDMETHODIMP HandleAuthenticationRequest(IRMAAuthenticationManagerResponse* pResponse);
00135 
00136         // IRMASiteSupplier
00137     STDMETHODIMP SitesNeeded(UINT32 uRequestID, IRMAValues* pSiteProps);
00138     STDMETHODIMP SitesNotNeeded(UINT32 uRequestID);
00139     STDMETHODIMP BeginChangeLayout();
00140     STDMETHODIMP DoneChangeLayout();
00141 
00142         // IRMAPassiveSiteWatcher
00143     STDMETHODIMP PositionChanged(PNxPoint* pos);
00144         STDMETHODIMP SizeChanged(PNxSize* size);
00145 
00146         // IRMAAudioHook
00147         STDMETHODIMP OnBuffer(RMAAudioData* pAudioInData, RMAAudioData* pAudioOutData);
00148         STDMETHODIMP OnInit(RMAAudioFormat* pFormat);
00149 };
00150 
00151 class CRealMediaPlayerWindowed
00152         : public CRealMediaPlayer
00153 {
00154 public:
00155         CRealMediaPlayerWindowed(HWND hWndParent, CRealMediaGraph* pRMG);
00156         virtual ~CRealMediaPlayerWindowed();
00157 
00158         void SetWindowRect(CRect r);
00159         void SetDestRect(CRect r);
00160 
00161         bool CreateSite(IRMASite** pSite);
00162         void DestroySite(IRMASite* pSite);
00163 };
00164 
00165 class CRealMediaPlayerWindowless
00166         : public CRealMediaPlayer
00167 {
00168         CComPtr<ISubPicAllocatorPresenter> m_pRMAP;
00169 
00170 public:
00171         CRealMediaPlayerWindowless(HWND hWndParent, CRealMediaGraph* pRMG);
00172         virtual ~CRealMediaPlayerWindowless();
00173 
00174     STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
00175 
00176         bool CreateSite(IRMASite** pSite);
00177         void DestroySite(IRMASite* pSite);
00178 
00179         STDMETHODIMP SizeChanged(PNxSize* size);
00180 };
00181 
00182 class CRealMediaGraph : public CBaseGraph
00183 {
00184         CRealMediaPlayer* m_pRMP; // TODO: access m_pRMP through a private interface
00185 
00186 public:
00187         CRealMediaGraph(HWND hWndParent, HRESULT& hr); // in windowless mode IVideoWindow::* will return E_NOTIMPL, use ISubPicAllocatorPresenter instead
00188         virtual ~CRealMediaGraph();
00189 
00190     DECLARE_IUNKNOWN;
00191     STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
00192 
00193 protected:
00194         // IGraphBuilder
00195     STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList);
00196 
00197         // IMediaControl
00198     STDMETHODIMP Run();
00199     STDMETHODIMP Pause();
00200     STDMETHODIMP Stop();
00201         STDMETHODIMP GetState(LONG msTimeout, OAFilterState* pfs);
00202 
00203         // IMediaSeeking
00204         STDMETHODIMP GetDuration(LONGLONG* pDuration);
00205         STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
00206         STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
00207 
00208         // IVideoWindow
00209     STDMETHODIMP SetWindowPosition(long Left, long Top, long Width, long Height);
00210 
00211         // IBasicVideo
00212     STDMETHODIMP SetDestinationPosition(long Left, long Top, long Width, long Height);
00213     STDMETHODIMP GetVideoSize(long* pWidth, long* pHeight);
00214 
00215         // IBasicAudio
00216     STDMETHODIMP put_Volume(long lVolume);
00217     STDMETHODIMP get_Volume(long* plVolume);
00218 
00219         // IAMOpenProgress
00220         STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent);
00221 
00222         // IGraphEngine
00223         STDMETHODIMP_(engine_t) GetEngine();
00224 };
00225 
00226 }
00227 using namespace DSObjects;

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