X64 transport [Part 5] (Update plugins.cpp)
[xy_vsfilter.git] / src / apps / mplayerc / RealMediaGraph.h
blob3e085f6bbc3db6dbaceaa1ea7259f3149922d2ad
1 /*
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)
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.
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
22 #pragma once
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"
46 namespace DSObjects
49 class CRealMediaGraph;
51 class CRealMediaPlayer
52 : public CUnknown
53 , public IRMAErrorSink
54 , public IRMAClientAdviseSink
55 , public IRMAAuthenticationManager
56 , public IRMASiteSupplier
57 , public IRMAPassiveSiteWatcher
58 , public IRMAAudioHook
61 protected:
62 friend class CRealMediaGraph;
63 CRealMediaGraph* m_pRMG; // IMPORTANT: do not ever AddRef on this from here
65 HWND m_hWndParent;
66 CSize m_VideoSize;
67 bool m_fVideoSizeChanged;
71 DWORD m_wndStyle;
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;
101 public:
102 CRealMediaPlayer(HWND hWndParent, CRealMediaGraph* pRMG);
103 virtual ~CRealMediaPlayer();
105 DECLARE_IUNKNOWN;
106 STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
108 bool Init();
109 void Deinit();
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;
117 // IRMAErrorSink
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);
136 // IRMASiteSupplier
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);
146 // IRMAAudioHook
147 STDMETHODIMP OnBuffer(RMAAudioData* pAudioInData, RMAAudioData* pAudioOutData);
148 STDMETHODIMP OnInit(RMAAudioFormat* pFormat);
151 class CRealMediaPlayerWindowed
152 : public CRealMediaPlayer
154 public:
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;
170 public:
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
186 CStringW m_fn;
188 public:
189 CRealMediaGraph(HWND hWndParent, HRESULT& hr); // in windowless mode IVideoWindow::* will return E_NOTIMPL, use ISubPicAllocatorPresenter instead
190 virtual ~CRealMediaGraph();
192 DECLARE_IUNKNOWN;
193 STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
195 protected:
196 // IGraphBuilder
197 STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList);
199 // IMediaControl
200 STDMETHODIMP Run();
201 STDMETHODIMP Pause();
202 STDMETHODIMP Stop();
203 STDMETHODIMP GetState(LONG msTimeout, OAFilterState* pfs);
205 // IMediaSeeking
206 STDMETHODIMP GetDuration(LONGLONG* pDuration);
207 STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
208 STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
210 // IVideoWindow
211 STDMETHODIMP SetWindowPosition(long Left, long Top, long Width, long Height);
213 // IBasicVideo
214 STDMETHODIMP SetDestinationPosition(long Left, long Top, long Width, long Height);
215 STDMETHODIMP GetVideoSize(long* pWidth, long* pHeight);
217 // IBasicAudio
218 STDMETHODIMP put_Volume(long lVolume);
219 STDMETHODIMP get_Volume(long* plVolume);
221 // IAMOpenProgress
222 STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent);
224 // IGraphEngine
225 STDMETHODIMP_(engine_t) GetEngine();
229 using namespace DSObjects;