Welcome to mirror list, hosted at ThFree Co, Russian Federation.

BaseGraph.h « mplayerc « apps « src - github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5e7c1093524a0a023fb40518c6be52111e08d861 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
/*
 * $Id$
 *
 * (C) 2003-2006 Gabest
 * (C) 2006-2010 see AUTHORS
 *
 * This file is part of mplayerc.
 *
 * Mplayerc is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * Mplayerc is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#pragma once

#include "IGraphBuilder2.h"


class CPlayerWindow : public CWnd
{
public:
	CPlayerWindow() {}

protected:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	DECLARE_MESSAGE_MAP()
};

typedef enum {DirectShow = 0, RealMedia, QuickTime, ShockWave} engine_t;

interface __declspec(uuid("B110CDE5-6331-4118-8AAF-A870D6F7E2E4"))
IGraphEngine :
public IUnknown
{
	STDMETHOD_(engine_t, GetEngine) () = 0;
};

enum
{
	EC_BG_AUDIO_CHANGED = EC_USER+1,
	EC_BG_ERROR
};

class CBaseGraph
	: public CUnknown
	, public IGraphBuilder2
	, public IMediaControl
	, public IMediaEventEx
	, public IMediaSeeking
	, public IVideoWindow
	, public IBasicVideo
	, public IBasicAudio
	, public IAMOpenProgress
	, public IGraphEngine
{
	OAHWND m_hNotifyWnd;
	long m_lNotifyMsg;
	LONG_PTR m_lNotifyInstData;

	typedef struct
	{
		long m_lEventCode;
		LONG_PTR m_lParam1, m_lParam2;
	} GMSG;
	CList<GMSG> m_msgqueue;

protected:
	void ClearMessageQueue();

public:
	CBaseGraph();
	virtual ~CBaseGraph();

	DECLARE_IUNKNOWN;
	STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);

	void NotifyEvent(long lEventCode, LONG_PTR lParam1 = 0, LONG_PTR lParam2 = 0);

protected:
	// IDispatch
	STDMETHODIMP GetTypeInfoCount(UINT* pctinfo);
	STDMETHODIMP GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo);
	STDMETHODIMP GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId);
	STDMETHODIMP Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr);

	// IFilterGraph
	STDMETHODIMP AddFilter(IBaseFilter* pFilter, LPCWSTR pName);
	STDMETHODIMP RemoveFilter(IBaseFilter* pFilter);
	STDMETHODIMP EnumFilters(IEnumFilters** ppEnum);
	STDMETHODIMP FindFilterByName(LPCWSTR pName, IBaseFilter** ppFilter);
	STDMETHODIMP ConnectDirect(IPin* ppinOut, IPin* ppinIn, const AM_MEDIA_TYPE* pmt);
	STDMETHODIMP Reconnect(IPin* ppin);
	STDMETHODIMP Disconnect(IPin* ppin);
	STDMETHODIMP SetDefaultSyncSource();

	// IGraphBuilder
	STDMETHODIMP Connect(IPin* ppinOut, IPin* ppinIn);
	STDMETHODIMP Render(IPin* ppinOut);
	STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList);
	STDMETHODIMP AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter);
	STDMETHODIMP SetLogFile(DWORD_PTR hFile);
	STDMETHODIMP Abort();
	STDMETHODIMP ShouldOperationContinue();

	// IFilterGraph2
	STDMETHODIMP AddSourceFilterForMoniker(IMoniker* pMoniker, IBindCtx* pCtx, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter);
	STDMETHODIMP ReconnectEx(IPin* ppin, const AM_MEDIA_TYPE* pmt);
	STDMETHODIMP RenderEx(IPin* pPinOut, DWORD dwFlags, DWORD* pvContext);

	// IGraphBuilder2
	STDMETHODIMP IsPinDirection(IPin* pPin, PIN_DIRECTION dir);
	STDMETHODIMP IsPinConnected(IPin* pPin);
	STDMETHODIMP ConnectFilter(IBaseFilter* pBF, IPin* pPinIn);
	STDMETHODIMP ConnectFilter(IPin* pPinOut, IBaseFilter* pBF);
	STDMETHODIMP ConnectFilterDirect(IPin* pPinOut, IBaseFilter* pBF, const AM_MEDIA_TYPE* pmt);
	STDMETHODIMP NukeDownstream(IUnknown* pUnk);
	STDMETHODIMP FindInterface(REFIID iid, void** ppv, BOOL bRemove);
	STDMETHODIMP AddToROT();
	STDMETHODIMP RemoveFromROT();

	// IMediaControl
	STDMETHODIMP Run();
	STDMETHODIMP Pause();
	STDMETHODIMP Stop();
	STDMETHODIMP GetState(LONG msTimeout, OAFilterState* pfs);
	STDMETHODIMP RenderFile(BSTR strFilename);
	STDMETHODIMP AddSourceFilter(BSTR strFilename, IDispatch** ppUnk);
	STDMETHODIMP get_FilterCollection(IDispatch** ppUnk);
	STDMETHODIMP get_RegFilterCollection(IDispatch** ppUnk);
	STDMETHODIMP StopWhenReady();

	// IMediaEvent
	STDMETHODIMP GetEventHandle(OAEVENT* hEvent);
	STDMETHODIMP GetEvent(long* lEventCode, LONG_PTR* lParam1, LONG_PTR* lParam2, long msTimeout);
	STDMETHODIMP WaitForCompletion(long msTimeout, long* pEvCode);
	STDMETHODIMP CancelDefaultHandling(long lEvCode);
	STDMETHODIMP RestoreDefaultHandling(long lEvCode);
	STDMETHODIMP FreeEventParams(long lEvCode, LONG_PTR lParam1, LONG_PTR lParam2);

	// IMediaEventEx
	STDMETHODIMP SetNotifyWindow(OAHWND hwnd, long lMsg, LONG_PTR lInstanceData);
	STDMETHODIMP SetNotifyFlags(long lNoNotifyFlags);
	STDMETHODIMP GetNotifyFlags(long* lplNoNotifyFlags);

	// IMediaSeeking
	STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
	STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
	STDMETHODIMP IsFormatSupported(const GUID* pFormat);
	STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
	STDMETHODIMP GetTimeFormat(GUID* pFormat);
	STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
	STDMETHODIMP SetTimeFormat(const GUID* pFormat);
	STDMETHODIMP GetDuration(LONGLONG* pDuration);
	STDMETHODIMP GetStopPosition(LONGLONG* pStop);
	STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
	STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
	STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
	STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
	STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
	STDMETHODIMP SetRate(double dRate);
	STDMETHODIMP GetRate(double* pdRate);
	STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);

	// IVideoWindow
	STDMETHODIMP put_Caption(BSTR strCaption);
	STDMETHODIMP get_Caption(BSTR* strCaption);
	STDMETHODIMP put_WindowStyle(long WindowStyle);
	STDMETHODIMP get_WindowStyle(long* WindowStyle);
	STDMETHODIMP put_WindowStyleEx(long WindowStyleEx);
	STDMETHODIMP get_WindowStyleEx(long* WindowStyleEx);
	STDMETHODIMP put_AutoShow(long AutoShow);
	STDMETHODIMP get_AutoShow(long* AutoShow);
	STDMETHODIMP put_WindowState(long WindowState);
	STDMETHODIMP get_WindowState(long* WindowState);
	STDMETHODIMP put_BackgroundPalette(long BackgroundPalette);
	STDMETHODIMP get_BackgroundPalette(long* pBackgroundPalette);
	STDMETHODIMP put_Visible(long Visible);
	STDMETHODIMP get_Visible(long* pVisible);
	STDMETHODIMP put_Left(long Left);
	STDMETHODIMP get_Left(long* pLeft);
	STDMETHODIMP put_Width(long Width);
	STDMETHODIMP get_Width(long* pWidth);
	STDMETHODIMP put_Top(long Top);
	STDMETHODIMP get_Top(long* pTop);
	STDMETHODIMP put_Height(long Height);
	STDMETHODIMP get_Height(long* pHeight);
	STDMETHODIMP put_Owner(OAHWND Owner);
	STDMETHODIMP get_Owner(OAHWND* Owner);
	STDMETHODIMP put_MessageDrain(OAHWND Drain);
	STDMETHODIMP get_MessageDrain(OAHWND* Drain);
	STDMETHODIMP get_BorderColor(long* Color);
	STDMETHODIMP put_BorderColor(long Color);
	STDMETHODIMP get_FullScreenMode(long* FullScreenMode);
	STDMETHODIMP put_FullScreenMode(long FullScreenMode);
	STDMETHODIMP SetWindowForeground(long Focus);
	STDMETHODIMP NotifyOwnerMessage(OAHWND hwnd, long uMsg, LONG_PTR wParam, LONG_PTR lParam);
	STDMETHODIMP SetWindowPosition(long Left, long Top, long Width, long Height);
	STDMETHODIMP GetWindowPosition(long* pLeft, long* pTop, long* pWidth, long* pHeight);
	STDMETHODIMP GetMinIdealImageSize(long* pWidth, long* pHeight);
	STDMETHODIMP GetMaxIdealImageSize(long* pWidth, long* pHeight);
	STDMETHODIMP GetRestorePosition(long* pLeft, long* pTop, long* pWidth, long* pHeight);
	STDMETHODIMP HideCursor(long HideCursor);
	STDMETHODIMP IsCursorHidden(long* CursorHidden);

	// IBasicVideo
	STDMETHODIMP get_AvgTimePerFrame(REFTIME* pAvgTimePerFrame);
	STDMETHODIMP get_BitRate(long* pBitRate);
	STDMETHODIMP get_BitErrorRate(long* pBitErrorRate);
	STDMETHODIMP get_VideoWidth(long* pVideoWidth);
	STDMETHODIMP get_VideoHeight(long* pVideoHeight);
	STDMETHODIMP put_SourceLeft(long SourceLeft);
	STDMETHODIMP get_SourceLeft(long* pSourceLeft);
	STDMETHODIMP put_SourceWidth(long SourceWidth);
	STDMETHODIMP get_SourceWidth(long* pSourceWidth);
	STDMETHODIMP put_SourceTop(long SourceTop);
	STDMETHODIMP get_SourceTop(long* pSourceTop);
	STDMETHODIMP put_SourceHeight(long SourceHeight);
	STDMETHODIMP get_SourceHeight(long* pSourceHeight);
	STDMETHODIMP put_DestinationLeft(long DestinationLeft);
	STDMETHODIMP get_DestinationLeft(long* pDestinationLeft);
	STDMETHODIMP put_DestinationWidth(long DestinationWidth);
	STDMETHODIMP get_DestinationWidth(long* pDestinationWidth);
	STDMETHODIMP put_DestinationTop(long DestinationTop);
	STDMETHODIMP get_DestinationTop(long* pDestinationTop);
	STDMETHODIMP put_DestinationHeight(long DestinationHeight);
	STDMETHODIMP get_DestinationHeight(long* pDestinationHeight);
	STDMETHODIMP SetSourcePosition(long Left, long Top, long Width, long Height);
	STDMETHODIMP GetSourcePosition(long* pLeft, long* pTop, long* pWidth, long* pHeight);
	STDMETHODIMP SetDefaultSourcePosition();
	STDMETHODIMP SetDestinationPosition(long Left, long Top, long Width, long Height);
	STDMETHODIMP GetDestinationPosition(long* pLeft, long* pTop, long* pWidth, long* pHeight);
	STDMETHODIMP SetDefaultDestinationPosition();
	STDMETHODIMP GetVideoSize(long* pWidth, long* pHeight);
	STDMETHODIMP GetVideoPaletteEntries(long StartIndex, long Entries, long* pRetrieved, long* pPalette);
	STDMETHODIMP GetCurrentImage(long* pBufferSize, long* pDIBImage);
	STDMETHODIMP IsUsingDefaultSource();
	STDMETHODIMP IsUsingDefaultDestination();

	// IBasicAudio
	STDMETHODIMP put_Volume(long lVolume);
	STDMETHODIMP get_Volume(long* plVolume);
	STDMETHODIMP put_Balance(long lBalance);
	STDMETHODIMP get_Balance(long* plBalance);

	// IAMOpenProgress
	STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent);
	STDMETHODIMP AbortOperation();

	// IGraphEngine
	STDMETHODIMP_(engine_t) GetEngine();
};