mstask/tests: Add more tests for IEnumWorkItems interface.
[wine.git] / dlls / mf / session.c
blob18c5f3bf01ec0b5cc433bb4bafba1da261fd7bd6
1 /*
2 * Copyright 2017 Nikolay Sivov
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.
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.
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
18 #include "config.h"
20 #include <stdarg.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "mfidl.h"
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
32 typedef struct mfsession
34 IMFMediaSession IMFMediaSession_iface;
35 LONG ref;
36 } mfsession;
38 static inline mfsession *impl_from_IMFMediaSession(IMFMediaSession *iface)
40 return CONTAINING_RECORD(iface, mfsession, IMFMediaSession_iface);
43 static HRESULT WINAPI mfsession_QueryInterface(IMFMediaSession *iface, REFIID riid, void **out)
45 mfsession *This = impl_from_IMFMediaSession(iface);
47 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), out);
49 if (IsEqualIID(riid, &IID_IMFMediaSession) ||
50 IsEqualIID(riid, &IID_IMFMediaEventGenerator) ||
51 IsEqualIID(riid, &IID_IUnknown))
53 *out = &This->IMFMediaSession_iface;
55 else
57 FIXME("(%s, %p)\n", debugstr_guid(riid), out);
58 *out = NULL;
59 return E_NOINTERFACE;
62 IUnknown_AddRef((IUnknown*)*out);
63 return S_OK;
66 static ULONG WINAPI mfsession_AddRef(IMFMediaSession *iface)
68 mfsession *This = impl_from_IMFMediaSession(iface);
69 ULONG ref = InterlockedIncrement(&This->ref);
71 TRACE("(%p) ref=%u\n", This, ref);
73 return ref;
76 static ULONG WINAPI mfsession_Release(IMFMediaSession *iface)
78 mfsession *This = impl_from_IMFMediaSession(iface);
79 ULONG ref = InterlockedDecrement(&This->ref);
81 TRACE("(%p) ref=%u\n", This, ref);
83 if (!ref)
85 HeapFree(GetProcessHeap(), 0, This);
88 return ref;
91 static HRESULT WINAPI mfsession_GetEvent(IMFMediaSession *iface, DWORD flags, IMFMediaEvent **event)
93 mfsession *This = impl_from_IMFMediaSession(iface);
95 FIXME("(%p)->(%#x, %p)\n", This, flags, event);
97 return E_NOTIMPL;
100 static HRESULT WINAPI mfsession_BeginGetEvent(IMFMediaSession *iface, IMFAsyncCallback *callback, IUnknown *state)
102 mfsession *This = impl_from_IMFMediaSession(iface);
104 FIXME("(%p)->(%p, %p)\n", This, callback, state);
106 return E_NOTIMPL;
109 static HRESULT WINAPI mfsession_EndGetEvent(IMFMediaSession *iface, IMFAsyncResult *result, IMFMediaEvent **event)
111 mfsession *This = impl_from_IMFMediaSession(iface);
113 FIXME("(%p)->(%p, %p)\n", This, result, event);
115 return E_NOTIMPL;
118 static HRESULT WINAPI mfsession_QueueEvent(IMFMediaSession *iface, MediaEventType event_type, REFGUID ext_type,
119 HRESULT hr, const PROPVARIANT *value)
121 mfsession *This = impl_from_IMFMediaSession(iface);
123 FIXME("(%p)->(%d, %s, %#x, %p)\n", This, event_type, debugstr_guid(ext_type), hr, value);
125 return E_NOTIMPL;
128 static HRESULT WINAPI mfsession_SetTopology(IMFMediaSession *iface, DWORD flags, IMFTopology *topology)
130 mfsession *This = impl_from_IMFMediaSession(iface);
132 FIXME("(%p)->(%#x, %p)\n", This, flags, topology);
134 return E_NOTIMPL;
137 static HRESULT WINAPI mfsession_ClearTopologies(IMFMediaSession *iface)
139 mfsession *This = impl_from_IMFMediaSession(iface);
141 FIXME("(%p)\n", This);
143 return E_NOTIMPL;
146 static HRESULT WINAPI mfsession_Start(IMFMediaSession *iface, const GUID *format, const PROPVARIANT *start)
148 mfsession *This = impl_from_IMFMediaSession(iface);
150 FIXME("(%p)->(%s, %p)\n", This, debugstr_guid(format), start);
152 return E_NOTIMPL;
155 static HRESULT WINAPI mfsession_Pause(IMFMediaSession *iface)
157 mfsession *This = impl_from_IMFMediaSession(iface);
159 FIXME("(%p)\n", This);
161 return E_NOTIMPL;
164 static HRESULT WINAPI mfsession_Stop(IMFMediaSession *iface)
166 mfsession *This = impl_from_IMFMediaSession(iface);
168 FIXME("(%p)\n", This);
170 return E_NOTIMPL;
173 static HRESULT WINAPI mfsession_Close(IMFMediaSession *iface)
175 mfsession *This = impl_from_IMFMediaSession(iface);
177 FIXME("(%p)\n", This);
179 return E_NOTIMPL;
182 static HRESULT WINAPI mfsession_Shutdown(IMFMediaSession *iface)
184 mfsession *This = impl_from_IMFMediaSession(iface);
186 FIXME("(%p)\n", This);
188 return E_NOTIMPL;
191 static HRESULT WINAPI mfsession_GetClock(IMFMediaSession *iface, IMFClock **clock)
193 mfsession *This = impl_from_IMFMediaSession(iface);
195 FIXME("(%p)->(%p)\n", This, clock);
197 return E_NOTIMPL;
200 static HRESULT WINAPI mfsession_GetSessionCapabilities(IMFMediaSession *iface, DWORD *caps)
202 mfsession *This = impl_from_IMFMediaSession(iface);
204 FIXME("(%p)->(%p)\n", This, caps);
206 return E_NOTIMPL;
209 static HRESULT WINAPI mfsession_GetFullTopology(IMFMediaSession *iface, DWORD flags, TOPOID id, IMFTopology **topology)
211 mfsession *This = impl_from_IMFMediaSession(iface);
213 FIXME("(%p)->(%#x, %s, %p)\n", This, flags, wine_dbgstr_longlong(id), topology);
215 return E_NOTIMPL;
218 static const IMFMediaSessionVtbl mfmediasessionvtbl =
220 mfsession_QueryInterface,
221 mfsession_AddRef,
222 mfsession_Release,
223 mfsession_GetEvent,
224 mfsession_BeginGetEvent,
225 mfsession_EndGetEvent,
226 mfsession_QueueEvent,
227 mfsession_SetTopology,
228 mfsession_ClearTopologies,
229 mfsession_Start,
230 mfsession_Pause,
231 mfsession_Stop,
232 mfsession_Close,
233 mfsession_Shutdown,
234 mfsession_GetClock,
235 mfsession_GetSessionCapabilities,
236 mfsession_GetFullTopology,
239 /***********************************************************************
240 * MFCreateTopology (mf.@)
242 HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **session)
244 mfsession *object;
246 TRACE("(%p, %p)\n", config, session);
248 if (!session)
249 return E_POINTER;
251 if (config)
252 FIXME("session configuration ignored\n");
254 object = HeapAlloc(GetProcessHeap(), 0, sizeof(*object));
255 if (!object)
256 return E_OUTOFMEMORY;
258 object->IMFMediaSession_iface.lpVtbl = &mfmediasessionvtbl;
259 object->ref = 1;
261 *session = &object->IMFMediaSession_iface;
263 return S_OK;