makefiles: Install PE files in an architecture-specific directory.
[wine.git] / dlls / mfplat / queue.c
blob8279929b46e3bed6ea03257f23b8176a628b528b
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 #include <stdarg.h>
21 #define COBJMACROS
22 #define NONAMELESSUNION
24 #include "wine/debug.h"
25 #include "wine/list.h"
27 #include "mfplat_private.h"
28 #include "rtworkq.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
32 /***********************************************************************
33 * MFAllocateWorkQueue (mfplat.@)
35 HRESULT WINAPI MFAllocateWorkQueue(DWORD *queue)
37 TRACE("%p.\n", queue);
39 return RtwqAllocateWorkQueue(RTWQ_STANDARD_WORKQUEUE, queue);
42 /***********************************************************************
43 * MFPutWorkItem (mfplat.@)
45 HRESULT WINAPI MFPutWorkItem(DWORD queue, IMFAsyncCallback *callback, IUnknown *state)
47 IRtwqAsyncResult *result;
48 HRESULT hr;
50 TRACE("%#x, %p, %p.\n", queue, callback, state);
52 if (FAILED(hr = RtwqCreateAsyncResult(NULL, (IRtwqAsyncCallback *)callback, state, &result)))
53 return hr;
55 hr = RtwqPutWorkItem(queue, 0, result);
57 IRtwqAsyncResult_Release(result);
59 return hr;
62 /***********************************************************************
63 * MFPutWorkItem2 (mfplat.@)
65 HRESULT WINAPI MFPutWorkItem2(DWORD queue, LONG priority, IMFAsyncCallback *callback, IUnknown *state)
67 IRtwqAsyncResult *result;
68 HRESULT hr;
70 TRACE("%#x, %d, %p, %p.\n", queue, priority, callback, state);
72 if (FAILED(hr = RtwqCreateAsyncResult(NULL, (IRtwqAsyncCallback *)callback, state, &result)))
73 return hr;
75 hr = RtwqPutWorkItem(queue, priority, result);
77 IRtwqAsyncResult_Release(result);
79 return hr;
82 /***********************************************************************
83 * MFPutWorkItemEx (mfplat.@)
85 HRESULT WINAPI MFPutWorkItemEx(DWORD queue, IMFAsyncResult *result)
87 TRACE("%#x, %p\n", queue, result);
89 return RtwqPutWorkItem(queue, 0, (IRtwqAsyncResult *)result);
92 /***********************************************************************
93 * MFPutWorkItemEx2 (mfplat.@)
95 HRESULT WINAPI MFPutWorkItemEx2(DWORD queue, LONG priority, IMFAsyncResult *result)
97 TRACE("%#x, %d, %p\n", queue, priority, result);
99 return RtwqPutWorkItem(queue, priority, (IRtwqAsyncResult *)result);
102 /***********************************************************************
103 * MFScheduleWorkItem (mfplat.@)
105 HRESULT WINAPI MFScheduleWorkItem(IMFAsyncCallback *callback, IUnknown *state, INT64 timeout, MFWORKITEM_KEY *key)
107 IRtwqAsyncResult *result;
108 HRESULT hr;
110 TRACE("%p, %p, %s, %p.\n", callback, state, wine_dbgstr_longlong(timeout), key);
112 if (FAILED(hr = RtwqCreateAsyncResult(NULL, (IRtwqAsyncCallback *)callback, state, &result)))
113 return hr;
115 hr = RtwqScheduleWorkItem(result, timeout, key);
117 IRtwqAsyncResult_Release(result);
119 return hr;
122 /***********************************************************************
123 * MFInvokeCallback (mfplat.@)
125 HRESULT WINAPI MFInvokeCallback(IMFAsyncResult *result)
127 TRACE("%p.\n", result);
129 return RtwqInvokeCallback((IRtwqAsyncResult *)result);
132 /***********************************************************************
133 * MFGetTimerPeriodicity (mfplat.@)
135 HRESULT WINAPI MFGetTimerPeriodicity(DWORD *period)
137 TRACE("%p.\n", period);
139 *period = 10;
141 return S_OK;
144 /***********************************************************************
145 * MFBeginRegisterWorkQueueWithMMCSS (mfplat.@)
147 HRESULT WINAPI MFBeginRegisterWorkQueueWithMMCSS(DWORD queue, const WCHAR *usage_class, DWORD taskid,
148 IMFAsyncCallback *callback, IUnknown *state)
150 return RtwqBeginRegisterWorkQueueWithMMCSS(queue, usage_class, taskid, 0,
151 (IRtwqAsyncCallback *)callback, state);