2 * Copyright (C) 2003-2006 Gabest
3 * http://www.gabest.org
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)
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.
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
24 #include "BaseGraph.h"
26 #include "DX7AllocatorPresenter.h"
27 #include "DX9AllocatorPresenter.h"
29 #include "..\..\..\include\RealMedia\pntypes.h"
30 #include "..\..\..\include\RealMedia\pnwintyp.h"
31 #include "..\..\..\include\RealMedia\pncom.h"
32 #include "..\..\..\include\RealMedia\rmapckts.h"
33 #include "..\..\..\include\RealMedia\rmacomm.h"
34 #include "..\..\..\include\RealMedia\rmamon.h"
35 #include "..\..\..\include\RealMedia\rmafiles.h"
36 #include "..\..\..\include\RealMedia\rmaengin.h"
37 #include "..\..\..\include\RealMedia\rmacore.h"
38 #include "..\..\..\include\RealMedia\rmaclsnk.h"
39 #include "..\..\..\include\RealMedia\rmaerror.h"
40 #include "..\..\..\include\RealMedia\rmaauth.h"
41 #include "..\..\..\include\RealMedia\rmawin.h"
42 #include "..\..\..\include\RealMedia\rmasite2.h"
43 #include "..\..\..\include\RealMedia\rmaausvc.h"
44 #include "..\..\..\include\RealMedia\rmavsurf.h"
49 class CRealMediaGraph
;
51 class CRealMediaPlayer
53 , public IRMAErrorSink
54 , public IRMAClientAdviseSink
55 , public IRMAAuthenticationManager
56 , public IRMASiteSupplier
57 , public IRMAPassiveSiteWatcher
58 , public IRMAAudioHook
62 friend class CRealMediaGraph
;
63 CRealMediaGraph
* m_pRMG
; // IMPORTANT: do not ever AddRef on this from here
67 bool m_fVideoSizeChanged
;
72 CPlayerWindow m_wndWindowFrame
, m_wndDestFrame
;
76 FPRMCREATEENGINE m_fpCreateEngine
;
77 FPRMCLOSEENGINE m_fpCloseEngine
;
78 FPRMSETDLLACCESSPATH m_fpSetDLLAccessPath
;
79 HMODULE m_hRealMediaCore
;
81 CComPtr
<IRMAClientEngine
> m_pEngine
;
82 CComPtr
<IRMAPlayer
> m_pPlayer
;
83 CComQIPtr
<IRMAAudioPlayer
, &IID_IRMAAudioPlayer
> m_pAudioPlayer
;
84 CComPtr
<IRMAVolume
> m_pVolume
;
85 CComQIPtr
<IRMASiteManager
, &IID_IRMASiteManager
> m_pSiteManager
;
86 CComQIPtr
<IRMACommonClassFactory
, &IID_IRMACommonClassFactory
> m_pCommonClassFactory
;
88 CComQIPtr
<IRMASite
, &IID_IRMASite
> m_pTheSite
;
89 CComQIPtr
<IRMASite2
, &IID_IRMASite2
> m_pTheSite2
;
90 CMap
<UINT32
, UINT32
&, IRMASite
*, IRMASite
*&> m_CreatedSites
;
94 OAFilterState m_State
, m_UserState
;
95 REFERENCE_TIME m_nCurrent
, m_nDuration
;
97 UINT16 m_unPercentComplete
;
102 CRealMediaPlayer(HWND hWndParent
, CRealMediaGraph
* pRMG
);
103 virtual ~CRealMediaPlayer();
106 STDMETHODIMP
NonDelegatingQueryInterface(REFIID riid
, void** ppv
);
111 virtual CSize
GetVideoSize() {return(m_VideoSize
);}
112 virtual void SetWindowRect(CRect r
) {}
113 virtual void SetDestRect(CRect r
) {}
114 virtual bool CreateSite(IRMASite
** pSite
) = 0;
115 virtual void DestroySite(IRMASite
* pSite
) = 0;
118 STDMETHODIMP
ErrorOccurred(const UINT8 unSeverity
, const UINT32 ulRMACode
, const UINT32 ulUserCode
, const char* pUserString
, const char* pMoreInfoURL
);
120 // IRMAClientAdviseSink
121 STDMETHODIMP
OnPosLength(UINT32 ulPosition
, UINT32 ulLength
);
122 STDMETHODIMP
OnPresentationOpened();
123 STDMETHODIMP
OnPresentationClosed();
124 STDMETHODIMP
OnStatisticsChanged();
125 STDMETHODIMP
OnPreSeek(UINT32 ulOldTime
, UINT32 ulNewTime
);
126 STDMETHODIMP
OnPostSeek(UINT32 ulOldTime
, UINT32 ulNewTime
);
127 STDMETHODIMP
OnStop();
128 STDMETHODIMP
OnPause(UINT32 ulTime
);
129 STDMETHODIMP
OnBegin(UINT32 ulTime
);
130 STDMETHODIMP
OnBuffering(UINT32 ulFlags
, UINT16 unPercentComplete
);
131 STDMETHODIMP
OnContacting(const char* pHostName
);
133 // IRMAAuthenticationManager
134 STDMETHODIMP
HandleAuthenticationRequest(IRMAAuthenticationManagerResponse
* pResponse
);
137 STDMETHODIMP
SitesNeeded(UINT32 uRequestID
, IRMAValues
* pSiteProps
);
138 STDMETHODIMP
SitesNotNeeded(UINT32 uRequestID
);
139 STDMETHODIMP
BeginChangeLayout();
140 STDMETHODIMP
DoneChangeLayout();
142 // IRMAPassiveSiteWatcher
143 STDMETHODIMP
PositionChanged(PNxPoint
* pos
);
144 STDMETHODIMP
SizeChanged(PNxSize
* size
);
147 STDMETHODIMP
OnBuffer(RMAAudioData
* pAudioInData
, RMAAudioData
* pAudioOutData
);
148 STDMETHODIMP
OnInit(RMAAudioFormat
* pFormat
);
151 class CRealMediaPlayerWindowed
152 : public CRealMediaPlayer
155 CRealMediaPlayerWindowed(HWND hWndParent
, CRealMediaGraph
* pRMG
);
156 virtual ~CRealMediaPlayerWindowed();
158 void SetWindowRect(CRect r
);
159 void SetDestRect(CRect r
);
161 bool CreateSite(IRMASite
** pSite
);
162 void DestroySite(IRMASite
* pSite
);
165 class CRealMediaPlayerWindowless
166 : public CRealMediaPlayer
168 CComPtr
<ISubPicAllocatorPresenter
> m_pRMAP
;
171 CRealMediaPlayerWindowless(HWND hWndParent
, CRealMediaGraph
* pRMG
);
172 virtual ~CRealMediaPlayerWindowless();
174 STDMETHODIMP
NonDelegatingQueryInterface(REFIID riid
, void** ppv
);
176 bool CreateSite(IRMASite
** pSite
);
177 void DestroySite(IRMASite
* pSite
);
179 STDMETHODIMP
SizeChanged(PNxSize
* size
);
182 class CRealMediaGraph
: public CBaseGraph
184 CRealMediaPlayer
* m_pRMP
; // TODO: access m_pRMP through a private interface
189 CRealMediaGraph(HWND hWndParent
, HRESULT
& hr
); // in windowless mode IVideoWindow::* will return E_NOTIMPL, use ISubPicAllocatorPresenter instead
190 virtual ~CRealMediaGraph();
193 STDMETHODIMP
NonDelegatingQueryInterface(REFIID riid
, void** ppv
);
197 STDMETHODIMP
RenderFile(LPCWSTR lpcwstrFile
, LPCWSTR lpcwstrPlayList
);
201 STDMETHODIMP
Pause();
203 STDMETHODIMP
GetState(LONG msTimeout
, OAFilterState
* pfs
);
206 STDMETHODIMP
GetDuration(LONGLONG
* pDuration
);
207 STDMETHODIMP
GetCurrentPosition(LONGLONG
* pCurrent
);
208 STDMETHODIMP
SetPositions(LONGLONG
* pCurrent
, DWORD dwCurrentFlags
, LONGLONG
* pStop
, DWORD dwStopFlags
);
211 STDMETHODIMP
SetWindowPosition(long Left
, long Top
, long Width
, long Height
);
214 STDMETHODIMP
SetDestinationPosition(long Left
, long Top
, long Width
, long Height
);
215 STDMETHODIMP
GetVideoSize(long* pWidth
, long* pHeight
);
218 STDMETHODIMP
put_Volume(long lVolume
);
219 STDMETHODIMP
get_Volume(long* plVolume
);
222 STDMETHODIMP
QueryProgress(LONGLONG
* pllTotal
, LONGLONG
* pllCurrent
);
225 STDMETHODIMP_(engine_t
) GetEngine();
229 using namespace DSObjects
;