mountmgr.sys: Ensure unixlib function tables and enum stay in sync.
[wine.git] / dlls / mfplat / queue.c
blob6ee0df37dce11c5cc86cffcd24fa970bba77e8a8
1 /*
2 * Copyright 2019 Nikolay Sivov for CodeWeavers
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
19 #define COBJMACROS
21 #include "mfplat_private.h"
22 #include "rtworkq.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
26 /***********************************************************************
27 * MFAllocateWorkQueue (mfplat.@)
29 HRESULT WINAPI MFAllocateWorkQueue(DWORD *queue)
31 TRACE("%p.\n", queue);
33 return RtwqAllocateWorkQueue(RTWQ_STANDARD_WORKQUEUE, queue);
36 /***********************************************************************
37 * MFPutWorkItem (mfplat.@)
39 HRESULT WINAPI MFPutWorkItem(DWORD queue, IMFAsyncCallback *callback, IUnknown *state)
41 IRtwqAsyncResult *result;
42 HRESULT hr;
44 TRACE("%#lx, %p, %p.\n", queue, callback, state);
46 if (FAILED(hr = RtwqCreateAsyncResult(NULL, (IRtwqAsyncCallback *)callback, state, &result)))
47 return hr;
49 hr = RtwqPutWorkItem(queue, 0, result);
51 IRtwqAsyncResult_Release(result);
53 return hr;
56 /***********************************************************************
57 * MFPutWorkItem2 (mfplat.@)
59 HRESULT WINAPI MFPutWorkItem2(DWORD queue, LONG priority, IMFAsyncCallback *callback, IUnknown *state)
61 IRtwqAsyncResult *result;
62 HRESULT hr;
64 TRACE("%#lx, %ld, %p, %p.\n", queue, priority, callback, state);
66 if (FAILED(hr = RtwqCreateAsyncResult(NULL, (IRtwqAsyncCallback *)callback, state, &result)))
67 return hr;
69 hr = RtwqPutWorkItem(queue, priority, result);
71 IRtwqAsyncResult_Release(result);
73 return hr;
76 /***********************************************************************
77 * MFPutWorkItemEx (mfplat.@)
79 HRESULT WINAPI MFPutWorkItemEx(DWORD queue, IMFAsyncResult *result)
81 TRACE("%#lx, %p\n", queue, result);
83 return RtwqPutWorkItem(queue, 0, (IRtwqAsyncResult *)result);
86 /***********************************************************************
87 * MFPutWorkItemEx2 (mfplat.@)
89 HRESULT WINAPI MFPutWorkItemEx2(DWORD queue, LONG priority, IMFAsyncResult *result)
91 TRACE("%#lx, %ld, %p\n", queue, priority, result);
93 return RtwqPutWorkItem(queue, priority, (IRtwqAsyncResult *)result);
96 /***********************************************************************
97 * MFScheduleWorkItem (mfplat.@)
99 HRESULT WINAPI MFScheduleWorkItem(IMFAsyncCallback *callback, IUnknown *state, INT64 timeout, MFWORKITEM_KEY *key)
101 IRtwqAsyncResult *result;
102 HRESULT hr;
104 TRACE("%p, %p, %s, %p.\n", callback, state, wine_dbgstr_longlong(timeout), key);
106 if (FAILED(hr = RtwqCreateAsyncResult(NULL, (IRtwqAsyncCallback *)callback, state, &result)))
107 return hr;
109 hr = RtwqScheduleWorkItem(result, timeout, key);
111 IRtwqAsyncResult_Release(result);
113 return hr;
116 /***********************************************************************
117 * MFInvokeCallback (mfplat.@)
119 HRESULT WINAPI MFInvokeCallback(IMFAsyncResult *result)
121 TRACE("%p.\n", result);
123 return RtwqInvokeCallback((IRtwqAsyncResult *)result);
126 /***********************************************************************
127 * MFGetTimerPeriodicity (mfplat.@)
129 HRESULT WINAPI MFGetTimerPeriodicity(DWORD *period)
131 TRACE("%p.\n", period);
133 *period = 10;
135 return S_OK;
138 /***********************************************************************
139 * MFBeginRegisterWorkQueueWithMMCSS (mfplat.@)
141 HRESULT WINAPI MFBeginRegisterWorkQueueWithMMCSS(DWORD queue, const WCHAR *usage_class, DWORD taskid,
142 IMFAsyncCallback *callback, IUnknown *state)
144 return RtwqBeginRegisterWorkQueueWithMMCSS(queue, usage_class, taskid, 0,
145 (IRtwqAsyncCallback *)callback, state);