1/*
2 * Copyright 2004 Christian Costa
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19import "unknwn.idl";
20import "mmstream.idl";
21import "strmif.idl";
22
23cpp_quote("#include <ddraw.h>")
24cpp_quote("#include <mmsystem.h>")
25cpp_quote("#include <mmstream.h>")
26cpp_quote("#include <ddstream.h>")
27cpp_quote("#include <austream.h>")
28
29cpp_quote("#if 0")
30interface IDirectDraw;
31interface IDirectDrawSurface;
32cpp_quote("#endif")
33
34interface IAMMultiMediaStream;
35interface IAMMediaStream;
36interface IMediaStreamFilter;
37interface IAMMediaTypeStream;
38interface IAMMediaTypeSample;
39
40enum {
41	AMMSF_NOGRAPHTHREAD      = 0x00000001
42};
43
44enum {
45	AMMSF_ADDDEFAULTRENDERER = 0x00000001,
46	AMMSF_CREATEPEER         = 0x00000002,
47	AMMSF_STOPIFNOSAMPLES	 = 0x00000004,
48	AMMSF_NOSTALL		 = 0x00000008
49};
50
51enum {
52	AMMSF_RENDERTYPEMASK     = 0x00000003,
53	AMMSF_RENDERTOEXISTING   = 0x00000000,
54	AMMSF_RENDERALLSTREAMS   = 0x00000001,
55	AMMSF_NORENDER           = 0x00000002,
56	AMMSF_NOCLOCK            = 0x00000004,
57	AMMSF_RUN                = 0x00000008
58};
59
60
61typedef [v1_enum] enum {
62	Disabled = 0,
63	ReadData = 1,
64	RenderData = 2
65} OUTPUT_STATE;
66
67[
68object,
69uuid(7DB01C96-C0C3-11d0-8FF1-00C04FD9189D),
70dual,
71helpstring("IDirectShowStream Interface"),
72pointer_default(unique)
73]
74interface IDirectShowStream : IDispatch
75{
76	[propget, id(1), helpstring("property FileName")] HRESULT FileName([out, retval] BSTR *pVal);
77	[propput, id(1), helpstring("property FileName")] HRESULT FileName([in] BSTR newVal);
78	[propget, id(2), helpstring("property Video")] HRESULT Video([out, retval] OUTPUT_STATE *pVal);
79	[propput, id(2), helpstring("propetry Video")] HRESULT Video([in] OUTPUT_STATE newVal);
80	[propget, id(3), helpstring("property Audio")] HRESULT Audio([out, retval] OUTPUT_STATE *pVal);
81	[propput, id(3), helpstring("propetry Audio")] HRESULT Audio([in] OUTPUT_STATE newVal);
82};
83
84[
85object,
86uuid(BEBE595C-9A6F-11d0-8FDE-00C04FD9189D),
87pointer_default(unique)
88]
89interface IAMMultiMediaStream : IMultiMediaStream
90{
91	HRESULT Initialize(
92		[in] STREAM_TYPE StreamType,
93		[in] DWORD dwFlags,
94		[in] IGraphBuilder *pFilterGraph);
95
96	HRESULT GetFilterGraph(
97		[out] IGraphBuilder **ppGraphBuilder);
98
99	HRESULT GetFilter(
100		[out] IMediaStreamFilter **ppFilter);
101
102	HRESULT AddMediaStream(
103		[in] IUnknown *pStreamObject,
104		[in] const MSPID *PurposeId,
105		[in] DWORD dwFlags,
106		[out] IMediaStream **ppNewStream);
107
108	HRESULT OpenFile(
109		[in] LPCWSTR pszFileName,
110		[in] DWORD dwFlags);
111
112	HRESULT OpenMoniker(
113		[in] IBindCtx *pCtx,
114		[in] IMoniker *pMoniker,
115		[in] DWORD dwFlags);
116
117	HRESULT Render(
118		[in] DWORD dwFlags);
119}
120
121
122[
123object,
124uuid(BEBE595D-9A6F-11d0-8FDE-00C04FD9189D),
125pointer_default(unique)
126]
127interface IAMMediaStream : IMediaStream
128{
129	HRESULT Initialize(
130		[in] IUnknown *pSourceObject,
131		[in] DWORD dwFlags,
132		[in] REFMSPID PurposeId,
133		[in] const STREAM_TYPE StreamType);
134
135	HRESULT SetState(
136		[in] FILTER_STATE State);
137
138	HRESULT JoinAMMultiMediaStream(
139		[in] IAMMultiMediaStream *pAMMultiMediaStream);
140
141	HRESULT JoinFilter(
142		[in] IMediaStreamFilter *pMediaStreamFilter);
143
144	HRESULT JoinFilterGraph(
145		[in] IFilterGraph *pFilterGraph);
146}
147
148
149[
150object,
151local,
152uuid(BEBE595E-9A6F-11d0-8FDE-00C04FD9189D),
153pointer_default(unique)
154]
155interface IMediaStreamFilter : IBaseFilter
156{
157	HRESULT AddMediaStream(
158		[in] IAMMediaStream *pAMMediaStream);
159
160	HRESULT GetMediaStream(
161		[in] REFMSPID idPurpose,
162		[out] IMediaStream **ppMediaStream);
163
164	HRESULT EnumMediaStreams(
165		[in] long Index,
166		[out] IMediaStream **ppMediaStream);
167
168	HRESULT SupportSeeking(
169		[in] BOOL bRenderer);
170
171	HRESULT ReferenceTimeToStreamTime(
172		[in] [out] REFERENCE_TIME *pTime);
173
174	HRESULT GetCurrentStreamTime(
175		[out] REFERENCE_TIME *pCurrentStreamTime);
176
177	HRESULT WaitUntil(
178		[in]  REFERENCE_TIME WaitStreamTime);
179
180	HRESULT Flush(
181		[in] BOOL bCancelEOS);
182
183	HRESULT EndOfStream();
184}
185
186
187[
188object,
189local,
190uuid(AB6B4AFC-F6E4-11d0-900D-00C04FD9189D),
191pointer_default(unique)
192]
193interface IDirectDrawMediaSampleAllocator : IUnknown
194{
195	HRESULT GetDirectDraw(IDirectDraw **ppDirectDraw);
196}
197
198
199[
200object,
201local,
202uuid(AB6B4AFE-F6E4-11d0-900D-00C04FD9189D),
203pointer_default(unique)
204]
205interface IDirectDrawMediaSample : IUnknown
206{
207	HRESULT GetSurfaceAndReleaseLock(
208		[out] IDirectDrawSurface **ppDirectDrawSurface,
209		[out] RECT * pRect);
210
211	HRESULT LockMediaSamplePointer(void);
212}
213
214
215[
216object,
217local,
218uuid(AB6B4AFA-F6E4-11d0-900D-00C04FD9189D),
219pointer_default(unique)
220]
221
222interface IAMMediaTypeStream : IMediaStream
223{
224	HRESULT GetFormat(
225		[out] AM_MEDIA_TYPE * pMediaType,
226		[in] DWORD dwFlags);
227
228	HRESULT SetFormat(
229		[in] AM_MEDIA_TYPE * pMediaType,
230		[in] DWORD dwFlags);
231
232	HRESULT CreateSample(
233		[in] long lSampleSize,
234		[in] BYTE * pbBuffer,
235		[in] DWORD dwFlags,
236		[in] IUnknown *pUnkOuter,
237		[out] IAMMediaTypeSample ** ppAMMediaTypeSample);
238
239	HRESULT GetStreamAllocatorRequirements(
240		[out] ALLOCATOR_PROPERTIES *pProps);
241
242	HRESULT SetStreamAllocatorRequirements(
243		[in] ALLOCATOR_PROPERTIES *pProps);
244}
245
246
247[
248object,
249local,
250uuid(AB6B4AFB-F6E4-11d0-900D-00C04FD9189D),
251pointer_default(unique)
252]
253interface IAMMediaTypeSample : IStreamSample
254{
255	HRESULT SetPointer(
256		[in] BYTE *pBuffer,
257		[in] long lSize);
258
259	HRESULT GetPointer(
260		[out] BYTE ** ppBuffer);
261
262	long GetSize(void);
263
264	HRESULT GetTime(
265		[out] REFERENCE_TIME * pTimeStart,
266		[out] REFERENCE_TIME * pTimeEnd);
267
268	HRESULT SetTime(
269		[in] REFERENCE_TIME * pTimeStart,
270		[in] REFERENCE_TIME * pTimeEnd);
271
272	HRESULT IsSyncPoint(void);
273
274	HRESULT SetSyncPoint(
275		BOOL bIsSyncPoint);
276
277	HRESULT IsPreroll(void);
278
279	HRESULT SetPreroll(
280		BOOL bIsPreroll);
281
282	long GetActualDataLength(void);
283
284	HRESULT SetActualDataLength(long Len);
285
286	HRESULT GetMediaType(
287		AM_MEDIA_TYPE **ppMediaType);
288
289	HRESULT SetMediaType(
290		AM_MEDIA_TYPE *pMediaType);
291
292	HRESULT IsDiscontinuity(void);
293
294	HRESULT SetDiscontinuity(
295		BOOL bDiscontinuity);
296
297	HRESULT GetMediaTime(
298		[out] LONGLONG * pTimeStart,
299		[out] LONGLONG * pTimeEnd);
300
301	HRESULT SetMediaTime(
302		[in] LONGLONG * pTimeStart,
303		[in] LONGLONG * pTimeEnd);
304}
305
306[
307    uuid(49C47CE5-9BA4-11d0-8212-00C04FC32C45)
308]
309coclass AMMultiMediaStream
310{
311    [default] dispinterface IDirectShowStream;
312}
313
314cpp_quote("DEFINE_GUID(CLSID_AMDirectDrawStream,  0x49c47ce4, 0x9ba4, 0x11d0, 0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45);")
315cpp_quote("DEFINE_GUID(CLSID_AMAudioStream,       0x8496e040, 0xaf4c, 0x11d0, 0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45);")
316cpp_quote("DEFINE_GUID(CLSID_AMAudioData,         0xf2468580, 0xaf8a, 0x11d0, 0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45);")
317cpp_quote("DEFINE_GUID(CLSID_AMMediaTypeStream,   0xcf0f2f7c, 0xf7bf, 0x11d0, 0x90, 0x0d, 0x00, 0xc0, 0x4f, 0xd9, 0x18, 0x9d);")
318cpp_quote("DEFINE_GUID(CLSID_MediaStreamFilter,   0x49c47ce0, 0x9ba4, 0x11d0, 0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45);")
319