2019-02-18 14:24:09 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2019 Nikolay Sivov for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
2019-04-29 13:37:50 +02:00
|
|
|
#define NONAMELESSUNION
|
2019-02-18 14:24:09 +01:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
2019-03-01 09:03:12 +01:00
|
|
|
#include "wine/list.h"
|
2019-02-18 14:24:09 +01:00
|
|
|
|
2019-03-01 09:03:07 +01:00
|
|
|
#include "mfplat_private.h"
|
2020-02-05 06:44:13 +01:00
|
|
|
#include "rtworkq.h"
|
2019-03-01 09:03:07 +01:00
|
|
|
|
2019-02-18 14:24:09 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
|
|
|
|
|
2019-02-19 14:20:05 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* MFAllocateWorkQueue (mfplat.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI MFAllocateWorkQueue(DWORD *queue)
|
|
|
|
{
|
|
|
|
TRACE("%p.\n", queue);
|
|
|
|
|
2020-02-05 06:44:13 +01:00
|
|
|
return RtwqAllocateWorkQueue(RTWQ_STANDARD_WORKQUEUE, queue);
|
2019-02-19 14:20:05 +01:00
|
|
|
}
|
2019-02-21 11:32:00 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MFPutWorkItem (mfplat.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI MFPutWorkItem(DWORD queue, IMFAsyncCallback *callback, IUnknown *state)
|
|
|
|
{
|
2020-03-02 11:35:52 +01:00
|
|
|
IRtwqAsyncResult *result;
|
2019-02-21 11:32:00 +01:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("%#x, %p, %p.\n", queue, callback, state);
|
|
|
|
|
2020-03-02 11:35:52 +01:00
|
|
|
if (FAILED(hr = RtwqCreateAsyncResult(NULL, (IRtwqAsyncCallback *)callback, state, &result)))
|
2019-02-21 11:32:00 +01:00
|
|
|
return hr;
|
|
|
|
|
2020-03-02 11:35:52 +01:00
|
|
|
hr = RtwqPutWorkItem(queue, 0, result);
|
2019-03-13 07:29:33 +01:00
|
|
|
|
2020-03-02 11:35:52 +01:00
|
|
|
IRtwqAsyncResult_Release(result);
|
2019-03-13 07:29:33 +01:00
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MFPutWorkItem2 (mfplat.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI MFPutWorkItem2(DWORD queue, LONG priority, IMFAsyncCallback *callback, IUnknown *state)
|
|
|
|
{
|
2020-03-02 11:35:52 +01:00
|
|
|
IRtwqAsyncResult *result;
|
2019-03-13 07:29:33 +01:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("%#x, %d, %p, %p.\n", queue, priority, callback, state);
|
|
|
|
|
2020-03-02 11:35:52 +01:00
|
|
|
if (FAILED(hr = RtwqCreateAsyncResult(NULL, (IRtwqAsyncCallback *)callback, state, &result)))
|
2019-03-13 07:29:33 +01:00
|
|
|
return hr;
|
|
|
|
|
2020-03-02 11:35:52 +01:00
|
|
|
hr = RtwqPutWorkItem(queue, priority, result);
|
2019-02-21 11:32:00 +01:00
|
|
|
|
2020-03-02 11:35:52 +01:00
|
|
|
IRtwqAsyncResult_Release(result);
|
2019-02-21 11:32:00 +01:00
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MFPutWorkItemEx (mfplat.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI MFPutWorkItemEx(DWORD queue, IMFAsyncResult *result)
|
|
|
|
{
|
2019-03-01 09:03:10 +01:00
|
|
|
TRACE("%#x, %p\n", queue, result);
|
2019-02-21 11:32:00 +01:00
|
|
|
|
2020-03-02 11:35:52 +01:00
|
|
|
return RtwqPutWorkItem(queue, 0, (IRtwqAsyncResult *)result);
|
2019-03-13 07:29:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MFPutWorkItemEx2 (mfplat.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI MFPutWorkItemEx2(DWORD queue, LONG priority, IMFAsyncResult *result)
|
|
|
|
{
|
|
|
|
TRACE("%#x, %d, %p\n", queue, priority, result);
|
|
|
|
|
2020-02-05 06:44:13 +01:00
|
|
|
return RtwqPutWorkItem(queue, priority, (IRtwqAsyncResult *)result);
|
2019-02-21 11:32:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2020-02-05 06:44:13 +01:00
|
|
|
* MFScheduleWorkItem (mfplat.@)
|
2019-03-01 09:03:06 +01:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI MFScheduleWorkItem(IMFAsyncCallback *callback, IUnknown *state, INT64 timeout, MFWORKITEM_KEY *key)
|
|
|
|
{
|
2020-03-02 11:35:52 +01:00
|
|
|
IRtwqAsyncResult *result;
|
2019-03-01 09:03:06 +01:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("%p, %p, %s, %p.\n", callback, state, wine_dbgstr_longlong(timeout), key);
|
|
|
|
|
2020-03-02 11:35:52 +01:00
|
|
|
if (FAILED(hr = RtwqCreateAsyncResult(NULL, (IRtwqAsyncCallback *)callback, state, &result)))
|
2019-03-01 09:03:06 +01:00
|
|
|
return hr;
|
|
|
|
|
2020-03-02 11:35:52 +01:00
|
|
|
hr = RtwqScheduleWorkItem(result, timeout, key);
|
2019-03-01 09:03:06 +01:00
|
|
|
|
2020-03-02 11:35:52 +01:00
|
|
|
IRtwqAsyncResult_Release(result);
|
2019-03-01 09:03:06 +01:00
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2020-02-05 06:44:13 +01:00
|
|
|
* MFInvokeCallback (mfplat.@)
|
2019-03-01 09:03:06 +01:00
|
|
|
*/
|
2020-02-05 06:44:13 +01:00
|
|
|
HRESULT WINAPI MFInvokeCallback(IMFAsyncResult *result)
|
2019-03-01 09:03:06 +01:00
|
|
|
{
|
2020-02-05 06:44:13 +01:00
|
|
|
TRACE("%p.\n", result);
|
2019-03-04 11:33:41 +01:00
|
|
|
|
2020-02-05 06:44:13 +01:00
|
|
|
return RtwqInvokeCallback((IRtwqAsyncResult *)result);
|
2019-03-04 11:33:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2020-02-05 06:44:13 +01:00
|
|
|
* MFGetTimerPeriodicity (mfplat.@)
|
2019-03-04 11:33:41 +01:00
|
|
|
*/
|
2020-02-05 06:44:13 +01:00
|
|
|
HRESULT WINAPI MFGetTimerPeriodicity(DWORD *period)
|
2019-03-04 11:33:41 +01:00
|
|
|
{
|
2020-02-05 06:44:13 +01:00
|
|
|
TRACE("%p.\n", period);
|
2019-03-04 11:33:41 +01:00
|
|
|
|
2020-02-05 06:44:13 +01:00
|
|
|
*period = 10;
|
2019-03-04 11:33:41 +01:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
2020-10-07 10:40:23 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* MFBeginRegisterWorkQueueWithMMCSS (mfplat.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI MFBeginRegisterWorkQueueWithMMCSS(DWORD queue, const WCHAR *usage_class, DWORD taskid,
|
|
|
|
IMFAsyncCallback *callback, IUnknown *state)
|
|
|
|
{
|
|
|
|
return RtwqBeginRegisterWorkQueueWithMMCSS(queue, usage_class, taskid, 0,
|
|
|
|
(IRtwqAsyncCallback *)callback, state);
|
|
|
|
}
|