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
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
;
30 if (count
<= *capacity
)
33 max_capacity
= ~(SIZE_T
)0 / size
;
34 if (count
> max_capacity
)
37 new_capacity
= max(4, *capacity
);
38 while (new_capacity
< count
&& new_capacity
<= max_capacity
/ 2)
40 if (new_capacity
< count
)
41 new_capacity
= max_capacity
;
43 if (!(new_elements
= realloc(*elements
, new_capacity
* size
)))
46 *elements
= new_elements
;
47 *capacity
= new_capacity
;
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
);
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);
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
;
79 return wine_dbg_sprintf("%s", rev
);
82 static inline const char *debugstr_propvar(const PROPVARIANT
*v
)
90 return wine_dbg_sprintf("%p {VT_EMPTY}", v
);
92 return wine_dbg_sprintf("%p {VT_NULL}", v
);
94 return wine_dbg_sprintf("%p {VT_UI4: %ld}", v
, v
->ulVal
);
96 return wine_dbg_sprintf("%p {VT_UI8: %s}", v
, wine_dbgstr_longlong(v
->uhVal
.QuadPart
));
98 return wine_dbg_sprintf("%p {VT_I8: %s}", v
, wine_dbgstr_longlong(v
->hVal
.QuadPart
));
100 return wine_dbg_sprintf("%p {VT_R4: %.8e}", v
, v
->fltVal
);
102 return wine_dbg_sprintf("%p {VT_R8: %lf}", v
, v
->dblVal
);
104 return wine_dbg_sprintf("%p {VT_CLSID: %s}", v
, wine_dbgstr_guid(v
->puuid
));
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
);
110 return wine_dbg_sprintf("%p {VT_UNKNOWN: %p}", v
, v
->punkVal
);
112 return wine_dbg_sprintf("%p {vt %#x}", v
, v
->vt
);
116 extern HRESULT
file_scheme_handler_construct(REFIID riid
, void **obj
);
117 extern HRESULT
urlmon_scheme_handler_construct(REFIID riid
, void **obj
);
119 extern BOOL
mf_is_sample_copier_transform(IMFTransform
*transform
);
120 extern BOOL
mf_is_sar_sink(IMFMediaSink
*sink
);
121 extern HRESULT
topology_node_get_object(IMFTopologyNode
*node
, REFIID riid
, void **obj
);
122 extern HRESULT
topology_node_get_type_handler(IMFTopologyNode
*node
, DWORD stream
, BOOL output
, IMFMediaTypeHandler
**handler
);
123 extern HRESULT
topology_node_init_media_type(IMFTopologyNode
*node
, DWORD stream
, BOOL output
, IMFMediaType
**type
);