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";
20
21cpp_quote("#define MS_ERROR_CODE(x)                  MAKE_HRESULT(1, FACILITY_ITF, (x) + 0x400)")
22cpp_quote("#define MS_SUCCESS_CODE(x)                MAKE_HRESULT(0, FACILITY_ITF, x)")
23cpp_quote("#define MS_S_PENDING                      MS_SUCCESS_CODE(1)")
24cpp_quote("#define MS_S_NOUPDATE                     MS_SUCCESS_CODE(2)")
25cpp_quote("#define MS_S_ENDOFSTREAM                  MS_SUCCESS_CODE(3)")
26
27cpp_quote("#define MS_E_SAMPLEALLOC                  MS_ERROR_CODE(1)")
28cpp_quote("#define MS_E_PURPOSEID                    MS_ERROR_CODE(2)")
29cpp_quote("#define MS_E_NOSTREAM                     MS_ERROR_CODE(3)")
30cpp_quote("#define MS_E_NOSEEKING                    MS_ERROR_CODE(4)")
31cpp_quote("#define MS_E_INCOMPATIBLE                 MS_ERROR_CODE(5)")
32cpp_quote("#define MS_E_BUSY                         MS_ERROR_CODE(6)")
33cpp_quote("#define MS_E_NOTINIT                      MS_ERROR_CODE(7)")
34cpp_quote("#define MS_E_SOURCEALREADYDEFINED         MS_ERROR_CODE(8)")
35cpp_quote("#define MS_E_INVALIDSTREAMTYPE            MS_ERROR_CODE(9)")
36cpp_quote("#define MS_E_NOTRUNNING                   MS_ERROR_CODE(10)")
37
38cpp_quote("DEFINE_GUID(MSPID_PrimaryVideo,  0xa35ff56a, 0x9fda, 0x11d0, 0x8f, 0xdf, 0x0, 0xc0, 0x4f, 0xd9, 0x18, 0x9d);")
39cpp_quote("DEFINE_GUID(MSPID_PrimaryAudio,  0xa35ff56b, 0x9fda, 0x11d0, 0x8f, 0xdf, 0x0, 0xc0, 0x4f, 0xd9, 0x18, 0x9d);")
40
41cpp_quote("#if 0")
42typedef void* PAPCFUNC;
43cpp_quote("#endif")
44
45typedef LONGLONG STREAM_TIME;
46
47typedef GUID MSPID;
48typedef REFGUID REFMSPID;
49
50typedef enum {
51	STREAMTYPE_READ         = 0,
52	STREAMTYPE_WRITE        = 1,
53	STREAMTYPE_TRANSFORM    = 2
54} STREAM_TYPE;
55
56typedef enum {
57	STREAMSTATE_STOP        = 0,
58	STREAMSTATE_RUN         = 1
59} STREAM_STATE;
60
61
62typedef enum {
63	COMPSTAT_NOUPDATEOK                             = 0x00000001,
64	COMPSTAT_WAIT                                   = 0x00000002,
65	COMPSTAT_ABORT                                  = 0x00000004
66} COMPLETION_STATUS_FLAGS;
67
68enum {
69	MMSSF_HASCLOCK                                  = 0x00000001,
70	MMSSF_SUPPORTSEEK                               = 0x00000002,
71	MMSSF_ASYNCHRONOUS                              = 0x00000004
72};
73
74enum {
75	SSUPDATE_ASYNC                                  = 0x00000001,
76	SSUPDATE_CONTINUOUS                             = 0x00000002
77};
78
79interface IMultiMediaStream;
80interface IMediaStream;
81interface IStreamSample;
82
83
84[
85object,
86local,
87uuid(B502D1BC-9A57-11d0-8FDE-00C04FD9189D),
88pointer_default(unique)
89]
90interface IMultiMediaStream : IUnknown {
91
92	HRESULT GetInformation(
93		[out, optional] DWORD *pdwFlags,
94		[out, optional] STREAM_TYPE *pStreamType);
95
96	HRESULT GetMediaStream(
97		[in] REFMSPID idPurpose,
98		[out] IMediaStream **ppMediaStream);
99
100	HRESULT EnumMediaStreams(
101		[in] long Index,
102		[out] IMediaStream **ppMediaStream);
103
104	HRESULT GetState(
105		[out] STREAM_STATE *pCurrentState);
106
107	HRESULT SetState(
108		[in] STREAM_STATE NewState);
109
110	HRESULT GetTime(
111		[out] STREAM_TIME *pCurrentTime);
112
113	HRESULT GetDuration(
114		[out] STREAM_TIME *pDuration);
115
116	HRESULT Seek(
117		[in] STREAM_TIME SeekTime);
118
119	HRESULT GetEndOfStreamEventHandle(
120		[out] HANDLE *phEOS);
121}
122
123
124[
125object,
126uuid(B502D1BD-9A57-11d0-8FDE-00C04FD9189D),
127pointer_default(unique)
128]
129interface IMediaStream : IUnknown {
130
131	HRESULT GetMultiMediaStream(
132		[out] IMultiMediaStream **ppMultiMediaStream);
133
134	HRESULT GetInformation(
135		[out, optional] MSPID *pPurposeId,
136		[out, optional] STREAM_TYPE *pType);
137
138	HRESULT SetSameFormat(
139		[in] IMediaStream *pStreamThatHasDesiredFormat,
140		[in] DWORD dwFlags);
141
142	HRESULT AllocateSample(
143		[in]  DWORD dwFlags,
144		[out] IStreamSample **ppSample);
145
146	HRESULT CreateSharedSample(
147		[in]  IStreamSample *pExistingSample,
148		[in]  DWORD dwFlags,
149		[out] IStreamSample **ppNewSample);
150
151	HRESULT SendEndOfStream(DWORD dwFlags);
152}
153
154
155[
156object,
157local,
158uuid(B502D1BE-9A57-11d0-8FDE-00C04FD9189D),
159pointer_default(unique)
160]
161interface IStreamSample : IUnknown {
162
163	HRESULT GetMediaStream(
164		[in] IMediaStream **ppMediaStream);
165
166	HRESULT GetSampleTimes(
167		[out, optional] STREAM_TIME * pStartTime,
168		[out, optional] STREAM_TIME * pEndTime,
169		[out, optional] STREAM_TIME * pCurrentTime);
170
171	HRESULT SetSampleTimes(
172		[in, optional] const STREAM_TIME *pStartTime,
173		[in, optional] const STREAM_TIME *pEndTime);
174
175	HRESULT Update(
176		[in] DWORD dwFlags,
177		[in, optional] HANDLE hEvent,
178		[in, optional] PAPCFUNC pfnAPC,
179		[in, optional] DWORD dwAPCData);
180
181	HRESULT CompletionStatus(
182		[in] DWORD dwFlags,
183		[in, optional] DWORD dwMilliseconds);
184}
185