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
31 #include "wine/debug.h"
33 #include "sapi_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(sapi
);
39 ISpStream ISpStream_iface
;
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
;
60 FIXME("interface %s not implemented.\n", debugstr_guid(iid
));
64 IUnknown_AddRef((IUnknown
*)*obj
);
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
);
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
);
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
);
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
);
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
);
114 static HRESULT WINAPI
spstream_SetSize(ISpStream
*iface
, ULARGE_INTEGER size
)
116 FIXME("(%p, %s): stub.\n", iface
, wine_dbgstr_longlong(size
.QuadPart
));
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
),
130 static HRESULT WINAPI
spstream_Commit(ISpStream
*iface
, DWORD flag
)
132 FIXME("(%p, %d): stub.\n", iface
, flag
);
137 static HRESULT WINAPI
spstream_Revert(ISpStream
*iface
)
139 FIXME("(%p): stub.\n", iface
);
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
);
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
);
160 static HRESULT WINAPI
spstream_Stat(ISpStream
*iface
, STATSTG
*statstg
, DWORD flag
)
162 FIXME("(%p, %p, %d): stub.\n", iface
, statstg
, flag
);
167 static HRESULT WINAPI
spstream_Clone(ISpStream
*iface
, IStream
**stream
)
169 FIXME("(%p, %p): stub.\n", iface
, stream
);
174 static HRESULT WINAPI
spstream_GetFormat(ISpStream
*iface
, GUID
*format
, WAVEFORMATEX
**wave
)
176 FIXME("(%p, %p, %p): stub.\n", iface
, format
, wave
);
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
);
189 static HRESULT WINAPI
spstream_GetBaseStream(ISpStream
*iface
, IStream
**stream
)
191 FIXME("(%p, %p): stub.\n", iface
, stream
);
196 static HRESULT WINAPI
spstream_BindToFile(ISpStream
*iface
, LPCWSTR filename
, SPFILEMODE mode
,
197 const GUID
*format
, const WAVEFORMATEX
* wave
,
200 FIXME("(%p, %s, %d, %s, %p, %s): stub.\n", iface
, debugstr_w(filename
), mode
, debugstr_guid(format
),
201 wave
, wine_dbgstr_longlong(interest
));
206 static HRESULT WINAPI
spstream_Close(ISpStream
*iface
)
208 FIXME("(%p): stub.\n", iface
);
213 const static ISpStreamVtbl spstream_vtbl
=
215 spstream_QueryInterface
,
226 spstream_UnlockRegion
,
230 spstream_SetBaseStream
,
231 spstream_GetBaseStream
,
236 HRESULT
speech_stream_create(IUnknown
*outer
, REFIID iid
, void **obj
)
238 struct spstream
*This
= heap_alloc(sizeof(*This
));
241 if (!This
) return E_OUTOFMEMORY
;
242 This
->ISpStream_iface
.lpVtbl
= &spstream_vtbl
;
245 hr
= ISpStream_QueryInterface(&This
->ISpStream_iface
, iid
, obj
);
247 ISpStream_Release(&This
->ISpStream_iface
);