ReactOS 0.4.17-dev-934-g091855f
decoder.c
Go to the documentation of this file.
1/*
2 * Copyright 2024 Elizabeth Figura for CodeWeavers
3 *
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.
8 *
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.
13 *
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
17 *
18 */
19
20#include "d3d11_private.h"
21
23
24static struct d3d_video_decoder *impl_from_ID3D11VideoDecoder(ID3D11VideoDecoder *iface)
25{
27}
28
30 REFIID riid, void **object)
31{
32 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
33
34 if (IsEqualGUID(riid, &IID_ID3D11VideoDecoder)
35 || IsEqualGUID(riid, &IID_ID3D11DeviceChild)
37 {
38 ID3D11VideoDecoder_AddRef(iface);
39 *object = iface;
40 return S_OK;
41 }
42
43 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
44
45 *object = NULL;
46 return E_NOINTERFACE;
47}
48
49static ULONG STDMETHODCALLTYPE d3d11_video_decoder_AddRef(ID3D11VideoDecoder *iface)
50{
53
54 TRACE("%p increasing refcount to %lu.\n", decoder, refcount);
55
56 return refcount;
57}
58
59static ULONG STDMETHODCALLTYPE d3d11_video_decoder_Release(ID3D11VideoDecoder *iface)
60{
63
64 TRACE("%p decreasing refcount to %lu.\n", decoder, refcount);
65
66 if (!refcount)
67 {
68 ID3D11Device2_Release(&decoder->device->ID3D11Device2_iface);
71 }
72
73 return refcount;
74}
75
76static void STDMETHODCALLTYPE d3d11_video_decoder_GetDevice(ID3D11VideoDecoder *iface, ID3D11Device **device)
77{
79
80 TRACE("iface %p, device %p.\n", iface, device);
81
82 *device = (ID3D11Device *)decoder->device;
83 ID3D11Device_AddRef(*device);
84}
85
87 REFGUID guid, UINT *data_size, void *data)
88{
90
91 TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
92
93 return d3d_get_private_data(&decoder->private_store, guid, data_size, data);
94}
95
97 REFGUID guid, UINT data_size, const void *data)
98{
100
101 TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
102
103 return d3d_set_private_data(&decoder->private_store, guid, data_size, data);
104}
105
107 REFGUID guid, const IUnknown *data)
108{
110
111 TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data);
112
113 return d3d_set_private_data_interface(&decoder->private_store, guid, data);
114}
115
117 D3D11_VIDEO_DECODER_DESC *desc, D3D11_VIDEO_DECODER_CONFIG *config)
118{
119 FIXME("iface %p, desc %p, config %p, stub!\n", iface, desc, config);
120 return E_NOTIMPL;
121}
122
124{
125 FIXME("iface %p, handle %p, stub!\n", iface, handle);
126 return E_NOTIMPL;
127}
128
129static const struct ID3D11VideoDecoderVtbl d3d11_video_decoder_vtbl =
130{
140};
141
142HRESULT d3d_video_decoder_create(struct d3d_device *device, const D3D11_VIDEO_DECODER_DESC *desc,
143 const D3D11_VIDEO_DECODER_CONFIG *config, struct d3d_video_decoder **decoder)
144{
146
147 if (!(object = calloc(1, sizeof(*object))))
148 return E_OUTOFMEMORY;
149
150 object->ID3D11VideoDecoder_iface.lpVtbl = &d3d11_video_decoder_vtbl;
151 object->refcount = 1;
152
153 wined3d_private_store_init(&object->private_store);
154 object->device = device;
155 ID3D11Device2_AddRef(&device->ID3D11Device2_iface);
156
157 TRACE("Created video decoder %p.\n", object);
158 *decoder = object;
159 return S_OK;
160}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
HRESULT d3d_get_private_data(struct wined3d_private_store *store, REFGUID guid, UINT *data_size, void *data)
Definition: utils.c:803
HRESULT d3d_set_private_data_interface(struct wined3d_private_store *store, REFGUID guid, const IUnknown *object)
Definition: utils.c:867
HRESULT d3d_set_private_data(struct wined3d_private_store *store, REFGUID guid, UINT data_size, const void *data)
Definition: utils.c:841
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define free
Definition: debug_ros.c:5
static void STDMETHODCALLTYPE d3d11_video_decoder_GetDevice(ID3D11VideoDecoder *iface, ID3D11Device **device)
Definition: decoder.c:76
static ULONG STDMETHODCALLTYPE d3d11_video_decoder_AddRef(ID3D11VideoDecoder *iface)
Definition: decoder.c:49
static const struct ID3D11VideoDecoderVtbl d3d11_video_decoder_vtbl
Definition: decoder.c:129
HRESULT d3d_video_decoder_create(struct d3d_device *device, const D3D11_VIDEO_DECODER_DESC *desc, const D3D11_VIDEO_DECODER_CONFIG *config, struct d3d_video_decoder **decoder)
Definition: decoder.c:142
static HRESULT STDMETHODCALLTYPE d3d11_video_decoder_GetDriverHandle(ID3D11VideoDecoder *iface, HANDLE *handle)
Definition: decoder.c:123
static HRESULT STDMETHODCALLTYPE d3d11_video_decoder_GetCreationParameters(ID3D11VideoDecoder *iface, D3D11_VIDEO_DECODER_DESC *desc, D3D11_VIDEO_DECODER_CONFIG *config)
Definition: decoder.c:116
static ULONG STDMETHODCALLTYPE d3d11_video_decoder_Release(ID3D11VideoDecoder *iface)
Definition: decoder.c:59
static HRESULT STDMETHODCALLTYPE d3d11_video_decoder_GetPrivateData(ID3D11VideoDecoder *iface, REFGUID guid, UINT *data_size, void *data)
Definition: decoder.c:86
static struct d3d_video_decoder * impl_from_ID3D11VideoDecoder(ID3D11VideoDecoder *iface)
Definition: decoder.c:24
static HRESULT STDMETHODCALLTYPE d3d11_video_decoder_SetPrivateData(ID3D11VideoDecoder *iface, REFGUID guid, UINT data_size, const void *data)
Definition: decoder.c:96
static HRESULT STDMETHODCALLTYPE d3d11_video_decoder_SetPrivateDataInterface(ID3D11VideoDecoder *iface, REFGUID guid, const IUnknown *data)
Definition: decoder.c:106
static HRESULT STDMETHODCALLTYPE d3d11_video_decoder_QueryInterface(ID3D11VideoDecoder *iface, REFIID riid, void **object)
Definition: decoder.c:29
#define NULL
Definition: types.h:112
GUID guid
Definition: version.c:147
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
unsigned int UINT
Definition: sysinfo.c:13
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define calloc
Definition: rosglue.h:14
#define TRACE(s)
Definition: solgame.cpp:4
Definition: scsiwmi.h:51
struct d3d_device * device
ID3D11VideoDecoder ID3D11VideoDecoder_iface
Definition: devices.h:37
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
static void wined3d_private_store_cleanup(struct wined3d_private_store *store)
Definition: wined3d.h:2636
static void wined3d_private_store_init(struct wined3d_private_store *store)
Definition: wined3d.h:2607
#define E_NOINTERFACE
Definition: winerror.h:3479