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
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(mfplat
);
32 typedef struct mfsession
34 IMFMediaSession IMFMediaSession_iface
;
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
;
57 FIXME("(%s, %p)\n", debugstr_guid(riid
), out
);
62 IUnknown_AddRef((IUnknown
*)*out
);
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
);
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
);
85 HeapFree(GetProcessHeap(), 0, This
);
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
);
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
);
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
);
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
);
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
);
137 static HRESULT WINAPI
mfsession_ClearTopologies(IMFMediaSession
*iface
)
139 mfsession
*This
= impl_from_IMFMediaSession(iface
);
141 FIXME("(%p)\n", This
);
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
);
155 static HRESULT WINAPI
mfsession_Pause(IMFMediaSession
*iface
)
157 mfsession
*This
= impl_from_IMFMediaSession(iface
);
159 FIXME("(%p)\n", This
);
164 static HRESULT WINAPI
mfsession_Stop(IMFMediaSession
*iface
)
166 mfsession
*This
= impl_from_IMFMediaSession(iface
);
168 FIXME("(%p)\n", This
);
173 static HRESULT WINAPI
mfsession_Close(IMFMediaSession
*iface
)
175 mfsession
*This
= impl_from_IMFMediaSession(iface
);
177 FIXME("(%p)\n", This
);
182 static HRESULT WINAPI
mfsession_Shutdown(IMFMediaSession
*iface
)
184 mfsession
*This
= impl_from_IMFMediaSession(iface
);
186 FIXME("(%p)\n", This
);
191 static HRESULT WINAPI
mfsession_GetClock(IMFMediaSession
*iface
, IMFClock
**clock
)
193 mfsession
*This
= impl_from_IMFMediaSession(iface
);
195 FIXME("(%p)->(%p)\n", This
, clock
);
200 static HRESULT WINAPI
mfsession_GetSessionCapabilities(IMFMediaSession
*iface
, DWORD
*caps
)
202 mfsession
*This
= impl_from_IMFMediaSession(iface
);
204 FIXME("(%p)->(%p)\n", This
, caps
);
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
);
218 static const IMFMediaSessionVtbl mfmediasessionvtbl
=
220 mfsession_QueryInterface
,
224 mfsession_BeginGetEvent
,
225 mfsession_EndGetEvent
,
226 mfsession_QueueEvent
,
227 mfsession_SetTopology
,
228 mfsession_ClearTopologies
,
235 mfsession_GetSessionCapabilities
,
236 mfsession_GetFullTopology
,
239 /***********************************************************************
240 * MFCreateTopology (mf.@)
242 HRESULT WINAPI
MFCreateMediaSession(IMFAttributes
*config
, IMFMediaSession
**session
)
246 TRACE("(%p, %p)\n", config
, session
);
252 FIXME("session configuration ignored\n");
254 object
= HeapAlloc(GetProcessHeap(), 0, sizeof(*object
));
256 return E_OUTOFMEMORY
;
258 object
->IMFMediaSession_iface
.lpVtbl
= &mfmediasessionvtbl
;
261 *session
= &object
->IMFMediaSession_iface
;