wined3d: Move struct wined3d_shader_resource_view_vk to wined3d_vk.h.
[wine.git] / dlls / mf / mf_private.h
blob69923154b79786c3f86f5bde694a2efcf50ef99c
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 "mferror.h"
20 #include "mfidl.h"
21 #include "mfapi.h"
23 #include "wine/debug.h"
25 static inline BOOL mf_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
27 size_t new_capacity, max_capacity;
28 void *new_elements;
30 if (count <= *capacity)
31 return TRUE;
33 max_capacity = ~(SIZE_T)0 / size;
34 if (count > max_capacity)
35 return FALSE;
37 new_capacity = max(4, *capacity);
38 while (new_capacity < count && new_capacity <= max_capacity / 2)
39 new_capacity *= 2;
40 if (new_capacity < count)
41 new_capacity = max_capacity;
43 if (!(new_elements = realloc(*elements, new_capacity * size)))
44 return FALSE;
46 *elements = new_elements;
47 *capacity = new_capacity;
49 return TRUE;
52 struct activate_funcs
54 HRESULT (*create_object)(IMFAttributes *attributes, void *context, IUnknown **object);
55 void (*shutdown_object)(void *context, IUnknown *object);
56 void (*free_private)(void *context);
59 HRESULT create_activation_object(void *context, const struct activate_funcs *funcs, IMFActivate **ret) DECLSPEC_HIDDEN;
61 static inline const char *debugstr_time(LONGLONG time)
63 ULONGLONG abstime = time >= 0 ? time : -time;
64 unsigned int i = 0, j = 0;
65 char buffer[23], rev[23];
67 while (abstime || i <= 8)
69 buffer[i++] = '0' + (abstime % 10);
70 abstime /= 10;
71 if (i == 7) buffer[i++] = '.';
73 if (time < 0) buffer[i++] = '-';
75 while (i--) rev[j++] = buffer[i];
76 while (rev[j-1] == '0' && rev[j-2] != '.') --j;
77 rev[j] = 0;
79 return wine_dbg_sprintf("%s", rev);
82 static inline const char *debugstr_propvar(const PROPVARIANT *v)
84 if (!v)
85 return "(null)";
87 switch (v->vt)
89 case VT_EMPTY:
90 return wine_dbg_sprintf("%p {VT_EMPTY}", v);
91 case VT_NULL:
92 return wine_dbg_sprintf("%p {VT_NULL}", v);
93 case VT_UI4:
94 return wine_dbg_sprintf("%p {VT_UI4: %ld}", v, v->ulVal);
95 case VT_UI8:
96 return wine_dbg_sprintf("%p {VT_UI8: %s}", v, wine_dbgstr_longlong(v->uhVal.QuadPart));
97 case VT_I8:
98 return wine_dbg_sprintf("%p {VT_I8: %s}", v, wine_dbgstr_longlong(v->hVal.QuadPart));
99 case VT_R4:
100 return wine_dbg_sprintf("%p {VT_R4: %.8e}", v, v->fltVal);
101 case VT_R8:
102 return wine_dbg_sprintf("%p {VT_R8: %lf}", v, v->dblVal);
103 case VT_CLSID:
104 return wine_dbg_sprintf("%p {VT_CLSID: %s}", v, wine_dbgstr_guid(v->puuid));
105 case VT_LPWSTR:
106 return wine_dbg_sprintf("%p {VT_LPWSTR: %s}", v, wine_dbgstr_w(v->pwszVal));
107 case VT_VECTOR | VT_UI1:
108 return wine_dbg_sprintf("%p {VT_VECTOR|VT_UI1: %p}", v, v->caub.pElems);
109 case VT_UNKNOWN:
110 return wine_dbg_sprintf("%p {VT_UNKNOWN: %p}", v, v->punkVal);
111 default:
112 return wine_dbg_sprintf("%p {vt %#x}", v, v->vt);
116 extern BOOL mf_is_sample_copier_transform(IMFTransform *transform) DECLSPEC_HIDDEN;
117 extern BOOL mf_is_sar_sink(IMFMediaSink *sink) DECLSPEC_HIDDEN;
118 extern HRESULT topology_node_get_object(IMFTopologyNode *node, REFIID riid, void **obj) DECLSPEC_HIDDEN;
119 extern HRESULT topology_node_get_type_handler(IMFTopologyNode *node, DWORD stream, BOOL output, IMFMediaTypeHandler **handler) DECLSPEC_HIDDEN;
120 extern HRESULT topology_node_init_media_type(IMFTopologyNode *node, DWORD stream, BOOL output, IMFMediaType **type) DECLSPEC_HIDDEN;