mf/topoloader: Move node connection responsibility to connection function.
[wine/zf.git] / dlls / sapi / stream.c
blob06ba4367b4837eb6c0412cce1592c404b6f2195d
1 /*
2 * Speech API (SAPI) stream implementation.
4 * Copyright 2020 Gijs Vermeulen
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
23 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "objbase.h"
29 #include "sapiddk.h"
31 #include "wine/debug.h"
33 #include "sapi_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(sapi);
37 struct spstream
39 ISpStream ISpStream_iface;
40 LONG ref;
43 static inline struct spstream *impl_from_ISpStream(ISpStream *iface)
45 return CONTAINING_RECORD(iface, struct spstream, ISpStream_iface);
48 static HRESULT WINAPI spstream_QueryInterface(ISpStream *iface, REFIID iid, void **obj)
50 struct spstream *This = impl_from_ISpStream(iface);
52 TRACE("(%p, %s, %p).\n", iface, debugstr_guid(iid), obj);
54 if (IsEqualIID(iid, &IID_IUnknown) ||
55 IsEqualIID(iid, &IID_ISpStream))
56 *obj = &This->ISpStream_iface;
57 else
59 *obj = NULL;
60 FIXME("interface %s not implemented.\n", debugstr_guid(iid));
61 return E_NOINTERFACE;
64 IUnknown_AddRef((IUnknown *)*obj);
65 return S_OK;
68 static ULONG WINAPI spstream_AddRef(ISpStream *iface)
70 struct spstream *This = impl_from_ISpStream(iface);
71 ULONG ref = InterlockedIncrement(&This->ref);
73 TRACE("(%p): ref=%u.\n", iface, ref);
75 return ref;
78 static ULONG WINAPI spstream_Release(ISpStream *iface)
80 struct spstream *This = impl_from_ISpStream(iface);
81 ULONG ref = InterlockedDecrement(&This->ref);
83 TRACE("(%p): ref=%u.\n", iface, ref);
85 if (!ref)
87 heap_free(This);
90 return ref;
93 static HRESULT WINAPI spstream_Read(ISpStream *iface, void *pv, ULONG cb, ULONG *read)
95 FIXME("(%p, %p, %d, %p): stub.\n", iface, pv, cb, read);
97 return E_NOTIMPL;
100 static HRESULT WINAPI spstream_Write(ISpStream *iface, const void *pv, ULONG cb, ULONG *written)
102 FIXME("(%p, %p, %d, %p): stub.\n", iface, pv, cb, written);
104 return E_NOTIMPL;
107 static HRESULT WINAPI spstream_Seek(ISpStream *iface, LARGE_INTEGER mode, DWORD origin, ULARGE_INTEGER *position)
109 FIXME("(%p, %s, %d, %p): stub.\n", iface, wine_dbgstr_longlong(mode.QuadPart), origin, position);
111 return E_NOTIMPL;
114 static HRESULT WINAPI spstream_SetSize(ISpStream *iface, ULARGE_INTEGER size)
116 FIXME("(%p, %s): stub.\n", iface, wine_dbgstr_longlong(size.QuadPart));
118 return E_NOTIMPL;
121 static HRESULT WINAPI spstream_CopyTo(ISpStream *iface, IStream *stream, ULARGE_INTEGER cb,
122 ULARGE_INTEGER *read, ULARGE_INTEGER *written)
124 FIXME("(%p, %p, %s, %p, %p): stub.\n", iface, stream, wine_dbgstr_longlong(cb.QuadPart),
125 read, written);
127 return E_NOTIMPL;
130 static HRESULT WINAPI spstream_Commit(ISpStream *iface, DWORD flag)
132 FIXME("(%p, %d): stub.\n", iface, flag);
134 return E_NOTIMPL;
137 static HRESULT WINAPI spstream_Revert(ISpStream *iface)
139 FIXME("(%p): stub.\n", iface);
141 return E_NOTIMPL;
144 static HRESULT WINAPI spstream_LockRegion(ISpStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER cb, DWORD type)
146 FIXME("(%p, %s, %s, %d): stub.\n", iface, wine_dbgstr_longlong(offset.QuadPart),
147 wine_dbgstr_longlong(cb.QuadPart), type);
149 return E_NOTIMPL;
152 static HRESULT WINAPI spstream_UnlockRegion(ISpStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER cb, DWORD type)
154 FIXME("(%p, %s, %s, %d): stub.\n", iface, wine_dbgstr_longlong(offset.QuadPart),
155 wine_dbgstr_longlong(cb.QuadPart), type);
157 return E_NOTIMPL;
160 static HRESULT WINAPI spstream_Stat(ISpStream *iface, STATSTG *statstg, DWORD flag)
162 FIXME("(%p, %p, %d): stub.\n", iface, statstg, flag);
164 return E_NOTIMPL;
167 static HRESULT WINAPI spstream_Clone(ISpStream *iface, IStream **stream)
169 FIXME("(%p, %p): stub.\n", iface, stream);
171 return E_NOTIMPL;
174 static HRESULT WINAPI spstream_GetFormat(ISpStream *iface, GUID *format, WAVEFORMATEX **wave)
176 FIXME("(%p, %p, %p): stub.\n", iface, format, wave);
178 return E_NOTIMPL;
181 static HRESULT WINAPI spstream_SetBaseStream(ISpStream *iface, IStream *stream, REFGUID format,
182 const WAVEFORMATEX *wave)
184 FIXME("(%p, %p, %s, %p): stub.\n", iface, stream, debugstr_guid(format), wave);
186 return E_NOTIMPL;
189 static HRESULT WINAPI spstream_GetBaseStream(ISpStream *iface, IStream **stream)
191 FIXME("(%p, %p): stub.\n", iface, stream);
193 return E_NOTIMPL;
196 static HRESULT WINAPI spstream_BindToFile(ISpStream *iface, LPCWSTR filename, SPFILEMODE mode,
197 const GUID *format, const WAVEFORMATEX* wave,
198 ULONGLONG interest)
200 FIXME("(%p, %s, %d, %s, %p, %s): stub.\n", iface, debugstr_w(filename), mode, debugstr_guid(format),
201 wave, wine_dbgstr_longlong(interest));
203 return E_NOTIMPL;
206 static HRESULT WINAPI spstream_Close(ISpStream *iface)
208 FIXME("(%p): stub.\n", iface);
210 return E_NOTIMPL;
213 const static ISpStreamVtbl spstream_vtbl =
215 spstream_QueryInterface,
216 spstream_AddRef,
217 spstream_Release,
218 spstream_Read,
219 spstream_Write,
220 spstream_Seek,
221 spstream_SetSize,
222 spstream_CopyTo,
223 spstream_Commit,
224 spstream_Revert,
225 spstream_LockRegion,
226 spstream_UnlockRegion,
227 spstream_Stat,
228 spstream_Clone,
229 spstream_GetFormat,
230 spstream_SetBaseStream,
231 spstream_GetBaseStream,
232 spstream_BindToFile,
233 spstream_Close
236 HRESULT speech_stream_create(IUnknown *outer, REFIID iid, void **obj)
238 struct spstream *This = heap_alloc(sizeof(*This));
239 HRESULT hr;
241 if (!This) return E_OUTOFMEMORY;
242 This->ISpStream_iface.lpVtbl = &spstream_vtbl;
243 This->ref = 1;
245 hr = ISpStream_QueryInterface(&This->ISpStream_iface, iid, obj);
247 ISpStream_Release(&This->ISpStream_iface);
248 return hr;