Check-in [07dee29164]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:add first draft of tclwmf extension to [undroidwish]
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 07dee291642ed02f96fa062478020eb2e7b9104f
User & Date: chw 2016-06-20 07:20:46.772
Context
2016-06-20
07:22
include tclwmf in Win32 [undroidwish] build scripts check-in: 3bf77f48d6 user: chw tags: trunk
07:20
add first draft of tclwmf extension to [undroidwish] check-in: 07dee29164 user: chw tags: trunk
2016-06-19
23:24
fix for ticket [9fa8dde952] check-in: 255d71cc47 user: chw tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Added undroid/tclwmf/Makefile.in.


































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# Makefile.in --
#
#	This file is a Makefile for Sample TEA Extension.  If it has the name
#	"Makefile.in" then it is a template for a Makefile;  to generate the
#	actual Makefile, run "./configure", which is a configuration script
#	generated by the "autoconf" program (constructs like "@foo@" will get
#	replaced in the actual Makefile.
#
# Copyright (c) 1999 Scriptics Corporation.
# Copyright (c) 2003-2008 ActiveState Software
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.

#========================================================================
# Nothing of the variables below this line need to be changed.  Please
# check the TARGETS section below to make sure the make targets are
# correct.
#========================================================================

#========================================================================
# The names of the source files is defined in the configure script.
# The object files are used for linking into the final library.
# This will be used when a dist target is added to the Makefile.
# It is not important to specify the directory, as long as it is the
# $(srcdir) subdirectory.
#========================================================================

PKG_SOURCES	= @PKG_SOURCES@
PKG_OBJECTS	= @PKG_OBJECTS@

#========================================================================
# PKG_TCL_SOURCES identifies Tcl runtime files that are associated with
# this package that need to be installed, if any.
#========================================================================

PKG_TCL_SOURCES = @PKG_TCL_SOURCES@

#========================================================================
# This is a list of public header files to be installed, if any.
#========================================================================

PKG_HEADERS	= @PKG_HEADERS@

PKG_EXTRA_FILES =

PKG_MAN_PAGES	=

#========================================================================
# "PKG_LIB_FILE" refers to the library (dynamic or static as per
# configuration options) composed of the named objects.
#========================================================================

PKG_LIB_FILE	= @PKG_LIB_FILE@
PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@

lib_BINARIES	= $(PKG_LIB_FILE)
BINARIES	= $(lib_BINARIES)

SHELL		= @SHELL@

srcdir		= @srcdir@
prefix		= @prefix@
exec_prefix	= @exec_prefix@

bindir		= @bindir@
libdir		= @libdir@
datadir		= @datadir@
mandir		= @mandir@
includedir	= @includedir@

DESTDIR		=

PKG_DIR		= $(PACKAGE_NAME)$(PACKAGE_VERSION)
pkgdatadir	= $(datadir)/$(PKG_DIR)
pkglibdir	= $(libdir)/$(PKG_DIR)
pkgincludedir	= $(includedir)/$(PKG_DIR)

top_builddir	= .

INSTALL		= @INSTALL@
INSTALL_PROGRAM	= @INSTALL_PROGRAM@
INSTALL_DATA	= @INSTALL_DATA@
INSTALL_SCRIPT	= @INSTALL_SCRIPT@

PACKAGE_NAME	= @PACKAGE_NAME@
PACKAGE_VERSION	= @PACKAGE_VERSION@
CC		= @CC@
CFLAGS_DEFAULT	= @CFLAGS_DEFAULT@
CFLAGS_WARNING	= @CFLAGS_WARNING@
CLEANFILES	= @CLEANFILES@
EXEEXT		= @EXEEXT@
LDFLAGS_DEFAULT	= @LDFLAGS_DEFAULT@
MAKE_LIB	= @MAKE_LIB@
MAKE_SHARED_LIB	= @MAKE_SHARED_LIB@
MAKE_STATIC_LIB	= @MAKE_STATIC_LIB@
MAKE_STUB_LIB	= @MAKE_STUB_LIB@
OBJEXT		= @OBJEXT@
RANLIB		= @RANLIB@
RANLIB_STUB	= @RANLIB_STUB@
SHLIB_CFLAGS	= @SHLIB_CFLAGS@
SHLIB_LD	= @SHLIB_LD@
SHLIB_LD_LIBS	= @SHLIB_LD_LIBS@
STLIB_LD	= @STLIB_LD@
TCL_DEFS	= @TCL_DEFS@
TCL_SRC_DIR	= @TCL_SRC_DIR@
TCL_BIN_DIR	= @TCL_BIN_DIR@
TK_SRC_DIR	= @TK_SRC_DIR@
TK_BIN_DIR	= @TK_BIN_DIR@

# Not used by sample, but retained for reference of what Tcl required
TCL_LIBS	= @TCL_LIBS@
#TK_LIBS	= @TK_LIBS@
# TK_LIBS currently not required
TK_LIBS		=

#========================================================================
# TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our
# package without installing.  The other environment variables allow us
# to test against an uninstalled Tcl.  Add special env vars that you
# require for testing here (like TCLX_LIBRARY).
#========================================================================

EXTRA_PATH	= $(top_builddir):$(TCL_BIN_DIR):$(TK_BIN_DIR)
TCLSH_ENV	= TCL_LIBRARY=`@CYGPATH@ $(TCL_SRC_DIR)/library` \
		  TK_LIBRARY=`@CYGPATH@ $(TK_SRC_DIR)/library` \
		  @LD_LIBRARY_PATH_VAR@="$(EXTRA_PATH):$(@LD_LIBRARY_PATH_VAR@)" \
		  PATH="$(EXTRA_PATH):$(PATH)" \
		  TCLLIBPATH="$(top_builddir)"
TCLSH_PROG	= @TCLSH_PROG@
WISH_PROG	= @WISH_PROG@
TCLSH		= $(TCLSH_ENV) $(TCLSH_PROG)
WISH		= $(TCLSH_ENV) $(WISH_PROG)

# The local includes must come first, because the TK_XINCLUDES can be
# just a comment
INCLUDES	= @PKG_INCLUDES@ -Icompat \
		  @TCL_INCLUDES@ @TK_INCLUDES@ @TK_XINCLUDES@

PKG_CFLAGS	= @PKG_CFLAGS@

DEFS		= @DEFS@ $(PKG_CFLAGS)

CONFIG_CLEAN_FILES = Makefile

CPPFLAGS	= @CPPFLAGS@
LIBS		= @PKG_LIBS@ @LIBS@
AR		= @AR@
CFLAGS		= @CFLAGS@
COMPILE		= $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)

#========================================================================
# Start of user-definable TARGETS section
#========================================================================

#========================================================================
# TEA TARGETS.  Please note that the "libraries:" target refers to platform
# independent files, and the "binaries:" target inclues executable programs and
# platform-dependent libraries.  Modify these targets so that they install
# the various pieces of your package.  The make and install rules
# for the BINARIES that you specified above have already been done.
#========================================================================

all: binaries libraries doc

#========================================================================
# The binaries target builds executable programs, Windows .dll's, unix
# shared/static libraries, and any other platform-dependent files.
# The list of targets to build for "binaries:" is specified at the top
# of the Makefile, in the "BINARIES" variable.
#========================================================================

binaries: $(BINARIES) pkgIndex.tcl

libraries:

doc:

install: all install-binaries install-libraries install-doc

install-binaries: binaries install-lib-binaries install-bin-binaries
	@mkdir -p $(DESTDIR)$(pkglibdir)
	$(INSTALL_DATA) pkgIndex.tcl $(DESTDIR)$(pkglibdir)
	@list='$(PKG_EXTRA_FILES)'; for p in $$list; do \
	  if test -f $(srcdir)/$$p; then \
	    destp=`basename $$p`; \
	    echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \
	    $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \
	  fi; \
	done

#========================================================================
# This rule installs platform-independent files, such as header files.
#========================================================================

install-libraries: libraries

#========================================================================
# Install documentation.  Unix manpages should go in the $(mandir)
# directory.
#========================================================================

install-doc: doc
	@mkdir -p $(DESTDIR)$(mandir)/mann
	@echo "Installing documentation in $(DESTDIR)$(mandir)"
	@list='$(srcdir)/doc/*.n'; for i in $$list; do \
	  echo "Installing $$i"; \
	  rm -f $(DESTDIR)$(mandir)/mann/`basename $$i`; \
	  $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/mann ; \
	done

test:

shell: binaries libraries
	@$(TCLSH) $(SCRIPT)

gdb:
	$(TCLSH_ENV) gdb $(TCLSH_PROG) $(SCRIPT)

depend:

#========================================================================
# $(PKG_LIB_FILE) should be listed as part of the BINARIES variable
# mentioned above.  That will ensure that this target is built when you
# run "make binaries".
#
# The $(PKG_OBJECTS) objects are created and linked into the final
# library.  In most cases these object files will correspond to the
# source files above.
#========================================================================

$(PKG_LIB_FILE): $(PKG_OBJECTS)
	-rm -f $(PKG_LIB_FILE)
	${MAKE_LIB}
	$(RANLIB) $(PKG_LIB_FILE)

#========================================================================
# In the following lines, $(srcdir) refers to the toplevel directory
# containing your extension.  If your sources are in a subdirectory,
# you will have to modify the paths to reflect this:
#
# tkpkg.$(OBJEXT): $(srcdir)/tkpkg.c
# 	$(COMPILE) -c `@CYGPATH@ $(srcdir)/tkpkg.c` -o $@
#
# Setting the VPATH variable to a list of paths will cause the
# makefile to look into these paths when resolving .c to .obj
# dependencies.
#========================================================================

# I added leading $(srcdir) because autoconf 2.53 strips it off
VPATH = $(srcdir)

.SUFFIXES: .c .$(OBJEXT)

.c.@OBJEXT@:
	$(COMPILE) -c `@CYGPATH@ $<` -o $@

pkgIndex.tcl:
	echo 'package ifneeded $(PACKAGE_NAME) $(PACKAGE_VERSION) \
	    [list load [file join $$dir $(PKG_LIB_FILE)] $(PACKAGE_NAME)]' \
	  > pkgIndex.tcl

#========================================================================
# End of user-definable section
#========================================================================

#========================================================================
# Don't modify the file to clean here.  Instead, set the "CLEANFILES"
# variable in configure.in
#========================================================================

clean:
	-test -z "$(BINARIES)" || rm -f $(BINARIES)
	-rm -f *.$(OBJEXT) core *.core *~
	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)

distclean: clean
	-rm -f *.tab.c
	-rm -f $(CONFIG_CLEAN_FILES)
	-rm -f config.cache config.log config.status

#========================================================================
# Install binary object libraries.  On Windows this includes both .dll and
# .lib files.  Because the .lib files are not explicitly listed anywhere,
# we need to deduce their existence from the .dll file of the same name.
#
# You should not have to modify this target.
#========================================================================

install-lib-binaries:
	@mkdir -p $(DESTDIR)$(pkglibdir)
	@list='$(lib_BINARIES)'; for p in $$list; do \
	  if test -f $$p; then \
	    echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p"; \
	    $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p; \
	    echo " $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p"; \
	    $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p; \
	    ext=`echo $$p|sed -e "s/.*\.//"`; \
	    if test "x$$ext" = "xdll"; then \
		lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \
		if test -f $$lib; then \
		    echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \
	            $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib; \
		fi; \
	    fi; \
	  fi; \
	done
	@list='$(PKG_TCL_SOURCES)'; for p in $$list; do \
	  if test -f $(srcdir)/$$p; then \
	    destp=`basename $$p`; \
	    echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \
	    $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \
	  fi; \
	done

#========================================================================
# Install binary executables (e.g. .exe files)
#
# You should not have to modify this target.
#========================================================================

install-bin-binaries:
	@mkdir -p $(DESTDIR)$(bindir)
	@list='$(bin_BINARIES)'; for p in $$list; do \
	  if test -f $$p; then \
	    echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p"; \
	    $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \
	  fi; \
	done

Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
	cd $(top_builddir) \
	  && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status

uninstall-binaries:
	list='$(lib_BINARIES)'; for p in $$list; do \
	  rm -f $(DESTDIR)$(pkglibdir)/$$p; \
	done
	list='$(PKG_TCL_SOURCES)'; for p in $$list; do \
	  p=`basename $$p`; \
	  rm -f $(DESTDIR)$(pkglibdir)/$$p; \
	done
	list='$(bin_BINARIES)'; for p in $$list; do \
	  rm -f $(DESTDIR)$(bindir)/$$p; \
	done

#========================================================================
# Distribution creation
# You should not have to modify this target.
#========================================================================

TAR		= tar
#COMPRESS	= $(TAR) cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar
COMPRESS	= $(TAR) zcvf $(PKG_DIR).tar.gz $(PKG_DIR)
DIST_ROOT	= /tmp/dist
DIST_DIR	= $(DIST_ROOT)/$(PKG_DIR)

dist-clean:
	rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.*

dist: dist-clean
	mkdir -p $(DIST_DIR)
	cp -p $(srcdir)/license.terms \
		$(srcdir)/Makefile.in $(srcdir)/aclocal.m4 \
		$(srcdir)/configure $(srcdir)/configure.in  $(DIST_DIR)/
	chmod 664 $(DIST_DIR)/Makefile.in $(DIST_DIR)/aclocal.m4
	chmod 775 $(DIST_DIR)/configure $(DIST_DIR)/configure.in
	mkdir -p $(DIST_DIR)/tclconfig
	cp $(srcdir)/tclconfig/install-sh $(srcdir)/tclconfig/tcl.m4 \
		$(DIST_DIR)/tclconfig/
	chmod 664 $(DIST_DIR)/tclconfig/tcl.m4
	chmod +x $(DIST_DIR)/tclconfig/install-sh
	mkdir -p $(DIST_DIR)/demos
	cp -p $(srcdir)/demos/*.tcl $(DIST_DIR)/demos/
	mkdir -p $(DIST_DIR)/doc
	cp -p $(srcdir)/doc/*.n $(DIST_DIR)/doc/
	mkdir -p $(DIST_DIR)
	cp -p $(srcdir)/*.[ch] $(DIST_DIR)
	(cd $(DIST_ROOT); $(COMPRESS);)

.PHONY: all binaries clean depend distclean doc install libraries test

# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
Added undroid/tclwmf/aclocal.m4.


















>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
#
# Include the TEA standard macro set
#

builtin(include,tclconfig/tcl.m4)

#
# Add here whatever m4 macros you want to define for your package
#
Added undroid/tclwmf/compat/mfapi.h.


























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
/**
 * This file is part of the mingw-w64 runtime package.
 * No warranty is given; refer to the file DISCLAIMER within this package.
 */

#include <winapifamily.h>

#ifndef __MFAPI_H__
#define __MFAPI_H__

#include <mfobjects.h>
#include <mmreg.h>
#include <avrt.h>

#ifndef AVRT_DATA
#define AVRT_DATA
#endif

#ifndef AVRT_BSS
#define AVRT_BSS
#endif

#ifndef MF_VERSION
#if WINVER < 0x0601
#define MF_SDK_VERSION 0x1
#else
#define MF_SDK_VERSION 0x2
#endif

#define MF_API_VERSION 0x0070
#define MF_VERSION (MF_SDK_VERSION << 16 | MF_API_VERSION)
#endif

/*ksmedia.h needs fixing about "multi-character character constant"*/
typedef struct _MFT_REGISTRATION_INFO MFT_REGISTRATION_INFO;
typedef struct IMFActivate IMFActivate;

#define MFSTARTUP_NOSOCKET 0x1
#define MFSTARTUP_LITE (MFSTARTUP_NOSOCKET)
#define MFSTARTUP_FULL 0

#if defined (__cplusplus)
extern "C" {
#endif

#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
  typedef unsigned __int64 MFWORKITEM_KEY;

#if defined (__cplusplus) && !defined (CINTERFACE)
  typedef struct tagMFASYNCRESULT : public IMFAsyncResult {
    OVERLAPPED overlapped;
    IMFAsyncCallback *pCallback;
    HRESULT hrStatusResult;
    DWORD dwBytesTransferred;
    HANDLE hEvent;
  } MFASYNCRESULT;
#else
  typedef struct tagMFASYNCRESULT {
    IMFAsyncResult AsyncResult;
    OVERLAPPED overlapped;
    IMFAsyncCallback *pCallback;
    HRESULT hrStatusResult;
    DWORD dwBytesTransferred;
    HANDLE hEvent;
  } MFASYNCRESULT;
#endif

  STDAPI MFStartup (ULONG Version, DWORD dwFlags
#if defined (__cplusplus)
    = MFSTARTUP_FULL
#endif
    );

  STDAPI MFShutdown ();
  STDAPI MFLockPlatform ();
  STDAPI MFUnlockPlatform ();
  STDAPI MFPutWorkItem2 (DWORD dwQueue, LONG Priority, IMFAsyncCallback *pCallback, IUnknown *pState);
  STDAPI MFPutWorkItemEx2 (DWORD dwQueue, LONG Priority, IMFAsyncResult *pResult);
  STDAPI MFPutWaitingWorkItem (HANDLE hEvent, LONG Priority, IMFAsyncResult *pResult, MFWORKITEM_KEY *pKey);
  STDAPI MFAllocateSerialWorkQueue (DWORD dwWorkQueue, DWORD *pdwWorkQueue);
  STDAPI MFCancelWorkItem (MFWORKITEM_KEY Key);
  STDAPI MFLockWorkQueue (DWORD dwWorkQueue);
  STDAPI MFUnlockWorkQueue (DWORD dwWorkQueue);
  STDAPI MFLockSharedWorkQueue (PCWSTR wszClass, LONG BasePriority, DWORD *pdwTaskId, DWORD *pID);
  STDAPI MFCreateAsyncResult (IUnknown *punkObject, IMFAsyncCallback *pCallback, IUnknown *punkState, IMFAsyncResult **ppAsyncResult);
  STDAPI MFInvokeCallback (IMFAsyncResult *pAsyncResult);
  STDAPI MFCreateMemoryBuffer (DWORD cbMaxLength, IMFMediaBuffer **ppBuffer);
  STDAPI MFCreateMediaBufferWrapper (IMFMediaBuffer *pBuffer, DWORD cbOffset, DWORD dwLength, IMFMediaBuffer **ppBuffer);
#endif

#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
#include <dxgiformat.h>

  typedef void (*MFPERIODICCALLBACK) (IUnknown *pContext);

  typedef enum _EAllocationType {
    eAllocationTypeDynamic,
    eAllocationTypeRT,
    eAllocationTypePageable,
    eAllocationTypeIgnore
  } EAllocationType;

#if WINVER >= 0x0601
  typedef enum {
    MF_STANDARD_WORKQUEUE = 0,
    MF_WINDOW_WORKQUEUE = 1,
    MF_MULTITHREADED_WORKQUEUE = 2,
  } MFASYNC_WORKQUEUE_TYPE;
#endif

  STDAPI MFPutWorkItem (DWORD dwQueue, IMFAsyncCallback *pCallback, IUnknown *pState);
  STDAPI MFPutWorkItemEx (DWORD dwQueue, IMFAsyncResult *pResult);
  STDAPI MFScheduleWorkItem (IMFAsyncCallback *pCallback, IUnknown *pState, INT64 Timeout, MFWORKITEM_KEY *pKey);
  STDAPI MFScheduleWorkItemEx (IMFAsyncResult *pResult, INT64 Timeout, MFWORKITEM_KEY *pKey);
  STDAPI MFGetTimerPeriodicity (DWORD *Periodicity);
  STDAPI MFAddPeriodicCallback (MFPERIODICCALLBACK Callback, IUnknown *pContext, DWORD *pdwKey);
  STDAPI MFRemovePeriodicCallback (DWORD dwKey);
  STDAPI MFAllocateWorkQueue (DWORD *pdwWorkQueue);
  STDAPI MFBeginRegisterWorkQueueWithMMCSS (DWORD dwWorkQueueId, LPCWSTR wszClass, DWORD dwTaskId, IMFAsyncCallback *pDoneCallback, IUnknown *pDoneState);
  STDAPI MFBeginRegisterWorkQueueWithMMCSSEx (DWORD dwWorkQueueId, LPCWSTR wszClass, DWORD dwTaskId, LONG lPriority, IMFAsyncCallback *pDoneCallback, IUnknown *pDoneState);
  STDAPI MFEndRegisterWorkQueueWithMMCSS (IMFAsyncResult *pResult, DWORD *pdwTaskId);
  STDAPI MFBeginUnregisterWorkQueueWithMMCSS (DWORD dwWorkQueueId, IMFAsyncCallback *pDoneCallback, IUnknown *pDoneState);
  STDAPI MFEndUnregisterWorkQueueWithMMCSS (IMFAsyncResult *pResult);
  STDAPI MFGetWorkQueueMMCSSClass (DWORD dwWorkQueueId, LPWSTR pwszClass, DWORD *pcchClass);
  STDAPI MFGetWorkQueueMMCSSTaskId (DWORD dwWorkQueueId, LPDWORD pdwTaskId);
  STDAPI MFRegisterPlatformWithMMCSS (PCWSTR wszClass, DWORD *pdwTaskId, LONG lPriority);
  STDAPI MFUnregisterPlatformFromMMCSS ();
  STDAPI MFGetWorkQueueMMCSSPriority (DWORD dwWorkQueueId, LONG *lPriority);
  STDAPI MFCreateFile (MF_FILE_ACCESSMODE AccessMode, MF_FILE_OPENMODE OpenMode, MF_FILE_FLAGS fFlags, LPCWSTR pwszFileURL, IMFByteStream **ppIByteStream);
  STDAPI MFCreateTempFile (MF_FILE_ACCESSMODE AccessMode, MF_FILE_OPENMODE OpenMode, MF_FILE_FLAGS fFlags, IMFByteStream **ppIByteStream);
  STDAPI MFBeginCreateFile (MF_FILE_ACCESSMODE AccessMode, MF_FILE_OPENMODE OpenMode, MF_FILE_FLAGS fFlags, LPCWSTR pwszFilePath, IMFAsyncCallback *pCallback, IUnknown *pState, IUnknown **ppCancelCookie);
  STDAPI MFEndCreateFile (IMFAsyncResult *pResult, IMFByteStream **ppFile);
  STDAPI MFCancelCreateFile (IUnknown *pCancelCookie);
  STDAPI MFCreateLegacyMediaBufferOnMFMediaBuffer (IMFSample *pSample, IMFMediaBuffer *pMFMediaBuffer, DWORD cbOffset, IMediaBuffer **ppMediaBuffer);
  STDAPI_ (DXGI_FORMAT) MFMapDX9FormatToDXGIFormat (DWORD dx9);
  STDAPI_ (DWORD) MFMapDXGIFormatToDX9Format (DXGI_FORMAT dx11);
  STDAPI MFCreateDXSurfaceBuffer (REFIID riid, IUnknown *punkSurface, WINBOOL fBottomUpWhenLinear, IMFMediaBuffer **ppBuffer);
  STDAPI MFCreateWICBitmapBuffer (REFIID riid, IUnknown *punkSurface, IMFMediaBuffer **ppBuffer);
  STDAPI MFGetContentProtectionSystemCLSID (REFGUID guidProtectionSystemID, CLSID *pclsid);
#if WINVER >= 0x0601
  STDAPI MFAllocateWorkQueueEx (MFASYNC_WORKQUEUE_TYPE WorkQueueType, DWORD *pdwWorkQueue);
#endif
  EXTERN_C void *WINAPI MFHeapAlloc (size_t nSize, ULONG dwFlags, char *pszFile, int line, EAllocationType eat);
  EXTERN_C void WINAPI MFHeapFree (void *pv);

  DEFINE_GUID (CLSID_MFSourceResolver, 0x90eab60f, 0xe43a, 0x4188, 0xbc, 0xc4, 0xe4, 0x7f, 0xdf, 0x04, 0x86, 0x8c);
#endif

#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
  STDAPI MFLockDXGIDeviceManager (UINT *pResetToken, IMFDXGIDeviceManager **ppManager);
  STDAPI MFUnlockDXGIDeviceManager ();
  STDAPI MFCreateDXGISurfaceBuffer (REFIID riid, IUnknown *punkSurface, UINT uSubresourceIndex, WINBOOL fBottomUpWhenLinear, IMFMediaBuffer **ppBuffer);
  STDAPI MFCreateVideoSampleAllocatorEx (REFIID riid, void **ppSampleAllocator);
  STDAPI MFCreateDXGIDeviceManager (UINT *resetToken, IMFDXGIDeviceManager **ppDeviceManager);
  STDAPI MFCreateAlignedMemoryBuffer (DWORD cbMaxLength, DWORD cbAligment, IMFMediaBuffer **ppBuffer);
  STDAPI MFCreateMediaEvent (MediaEventType met, REFGUID guidExtendedType, HRESULT hrStatus, const PROPVARIANT *pvValue, IMFMediaEvent **ppEvent);
  STDAPI MFCreateEventQueue (IMFMediaEventQueue **ppMediaEventQueue);

#define MF_E_DXGI_DEVICE_NOT_INITIALIZED ((HRESULT)__MSABI_LONG(0x80041000))
#define MF_E_DXGI_NEW_VIDEO_DEVICE ((HRESULT)__MSABI_LONG(0x80041001))
#define MF_E_DXGI_VIDEO_DEVICE_LOCKED ((HRESULT)__MSABI_LONG(0x80041002))

#define MF_1_BYTE_ALIGNMENT 0x00000000
#define MF_2_BYTE_ALIGNMENT 0x00000001
#define MF_4_BYTE_ALIGNMENT 0x00000003
#define MF_8_BYTE_ALIGNMENT 0x00000007
#ifndef MF_16_BYTE_ALIGNMENT
#define MF_16_BYTE_ALIGNMENT 0x0000000f
#endif
#ifndef MF_32_BYTE_ALIGNMENT
#define MF_32_BYTE_ALIGNMENT 0x0000001f
#endif
#ifndef MF_64_BYTE_ALIGNMENT
#define MF_64_BYTE_ALIGNMENT 0x0000003f
#endif
#ifndef MF_128_BYTE_ALIGNMENT
#define MF_128_BYTE_ALIGNMENT 0x0000007f
#endif
#ifndef MF_256_BYTE_ALIGNMENT
#define MF_256_BYTE_ALIGNMENT 0x000000ff
#endif
#ifndef MF_512_BYTE_ALIGNMENT
#define MF_512_BYTE_ALIGNMENT 0x000001ff
#endif

#endif

#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
  typedef enum {
    MF_TOPOSTATUS_INVALID = 0,
    MF_TOPOSTATUS_READY = 100,
    MF_TOPOSTATUS_STARTED_SOURCE = 200,
#if WINVER >= 0x0601
    MF_TOPOSTATUS_DYNAMIC_CHANGED = 210,
#endif
    MF_TOPOSTATUS_SINK_SWITCHED = 300,
    MF_TOPOSTATUS_ENDED = 400,
  } MF_TOPOSTATUS;

  EXTERN_C const GUID MR_BUFFER_SERVICE;

#define MFSESSIONCAP_START 0x00000001
#define MFSESSIONCAP_SEEK 0x00000002
#define MFSESSIONCAP_PAUSE 0x00000004
#define MFSESSIONCAP_RATE_FORWARD 0x00000010
#define MFSESSIONCAP_RATE_REVERSE 0x00000020
#define MFSESSIONCAP_DOES_NOT_USE_NETWORK 0x00000040

  DEFINE_GUID (MF_EVENT_SESSIONCAPS, 0x7e5ebcd0, 0x11b8, 0x4abe, 0xaf, 0xad, 0x10, 0xf6, 0x59, 0x9a, 0x7f, 0x42);
  DEFINE_GUID (MF_EVENT_SESSIONCAPS_DELTA, 0x7e5ebcd1, 0x11b8, 0x4abe, 0xaf, 0xad, 0x10, 0xf6, 0x59, 0x9a, 0x7f, 0x42);
  DEFINE_GUID (MF_EVENT_TOPOLOGY_STATUS, 0x30c5018d, 0x9a53, 0x454b, 0xad, 0x9e, 0x6d, 0x5f, 0x8f, 0xa7, 0xc4, 0x3b);
  DEFINE_GUID (MF_EVENT_START_PRESENTATION_TIME, 0x5ad914d0, 0x9b45, 0x4a8d, 0xa2, 0xc0, 0x81, 0xd1, 0xe5, 0xb, 0xfb, 0x7);
  DEFINE_GUID (MF_EVENT_PRESENTATION_TIME_OFFSET, 0x5ad914d1, 0x9b45, 0x4a8d, 0xa2, 0xc0, 0x81, 0xd1, 0xe5, 0xb, 0xfb, 0x7);
  DEFINE_GUID (MF_EVENT_START_PRESENTATION_TIME_AT_OUTPUT, 0x5ad914d2, 0x9b45, 0x4a8d, 0xa2, 0xc0, 0x81, 0xd1, 0xe5, 0xb, 0xfb, 0x7);
  DEFINE_GUID (MF_EVENT_SOURCE_FAKE_START, 0xa8cc55a7, 0x6b31, 0x419f, 0x84, 0x5d, 0xff, 0xb3, 0x51, 0xa2, 0x43, 0x4b);
  DEFINE_GUID (MF_EVENT_SOURCE_PROJECTSTART, 0xa8cc55a8, 0x6b31, 0x419f, 0x84, 0x5d, 0xff, 0xb3, 0x51, 0xa2, 0x43, 0x4b);
  DEFINE_GUID (MF_EVENT_SOURCE_ACTUAL_START, 0xa8cc55a9, 0x6b31, 0x419f, 0x84, 0x5d, 0xff, 0xb3, 0x51, 0xa2, 0x43, 0x4b);
  DEFINE_GUID (MF_EVENT_SOURCE_TOPOLOGY_CANCELED, 0xdb62f650, 0x9a5e, 0x4704, 0xac, 0xf3, 0x56, 0x3b, 0xc6, 0xa7, 0x33, 0x64);
  DEFINE_GUID (MF_EVENT_SOURCE_CHARACTERISTICS, 0x47db8490, 0x8b22, 0x4f52, 0xaf, 0xda, 0x9c, 0xe1, 0xb2, 0xd3, 0xcf, 0xa8);
  DEFINE_GUID (MF_EVENT_SOURCE_CHARACTERISTICS_OLD, 0x47db8491, 0x8b22, 0x4f52, 0xaf, 0xda, 0x9c, 0xe1, 0xb2, 0xd3, 0xcf, 0xa8);
  DEFINE_GUID (MF_EVENT_DO_THINNING, 0x321ea6fb, 0xdad9, 0x46e4, 0xb3, 0x1d, 0xd2, 0xea, 0xe7, 0x9, 0xe, 0x30);
  DEFINE_GUID (MF_EVENT_SCRUBSAMPLE_TIME, 0x9ac712b3, 0xdcb8, 0x44d5, 0x8d, 0xc, 0x37, 0x45, 0x5a, 0x27, 0x82, 0xe3);
  DEFINE_GUID (MF_EVENT_OUTPUT_NODE, 0x830f1a8b, 0xc060, 0x46dd, 0xa8, 0x01, 0x1c, 0x95, 0xde, 0xc9, 0xb1, 0x07);
  DEFINE_GUID (MF_EVENT_FORMAT_CHANGE_REQUEST_SOURCE_SAR, 0xb26fbdfd, 0xc32c, 0x41fe, 0x9c, 0xf0, 0x8, 0x3c, 0xd5, 0xc7, 0xf8, 0xa4);
#endif

#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
#if WINVER >= 0x0601
  DEFINE_GUID (MF_EVENT_MFT_INPUT_STREAM_ID, 0xf29c2cca, 0x7ae6, 0x42d2, 0xb2, 0x84, 0xbf, 0x83, 0x7c, 0xc8, 0x74, 0xe2);
  DEFINE_GUID (MF_EVENT_MFT_CONTEXT, 0xb7cd31f1, 0x899e, 0x4b41, 0x80, 0xc9, 0x26, 0xa8, 0x96, 0xd3, 0x29, 0x77);
#endif
  STDAPI MFCreateSample (IMFSample **ppIMFSample);
  DEFINE_GUID (MFSampleExtension_CleanPoint, 0x9cdf01d8, 0xa0f0, 0x43ba, 0xb0, 0x77, 0xea, 0xa0, 0x6c, 0xbd, 0x72, 0x8a);
  DEFINE_GUID (MFSampleExtension_Discontinuity, 0x9cdf01d9, 0xa0f0, 0x43ba, 0xb0, 0x77, 0xea, 0xa0, 0x6c, 0xbd, 0x72, 0x8a);
  DEFINE_GUID (MFSampleExtension_Token, 0x8294da66, 0xf328, 0x4805, 0xb5, 0x51, 0x00, 0xde, 0xb4, 0xc5, 0x7a, 0x61);
  DEFINE_GUID (MFSampleExtension_DecodeTimestamp, 0x73a954d4, 0x9e2, 0x4861, 0xbe, 0xfc, 0x94, 0xbd, 0x97, 0xc0, 0x8e, 0x6e);
  DEFINE_GUID (MFSampleExtension_VideoEncodeQP, 0xb2efe478, 0xf979, 0x4c66, 0xb9, 0x5e, 0xee, 0x2b, 0x82, 0xc8, 0x2f, 0x36);
  DEFINE_GUID (MFSampleExtension_VideoEncodePictureType, 0x973704e6, 0xcd14, 0x483c, 0x8f, 0x20, 0xc9, 0xfc, 0x9, 0x28, 0xba, 0xd5);
  DEFINE_GUID (MFSampleExtension_FrameCorruption, 0xb4dd4a8c, 0xbeb, 0x44c4, 0x8b, 0x75, 0xb0, 0x2b, 0x91, 0x3b, 0x4, 0xf0);
  DEFINE_GUID (MFSampleExtension_DescrambleData, 0x43483be6, 0x4903, 0x4314, 0xb0, 0x32, 0x29, 0x51, 0x36, 0x59, 0x36, 0xfc);
  DEFINE_GUID (MFSampleExtension_SampleKeyID, 0x9ed713c8, 0x9b87, 0x4b26, 0x82, 0x97, 0xa9, 0x3b, 0x0c, 0x5a, 0x8a, 0xcc);
  DEFINE_GUID (MFSampleExtension_GenKeyFunc, 0x441ca1ee, 0x6b1f, 0x4501, 0x90, 0x3a, 0xde, 0x87, 0xdf, 0x42, 0xf6, 0xed);
  DEFINE_GUID (MFSampleExtension_GenKeyCtx, 0x188120cb, 0xd7da, 0x4b59, 0x9b, 0x3e, 0x92, 0x52, 0xfd, 0x37, 0x30, 0x1c);
  DEFINE_GUID (MFSampleExtension_PacketCrossOffsets, 0x2789671d, 0x389f, 0x40bb, 0x90, 0xd9, 0xc2, 0x82, 0xf7, 0x7f, 0x9a, 0xbd);
  DEFINE_GUID (MFSampleExtension_Encryption_SampleID, 0x6698b84e, 0x0afa, 0x4330, 0xae, 0xb2, 0x1c, 0x0a, 0x98, 0xd7, 0xa4, 0x4d);
  DEFINE_GUID (MFSampleExtension_Encryption_KeyID, 0x76376591, 0x795f, 0x4da1, 0x86, 0xed, 0x9d, 0x46, 0xec, 0xa1, 0x09, 0xa9);
  DEFINE_GUID (MFSampleExtension_Interlaced, 0xb1d5830a, 0xdeb8, 0x40e3, 0x90, 0xfa, 0x38, 0x99, 0x43, 0x71, 0x64, 0x61);
  DEFINE_GUID (MFSampleExtension_BottomFieldFirst, 0x941ce0a3, 0x6ae3, 0x4dda, 0x9a, 0x08, 0xa6, 0x42, 0x98, 0x34, 0x06, 0x17);
  DEFINE_GUID (MFSampleExtension_RepeatFirstField, 0x304d257c, 0x7493, 0x4fbd, 0xb1, 0x49, 0x92, 0x28, 0xde, 0x8d, 0x9a, 0x99);
  DEFINE_GUID (MFSampleExtension_SingleField, 0x9d85f816, 0x658b, 0x455a, 0xbd, 0xe0, 0x9f, 0xa7, 0xe1, 0x5a, 0xb8, 0xf9);
  DEFINE_GUID (MFSampleExtension_DerivedFromTopField, 0x6852465a, 0xae1c, 0x4553, 0x8e, 0x9b, 0xc3, 0x42, 0x0f, 0xcb, 0x16, 0x37);

  STDAPI MFCreateAttributes (IMFAttributes **ppMFAttributes, UINT32 cInitialSize);
  STDAPI MFInitAttributesFromBlob (IMFAttributes *pAttributes, const UINT8 *pBuf, UINT cbBufSize);
  STDAPI MFGetAttributesAsBlobSize (IMFAttributes *pAttributes, UINT32 *pcbBufSize);
  STDAPI MFGetAttributesAsBlob (IMFAttributes *pAttributes, UINT8 *pBuf, UINT cbBufSize);

#ifdef MF_INIT_GUIDS
#include <initguid.h>
#endif

  DEFINE_GUID (MFT_CATEGORY_VIDEO_DECODER, 0xd6c02d4b, 0x6833, 0x45b4, 0x97, 0x1a, 0x05, 0xa4, 0xb0, 0x4b, 0xab, 0x91);
  DEFINE_GUID (MFT_CATEGORY_VIDEO_ENCODER, 0xf79eac7d, 0xe545, 0x4387, 0xbd, 0xee, 0xd6, 0x47, 0xd7, 0xbd, 0xe4, 0x2a);
  DEFINE_GUID (MFT_CATEGORY_VIDEO_EFFECT, 0x12e17c21, 0x532c, 0x4a6e, 0x8a, 0x1c, 0x40, 0x82, 0x5a, 0x73, 0x63, 0x97);
  DEFINE_GUID (MFT_CATEGORY_MULTIPLEXER, 0x059c561e, 0x05ae, 0x4b61, 0xb6, 0x9d, 0x55, 0xb6, 0x1e, 0xe5, 0x4a, 0x7b);
  DEFINE_GUID (MFT_CATEGORY_DEMULTIPLEXER, 0xa8700a7a, 0x939b, 0x44c5, 0x99, 0xd7, 0x76, 0x22, 0x6b, 0x23, 0xb3, 0xf1);
  DEFINE_GUID (MFT_CATEGORY_AUDIO_DECODER, 0x9ea73fb4, 0xef7a, 0x4559, 0x8d, 0x5d, 0x71, 0x9d, 0x8f, 0x04, 0x26, 0xc7);
  DEFINE_GUID (MFT_CATEGORY_AUDIO_ENCODER, 0x91c64bd0, 0xf91e, 0x4d8c, 0x92, 0x76, 0xdb, 0x24, 0x82, 0x79, 0xd9, 0x75);
  DEFINE_GUID (MFT_CATEGORY_AUDIO_EFFECT, 0x11064c48, 0x3648, 0x4ed0, 0x93, 0x2e, 0x05, 0xce, 0x8a, 0xc8, 0x11, 0xb7);
  DEFINE_GUID (MFT_CATEGORY_OTHER, 0x90175d57, 0xb7ea, 0x4901, 0xae, 0xb3, 0x93, 0x3a, 0x87, 0x47, 0x75, 0x6f);
#if WINVER >= 0x0601
  DEFINE_GUID (MFT_CATEGORY_VIDEO_PROCESSOR, 0x302ea3fc, 0xaa5f, 0x47f9, 0x9f, 0x7a, 0xc2, 0x18, 0x8b, 0xb1, 0x63, 0x2);
#endif
#endif

#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
#if WINVER >= 0x0601
  enum _MFT_ENUM_FLAG {
    MFT_ENUM_FLAG_SYNCMFT = 0x00000001,
    MFT_ENUM_FLAG_ASYNCMFT = 0x00000002,
    MFT_ENUM_FLAG_HARDWARE = 0x00000004,
    MFT_ENUM_FLAG_FIELDOFUSE = 0x00000008,
    MFT_ENUM_FLAG_LOCALMFT = 0x00000010,
    MFT_ENUM_FLAG_TRANSCODE_ONLY = 0x00000020,
    MFT_ENUM_FLAG_SORTANDFILTER = 0x00000040,
    MFT_ENUM_FLAG_SORTANDFILTER_APPROVED_ONLY = 0x000000c0,
    MFT_ENUM_FLAG_SORTANDFILTER_WEB_ONLY = 0x00000140,
    MFT_ENUM_FLAG_ALL = 0x0000003f
  };
#endif

  STDAPI MFTRegister (CLSID clsidMFT, GUID guidCategory, LPWSTR pszName, UINT32 Flags, UINT32 cInputTypes, MFT_REGISTER_TYPE_INFO *pInputTypes, UINT32 cOutputTypes, MFT_REGISTER_TYPE_INFO *pOutputTypes, IMFAttributes *pAttributes);
  STDAPI MFTUnregister (CLSID clsidMFT);
  STDAPI MFTEnum (GUID guidCategory, UINT32 Flags, MFT_REGISTER_TYPE_INFO *pInputType, MFT_REGISTER_TYPE_INFO *pOutputType, IMFAttributes *pAttributes, CLSID **ppclsidMFT, UINT32 *pcMFTs);
  STDAPI MFTGetInfo (CLSID clsidMFT, LPWSTR *pszName, MFT_REGISTER_TYPE_INFO **ppInputTypes, UINT32 *pcInputTypes, MFT_REGISTER_TYPE_INFO **ppOutputTypes, UINT32 *pcOutputTypes, IMFAttributes **ppAttributes);
#if WINVER >= 0x0601
  STDAPI MFTRegisterLocal (IClassFactory *pClassFactory, REFGUID guidCategory, LPCWSTR pszName, UINT32 Flags, UINT32 cInputTypes, const MFT_REGISTER_TYPE_INFO *pInputTypes, UINT32 cOutputTypes, const MFT_REGISTER_TYPE_INFO *pOutputTypes);
  STDAPI MFTUnregisterLocal (IClassFactory *pClassFactory);
  STDAPI MFTRegisterLocalByCLSID (REFCLSID clisdMFT, REFGUID guidCategory, LPCWSTR pszName, UINT32 Flags, UINT32 cInputTypes, const MFT_REGISTER_TYPE_INFO *pInputTypes, UINT32 cOutputTypes, const MFT_REGISTER_TYPE_INFO *pOutputTypes);
  STDAPI MFTUnregisterLocalByCLSID (CLSID clsidMFT);
  STDAPI MFTEnumEx (GUID guidCategory, UINT32 Flags, const MFT_REGISTER_TYPE_INFO *pInputType, const MFT_REGISTER_TYPE_INFO *pOutputType, IMFActivate ***pppMFTActivate, UINT32 *pnumMFTActivate);
  STDAPI MFGetPluginControl (IMFPluginControl **ppPluginControl);
  STDAPI MFGetMFTMerit (IUnknown *pMFT, UINT32 cbVerifier, const BYTE *verifier, DWORD *merit);
#endif
#if WINVER >= 0x0602
  STDAPI MFRegisterLocalSchemeHandler (PCWSTR szScheme, IMFActivate *pActivate);
  STDAPI MFRegisterLocalByteStreamHandler (PCWSTR szFileExtension, PCWSTR szMimeType, IMFActivate *pActivate);
  STDAPI MFCreateMFByteStreamWrapper (IMFByteStream *pStream, IMFByteStream **ppStreamWrapper);
#endif
#endif

#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
#if WINVER >= 0x0602
  STDAPI MFCreateMediaExtensionActivate (PCWSTR szActivatableClassId, IUnknown *pConfiguration, REFIID riid, LPVOID *ppvObject);
#endif

  DEFINE_GUID (MFT_SUPPORT_DYNAMIC_FORMAT_CHANGE, 0x53476a11, 0x3f13, 0x49fb, 0xac, 0x42, 0xee, 0x27, 0x33, 0xc9, 0x67, 0x41);

#ifndef FCC
#define FCC(ch4) ((((DWORD) (ch4) &0xff) << 24) | (((DWORD) (ch4) &0xff00) << 8) | (((DWORD) (ch4) &0xff0000) >> 8) | (((DWORD) (ch4) &0xff000000) >> 24))
#endif

#ifndef DEFINE_MEDIATYPE_GUID
#define DEFINE_MEDIATYPE_GUID(name, format) DEFINE_GUID (name, format, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
#endif

#ifndef DIRECT3D_VERSION
#define D3DFMT_R8G8B8 20
#define D3DFMT_A8R8G8B8 21
#define D3DFMT_X8R8G8B8 22
#define D3DFMT_R5G6B5 23
#define D3DFMT_X1R5G5B5 24
#define D3DFMT_P8 41
#define LOCAL_D3DFMT_DEFINES 1
#endif

  DEFINE_MEDIATYPE_GUID (MFVideoFormat_Base, 0x00000000);
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_RGB32, D3DFMT_X8R8G8B8);
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_ARGB32, D3DFMT_A8R8G8B8);
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_RGB24, D3DFMT_R8G8B8);
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_RGB555, D3DFMT_X1R5G5B5);
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_RGB565, D3DFMT_R5G6B5);
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_RGB8, D3DFMT_P8);
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_AI44, FCC ('AI44'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_AYUV, FCC ('AYUV'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_YUY2, FCC ('YUY2'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_YVYU, FCC ('YVYU'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_YVU9, FCC ('YVU9'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_UYVY, FCC ('UYVY'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_NV11, FCC ('NV11'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_NV12, FCC ('NV12'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_YV12, FCC ('YV12'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_I420, FCC ('I420'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_IYUV, FCC ('IYUV'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_Y210, FCC ('Y210'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_Y216, FCC ('Y216'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_Y410, FCC ('Y410'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_Y416, FCC ('Y416'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_Y41P, FCC ('Y41P'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_Y41T, FCC ('Y41T'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_Y42T, FCC ('Y42T'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_P210, FCC ('P210'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_P216, FCC ('P216'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_P010, FCC ('P010'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_P016, FCC ('P016'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_v210, FCC ('v210'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_v216, FCC ('v216'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_v410, FCC ('v410'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_MP43, FCC ('MP43'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_MP4S, FCC ('MP4S'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_M4S2, FCC ('M4S2'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_MP4V, FCC ('MP4V'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_WMV1, FCC ('WMV1'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_WMV2, FCC ('WMV2'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_WMV3, FCC ('WMV3'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_WVC1, FCC ('WVC1'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_MSS1, FCC ('MSS1'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_MSS2, FCC ('MSS2'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_MPG1, FCC ('MPG1'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_DVSL, FCC ('dvsl'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_DVSD, FCC ('dvsd'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_DVHD, FCC ('dvhd'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_DV25, FCC ('dv25'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_DV50, FCC ('dv50'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_DVH1, FCC ('dvh1'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_DVC, FCC ('dvc '));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_H264, FCC ('H264'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_H265, FCC ('H265'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_MJPG, FCC ('MJPG'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_420O, FCC ('420O'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_HEVC, FCC ('HEVC'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_HEVC_ES, FCC('HEVS'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_VP80, FCC ('VP80'));
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_VP90, FCC ('VP90'));
#if WINVER >= 0x0602
  DEFINE_MEDIATYPE_GUID (MFVideoFormat_H263, FCC ('H263'));
#endif

#ifdef LOCAL_D3DFMT_DEFINES
#undef D3DFMT_R8G8B8
#undef D3DFMT_A8R8G8B8
#undef D3DFMT_X8R8G8B8
#undef D3DFMT_R5G6B5
#undef D3DFMT_X1R5G5B5
#undef D3DFMT_P8
#undef LOCAL_D3DFMT_DEFINES
#endif

#if WINVER >= 0x0602
  typedef enum _MFVideo3DFormat {
    MFVideo3DSampleFormat_BaseView = 0,
    MFVideo3DSampleFormat_MultiView = 1,
    MFVideo3DSampleFormat_Packed_LeftRight = 2,
    MFVideo3DSampleFormat_Packed_TopBottom = 3,
  } MFVideo3DFormat;

  typedef enum _MFVideo3DSampleFormat {
    MFSampleExtension_3DVideo_MultiView = 1,
    MFSampleExtension_3DVideo_Packed = 0,
  } MFVideo3DSampleFormat;

  typedef enum _MFVideoRotationFormat {
    MFVideoRotationFormat_0 = 0,
    MFVideoRotationFormat_90 = 90,
    MFVideoRotationFormat_180 = 180,
    MFVideoRotationFormat_270 = 270,
  } MFVideoRotationFormat;
#endif

  typedef enum _MFVideoDRMFlags {
    MFVideoDRMFlag_None = 0,
    MFVideoDRMFlag_AnalogProtected = 1,
    MFVideoDRMFlag_DigitallyProtected = 2,
  } MFVideoDRMFlags;

  typedef enum _MFVideoPadFlags {
    MFVideoPadFlag_PAD_TO_None = 0,
    MFVideoPadFlag_PAD_TO_4x3 = 1,
    MFVideoPadFlag_PAD_TO_16x9 = 2
  } MFVideoPadFlags;

  typedef enum _MFVideoSrcContentHintFlags {
    MFVideoSrcContentHintFlag_None = 0,
    MFVideoSrcContentHintFlag_16x9 = 1,
    MFVideoSrcContentHintFlag_235_1 = 2
  } MFVideoSrcContentHintFlags;

  typedef struct _MFFOLDDOWN_MATRIX {
    UINT32 cbSize;
    UINT32 cSrcChannels;
    UINT32 cDstChannels;
    UINT32 dwChannelMask;
    LONG Coeff[64];
  } MFFOLDDOWN_MATRIX;

#define MFVideoFormat_MPG2 MFVideoFormat_MPEG2

  DEFINE_GUID (MFVideoFormat_H264_ES, 0x3f40f4f0, 0x5622, 0x4ff8, 0xb6, 0xd8, 0xa1, 0x7a, 0x58, 0x4b, 0xee, 0x5e);
  DEFINE_GUID (MFVideoFormat_MPEG2, 0xe06d8026, 0xdb46, 0x11cf, 0xb4, 0xd1, 0x00, 0x80, 0x5f, 0x6c, 0xbb, 0xea);
  DEFINE_MEDIATYPE_GUID (MFAudioFormat_Base, 0x00000000);
  DEFINE_MEDIATYPE_GUID (MFAudioFormat_PCM, WAVE_FORMAT_PCM);
  DEFINE_MEDIATYPE_GUID (MFAudioFormat_Float, WAVE_FORMAT_IEEE_FLOAT);
  DEFINE_MEDIATYPE_GUID (MFAudioFormat_DTS, WAVE_FORMAT_DTS);
  DEFINE_MEDIATYPE_GUID (MFAudioFormat_Dolby_AC3_SPDIF, WAVE_FORMAT_DOLBY_AC3_SPDIF);
  DEFINE_MEDIATYPE_GUID (MFAudioFormat_DRM, WAVE_FORMAT_DRM);
  DEFINE_MEDIATYPE_GUID (MFAudioFormat_WMAudioV8, WAVE_FORMAT_WMAUDIO2);
  DEFINE_MEDIATYPE_GUID (MFAudioFormat_WMAudioV9, WAVE_FORMAT_WMAUDIO3);
  DEFINE_MEDIATYPE_GUID (MFAudioFormat_WMAudio_Lossless, WAVE_FORMAT_WMAUDIO_LOSSLESS);
  DEFINE_MEDIATYPE_GUID (MFAudioFormat_WMASPDIF, WAVE_FORMAT_WMASPDIF);
  DEFINE_MEDIATYPE_GUID (MFAudioFormat_MSP1, WAVE_FORMAT_WMAVOICE9);
  DEFINE_MEDIATYPE_GUID (MFAudioFormat_MP3, WAVE_FORMAT_MPEGLAYER3);
  DEFINE_MEDIATYPE_GUID (MFAudioFormat_MPEG, WAVE_FORMAT_MPEG);
  DEFINE_MEDIATYPE_GUID (MFAudioFormat_AAC, WAVE_FORMAT_MPEG_HEAAC);
  DEFINE_MEDIATYPE_GUID (MFAudioFormat_ADTS, WAVE_FORMAT_MPEG_ADTS_AAC);
  DEFINE_GUID (MFAudioFormat_Dolby_AC3, 0xe06d802c, 0xdb46, 0x11cf, 0xb4, 0xd1, 0x00, 0x80, 0x05f, 0x6c, 0xbb, 0xea);
  DEFINE_GUID (MFAudioFormat_Dolby_DDPlus, 0xa7fb87af, 0x2d02, 0x42fb, 0xa4, 0xd4, 0x5, 0xcd, 0x93, 0x84, 0x3b, 0xdd);
  DEFINE_GUID (MFMPEG4Format_Base, 0x00000000, 0x767a, 0x494d, 0xb4, 0x78, 0xf2, 0x9d, 0x25, 0xdc, 0x90, 0x37);
  DEFINE_GUID (MF_MT_MAJOR_TYPE, 0x48eba18e, 0xf8c9, 0x4687, 0xbf, 0x11, 0x0a, 0x74, 0xc9, 0xf9, 0x6a, 0x8f);
  DEFINE_GUID (MF_MT_SUBTYPE, 0xf7e34c9a, 0x42e8, 0x4714, 0xb7, 0x4b, 0xcb, 0x29, 0xd7, 0x2c, 0x35, 0xe5);
  DEFINE_GUID (MF_MT_ALL_SAMPLES_INDEPENDENT, 0xc9173739, 0x5e56, 0x461c, 0xb7, 0x13, 0x46, 0xfb, 0x99, 0x5c, 0xb9, 0x5f);
  DEFINE_GUID (MF_MT_FIXED_SIZE_SAMPLES, 0xb8ebefaf, 0xb718, 0x4e04, 0xb0, 0xa9, 0x11, 0x67, 0x75, 0xe3, 0x32, 0x1b);
  DEFINE_GUID (MF_MT_COMPRESSED, 0x3afd0cee, 0x18f2, 0x4ba5, 0xa1, 0x10, 0x8b, 0xea, 0x50, 0x2e, 0x1f, 0x92);
  DEFINE_GUID (MF_MT_SAMPLE_SIZE, 0xdad3ab78, 0x1990, 0x408b, 0xbc, 0xe2, 0xeb, 0xa6, 0x73, 0xda, 0xcc, 0x10);
  DEFINE_GUID (MF_MT_WRAPPED_TYPE, 0x4d3f7b23, 0xd02f, 0x4e6c, 0x9b, 0xee, 0xe4, 0xbf, 0x2c, 0x6c, 0x69, 0x5d);
  DEFINE_GUID (MF_MT_AUDIO_NUM_CHANNELS, 0x37e48bf5, 0x645e, 0x4c5b, 0x89, 0xde, 0xad, 0xa9, 0xe2, 0x9b, 0x69, 0x6a);
  DEFINE_GUID (MF_MT_AUDIO_SAMPLES_PER_SECOND, 0x5faeeae7, 0x0290, 0x4c31, 0x9e, 0x8a, 0xc5, 0x34, 0xf6, 0x8d, 0x9d, 0xba);
  DEFINE_GUID (MF_MT_AUDIO_FLOAT_SAMPLES_PER_SECOND, 0xfb3b724a, 0xcfb5, 0x4319, 0xae, 0xfe, 0x6e, 0x42, 0xb2, 0x40, 0x61, 0x32);
  DEFINE_GUID (MF_MT_AUDIO_AVG_BYTES_PER_SECOND, 0x1aab75c8, 0xcfef, 0x451c, 0xab, 0x95, 0xac, 0x03, 0x4b, 0x8e, 0x17, 0x31);
  DEFINE_GUID (MF_MT_AUDIO_BLOCK_ALIGNMENT, 0x322de230, 0x9eeb, 0x43bd, 0xab, 0x7a, 0xff, 0x41, 0x22, 0x51, 0x54, 0x1d);
  DEFINE_GUID (MF_MT_AUDIO_BITS_PER_SAMPLE, 0xf2deb57f, 0x40fa, 0x4764, 0xaa, 0x33, 0xed, 0x4f, 0x2d, 0x1f, 0xf6, 0x69);
  DEFINE_GUID (MF_MT_AUDIO_VALID_BITS_PER_SAMPLE, 0xd9bf8d6a, 0x9530, 0x4b7c, 0x9d, 0xdf, 0xff, 0x6f, 0xd5, 0x8b, 0xbd, 0x06);
  DEFINE_GUID (MF_MT_AUDIO_SAMPLES_PER_BLOCK, 0xaab15aac, 0xe13a, 0x4995, 0x92, 0x22, 0x50, 0x1e, 0xa1, 0x5c, 0x68, 0x77);
  DEFINE_GUID (MF_MT_AUDIO_CHANNEL_MASK, 0x55fb5765, 0x644a, 0x4caf, 0x84, 0x79, 0x93, 0x89, 0x83, 0xbb, 0x15, 0x88);
  DEFINE_GUID (MF_MT_AUDIO_FOLDDOWN_MATRIX, 0x9d62927c, 0x36be, 0x4cf2, 0xb5, 0xc4, 0xa3, 0x92, 0x6e, 0x3e, 0x87, 0x11);
  DEFINE_GUID (MF_MT_AUDIO_WMADRC_PEAKREF, 0x9d62927d, 0x36be, 0x4cf2, 0xb5, 0xc4, 0xa3, 0x92, 0x6e, 0x3e, 0x87, 0x11);
  DEFINE_GUID (MF_MT_AUDIO_WMADRC_PEAKTARGET, 0x9d62927e, 0x36be, 0x4cf2, 0xb5, 0xc4, 0xa3, 0x92, 0x6e, 0x3e, 0x87, 0x11);
  DEFINE_GUID (MF_MT_AUDIO_WMADRC_AVGREF, 0x9d62927f, 0x36be, 0x4cf2, 0xb5, 0xc4, 0xa3, 0x92, 0x6e, 0x3e, 0x87, 0x11);
  DEFINE_GUID (MF_MT_AUDIO_WMADRC_AVGTARGET, 0x9d629280, 0x36be, 0x4cf2, 0xb5, 0xc4, 0xa3, 0x92, 0x6e, 0x3e, 0x87, 0x11);
  DEFINE_GUID (MF_MT_AUDIO_PREFER_WAVEFORMATEX, 0xa901aaba, 0xe037, 0x458a, 0xbd, 0xf6, 0x54, 0x5b, 0xe2, 0x07, 0x40, 0x42);
  DEFINE_GUID (MF_MT_FRAME_SIZE, 0x1652c33d, 0xd6b2, 0x4012, 0xb8, 0x34, 0x72, 0x03, 0x08, 0x49, 0xa3, 0x7d);
  DEFINE_GUID (MF_MT_FRAME_RATE, 0xc459a2e8, 0x3d2c, 0x4e44, 0xb1, 0x32, 0xfe, 0xe5, 0x15, 0x6c, 0x7b, 0xb0);
  DEFINE_GUID (MF_MT_PIXEL_ASPECT_RATIO, 0xc6376a1e, 0x8d0a, 0x4027, 0xbe, 0x45, 0x6d, 0x9a, 0x0a, 0xd3, 0x9b, 0xb6);
  DEFINE_GUID (MF_MT_DRM_FLAGS, 0x8772f323, 0x355a, 0x4cc7, 0xbb, 0x78, 0x6d, 0x61, 0xa0, 0x48, 0xae, 0x82);
  DEFINE_GUID (MF_MT_PAD_CONTROL_FLAGS, 0x4d0e73e5, 0x80ea, 0x4354, 0xa9, 0xd0, 0x11, 0x76, 0xce, 0xb0, 0x28, 0xea);
  DEFINE_GUID (MF_MT_SOURCE_CONTENT_HINT, 0x68aca3cc, 0x22d0, 0x44e6, 0x85, 0xf8, 0x28, 0x16, 0x71, 0x97, 0xfa, 0x38);
  DEFINE_GUID (MF_MT_VIDEO_CHROMA_SITING, 0x65df2370, 0xc773, 0x4c33, 0xaa, 0x64, 0x84, 0x3e, 0x06, 0x8e, 0xfb, 0x0c);
  DEFINE_GUID (MF_MT_INTERLACE_MODE, 0xe2724bb8, 0xe676, 0x4806, 0xb4, 0xb2, 0xa8, 0xd6, 0xef, 0xb4, 0x4c, 0xcd);
  DEFINE_GUID (MF_MT_TRANSFER_FUNCTION, 0x5fb0fce9, 0xbe5c, 0x4935, 0xa8, 0x11, 0xec, 0x83, 0x8f, 0x8e, 0xed, 0x93);
  DEFINE_GUID (MF_MT_VIDEO_PRIMARIES, 0xdbfbe4d7, 0x0740, 0x4ee0, 0x81, 0x92, 0x85, 0x0a, 0xb0, 0xe2, 0x19, 0x35);
  DEFINE_GUID (MF_MT_YUV_MATRIX, 0x3e23d450, 0x2c75, 0x4d25, 0xa0, 0x0e, 0xb9, 0x16, 0x70, 0xd1, 0x23, 0x27);
  DEFINE_GUID (MF_MT_VIDEO_LIGHTING, 0x53a0529c, 0x890b, 0x4216, 0x8b, 0xf9, 0x59, 0x93, 0x67, 0xad, 0x6d, 0x20);
  DEFINE_GUID (MF_MT_VIDEO_NOMINAL_RANGE, 0xc21b8ee5, 0xb956, 0x4071, 0x8d, 0xaf, 0x32, 0x5e, 0xdf, 0x5c, 0xab, 0x11);
  DEFINE_GUID (MF_MT_GEOMETRIC_APERTURE, 0x66758743, 0x7e5f, 0x400d, 0x98, 0x0a, 0xaa, 0x85, 0x96, 0xc8, 0x56, 0x96);
  DEFINE_GUID (MF_MT_MINIMUM_DISPLAY_APERTURE, 0xd7388766, 0x18fe, 0x48c6, 0xa1, 0x77, 0xee, 0x89, 0x48, 0x67, 0xc8, 0xc4);
  DEFINE_GUID (MF_MT_PAN_SCAN_APERTURE, 0x79614dde, 0x9187, 0x48fb, 0xb8, 0xc7, 0x4d, 0x52, 0x68, 0x9d, 0xe6, 0x49);
  DEFINE_GUID (MF_MT_PAN_SCAN_ENABLED, 0x4b7f6bc3, 0x8b13, 0x40b2, 0xa9, 0x93, 0xab, 0xf6, 0x30, 0xb8, 0x20, 0x4e);
  DEFINE_GUID (MF_MT_AVG_BITRATE, 0x20332624, 0xfb0d, 0x4d9e, 0xbd, 0x0d, 0xcb, 0xf6, 0x78, 0x6c, 0x10, 0x2e);
  DEFINE_GUID (MF_MT_AVG_BIT_ERROR_RATE, 0x799cabd6, 0x3508, 0x4db4, 0xa3, 0xc7, 0x56, 0x9c, 0xd5, 0x33, 0xde, 0xb1);
  DEFINE_GUID (MF_MT_MAX_KEYFRAME_SPACING, 0xc16eb52b, 0x73a1, 0x476f, 0x8d, 0x62, 0x83, 0x9d, 0x6a, 0x02, 0x06, 0x52);
  DEFINE_GUID (MF_MT_USER_DATA, 0xb6bc765f, 0x4c3b, 0x40a4, 0xbd, 0x51, 0x25, 0x35, 0xb6, 0x6f, 0xe0, 0x9d);
  DEFINE_GUID (MF_MT_DEFAULT_STRIDE, 0x644b4e48, 0x1e02, 0x4516, 0xb0, 0xeb, 0xc0, 0x1c, 0xa9, 0xd4, 0x9a, 0xc6);
  DEFINE_GUID (MF_MT_PALETTE, 0x6d283f42, 0x9846, 0x4410, 0xaf, 0xd9, 0x65, 0x4d, 0x50, 0x3b, 0x1a, 0x54);
  DEFINE_GUID (MF_MT_MPEG_START_TIME_CODE, 0x91f67885, 0x4333, 0x4280, 0x97, 0xcd, 0xbd, 0x5a, 0x6c, 0x03, 0xa0, 0x6e);
  DEFINE_GUID (MF_MT_MPEG2_PROFILE, 0xad76a80b, 0x2d5c, 0x4e0b, 0xb3, 0x75, 0x64, 0xe5, 0x20, 0x13, 0x70, 0x36);
  DEFINE_GUID (MF_MT_MPEG2_LEVEL, 0x96f66574, 0x11c5, 0x4015, 0x86, 0x66, 0xbf, 0xf5, 0x16, 0x43, 0x6d, 0xa7);
  DEFINE_GUID (MF_MT_MPEG2_FLAGS, 0x31e3991d, 0xf701, 0x4b2f, 0xb4, 0x26, 0x8a, 0xe3, 0xbd, 0xa9, 0xe0, 0x4b);
  DEFINE_GUID (MF_MT_MPEG_SEQUENCE_HEADER, 0x3c036de7, 0x3ad0, 0x4c9e, 0x92, 0x16, 0xee, 0x6d, 0x6a, 0xc2, 0x1c, 0xb3);
  DEFINE_GUID (MF_MT_MPEG2_STANDARD, 0xa20af9e8, 0x928a, 0x4b26, 0xaa, 0xa9, 0xf0, 0x5c, 0x74, 0xca, 0xc4, 0x7c);
  DEFINE_GUID (MF_MT_MPEG2_TIMECODE, 0x5229ba10, 0xe29d, 0x4f80, 0xa5, 0x9c, 0xdf, 0x4f, 0x18, 0x2, 0x7, 0xd2);
  DEFINE_GUID (MF_MT_MPEG2_CONTENT_PACKET, 0x825d55e4, 0x4f12, 0x4197, 0x9e, 0xb3, 0x59, 0xb6, 0xe4, 0x71, 0xf, 0x6);
  DEFINE_GUID (MF_MT_H264_MAX_CODEC_CONFIG_DELAY, 0xf5929986, 0x4c45, 0x4fbb, 0xbb, 0x49, 0x6c, 0xc5, 0x34, 0xd0, 0x5b, 0x9b);
  DEFINE_GUID (MF_MT_H264_SUPPORTED_SLICE_MODES, 0xc8be1937, 0x4d64, 0x4549, 0x83, 0x43, 0xa8, 0x8, 0x6c, 0xb, 0xfd, 0xa5);
  DEFINE_GUID (MF_MT_H264_SUPPORTED_SYNC_FRAME_TYPES, 0x89a52c01, 0xf282, 0x48d2, 0xb5, 0x22, 0x22, 0xe6, 0xae, 0x63, 0x31, 0x99);
  DEFINE_GUID (MF_MT_H264_RESOLUTION_SCALING, 0xe3854272, 0xf715, 0x4757, 0xba, 0x90, 0x1b, 0x69, 0x6c, 0x77, 0x34, 0x57);
  DEFINE_GUID (MF_MT_H264_SIMULCAST_SUPPORT, 0x9ea2d63d, 0x53f0, 0x4a34, 0xb9, 0x4e, 0x9d, 0xe4, 0x9a, 0x7, 0x8c, 0xb3);
  DEFINE_GUID (MF_MT_H264_SUPPORTED_RATE_CONTROL_MODES, 0x6a8ac47e, 0x519c, 0x4f18, 0x9b, 0xb3, 0x7e, 0xea, 0xae, 0xa5, 0x59, 0x4d);
  DEFINE_GUID (MF_MT_H264_MAX_MB_PER_SEC, 0x45256d30, 0x7215, 0x4576, 0x93, 0x36, 0xb0, 0xf1, 0xbc, 0xd5, 0x9b, 0xb2);
  DEFINE_GUID (MF_MT_H264_SUPPORTED_USAGES, 0x60b1a998, 0xdc01, 0x40ce, 0x97, 0x36, 0xab, 0xa8, 0x45, 0xa2, 0xdb, 0xdc);
  DEFINE_GUID (MF_MT_H264_CAPABILITIES, 0xbb3bd508, 0x490a, 0x11e0, 0x99, 0xe4, 0x13, 0x16, 0xdf, 0xd7, 0x20, 0x85);
  DEFINE_GUID (MF_MT_H264_SVC_CAPABILITIES, 0xf8993abe, 0xd937, 0x4a8f, 0xbb, 0xca, 0x69, 0x66, 0xfe, 0x9e, 0x11, 0x52);
  DEFINE_GUID (MF_MT_H264_USAGE, 0x359ce3a5, 0xaf00, 0x49ca, 0xa2, 0xf4, 0x2a, 0xc9, 0x4c, 0xa8, 0x2b, 0x61);
  DEFINE_GUID (MF_MT_H264_RATE_CONTROL_MODES, 0x705177d8, 0x45cb, 0x11e0, 0xac, 0x7d, 0xb9, 0x1c, 0xe0, 0xd7, 0x20, 0x85);
  DEFINE_GUID (MF_MT_H264_LAYOUT_PER_STREAM, 0x85e299b2, 0x90e3, 0x4fe8, 0xb2, 0xf5, 0xc0, 0x67, 0xe0, 0xbf, 0xe5, 0x7a);
  DEFINE_GUID (MF_MT_DV_AAUX_SRC_PACK_0, 0x84bd5d88, 0x0fb8, 0x4ac8, 0xbe, 0x4b, 0xa8, 0x84, 0x8b, 0xef, 0x98, 0xf3);
  DEFINE_GUID (MF_MT_DV_AAUX_CTRL_PACK_0, 0xf731004e, 0x1dd1, 0x4515, 0xaa, 0xbe, 0xf0, 0xc0, 0x6a, 0xa5, 0x36, 0xac);
  DEFINE_GUID (MF_MT_DV_AAUX_SRC_PACK_1, 0x720e6544, 0x0225, 0x4003, 0xa6, 0x51, 0x01, 0x96, 0x56, 0x3a, 0x95, 0x8e);
  DEFINE_GUID (MF_MT_DV_AAUX_CTRL_PACK_1, 0xcd1f470d, 0x1f04, 0x4fe0, 0xbf, 0xb9, 0xd0, 0x7a, 0xe0, 0x38, 0x6a, 0xd8);
  DEFINE_GUID (MF_MT_DV_VAUX_SRC_PACK, 0x41402d9d, 0x7b57, 0x43c6, 0xb1, 0x29, 0x2c, 0xb9, 0x97, 0xf1, 0x50, 0x09);
  DEFINE_GUID (MF_MT_DV_VAUX_CTRL_PACK, 0x2f84e1c4, 0x0da1, 0x4788, 0x93, 0x8e, 0x0d, 0xfb, 0xfb, 0xb3, 0x4b, 0x48);
  DEFINE_GUID (MFMediaType_Default, 0x81a412e6, 0x8103, 0x4b06, 0x85, 0x7f, 0x18, 0x62, 0x78, 0x10, 0x24, 0xac);
  DEFINE_GUID (MFMediaType_Audio, 0x73647561, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
  DEFINE_GUID (MFMediaType_Video, 0x73646976, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
  DEFINE_GUID (MFMediaType_Protected, 0x7b4b6fe6, 0x9d04, 0x4494, 0xbe, 0x14, 0x7e, 0x0b, 0xd0, 0x76, 0xc8, 0xe4);
  DEFINE_GUID (MFMediaType_SAMI, 0xe69669a0, 0x3dcd, 0x40cb, 0x9e, 0x2e, 0x37, 0x08, 0x38, 0x7c, 0x06, 0x16);
  DEFINE_GUID (MFMediaType_Script, 0x72178c22, 0xe45b, 0x11d5, 0xbc, 0x2a, 0x00, 0xb0, 0xd0, 0xf3, 0xf4, 0xab);
  DEFINE_GUID (MFMediaType_Image, 0x72178c23, 0xe45b, 0x11d5, 0xbc, 0x2a, 0x00, 0xb0, 0xd0, 0xf3, 0xf4, 0xab);
  DEFINE_GUID (MFMediaType_HTML, 0x72178c24, 0xe45b, 0x11d5, 0xbc, 0x2a, 0x00, 0xb0, 0xd0, 0xf3, 0xf4, 0xab);
  DEFINE_GUID (MFMediaType_Binary, 0x72178c25, 0xe45b, 0x11d5, 0xbc, 0x2a, 0x00, 0xb0, 0xd0, 0xf3, 0xf4, 0xab);
  DEFINE_GUID (MFMediaType_FileTransfer, 0x72178c26, 0xe45b, 0x11d5, 0xbc, 0x2a, 0x00, 0xb0, 0xd0, 0xf3, 0xf4, 0xab);
  DEFINE_GUID (MFMediaType_Stream, 0xe436eb83, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70);
  DEFINE_GUID (MFImageFormat_JPEG, 0x19e4a5aa, 0x5662, 0x4fc5, 0xa0, 0xc0, 0x17, 0x58, 0x02, 0x8e, 0x10, 0x57);
  DEFINE_GUID (MFImageFormat_RGB32, 0x00000016, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
  DEFINE_GUID (MFStreamFormat_MPEG2Transport, 0xe06d8023, 0xdb46, 0x11cf, 0xb4, 0xd1, 0x00, 0x80, 0x5f, 0x6c, 0xbb, 0xea);
  DEFINE_GUID (MFStreamFormat_MPEG2Program, 0x263067d1, 0xd330, 0x45dc, 0xb6, 0x69, 0x34, 0xd9, 0x86, 0xe4, 0xe3, 0xe1);
#if WINVER >= 0x0601
  DEFINE_GUID (MF_MT_AAC_PAYLOAD_TYPE, 0xbfbabe79, 0x7434, 0x4d1c, 0x94, 0xf0, 0x72, 0xa3, 0xb9, 0xe1, 0x71, 0x88);
  DEFINE_GUID (MF_MT_AAC_AUDIO_PROFILE_LEVEL_INDICATION, 0x7632f0e6, 0x9538, 0x4d61, 0xac, 0xda, 0xea, 0x29, 0xc8, 0xc1, 0x44, 0x56);
  DEFINE_GUID (MF_MT_IMAGE_LOSS_TOLERANT, 0xed062cf4, 0xe34e, 0x4922, 0xbe, 0x99, 0x93, 0x40, 0x32, 0x13, 0x3d, 0x7c);
  DEFINE_GUID (MF_MT_MPEG4_SAMPLE_DESCRIPTION, 0x261e9d83, 0x9529, 0x4b8f, 0xa1, 0x11, 0x8b, 0x9c, 0x95, 0x0a, 0x81, 0xa9);
  DEFINE_GUID (MF_MT_MPEG4_CURRENT_SAMPLE_ENTRY, 0x9aa7e155, 0xb64a, 0x4c1d, 0xa5, 0x00, 0x45, 0x5d, 0x60, 0x0b, 0x65, 0x60);
  DEFINE_GUID (MF_MT_FRAME_RATE_RANGE_MIN, 0xd2e7558c, 0xdc1f, 0x403f, 0x9a, 0x72, 0xd2, 0x8b, 0xb1, 0xeb, 0x3b, 0x5e);
  DEFINE_GUID (MF_MT_FRAME_RATE_RANGE_MAX, 0xe3371d41, 0xb4cf, 0x4a05, 0xbd, 0x4e, 0x20, 0xb8, 0x8b, 0xb2, 0xc4, 0xd6);
#endif
#if WINVER >= 0x0602
  DEFINE_GUID (MF_MT_VIDEO_3D, 0xcb5e88cf, 0x7b5b, 0x476b, 0x85, 0xaa, 0x1c, 0xa5, 0xae, 0x18, 0x75, 0x55);
  DEFINE_GUID (MF_MT_VIDEO_3D_FORMAT, 0x5315d8a0, 0x87c5, 0x4697, 0xb7, 0x93, 0x66, 0x6, 0xc6, 0x7c, 0x4, 0x9b);
  DEFINE_GUID (MF_MT_VIDEO_3D_NUM_VIEWS, 0xbb077e8a, 0xdcbf, 0x42eb, 0xaf, 0x60, 0x41, 0x8d, 0xf9, 0x8a, 0xa4, 0x95);
  DEFINE_GUID (MF_MT_VIDEO_3D_LEFT_IS_BASE, 0x6d4b7bff, 0x5629, 0x4404, 0x94, 0x8c, 0xc6, 0x34, 0xf4, 0xce, 0x26, 0xd4);
  DEFINE_GUID (MF_MT_VIDEO_3D_FIRST_IS_LEFT, 0xec298493, 0xada, 0x4ea1, 0xa4, 0xfe, 0xcb, 0xbd, 0x36, 0xce, 0x93, 0x31);
  DEFINE_GUID (MFSampleExtension_3DVideo, 0xf86f97a4, 0xdd54, 0x4e2e, 0x9a, 0x5e, 0x55, 0xfc, 0x2d, 0x74, 0xa0, 0x05);
  DEFINE_GUID (MFSampleExtension_3DVideo_SampleFormat, 0x8671772, 0xe36f, 0x4cff, 0x97, 0xb3, 0xd7, 0x2e, 0x20, 0x98, 0x7a, 0x48);
  DEFINE_GUID (MF_MT_VIDEO_ROTATION, 0xc380465d, 0x2271, 0x428c, 0x9b, 0x83, 0xec, 0xea, 0x3b, 0x4a, 0x85, 0xc1);
  DEFINE_GUID (MF_MT_TIMESTAMP_CAN_BE_DTS, 0x24974215, 0x1b7b, 0x41e4, 0x86, 0x25, 0xac, 0x46, 0x9f, 0x2d, 0xed, 0xaa);
  DEFINE_GUID (MF_LOW_LATENCY, 0x9c27891a, 0xed7a, 0x40e1, 0x88, 0xe8, 0xb2, 0x27, 0x27, 0xa0, 0x24, 0xee);
#endif
#endif

#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
  typedef struct _MT_CUSTOM_VIDEO_PRIMARIES {
    float fRx;
    float fRy;
    float fGx;
    float fGy;
    float fBx;
    float fBy;
    float fWx;
    float fWy;
  } MT_CUSTOM_VIDEO_PRIMARIES;

#if WINVER >= 0x0601
  typedef struct _MT_ARBITRARY_HEADER {
    GUID majortype;
    GUID subtype;
    WINBOOL bFixedSizeSamples;
    WINBOOL bTemporalCompression;
    ULONG lSampleSize;
    GUID formattype;
  } MT_ARBITRARY_HEADER;
#endif

  DEFINE_GUID (MF_MT_CUSTOM_VIDEO_PRIMARIES, 0x47537213, 0x8cfb, 0x4722, 0xaa, 0x34, 0xfb, 0xc9, 0xe2, 0x4d, 0x77, 0xb8);
  DEFINE_GUID (MF_MT_AM_FORMAT_TYPE, 0x73d1072d, 0x1870, 0x4174, 0xa0, 0x63, 0x29, 0xff, 0x4f, 0xf6, 0xc1, 0x1e);
  DEFINE_GUID (AM_MEDIA_TYPE_REPRESENTATION, 0xe2e42ad2, 0x132c, 0x491e, 0xa2, 0x68, 0x3c, 0x7c, 0x2d, 0xca, 0x18, 0x1f);
  DEFINE_GUID (FORMAT_MFVideoFormat, 0xaed4ab2d, 0x7326, 0x43cb, 0x94, 0x64, 0xc8, 0x79, 0xca, 0xb9, 0xc4, 0x3d);
#if WINVER >= 0x0601
  DEFINE_GUID (MF_MT_ARBITRARY_HEADER, 0x9e6bd6f5, 0x109, 0x4f95, 0x84, 0xac, 0x93, 0x9, 0x15, 0x3a, 0x19, 0xfc);
  DEFINE_GUID (MF_MT_ARBITRARY_FORMAT, 0x5a75b249, 0xd7d, 0x49a1, 0xa1, 0xc3, 0xe0, 0xd8, 0x7f, 0xc, 0xad, 0xe5);
  DEFINE_GUID (MF_MT_ORIGINAL_4CC, 0xd7be3fe0, 0x2bc7, 0x492d, 0xb8, 0x43, 0x61, 0xa1, 0x91, 0x9b, 0x70, 0xc3);
  DEFINE_GUID (MF_MT_ORIGINAL_WAVE_FORMAT_TAG, 0x8cbbc843, 0x9fd9, 0x49c2, 0x88, 0x2f, 0xa7, 0x25, 0x86, 0xc4, 0x08, 0xad);
#endif

  struct tagVIDEOINFOHEADER;
  struct tagVIDEOINFOHEADER2;
  struct tagMPEG2VIDEOINFO;
  struct _AMMediaType;

  typedef struct tagVIDEOINFOHEADER VIDEOINFOHEADER;
  typedef struct tagVIDEOINFOHEADER2 VIDEOINFOHEADER2;
  struct tagMPEG1VIDEOINFO;
  typedef struct tagMPEG1VIDEOINFO MPEG1VIDEOINFO;
  typedef struct tagMPEG2VIDEOINFO MPEG2VIDEOINFO;
  typedef struct _AMMediaType AM_MEDIA_TYPE;

  STDAPI MFValidateMediaTypeSize (GUID FormatType, UINT8 *pBlock, UINT32 cbSize);
  STDAPI MFCreateMFVideoFormatFromMFMediaType (IMFMediaType *pMFType, MFVIDEOFORMAT **ppMFVF, UINT32 *pcbSize);
#endif

#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
  typedef enum _MFWaveFormatExConvertFlags {
    MFWaveFormatExConvertFlag_Normal = 0,
    MFWaveFormatExConvertFlag_ForceExtensible = 1
  } MFWaveFormatExConvertFlags;

  STDAPI MFCreateMediaType (IMFMediaType **ppMFType);
  STDAPI MFCreateWaveFormatExFromMFMediaType (IMFMediaType *pMFType, WAVEFORMATEX **ppWF, UINT32 *pcbSize, UINT32 Flags
#ifdef __cplusplus
    = MFWaveFormatExConvertFlag_Normal
#endif
    );
#endif

#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
  STDAPI MFInitMediaTypeFromVideoInfoHeader (IMFMediaType *pMFType, const VIDEOINFOHEADER *pVIH, UINT32 cbBufSize, const GUID *pSubtype
#ifdef __cplusplus
    = NULL
#endif
    );
  STDAPI MFInitMediaTypeFromVideoInfoHeader2 (IMFMediaType *pMFType, const VIDEOINFOHEADER2 *pVIH2, UINT32 cbBufSize, const GUID *pSubtype
#ifdef __cplusplus
    = NULL
#endif
    );
  STDAPI MFInitMediaTypeFromMPEG1VideoInfo (IMFMediaType *pMFType, const MPEG1VIDEOINFO *pMP1VI, UINT32 cbBufSize, const GUID *pSubtype
#ifdef __cplusplus
    = NULL
#endif
    );
  STDAPI MFInitMediaTypeFromMPEG2VideoInfo (IMFMediaType *pMFType, const MPEG2VIDEOINFO *pMP2VI, UINT32 cbBufSize, const GUID *pSubtype
#ifdef __cplusplus
    = NULL
#endif
    );
  STDAPI MFCalculateBitmapImageSize (const BITMAPINFOHEADER *pBMIH, UINT32 cbBufSize, UINT32 *pcbImageSize, WINBOOL *pbKnown
#ifdef __cplusplus
    = NULL
#endif
    );
  STDAPI MFInitMediaTypeFromWaveFormatEx (IMFMediaType *pMFType, const WAVEFORMATEX *pWaveFormat, UINT32 cbBufSize);
  STDAPI MFWrapMediaType (IMFMediaType *pOrig, REFGUID MajorType, REFGUID SubType, IMFMediaType **ppWrap);
  STDAPI MFUnwrapMediaType (IMFMediaType *pWrap, IMFMediaType **ppOrig);
  STDAPI MFCopyImage (BYTE *pDest, LONG lDestStride, const BYTE *pSrc, LONG lSrcStride, DWORD dwWidthInBytes, DWORD dwLines);
  STDAPI MFCreate2DMediaBuffer (DWORD dwWidth, DWORD dwHeight, DWORD dwFourCC, WINBOOL fBottomUp, IMFMediaBuffer **ppBuffer);
  STDAPI MFCreateMediaBufferFromMediaType (IMFMediaType *pMediaType, LONGLONG llDuration, DWORD dwMinLength, DWORD dwMinAlignment, IMFMediaBuffer **ppBuffer);
#endif

#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
  STDAPI MFCalculateImageSize (REFGUID guidSubtype, UINT32 unWidth, UINT32 unHeight, UINT32 *pcbImageSize);
  STDAPI MFFrameRateToAverageTimePerFrame (UINT32 unNumerator, UINT32 unDenominator, UINT64 *punAverageTimePerFrame);
  STDAPI MFAverageTimePerFrameToFrameRate (UINT64 unAverageTimePerFrame, UINT32 *punNumerator, UINT32 *punDenominator);
  STDAPI MFInitMediaTypeFromMFVideoFormat (IMFMediaType *pMFType, const MFVIDEOFORMAT *pMFVF, UINT32 cbBufSize);
  STDAPI MFInitMediaTypeFromAMMediaType (IMFMediaType *pMFType, const AM_MEDIA_TYPE *pAMType);
  STDAPI MFInitAMMediaTypeFromMFMediaType (IMFMediaType *pMFType, GUID guidFormatBlockType, AM_MEDIA_TYPE *pAMType);
  STDAPI MFCreateAMMediaTypeFromMFMediaType (IMFMediaType *pMFType, GUID guidFormatBlockType, AM_MEDIA_TYPE **ppAMType);
  STDAPI_ (WINBOOL) MFCompareFullToPartialMediaType (IMFMediaType *pMFTypeFull, IMFMediaType *pMFTypePartial);
#ifdef _KSMEDIA_
  STDAPI MFCreateVideoMediaTypeFromVideoInfoHeader (const KS_VIDEOINFOHEADER *pVideoInfoHeader, DWORD cbVideoInfoHeader, DWORD dwPixelAspectRatioX, DWORD dwPixelAspectRatioY, MFVideoInterlaceMode InterlaceMode, QWORD VideoFlags, const GUID *pSubtype, IMFVideoMediaType **ppIVideoMediaType);
  STDAPI MFCreateVideoMediaTypeFromVideoInfoHeader2 (const KS_VIDEOINFOHEADER2 *pVideoInfoHeader, DWORD cbVideoInfoHeader, QWORD AdditionalVideoFlags, const GUID *pSubtype, IMFVideoMediaType **ppIVideoMediaType);
#endif
  STDAPI MFCreateVideoMediaType (const MFVIDEOFORMAT *pVideoFormat, IMFVideoMediaType **ppIVideoMediaType);
  STDAPI MFCreateVideoMediaTypeFromSubtype (const GUID *pAMSubtype, IMFVideoMediaType **ppIVideoMediaType);
  STDAPI_ (WINBOOL) MFIsFormatYUV (DWORD Format);
  STDAPI MFCreateVideoMediaTypeFromBitMapInfoHeader (const BITMAPINFOHEADER *pbmihBitMapInfoHeader, DWORD dwPixelAspectRatioX, DWORD dwPixelAspectRatioY, MFVideoInterlaceMode InterlaceMode, QWORD VideoFlags, QWORD qwFramesPerSecondNumerator, QWORD qwFramesPerSecondDenominator, DWORD dwMaxBitRate, IMFVideoMediaType **ppIVideoMediaType);
  STDAPI MFGetStrideForBitmapInfoHeader (DWORD format, DWORD dwWidth, LONG *pStride);
  STDAPI MFGetPlaneSize (DWORD format, DWORD dwWidth, DWORD dwHeight, DWORD *pdwPlaneSize);
  STDAPI MFCreateMediaTypeFromRepresentation (GUID guidRepresentation, LPVOID pvRepresentation, IMFMediaType **ppIMediaType);
  STDAPI MFCreateAudioMediaType (const WAVEFORMATEX *pAudioFormat, IMFAudioMediaType **ppIAudioMediaType);
  DWORD STDMETHODCALLTYPE MFGetUncompressedVideoFormat (const MFVIDEOFORMAT *pVideoFormat);
  STDAPI MFInitVideoFormat (MFVIDEOFORMAT *pVideoFormat, MFStandardVideoFormat type);
  STDAPI MFInitVideoFormat_RGB (MFVIDEOFORMAT *pVideoFormat, DWORD dwWidth, DWORD dwHeight, DWORD D3Dfmt);
  STDAPI MFConvertColorInfoToDXVA (DWORD *pdwToDXVA, const MFVIDEOFORMAT *pFromFormat);
  STDAPI MFConvertColorInfoFromDXVA (MFVIDEOFORMAT *pToFormat, DWORD dwFromDXVA);
  STDAPI MFConvertFromFP16Array (float *pDest, const WORD *pSrc, DWORD dwCount);
  STDAPI MFConvertToFP16Array (WORD *pDest, const float *pSrc, DWORD dwCount);
#if WINVER >= 0x0601
  STDAPI MFCreateVideoMediaTypeFromBitMapInfoHeaderEx (const BITMAPINFOHEADER *pbmihBitMapInfoHeader, UINT32 cbBitMapInfoHeader, DWORD dwPixelAspectRatioX, DWORD dwPixelAspectRatioY, MFVideoInterlaceMode InterlaceMode, QWORD VideoFlags, DWORD dwFramesPerSecondNumerator, DWORD dwFramesPerSecondDenominator, DWORD dwMaxBitRate, IMFVideoMediaType **ppIVideoMediaType);
#endif
#endif

#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
#ifdef __cplusplus
  inline UINT32 HI32 (UINT64 up) { return (UINT32) (up >> 32); }
  inline UINT32 LO32 (UINT64 up) { return (UINT32) up; }
  inline UINT64 Pack2UINT32AsUINT64 (UINT32 uh, UINT32 ul) { return (((UINT64) uh) << 32) | ((UINT64) ul); }
  inline void Unpack2UINT32AsUINT64 (UINT64 up, UINT32 *puh, UINT32 *pul) { *puh = HI32 (up); *pul = LO32 (up); }
  inline UINT64 PackSize (UINT32 uw, UINT32 uh) { return Pack2UINT32AsUINT64 (uw, uh); }
  inline void UnpackSize (UINT64 up, UINT32 *puw, UINT32 *puh) { Unpack2UINT32AsUINT64 (up, puw, puh); }
  inline UINT64 PackRatio (INT32 n, UINT32 ud) { return Pack2UINT32AsUINT64 ((UINT32) n, ud); }
  inline void UnpackRatio (UINT64 up, INT32 *pn, UINT32 *pud) { Unpack2UINT32AsUINT64 (up, (UINT32 *) pn, pud); }
  inline UINT32 MFGetAttributeUINT32 (IMFAttributes *pattr, REFGUID guid, UINT32 udef) {
    UINT32 r;
    if (FAILED (pattr->GetUINT32 (guid, &r)))
      r = udef;
    return r;
  }
  inline UINT64 MFGetAttributeUINT64 (IMFAttributes *pattr, REFGUID guid, UINT64 udef) {
    UINT64 r;
    if (FAILED (pattr->GetUINT64 (guid, &r)))
      r = udef;
    return r;
  }
  inline double MFGetAttributeDouble (IMFAttributes *pattr, REFGUID guid, double fdef) {
    double r;
    if (FAILED (pattr->GetDouble (guid, &r)))
      r = fdef;
    return r;
  }
  inline HRESULT MFGetAttribute2UINT32asUINT64 (IMFAttributes *pattr, REFGUID guid, UINT32 *puh, UINT32 *pul) {
    UINT64 up;
    HRESULT hr = pattr->GetUINT64 (guid, &up);
    if (!FAILED (hr))
      Unpack2UINT32AsUINT64 (up, puh, pul);
    return hr;
  }
  inline HRESULT MFSetAttribute2UINT32asUINT64 (IMFAttributes *pattr, REFGUID guid, UINT32 uh, UINT32 ul) {
    return pattr->SetUINT64 (guid, Pack2UINT32AsUINT64 (uh, ul));
  }
  inline HRESULT MFGetAttributeRatio (IMFAttributes *pattr, REFGUID guid, UINT32 *pn, UINT32 *pd) { return MFGetAttribute2UINT32asUINT64 (pattr, guid, pn, pd); }
  inline HRESULT MFGetAttributeSize (IMFAttributes *pattr, REFGUID guid, UINT32 *pw, UINT32 *ph) { return MFGetAttribute2UINT32asUINT64 (pattr, guid, pw, ph); }
  inline HRESULT MFSetAttributeRatio (IMFAttributes *pattr, REFGUID guid, UINT32 un, UINT32 ud) { return MFSetAttribute2UINT32asUINT64 (pattr, guid, un, ud); }
  inline HRESULT MFSetAttributeSize (IMFAttributes *pattr, REFGUID guid, UINT32 uw, UINT32 uh) { return MFSetAttribute2UINT32asUINT64 (pattr, guid, uw, uh); }
#ifdef _INTSAFE_H_INCLUDED_
  inline HRESULT MFGetAttributeString (IMFAttributes *pattr, REFGUID guid, PWSTR *ppsz) {
    HRESULT hr;
    UINT32 length;
    PWSTR psz = NULL;
    *ppsz = NULL;
    hr = pattr->GetStringLength (guid, &length);
    if (SUCCEEDED (hr))
      hr = UIntAdd (length, 1, &length);
    if (SUCCEEDED (hr)) {
      size_t cb;
      hr = SizeTMult (length, sizeof (WCHAR), &cb);
      if (SUCCEEDED (hr) && !(psz = PWSTR (CoTaskMemAlloc (cb))))
	hr = E_OUTOFMEMORY;
    }
    if (SUCCEEDED (hr))
      hr = pattr->GetString (guid, psz, length, &length);
    if (SUCCEEDED (hr))
      *ppsz = psz;
    else
      CoTaskMemFree (psz);
    return hr;
  }
#endif

  STDAPI MFCreateCollection (IMFCollection **ppIMFCollection);
#endif

#if WINVER >= 0x0601
  LONGLONG WINAPI MFllMulDiv (LONGLONG a, LONGLONG b, LONGLONG c, LONGLONG d);
#endif
#endif

#if defined (__cplusplus)
}
#endif
#endif
Added undroid/tclwmf/compat/mferror.h.


















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/**
 * This file has no copyright assigned and is placed in the Public Domain.
 * This file is part of the mingw-w64 runtime package.
 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
 */

#ifndef _MFERROR_H
#define _MFERROR_H

#define STATUS_SEVERITY(hr) (((hr) >> 30) & 0x3)
#define _HRESULT_TYPEDEF_(_sc) ((HRESULT)_sc)

#define FACILITY_MF_WIN32  0x7
#define FACILITY_MF        0xd

#define STATUS_SEVERITY_SUCCESS        0x0
#define STATUS_SEVERITY_INFORMATIONAL  0x1
#define STATUS_SEVERITY_WARNING        0x2
#define STATUS_SEVERITY_ERROR          0x3

#define MF_E_PLATFORM_NOT_INITIALIZED  _HRESULT_TYPEDEF_(0xc00d36b0)
#define MF_E_BUFFERTOOSMALL            _HRESULT_TYPEDEF_(0xc00d36b1)
#define MF_E_INVALIDREQUEST            _HRESULT_TYPEDEF_(0xc00d36b2)
#define MF_E_INVALIDSTREAMNUMBER       _HRESULT_TYPEDEF_(0xc00d36b3)
#define MF_E_INVALIDMEDIATYPE          _HRESULT_TYPEDEF_(0xc00d36b4)
#define MF_E_NOTACCEPTING              _HRESULT_TYPEDEF_(0xc00d36b5)
#define MF_E_NOT_INITIALIZED           _HRESULT_TYPEDEF_(0xc00d36b6)
#define MF_E_UNSUPPORTED_REPRESENTATION  _HRESULT_TYPEDEF_(0xc00d36b7)
#define MF_E_NO_MORE_TYPES             _HRESULT_TYPEDEF_(0xc00d36b9)
#define MF_E_UNSUPPORTED_SERVICE       _HRESULT_TYPEDEF_(0xc00d36ba)
#define MF_E_UNEXPECTED                _HRESULT_TYPEDEF_(0xc00d36bb)
#define MF_E_INVALIDNAME               _HRESULT_TYPEDEF_(0xc00d36bc)
#define MF_E_INVALIDTYPE               _HRESULT_TYPEDEF_(0xc00d36bd)
#define MF_E_INVALID_FILE_FORMAT       _HRESULT_TYPEDEF_(0xc00d36be)
#define MF_E_INVALIDINDEX              _HRESULT_TYPEDEF_(0xc00d36bf)
#define MF_E_INVALID_TIMESTAMP         _HRESULT_TYPEDEF_(0xc00d36c0)
#define MF_E_UNSUPPORTED_SCHEME        _HRESULT_TYPEDEF_(0xc00d36c3)
#define MF_E_UNSUPPORTED_BYTESTREAM_TYPE  _HRESULT_TYPEDEF_(0xc00d36c4)
#define MF_E_UNSUPPORTED_TIME_FORMAT   _HRESULT_TYPEDEF_(0xc00d36c5)
#define MF_E_NO_SAMPLE_TIMESTAMP       _HRESULT_TYPEDEF_(0xc00d36c8)
#define MF_E_NO_SAMPLE_DURATION        _HRESULT_TYPEDEF_(0xc00d36c9)
#define MF_E_INVALID_STREAM_DATA       _HRESULT_TYPEDEF_(0xc00d36cb)
#define MF_E_RT_UNAVAILABLE            _HRESULT_TYPEDEF_(0xc00d36cf)
#define MF_E_UNSUPPORTED_RATE          _HRESULT_TYPEDEF_(0xc00d36d0)
#define MF_E_THINNING_UNSUPPORTED      _HRESULT_TYPEDEF_(0xc00d36d1)
#define MF_E_REVERSE_UNSUPPORTED       _HRESULT_TYPEDEF_(0xc00d36d2)
#define MF_E_UNSUPPORTED_RATE_TRANSITION  _HRESULT_TYPEDEF_(0xc00d36d3)
#define MF_E_RATE_CHANGE_PREEMPTED     _HRESULT_TYPEDEF_(0xc00d36d4)
#define MF_E_NOT_FOUND                 _HRESULT_TYPEDEF_(0xc00d36d5)
#define MF_E_NOT_AVAILABLE             _HRESULT_TYPEDEF_(0xc00d36d6)
#define MF_E_NO_CLOCK                  _HRESULT_TYPEDEF_(0xc00d36d7)
#define MF_S_MULTIPLE_BEGIN            _HRESULT_TYPEDEF_(0x000d36d8)
#define MF_E_MULTIPLE_BEGIN            _HRESULT_TYPEDEF_(0xc00d36d9)
#define MF_E_MULTIPLE_SUBSCRIBERS      _HRESULT_TYPEDEF_(0xc00d36da)
#define MF_E_TIMER_ORPHANED            _HRESULT_TYPEDEF_(0xc00d36db)
#define MF_E_STATE_TRANSITION_PENDING      _HRESULT_TYPEDEF_(0xc00d36dc)
#define MF_E_UNSUPPORTED_STATE_TRANSITION  _HRESULT_TYPEDEF_(0xc00d36dd)
#define MF_E_UNRECOVERABLE_ERROR_OCCURRED  _HRESULT_TYPEDEF_(0xc00d36de)
#define MF_E_SAMPLE_HAS_TOO_MANY_BUFFERS   _HRESULT_TYPEDEF_(0xc00d36df)
#define MF_E_SAMPLE_NOT_WRITABLE       _HRESULT_TYPEDEF_(0xc00d36e0)
#define MF_E_INVALID_KEY               _HRESULT_TYPEDEF_(0xc00d36e2)
#define MF_E_BAD_STARTUP_VERSION       _HRESULT_TYPEDEF_(0xc00d36e3)
#define MF_E_UNSUPPORTED_CAPTION       _HRESULT_TYPEDEF_(0xc00d36e4)
#define MF_E_INVALID_POSITION          _HRESULT_TYPEDEF_(0xc00d36e5)
#define MF_E_ATTRIBUTENOTFOUND         _HRESULT_TYPEDEF_(0xc00d36e6)
#define MF_E_PROPERTY_TYPE_NOT_ALLOWED _HRESULT_TYPEDEF_(0xc00d36e7)

#define MF_E_TOPO_INVALID_OPTIONAL_NODE    _HRESULT_TYPEDEF_(0xc00d520e)
#define MF_E_TOPO_CANNOT_FIND_DECRYPTOR    _HRESULT_TYPEDEF_(0xc00d5211)
#define MF_E_TOPO_CODEC_NOT_FOUND      _HRESULT_TYPEDEF_(0xc00d5212)
#define MF_E_TOPO_CANNOT_CONNECT       _HRESULT_TYPEDEF_(0xc00d5213)
#define MF_E_TOPO_UNSUPPORTED          _HRESULT_TYPEDEF_(0xc00d5214)
#define MF_E_TOPO_INVALID_TIME_ATTRIBUTES  _HRESULT_TYPEDEF_(0xc00d5215)
#define MF_E_TOPO_LOOPS_IN_TOPOLOGY    _HRESULT_TYPEDEF_(0xC00d5216)
#define MF_E_TOPO_MISSING_PRESENTATION_DESCRIPTOR  _HRESULT_TYPEDEF_(0xc00d5217)
#define MF_E_TOPO_MISSING_STREAM_DESCRIPTOR        _HRESULT_TYPEDEF_(0xc00d5218)
#define MF_E_TOPO_STREAM_DESCRIPTOR_NOT_SELECTED   _HRESULT_TYPEDEF_(0xc00d5219)
#define MF_E_TOPO_MISSING_SOURCE       _HRESULT_TYPEDEF_(0xc00d521a)
#define MF_E_TOPO_SINK_ACTIVATES_UNSUPPORTED       _HRESULT_TYPEDEF_(0xc00d521b)
#define MF_E_TRANSFORM_TYPE_NOT_SET      _HRESULT_TYPEDEF_(0xc00d6d60)
#define MF_E_TRANSFORM_STREAM_CHANGE     _HRESULT_TYPEDEF_(0xc00d6d61)
#define MF_E_TRANSFORM_INPUT_REMAINING   _HRESULT_TYPEDEF_(0xc00d6d62)
#define MF_E_TRANSFORM_PROFILE_MISSING   _HRESULT_TYPEDEF_(0xc00d6d63)
#define MF_E_TRANSFORM_PROFILE_INVALID_OR_CORRUPT  _HRESULT_TYPEDEF_(0xc00d6d64)
#define MF_E_TRANSFORM_PROFILE_TRUNCATED           _HRESULT_TYPEDEF_(0xc00d6d65)
#define MF_E_TRANSFORM_PROPERTY_PID_NOT_RECOGNIZED _HRESULT_TYPEDEF_(0xc00d6d66)
#define MF_E_TRANSFORM_PROPERTY_VARIANT_TYPE_WRONG _HRESULT_TYPEDEF_(0xc00d6d67)
#define MF_E_TRANSFORM_PROPERTY_NOT_WRITEABLE      _HRESULT_TYPEDEF_(0xc00d6d68)
#define MF_E_TRANSFORM_PROPERTY_ARRAY_VALUE_WRONG_NUM_DIM  _HRESULT_TYPEDEF_(0xc00d6d69)
#define MF_E_TRANSFORM_PROPERTY_VALUE_SIZE_WRONG   _HRESULT_TYPEDEF_(0xc00d6d6a)
#define MF_E_TRANSFORM_PROPERTY_VALUE_OUT_OF_RANGE _HRESULT_TYPEDEF_(0xc00d6d6b)
#define MF_E_TRANSFORM_PROPERTY_VALUE_INCOMPATIBLE _HRESULT_TYPEDEF_(0xc00d6d6c)
#define MF_E_TRANSFORM_NOT_POSSIBLE_FOR_CURRENT_OUTPUT_MEDIATYPE       _HRESULT_TYPEDEF_(0xc00d6d6d)
#define MF_E_TRANSFORM_NOT_POSSIBLE_FOR_CURRENT_INPUT_MEDIATYPE        _HRESULT_TYPEDEF_(0xc00d6d6e)
#define MF_E_TRANSFORM_NOT_POSSIBLE_FOR_CURRENT_MEDIATYPE_COMBINATION  _HRESULT_TYPEDEF_(0xc00d6d6f)
#define MF_E_TRANSFORM_CONFLICTS_WITH_OTHER_CURRENTLY_ENABLED_FEATURES _HRESULT_TYPEDEF_(0xc00d6d70)
#define MF_E_TRANSFORM_NEED_MORE_INPUT                                 _HRESULT_TYPEDEF_(0xc00d6d72)
#define MF_E_TRANSFORM_NOT_POSSIBLE_FOR_CURRENT_SPKR_CONFIG            _HRESULT_TYPEDEF_(0xc00d6d73)
#define MF_E_TRANSFORM_CANNOT_CHANGE_MEDIATYPE_WHILE_PROCESSING        _HRESULT_TYPEDEF_(0xc00d6d74)
#define MF_S_TRANSFORM_DO_NOT_PROPAGATE_EVENT       _HRESULT_TYPEDEF_(0x000d6d75)
#define MF_E_UNSUPPORTED_D3D_TYPE                   _HRESULT_TYPEDEF_(0xc00d6d76)
#define MF_E_TRANSFORM_ASYNC_LOCKED                 _HRESULT_TYPEDEF_(0xc00d6d77)
#define MF_E_TRANSFORM_CANNOT_INITIALIZE_ACM_DRIVER _HRESULT_TYPEDEF_(0xc00d6d78)

#endif /* _MFERROR_H */
Added undroid/tclwmf/compat/mfidl.h.
































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
/*** Autogenerated by WIDL 1.6 from include/mfidl.idl - Do not edit ***/

#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 475
#endif

#include <rpc.h>
#include <rpcndr.h>

#ifndef COM_NO_WINDOWS_H
#include <windows.h>
#include <ole2.h>
#endif

#ifndef __mfidl_h__
#define __mfidl_h__

/* Forward declarations */

#ifndef __IMFTopologyNode_FWD_DEFINED__
#define __IMFTopologyNode_FWD_DEFINED__
typedef interface IMFTopologyNode IMFTopologyNode;
#endif

#ifndef __IMFTopology_FWD_DEFINED__
#define __IMFTopology_FWD_DEFINED__
typedef interface IMFTopology IMFTopology;
#endif

#ifndef __IMFClock_FWD_DEFINED__
#define __IMFClock_FWD_DEFINED__
typedef interface IMFClock IMFClock;
#endif

#ifndef __IMFMediaSession_FWD_DEFINED__
#define __IMFMediaSession_FWD_DEFINED__
typedef interface IMFMediaSession IMFMediaSession;
#endif

#ifndef __IMFMediaTypeHandler_FWD_DEFINED__
#define __IMFMediaTypeHandler_FWD_DEFINED__
typedef interface IMFMediaTypeHandler IMFMediaTypeHandler;
#endif

#ifndef __IMFStreamDescriptor_FWD_DEFINED__
#define __IMFStreamDescriptor_FWD_DEFINED__
typedef interface IMFStreamDescriptor IMFStreamDescriptor;
#endif

#ifndef __IMFPresentationDescriptor_FWD_DEFINED__
#define __IMFPresentationDescriptor_FWD_DEFINED__
typedef interface IMFPresentationDescriptor IMFPresentationDescriptor;
#endif

#ifndef __IMFMediaSource_FWD_DEFINED__
#define __IMFMediaSource_FWD_DEFINED__
typedef interface IMFMediaSource IMFMediaSource;
#endif

#ifndef __IMFByteStreamBuffering_FWD_DEFINED__
#define __IMFByteStreamBuffering_FWD_DEFINED__
typedef interface IMFByteStreamBuffering IMFByteStreamBuffering;
#endif

/* Headers for imported files */

#include <mfobjects.h>

#ifdef __cplusplus
extern "C" {
#endif

#include <mftransform.h>
#include <windef.h>
typedef enum MFSESSION_SETTOPOLOGY_FLAGS {
    MFSESSION_SETTOPOLOGY_IMMEDIATE = 0x1,
    MFSESSION_SETTOPOLOGY_NORESOLUTION = 0x2,
    MFSESSION_SETTOPOLOGY_CLEAR_CURRENT = 0x4
} MFSESSION_SETTOPOLOGY_FLAGS;
typedef enum MFSESSION_GETFULLTOPOLOGY_FLAGS {
    MFSESSION_GETFULLTOPOLOGY_CURRENT = 0
} MFSESSION_GETFULLTOPOLOGY_FLAGS;
typedef enum MFPMPSESSION_CREATION_FLAGS {
    MFPMPSESSION_UNPROTECTED_PROCESS = 0x1
} MFPMPSESSION_CREATION_FLAGS;
typedef UINT64 TOPOID;
typedef enum MF_TOPOLOGY_TYPE {
    MF_TOPOLOGY_OUTPUT_NODE = 0,
    MF_TOPOLOGY_SOURCESTREAM_NODE = 1,
    MF_TOPOLOGY_TRANSFORM_NODE = 2,
    MF_TOPOLOGY_TEE_NODE = 3,
    MF_TOPOLOGY_MAX = 0xffffffff
} MF_TOPOLOGY_TYPE;
/*****************************************************************************
 * IMFTopologyNode interface
 */
#ifndef __IMFTopologyNode_INTERFACE_DEFINED__
#define __IMFTopologyNode_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFTopologyNode, 0x83cf873a, 0xf6da, 0x4bc8, 0x82,0x3f, 0xba,0xcf,0xd5,0x5d,0xc4,0x30);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("83cf873a-f6da-4bc8-823f-bacfd55dc430")
IMFTopologyNode : public IMFAttributes
{
    virtual HRESULT STDMETHODCALLTYPE SetObject(
        IUnknown *pObject) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetObject(
        IUnknown **ppObject) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetNodeType(
        MF_TOPOLOGY_TYPE *pType) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetTopoNodeID(
        TOPOID *pID) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetTopoNodeID(
        TOPOID ullTopoID) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetInputCount(
        DWORD *pcInputs) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetOutputCount(
        DWORD *pcOutputs) = 0;

    virtual HRESULT STDMETHODCALLTYPE ConnectOutput(
        DWORD dwOutputIndex,
        IMFTopologyNode *pDownstreamNode,
        DWORD dwInputIndexOnDownstreamNode) = 0;

    virtual HRESULT STDMETHODCALLTYPE DisconnectOutput(
        DWORD dwOutputIndex) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetInput(
        DWORD dwInputIndex,
        IMFTopologyNode **ppUpstreamNode,
        DWORD *pdwOutputIndexOnUpstreamNode) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetOutput(
        DWORD dwOutputIndex,
        IMFTopologyNode **ppDownstreamNode,
        DWORD *pdwInputIndexOnDownstreamNode) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetOutputPrefType(
        DWORD dwOutputIndex,
        IMFMediaType *pType) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetOutputPrefType(
        DWORD dwOutputIndex,
        IMFMediaType **ppType) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetInputPrefType(
        DWORD dwInputIndex,
        IMFMediaType *pType) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetInputPrefType(
        DWORD dwInputIndex,
        IMFMediaType **ppType) = 0;

    virtual HRESULT STDMETHODCALLTYPE CloneFrom(
        IMFTopologyNode *pNode) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFTopologyNode, 0x83cf873a, 0xf6da, 0x4bc8, 0x82,0x3f, 0xba,0xcf,0xd5,0x5d,0xc4,0x30)
#endif
#else
typedef struct IMFTopologyNodeVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFTopologyNode* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFTopologyNode* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFTopologyNode* This);

    /*** IMFAttributes methods ***/
    HRESULT (STDMETHODCALLTYPE *GetItem)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *GetItemType)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        MF_ATTRIBUTE_TYPE *pType);

    HRESULT (STDMETHODCALLTYPE *CompareItem)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        REFPROPVARIANT Value,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *Compare)(
        IMFTopologyNode* This,
        IMFAttributes *pTheirs,
        MF_ATTRIBUTES_MATCH_TYPE MatchType,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *GetUINT32)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        UINT32 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetUINT64)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        UINT64 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetDouble)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        double *pfValue);

    HRESULT (STDMETHODCALLTYPE *GetGUID)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        GUID *pguidValue);

    HRESULT (STDMETHODCALLTYPE *GetStringLength)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetString)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        LPWSTR pwszValue,
        UINT32 cchBufSize,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedString)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        LPWSTR *ppwszValue,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetBlobSize)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetBlob)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        UINT8 *pBuf,
        UINT32 cbBufSize,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedBlob)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        UINT8 **ppBuf,
        UINT32 *pcbSize);

    HRESULT (STDMETHODCALLTYPE *GetUnknown)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        REFIID riid,
        LPVOID *ppv);

    HRESULT (STDMETHODCALLTYPE *SetItem)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        REFPROPVARIANT Value);

    HRESULT (STDMETHODCALLTYPE *DeleteItem)(
        IMFTopologyNode* This,
        REFGUID guidKey);

    HRESULT (STDMETHODCALLTYPE *DeleteAllItems)(
        IMFTopologyNode* This);

    HRESULT (STDMETHODCALLTYPE *SetUINT32)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        UINT32 unValue);

    HRESULT (STDMETHODCALLTYPE *SetUINT64)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        UINT64 unValue);

    HRESULT (STDMETHODCALLTYPE *SetDouble)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        double fValue);

    HRESULT (STDMETHODCALLTYPE *SetGUID)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        REFGUID guidValue);

    HRESULT (STDMETHODCALLTYPE *SetString)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        LPCWSTR wszValue);

    HRESULT (STDMETHODCALLTYPE *SetBlob)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        const UINT8 *pBuf,
        UINT32 cbBufSize);

    HRESULT (STDMETHODCALLTYPE *SetUnknown)(
        IMFTopologyNode* This,
        REFGUID guidKey,
        IUnknown *pUnknown);

    HRESULT (STDMETHODCALLTYPE *LockStore)(
        IMFTopologyNode* This);

    HRESULT (STDMETHODCALLTYPE *UnlockStore)(
        IMFTopologyNode* This);

    HRESULT (STDMETHODCALLTYPE *GetCount)(
        IMFTopologyNode* This,
        UINT32 *pcItems);

    HRESULT (STDMETHODCALLTYPE *GetItemByIndex)(
        IMFTopologyNode* This,
        UINT32 unIndex,
        GUID *pguidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *CopyAllItems)(
        IMFTopologyNode* This,
        IMFAttributes *pDest);

    /*** IMFTopologyNode methods ***/
    HRESULT (STDMETHODCALLTYPE *SetObject)(
        IMFTopologyNode* This,
        IUnknown *pObject);

    HRESULT (STDMETHODCALLTYPE *GetObject)(
        IMFTopologyNode* This,
        IUnknown **ppObject);

    HRESULT (STDMETHODCALLTYPE *GetNodeType)(
        IMFTopologyNode* This,
        MF_TOPOLOGY_TYPE *pType);

    HRESULT (STDMETHODCALLTYPE *GetTopoNodeID)(
        IMFTopologyNode* This,
        TOPOID *pID);

    HRESULT (STDMETHODCALLTYPE *SetTopoNodeID)(
        IMFTopologyNode* This,
        TOPOID ullTopoID);

    HRESULT (STDMETHODCALLTYPE *GetInputCount)(
        IMFTopologyNode* This,
        DWORD *pcInputs);

    HRESULT (STDMETHODCALLTYPE *GetOutputCount)(
        IMFTopologyNode* This,
        DWORD *pcOutputs);

    HRESULT (STDMETHODCALLTYPE *ConnectOutput)(
        IMFTopologyNode* This,
        DWORD dwOutputIndex,
        IMFTopologyNode *pDownstreamNode,
        DWORD dwInputIndexOnDownstreamNode);

    HRESULT (STDMETHODCALLTYPE *DisconnectOutput)(
        IMFTopologyNode* This,
        DWORD dwOutputIndex);

    HRESULT (STDMETHODCALLTYPE *GetInput)(
        IMFTopologyNode* This,
        DWORD dwInputIndex,
        IMFTopologyNode **ppUpstreamNode,
        DWORD *pdwOutputIndexOnUpstreamNode);

    HRESULT (STDMETHODCALLTYPE *GetOutput)(
        IMFTopologyNode* This,
        DWORD dwOutputIndex,
        IMFTopologyNode **ppDownstreamNode,
        DWORD *pdwInputIndexOnDownstreamNode);

    HRESULT (STDMETHODCALLTYPE *SetOutputPrefType)(
        IMFTopologyNode* This,
        DWORD dwOutputIndex,
        IMFMediaType *pType);

    HRESULT (STDMETHODCALLTYPE *GetOutputPrefType)(
        IMFTopologyNode* This,
        DWORD dwOutputIndex,
        IMFMediaType **ppType);

    HRESULT (STDMETHODCALLTYPE *SetInputPrefType)(
        IMFTopologyNode* This,
        DWORD dwInputIndex,
        IMFMediaType *pType);

    HRESULT (STDMETHODCALLTYPE *GetInputPrefType)(
        IMFTopologyNode* This,
        DWORD dwInputIndex,
        IMFMediaType **ppType);

    HRESULT (STDMETHODCALLTYPE *CloneFrom)(
        IMFTopologyNode* This,
        IMFTopologyNode *pNode);

    END_INTERFACE
} IMFTopologyNodeVtbl;
interface IMFTopologyNode {
    CONST_VTBL IMFTopologyNodeVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFTopologyNode_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFTopologyNode_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFTopologyNode_Release(This) (This)->lpVtbl->Release(This)
/*** IMFAttributes methods ***/
#define IMFTopologyNode_GetItem(This,guidKey,pValue) (This)->lpVtbl->GetItem(This,guidKey,pValue)
#define IMFTopologyNode_GetItemType(This,guidKey,pType) (This)->lpVtbl->GetItemType(This,guidKey,pType)
#define IMFTopologyNode_CompareItem(This,guidKey,Value,pbResult) (This)->lpVtbl->CompareItem(This,guidKey,Value,pbResult)
#define IMFTopologyNode_Compare(This,pTheirs,MatchType,pbResult) (This)->lpVtbl->Compare(This,pTheirs,MatchType,pbResult)
#define IMFTopologyNode_GetUINT32(This,guidKey,punValue) (This)->lpVtbl->GetUINT32(This,guidKey,punValue)
#define IMFTopologyNode_GetUINT64(This,guidKey,punValue) (This)->lpVtbl->GetUINT64(This,guidKey,punValue)
#define IMFTopologyNode_GetDouble(This,guidKey,pfValue) (This)->lpVtbl->GetDouble(This,guidKey,pfValue)
#define IMFTopologyNode_GetGUID(This,guidKey,pguidValue) (This)->lpVtbl->GetGUID(This,guidKey,pguidValue)
#define IMFTopologyNode_GetStringLength(This,guidKey,pcchLength) (This)->lpVtbl->GetStringLength(This,guidKey,pcchLength)
#define IMFTopologyNode_GetString(This,guidKey,pwszValue,cchBufSize,pcchLength) (This)->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength)
#define IMFTopologyNode_GetAllocatedString(This,guidKey,ppwszValue,pcchLength) (This)->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength)
#define IMFTopologyNode_GetBlobSize(This,guidKey,pcbBlobSize) (This)->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize)
#define IMFTopologyNode_GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize) (This)->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize)
#define IMFTopologyNode_GetAllocatedBlob(This,guidKey,ppBuf,pcbSize) (This)->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize)
#define IMFTopologyNode_GetUnknown(This,guidKey,riid,ppv) (This)->lpVtbl->GetUnknown(This,guidKey,riid,ppv)
#define IMFTopologyNode_SetItem(This,guidKey,Value) (This)->lpVtbl->SetItem(This,guidKey,Value)
#define IMFTopologyNode_DeleteItem(This,guidKey) (This)->lpVtbl->DeleteItem(This,guidKey)
#define IMFTopologyNode_DeleteAllItems(This) (This)->lpVtbl->DeleteAllItems(This)
#define IMFTopologyNode_SetUINT32(This,guidKey,unValue) (This)->lpVtbl->SetUINT32(This,guidKey,unValue)
#define IMFTopologyNode_SetUINT64(This,guidKey,unValue) (This)->lpVtbl->SetUINT64(This,guidKey,unValue)
#define IMFTopologyNode_SetDouble(This,guidKey,fValue) (This)->lpVtbl->SetDouble(This,guidKey,fValue)
#define IMFTopologyNode_SetGUID(This,guidKey,guidValue) (This)->lpVtbl->SetGUID(This,guidKey,guidValue)
#define IMFTopologyNode_SetString(This,guidKey,wszValue) (This)->lpVtbl->SetString(This,guidKey,wszValue)
#define IMFTopologyNode_SetBlob(This,guidKey,pBuf,cbBufSize) (This)->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize)
#define IMFTopologyNode_SetUnknown(This,guidKey,pUnknown) (This)->lpVtbl->SetUnknown(This,guidKey,pUnknown)
#define IMFTopologyNode_LockStore(This) (This)->lpVtbl->LockStore(This)
#define IMFTopologyNode_UnlockStore(This) (This)->lpVtbl->UnlockStore(This)
#define IMFTopologyNode_GetCount(This,pcItems) (This)->lpVtbl->GetCount(This,pcItems)
#define IMFTopologyNode_GetItemByIndex(This,unIndex,pguidKey,pValue) (This)->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue)
#define IMFTopologyNode_CopyAllItems(This,pDest) (This)->lpVtbl->CopyAllItems(This,pDest)
/*** IMFTopologyNode methods ***/
#define IMFTopologyNode_SetObject(This,pObject) (This)->lpVtbl->SetObject(This,pObject)
#define IMFTopologyNode_GetObject(This,ppObject) (This)->lpVtbl->GetObject(This,ppObject)
#define IMFTopologyNode_GetNodeType(This,pType) (This)->lpVtbl->GetNodeType(This,pType)
#define IMFTopologyNode_GetTopoNodeID(This,pID) (This)->lpVtbl->GetTopoNodeID(This,pID)
#define IMFTopologyNode_SetTopoNodeID(This,ullTopoID) (This)->lpVtbl->SetTopoNodeID(This,ullTopoID)
#define IMFTopologyNode_GetInputCount(This,pcInputs) (This)->lpVtbl->GetInputCount(This,pcInputs)
#define IMFTopologyNode_GetOutputCount(This,pcOutputs) (This)->lpVtbl->GetOutputCount(This,pcOutputs)
#define IMFTopologyNode_ConnectOutput(This,dwOutputIndex,pDownstreamNode,dwInputIndexOnDownstreamNode) (This)->lpVtbl->ConnectOutput(This,dwOutputIndex,pDownstreamNode,dwInputIndexOnDownstreamNode)
#define IMFTopologyNode_DisconnectOutput(This,dwOutputIndex) (This)->lpVtbl->DisconnectOutput(This,dwOutputIndex)
#define IMFTopologyNode_GetInput(This,dwInputIndex,ppUpstreamNode,pdwOutputIndexOnUpstreamNode) (This)->lpVtbl->GetInput(This,dwInputIndex,ppUpstreamNode,pdwOutputIndexOnUpstreamNode)
#define IMFTopologyNode_GetOutput(This,dwOutputIndex,ppDownstreamNode,pdwInputIndexOnDownstreamNode) (This)->lpVtbl->GetOutput(This,dwOutputIndex,ppDownstreamNode,pdwInputIndexOnDownstreamNode)
#define IMFTopologyNode_SetOutputPrefType(This,dwOutputIndex,pType) (This)->lpVtbl->SetOutputPrefType(This,dwOutputIndex,pType)
#define IMFTopologyNode_GetOutputPrefType(This,dwOutputIndex,ppType) (This)->lpVtbl->GetOutputPrefType(This,dwOutputIndex,ppType)
#define IMFTopologyNode_SetInputPrefType(This,dwInputIndex,pType) (This)->lpVtbl->SetInputPrefType(This,dwInputIndex,pType)
#define IMFTopologyNode_GetInputPrefType(This,dwInputIndex,ppType) (This)->lpVtbl->GetInputPrefType(This,dwInputIndex,ppType)
#define IMFTopologyNode_CloneFrom(This,pNode) (This)->lpVtbl->CloneFrom(This,pNode)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFTopologyNode_QueryInterface(IMFTopologyNode* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFTopologyNode_AddRef(IMFTopologyNode* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFTopologyNode_Release(IMFTopologyNode* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFAttributes methods ***/
static FORCEINLINE HRESULT IMFTopologyNode_GetItem(IMFTopologyNode* This,REFGUID guidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItem(This,guidKey,pValue);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetItemType(IMFTopologyNode* This,REFGUID guidKey,MF_ATTRIBUTE_TYPE *pType) {
    return This->lpVtbl->GetItemType(This,guidKey,pType);
}
static FORCEINLINE HRESULT IMFTopologyNode_CompareItem(IMFTopologyNode* This,REFGUID guidKey,REFPROPVARIANT Value,WINBOOL *pbResult) {
    return This->lpVtbl->CompareItem(This,guidKey,Value,pbResult);
}
static FORCEINLINE HRESULT IMFTopologyNode_Compare(IMFTopologyNode* This,IMFAttributes *pTheirs,MF_ATTRIBUTES_MATCH_TYPE MatchType,WINBOOL *pbResult) {
    return This->lpVtbl->Compare(This,pTheirs,MatchType,pbResult);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetUINT32(IMFTopologyNode* This,REFGUID guidKey,UINT32 *punValue) {
    return This->lpVtbl->GetUINT32(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetUINT64(IMFTopologyNode* This,REFGUID guidKey,UINT64 *punValue) {
    return This->lpVtbl->GetUINT64(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetDouble(IMFTopologyNode* This,REFGUID guidKey,double *pfValue) {
    return This->lpVtbl->GetDouble(This,guidKey,pfValue);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetGUID(IMFTopologyNode* This,REFGUID guidKey,GUID *pguidValue) {
    return This->lpVtbl->GetGUID(This,guidKey,pguidValue);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetStringLength(IMFTopologyNode* This,REFGUID guidKey,UINT32 *pcchLength) {
    return This->lpVtbl->GetStringLength(This,guidKey,pcchLength);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetString(IMFTopologyNode* This,REFGUID guidKey,LPWSTR pwszValue,UINT32 cchBufSize,UINT32 *pcchLength) {
    return This->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetAllocatedString(IMFTopologyNode* This,REFGUID guidKey,LPWSTR *ppwszValue,UINT32 *pcchLength) {
    return This->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetBlobSize(IMFTopologyNode* This,REFGUID guidKey,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetBlob(IMFTopologyNode* This,REFGUID guidKey,UINT8 *pBuf,UINT32 cbBufSize,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetAllocatedBlob(IMFTopologyNode* This,REFGUID guidKey,UINT8 **ppBuf,UINT32 *pcbSize) {
    return This->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetUnknown(IMFTopologyNode* This,REFGUID guidKey,REFIID riid,LPVOID *ppv) {
    return This->lpVtbl->GetUnknown(This,guidKey,riid,ppv);
}
static FORCEINLINE HRESULT IMFTopologyNode_SetItem(IMFTopologyNode* This,REFGUID guidKey,REFPROPVARIANT Value) {
    return This->lpVtbl->SetItem(This,guidKey,Value);
}
static FORCEINLINE HRESULT IMFTopologyNode_DeleteItem(IMFTopologyNode* This,REFGUID guidKey) {
    return This->lpVtbl->DeleteItem(This,guidKey);
}
static FORCEINLINE HRESULT IMFTopologyNode_DeleteAllItems(IMFTopologyNode* This) {
    return This->lpVtbl->DeleteAllItems(This);
}
static FORCEINLINE HRESULT IMFTopologyNode_SetUINT32(IMFTopologyNode* This,REFGUID guidKey,UINT32 unValue) {
    return This->lpVtbl->SetUINT32(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFTopologyNode_SetUINT64(IMFTopologyNode* This,REFGUID guidKey,UINT64 unValue) {
    return This->lpVtbl->SetUINT64(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFTopologyNode_SetDouble(IMFTopologyNode* This,REFGUID guidKey,double fValue) {
    return This->lpVtbl->SetDouble(This,guidKey,fValue);
}
static FORCEINLINE HRESULT IMFTopologyNode_SetGUID(IMFTopologyNode* This,REFGUID guidKey,REFGUID guidValue) {
    return This->lpVtbl->SetGUID(This,guidKey,guidValue);
}
static FORCEINLINE HRESULT IMFTopologyNode_SetString(IMFTopologyNode* This,REFGUID guidKey,LPCWSTR wszValue) {
    return This->lpVtbl->SetString(This,guidKey,wszValue);
}
static FORCEINLINE HRESULT IMFTopologyNode_SetBlob(IMFTopologyNode* This,REFGUID guidKey,const UINT8 *pBuf,UINT32 cbBufSize) {
    return This->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize);
}
static FORCEINLINE HRESULT IMFTopologyNode_SetUnknown(IMFTopologyNode* This,REFGUID guidKey,IUnknown *pUnknown) {
    return This->lpVtbl->SetUnknown(This,guidKey,pUnknown);
}
static FORCEINLINE HRESULT IMFTopologyNode_LockStore(IMFTopologyNode* This) {
    return This->lpVtbl->LockStore(This);
}
static FORCEINLINE HRESULT IMFTopologyNode_UnlockStore(IMFTopologyNode* This) {
    return This->lpVtbl->UnlockStore(This);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetCount(IMFTopologyNode* This,UINT32 *pcItems) {
    return This->lpVtbl->GetCount(This,pcItems);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetItemByIndex(IMFTopologyNode* This,UINT32 unIndex,GUID *pguidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue);
}
static FORCEINLINE HRESULT IMFTopologyNode_CopyAllItems(IMFTopologyNode* This,IMFAttributes *pDest) {
    return This->lpVtbl->CopyAllItems(This,pDest);
}
/*** IMFTopologyNode methods ***/
static FORCEINLINE HRESULT IMFTopologyNode_SetObject(IMFTopologyNode* This,IUnknown *pObject) {
    return This->lpVtbl->SetObject(This,pObject);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetObject(IMFTopologyNode* This,IUnknown **ppObject) {
    return This->lpVtbl->GetObject(This,ppObject);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetNodeType(IMFTopologyNode* This,MF_TOPOLOGY_TYPE *pType) {
    return This->lpVtbl->GetNodeType(This,pType);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetTopoNodeID(IMFTopologyNode* This,TOPOID *pID) {
    return This->lpVtbl->GetTopoNodeID(This,pID);
}
static FORCEINLINE HRESULT IMFTopologyNode_SetTopoNodeID(IMFTopologyNode* This,TOPOID ullTopoID) {
    return This->lpVtbl->SetTopoNodeID(This,ullTopoID);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetInputCount(IMFTopologyNode* This,DWORD *pcInputs) {
    return This->lpVtbl->GetInputCount(This,pcInputs);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetOutputCount(IMFTopologyNode* This,DWORD *pcOutputs) {
    return This->lpVtbl->GetOutputCount(This,pcOutputs);
}
static FORCEINLINE HRESULT IMFTopologyNode_ConnectOutput(IMFTopologyNode* This,DWORD dwOutputIndex,IMFTopologyNode *pDownstreamNode,DWORD dwInputIndexOnDownstreamNode) {
    return This->lpVtbl->ConnectOutput(This,dwOutputIndex,pDownstreamNode,dwInputIndexOnDownstreamNode);
}
static FORCEINLINE HRESULT IMFTopologyNode_DisconnectOutput(IMFTopologyNode* This,DWORD dwOutputIndex) {
    return This->lpVtbl->DisconnectOutput(This,dwOutputIndex);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetInput(IMFTopologyNode* This,DWORD dwInputIndex,IMFTopologyNode **ppUpstreamNode,DWORD *pdwOutputIndexOnUpstreamNode) {
    return This->lpVtbl->GetInput(This,dwInputIndex,ppUpstreamNode,pdwOutputIndexOnUpstreamNode);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetOutput(IMFTopologyNode* This,DWORD dwOutputIndex,IMFTopologyNode **ppDownstreamNode,DWORD *pdwInputIndexOnDownstreamNode) {
    return This->lpVtbl->GetOutput(This,dwOutputIndex,ppDownstreamNode,pdwInputIndexOnDownstreamNode);
}
static FORCEINLINE HRESULT IMFTopologyNode_SetOutputPrefType(IMFTopologyNode* This,DWORD dwOutputIndex,IMFMediaType *pType) {
    return This->lpVtbl->SetOutputPrefType(This,dwOutputIndex,pType);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetOutputPrefType(IMFTopologyNode* This,DWORD dwOutputIndex,IMFMediaType **ppType) {
    return This->lpVtbl->GetOutputPrefType(This,dwOutputIndex,ppType);
}
static FORCEINLINE HRESULT IMFTopologyNode_SetInputPrefType(IMFTopologyNode* This,DWORD dwInputIndex,IMFMediaType *pType) {
    return This->lpVtbl->SetInputPrefType(This,dwInputIndex,pType);
}
static FORCEINLINE HRESULT IMFTopologyNode_GetInputPrefType(IMFTopologyNode* This,DWORD dwInputIndex,IMFMediaType **ppType) {
    return This->lpVtbl->GetInputPrefType(This,dwInputIndex,ppType);
}
static FORCEINLINE HRESULT IMFTopologyNode_CloneFrom(IMFTopologyNode* This,IMFTopologyNode *pNode) {
    return This->lpVtbl->CloneFrom(This,pNode);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFTopologyNode_SetObject_Proxy(
    IMFTopologyNode* This,
    IUnknown *pObject);
void __RPC_STUB IMFTopologyNode_SetObject_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFTopologyNode_GetObject_Proxy(
    IMFTopologyNode* This,
    IUnknown **ppObject);
void __RPC_STUB IMFTopologyNode_GetObject_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFTopologyNode_GetNodeType_Proxy(
    IMFTopologyNode* This,
    MF_TOPOLOGY_TYPE *pType);
void __RPC_STUB IMFTopologyNode_GetNodeType_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFTopologyNode_GetTopoNodeID_Proxy(
    IMFTopologyNode* This,
    TOPOID *pID);
void __RPC_STUB IMFTopologyNode_GetTopoNodeID_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFTopologyNode_SetTopoNodeID_Proxy(
    IMFTopologyNode* This,
    TOPOID ullTopoID);
void __RPC_STUB IMFTopologyNode_SetTopoNodeID_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFTopologyNode_GetInputCount_Proxy(
    IMFTopologyNode* This,
    DWORD *pcInputs);
void __RPC_STUB IMFTopologyNode_GetInputCount_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFTopologyNode_GetOutputCount_Proxy(
    IMFTopologyNode* This,
    DWORD *pcOutputs);
void __RPC_STUB IMFTopologyNode_GetOutputCount_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFTopologyNode_GetInput_Proxy(
    IMFTopologyNode* This,
    DWORD dwInputIndex,
    IMFTopologyNode **ppUpstreamNode,
    DWORD *pdwOutputIndexOnUpstreamNode);
void __RPC_STUB IMFTopologyNode_GetInput_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFTopologyNode_GetOutput_Proxy(
    IMFTopologyNode* This,
    DWORD dwOutputIndex,
    IMFTopologyNode **ppDownstreamNode,
    DWORD *pdwInputIndexOnDownstreamNode);
void __RPC_STUB IMFTopologyNode_GetOutput_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFTopologyNode_RemoteGetOutputPrefType_Proxy(
    IMFTopologyNode* This,
    DWORD dwOutputIndex,
    DWORD *pcbData,
    BYTE **ppbData);
void __RPC_STUB IMFTopologyNode_RemoteGetOutputPrefType_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFTopologyNode_RemoteGetInputPrefType_Proxy(
    IMFTopologyNode* This,
    DWORD dwInputIndex,
    DWORD *pcbData,
    BYTE **ppbData);
void __RPC_STUB IMFTopologyNode_RemoteGetInputPrefType_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFTopologyNode_CloneFrom_Proxy(
    IMFTopologyNode* This,
    IMFTopologyNode *pNode);
void __RPC_STUB IMFTopologyNode_CloneFrom_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT CALLBACK IMFTopologyNode_GetOutputPrefType_Proxy(
    IMFTopologyNode* This,
    DWORD dwOutputIndex,
    IMFMediaType **ppType);
HRESULT __RPC_STUB IMFTopologyNode_GetOutputPrefType_Stub(
    IMFTopologyNode* This,
    DWORD dwOutputIndex,
    DWORD *pcbData,
    BYTE **ppbData);
HRESULT CALLBACK IMFTopologyNode_GetInputPrefType_Proxy(
    IMFTopologyNode* This,
    DWORD dwInputIndex,
    IMFMediaType **ppType);
HRESULT __RPC_STUB IMFTopologyNode_GetInputPrefType_Stub(
    IMFTopologyNode* This,
    DWORD dwInputIndex,
    DWORD *pcbData,
    BYTE **ppbData);

#endif  /* __IMFTopologyNode_INTERFACE_DEFINED__ */

/*****************************************************************************
 * IMFTopology interface
 */
#ifndef __IMFTopology_INTERFACE_DEFINED__
#define __IMFTopology_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFTopology, 0x83cf873a, 0xf6da, 0x4bc8, 0x82,0x3f, 0xba,0xcf,0xd5,0x5d,0xc4,0x33);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("83cf873a-f6da-4bc8-823f-bacfd55dc433")
IMFTopology : public IMFAttributes
{
    virtual HRESULT STDMETHODCALLTYPE GetTopologyID(
        TOPOID *pID) = 0;

    virtual HRESULT STDMETHODCALLTYPE AddNode(
        IMFTopologyNode *pNode) = 0;

    virtual HRESULT STDMETHODCALLTYPE RemoveNode(
        IMFTopologyNode *pNode) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetNodeCount(
        WORD *pwNodes) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetNode(
        WORD wIndex,
        IMFTopologyNode **ppNode) = 0;

    virtual HRESULT STDMETHODCALLTYPE Clear(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE CloneFrom(
        IMFTopology *pTopology) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetNodeByID(
        TOPOID qwTopoNodeID,
        IMFTopologyNode **ppNode) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetSourceNodeCollection(
        IMFCollection **ppCollection) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetOutputNodeCollection(
        IMFCollection **ppCollection) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFTopology, 0x83cf873a, 0xf6da, 0x4bc8, 0x82,0x3f, 0xba,0xcf,0xd5,0x5d,0xc4,0x33)
#endif
#else
typedef struct IMFTopologyVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFTopology* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFTopology* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFTopology* This);

    /*** IMFAttributes methods ***/
    HRESULT (STDMETHODCALLTYPE *GetItem)(
        IMFTopology* This,
        REFGUID guidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *GetItemType)(
        IMFTopology* This,
        REFGUID guidKey,
        MF_ATTRIBUTE_TYPE *pType);

    HRESULT (STDMETHODCALLTYPE *CompareItem)(
        IMFTopology* This,
        REFGUID guidKey,
        REFPROPVARIANT Value,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *Compare)(
        IMFTopology* This,
        IMFAttributes *pTheirs,
        MF_ATTRIBUTES_MATCH_TYPE MatchType,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *GetUINT32)(
        IMFTopology* This,
        REFGUID guidKey,
        UINT32 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetUINT64)(
        IMFTopology* This,
        REFGUID guidKey,
        UINT64 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetDouble)(
        IMFTopology* This,
        REFGUID guidKey,
        double *pfValue);

    HRESULT (STDMETHODCALLTYPE *GetGUID)(
        IMFTopology* This,
        REFGUID guidKey,
        GUID *pguidValue);

    HRESULT (STDMETHODCALLTYPE *GetStringLength)(
        IMFTopology* This,
        REFGUID guidKey,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetString)(
        IMFTopology* This,
        REFGUID guidKey,
        LPWSTR pwszValue,
        UINT32 cchBufSize,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedString)(
        IMFTopology* This,
        REFGUID guidKey,
        LPWSTR *ppwszValue,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetBlobSize)(
        IMFTopology* This,
        REFGUID guidKey,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetBlob)(
        IMFTopology* This,
        REFGUID guidKey,
        UINT8 *pBuf,
        UINT32 cbBufSize,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedBlob)(
        IMFTopology* This,
        REFGUID guidKey,
        UINT8 **ppBuf,
        UINT32 *pcbSize);

    HRESULT (STDMETHODCALLTYPE *GetUnknown)(
        IMFTopology* This,
        REFGUID guidKey,
        REFIID riid,
        LPVOID *ppv);

    HRESULT (STDMETHODCALLTYPE *SetItem)(
        IMFTopology* This,
        REFGUID guidKey,
        REFPROPVARIANT Value);

    HRESULT (STDMETHODCALLTYPE *DeleteItem)(
        IMFTopology* This,
        REFGUID guidKey);

    HRESULT (STDMETHODCALLTYPE *DeleteAllItems)(
        IMFTopology* This);

    HRESULT (STDMETHODCALLTYPE *SetUINT32)(
        IMFTopology* This,
        REFGUID guidKey,
        UINT32 unValue);

    HRESULT (STDMETHODCALLTYPE *SetUINT64)(
        IMFTopology* This,
        REFGUID guidKey,
        UINT64 unValue);

    HRESULT (STDMETHODCALLTYPE *SetDouble)(
        IMFTopology* This,
        REFGUID guidKey,
        double fValue);

    HRESULT (STDMETHODCALLTYPE *SetGUID)(
        IMFTopology* This,
        REFGUID guidKey,
        REFGUID guidValue);

    HRESULT (STDMETHODCALLTYPE *SetString)(
        IMFTopology* This,
        REFGUID guidKey,
        LPCWSTR wszValue);

    HRESULT (STDMETHODCALLTYPE *SetBlob)(
        IMFTopology* This,
        REFGUID guidKey,
        const UINT8 *pBuf,
        UINT32 cbBufSize);

    HRESULT (STDMETHODCALLTYPE *SetUnknown)(
        IMFTopology* This,
        REFGUID guidKey,
        IUnknown *pUnknown);

    HRESULT (STDMETHODCALLTYPE *LockStore)(
        IMFTopology* This);

    HRESULT (STDMETHODCALLTYPE *UnlockStore)(
        IMFTopology* This);

    HRESULT (STDMETHODCALLTYPE *GetCount)(
        IMFTopology* This,
        UINT32 *pcItems);

    HRESULT (STDMETHODCALLTYPE *GetItemByIndex)(
        IMFTopology* This,
        UINT32 unIndex,
        GUID *pguidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *CopyAllItems)(
        IMFTopology* This,
        IMFAttributes *pDest);

    /*** IMFTopology methods ***/
    HRESULT (STDMETHODCALLTYPE *GetTopologyID)(
        IMFTopology* This,
        TOPOID *pID);

    HRESULT (STDMETHODCALLTYPE *AddNode)(
        IMFTopology* This,
        IMFTopologyNode *pNode);

    HRESULT (STDMETHODCALLTYPE *RemoveNode)(
        IMFTopology* This,
        IMFTopologyNode *pNode);

    HRESULT (STDMETHODCALLTYPE *GetNodeCount)(
        IMFTopology* This,
        WORD *pwNodes);

    HRESULT (STDMETHODCALLTYPE *GetNode)(
        IMFTopology* This,
        WORD wIndex,
        IMFTopologyNode **ppNode);

    HRESULT (STDMETHODCALLTYPE *Clear)(
        IMFTopology* This);

    HRESULT (STDMETHODCALLTYPE *CloneFrom)(
        IMFTopology* This,
        IMFTopology *pTopology);

    HRESULT (STDMETHODCALLTYPE *GetNodeByID)(
        IMFTopology* This,
        TOPOID qwTopoNodeID,
        IMFTopologyNode **ppNode);

    HRESULT (STDMETHODCALLTYPE *GetSourceNodeCollection)(
        IMFTopology* This,
        IMFCollection **ppCollection);

    HRESULT (STDMETHODCALLTYPE *GetOutputNodeCollection)(
        IMFTopology* This,
        IMFCollection **ppCollection);

    END_INTERFACE
} IMFTopologyVtbl;
interface IMFTopology {
    CONST_VTBL IMFTopologyVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFTopology_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFTopology_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFTopology_Release(This) (This)->lpVtbl->Release(This)
/*** IMFAttributes methods ***/
#define IMFTopology_GetItem(This,guidKey,pValue) (This)->lpVtbl->GetItem(This,guidKey,pValue)
#define IMFTopology_GetItemType(This,guidKey,pType) (This)->lpVtbl->GetItemType(This,guidKey,pType)
#define IMFTopology_CompareItem(This,guidKey,Value,pbResult) (This)->lpVtbl->CompareItem(This,guidKey,Value,pbResult)
#define IMFTopology_Compare(This,pTheirs,MatchType,pbResult) (This)->lpVtbl->Compare(This,pTheirs,MatchType,pbResult)
#define IMFTopology_GetUINT32(This,guidKey,punValue) (This)->lpVtbl->GetUINT32(This,guidKey,punValue)
#define IMFTopology_GetUINT64(This,guidKey,punValue) (This)->lpVtbl->GetUINT64(This,guidKey,punValue)
#define IMFTopology_GetDouble(This,guidKey,pfValue) (This)->lpVtbl->GetDouble(This,guidKey,pfValue)
#define IMFTopology_GetGUID(This,guidKey,pguidValue) (This)->lpVtbl->GetGUID(This,guidKey,pguidValue)
#define IMFTopology_GetStringLength(This,guidKey,pcchLength) (This)->lpVtbl->GetStringLength(This,guidKey,pcchLength)
#define IMFTopology_GetString(This,guidKey,pwszValue,cchBufSize,pcchLength) (This)->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength)
#define IMFTopology_GetAllocatedString(This,guidKey,ppwszValue,pcchLength) (This)->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength)
#define IMFTopology_GetBlobSize(This,guidKey,pcbBlobSize) (This)->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize)
#define IMFTopology_GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize) (This)->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize)
#define IMFTopology_GetAllocatedBlob(This,guidKey,ppBuf,pcbSize) (This)->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize)
#define IMFTopology_GetUnknown(This,guidKey,riid,ppv) (This)->lpVtbl->GetUnknown(This,guidKey,riid,ppv)
#define IMFTopology_SetItem(This,guidKey,Value) (This)->lpVtbl->SetItem(This,guidKey,Value)
#define IMFTopology_DeleteItem(This,guidKey) (This)->lpVtbl->DeleteItem(This,guidKey)
#define IMFTopology_DeleteAllItems(This) (This)->lpVtbl->DeleteAllItems(This)
#define IMFTopology_SetUINT32(This,guidKey,unValue) (This)->lpVtbl->SetUINT32(This,guidKey,unValue)
#define IMFTopology_SetUINT64(This,guidKey,unValue) (This)->lpVtbl->SetUINT64(This,guidKey,unValue)
#define IMFTopology_SetDouble(This,guidKey,fValue) (This)->lpVtbl->SetDouble(This,guidKey,fValue)
#define IMFTopology_SetGUID(This,guidKey,guidValue) (This)->lpVtbl->SetGUID(This,guidKey,guidValue)
#define IMFTopology_SetString(This,guidKey,wszValue) (This)->lpVtbl->SetString(This,guidKey,wszValue)
#define IMFTopology_SetBlob(This,guidKey,pBuf,cbBufSize) (This)->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize)
#define IMFTopology_SetUnknown(This,guidKey,pUnknown) (This)->lpVtbl->SetUnknown(This,guidKey,pUnknown)
#define IMFTopology_LockStore(This) (This)->lpVtbl->LockStore(This)
#define IMFTopology_UnlockStore(This) (This)->lpVtbl->UnlockStore(This)
#define IMFTopology_GetCount(This,pcItems) (This)->lpVtbl->GetCount(This,pcItems)
#define IMFTopology_GetItemByIndex(This,unIndex,pguidKey,pValue) (This)->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue)
#define IMFTopology_CopyAllItems(This,pDest) (This)->lpVtbl->CopyAllItems(This,pDest)
/*** IMFTopology methods ***/
#define IMFTopology_GetTopologyID(This,pID) (This)->lpVtbl->GetTopologyID(This,pID)
#define IMFTopology_AddNode(This,pNode) (This)->lpVtbl->AddNode(This,pNode)
#define IMFTopology_RemoveNode(This,pNode) (This)->lpVtbl->RemoveNode(This,pNode)
#define IMFTopology_GetNodeCount(This,pwNodes) (This)->lpVtbl->GetNodeCount(This,pwNodes)
#define IMFTopology_GetNode(This,wIndex,ppNode) (This)->lpVtbl->GetNode(This,wIndex,ppNode)
#define IMFTopology_Clear(This) (This)->lpVtbl->Clear(This)
#define IMFTopology_CloneFrom(This,pTopology) (This)->lpVtbl->CloneFrom(This,pTopology)
#define IMFTopology_GetNodeByID(This,qwTopoNodeID,ppNode) (This)->lpVtbl->GetNodeByID(This,qwTopoNodeID,ppNode)
#define IMFTopology_GetSourceNodeCollection(This,ppCollection) (This)->lpVtbl->GetSourceNodeCollection(This,ppCollection)
#define IMFTopology_GetOutputNodeCollection(This,ppCollection) (This)->lpVtbl->GetOutputNodeCollection(This,ppCollection)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFTopology_QueryInterface(IMFTopology* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFTopology_AddRef(IMFTopology* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFTopology_Release(IMFTopology* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFAttributes methods ***/
static FORCEINLINE HRESULT IMFTopology_GetItem(IMFTopology* This,REFGUID guidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItem(This,guidKey,pValue);
}
static FORCEINLINE HRESULT IMFTopology_GetItemType(IMFTopology* This,REFGUID guidKey,MF_ATTRIBUTE_TYPE *pType) {
    return This->lpVtbl->GetItemType(This,guidKey,pType);
}
static FORCEINLINE HRESULT IMFTopology_CompareItem(IMFTopology* This,REFGUID guidKey,REFPROPVARIANT Value,WINBOOL *pbResult) {
    return This->lpVtbl->CompareItem(This,guidKey,Value,pbResult);
}
static FORCEINLINE HRESULT IMFTopology_Compare(IMFTopology* This,IMFAttributes *pTheirs,MF_ATTRIBUTES_MATCH_TYPE MatchType,WINBOOL *pbResult) {
    return This->lpVtbl->Compare(This,pTheirs,MatchType,pbResult);
}
static FORCEINLINE HRESULT IMFTopology_GetUINT32(IMFTopology* This,REFGUID guidKey,UINT32 *punValue) {
    return This->lpVtbl->GetUINT32(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFTopology_GetUINT64(IMFTopology* This,REFGUID guidKey,UINT64 *punValue) {
    return This->lpVtbl->GetUINT64(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFTopology_GetDouble(IMFTopology* This,REFGUID guidKey,double *pfValue) {
    return This->lpVtbl->GetDouble(This,guidKey,pfValue);
}
static FORCEINLINE HRESULT IMFTopology_GetGUID(IMFTopology* This,REFGUID guidKey,GUID *pguidValue) {
    return This->lpVtbl->GetGUID(This,guidKey,pguidValue);
}
static FORCEINLINE HRESULT IMFTopology_GetStringLength(IMFTopology* This,REFGUID guidKey,UINT32 *pcchLength) {
    return This->lpVtbl->GetStringLength(This,guidKey,pcchLength);
}
static FORCEINLINE HRESULT IMFTopology_GetString(IMFTopology* This,REFGUID guidKey,LPWSTR pwszValue,UINT32 cchBufSize,UINT32 *pcchLength) {
    return This->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength);
}
static FORCEINLINE HRESULT IMFTopology_GetAllocatedString(IMFTopology* This,REFGUID guidKey,LPWSTR *ppwszValue,UINT32 *pcchLength) {
    return This->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength);
}
static FORCEINLINE HRESULT IMFTopology_GetBlobSize(IMFTopology* This,REFGUID guidKey,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFTopology_GetBlob(IMFTopology* This,REFGUID guidKey,UINT8 *pBuf,UINT32 cbBufSize,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFTopology_GetAllocatedBlob(IMFTopology* This,REFGUID guidKey,UINT8 **ppBuf,UINT32 *pcbSize) {
    return This->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize);
}
static FORCEINLINE HRESULT IMFTopology_GetUnknown(IMFTopology* This,REFGUID guidKey,REFIID riid,LPVOID *ppv) {
    return This->lpVtbl->GetUnknown(This,guidKey,riid,ppv);
}
static FORCEINLINE HRESULT IMFTopology_SetItem(IMFTopology* This,REFGUID guidKey,REFPROPVARIANT Value) {
    return This->lpVtbl->SetItem(This,guidKey,Value);
}
static FORCEINLINE HRESULT IMFTopology_DeleteItem(IMFTopology* This,REFGUID guidKey) {
    return This->lpVtbl->DeleteItem(This,guidKey);
}
static FORCEINLINE HRESULT IMFTopology_DeleteAllItems(IMFTopology* This) {
    return This->lpVtbl->DeleteAllItems(This);
}
static FORCEINLINE HRESULT IMFTopology_SetUINT32(IMFTopology* This,REFGUID guidKey,UINT32 unValue) {
    return This->lpVtbl->SetUINT32(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFTopology_SetUINT64(IMFTopology* This,REFGUID guidKey,UINT64 unValue) {
    return This->lpVtbl->SetUINT64(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFTopology_SetDouble(IMFTopology* This,REFGUID guidKey,double fValue) {
    return This->lpVtbl->SetDouble(This,guidKey,fValue);
}
static FORCEINLINE HRESULT IMFTopology_SetGUID(IMFTopology* This,REFGUID guidKey,REFGUID guidValue) {
    return This->lpVtbl->SetGUID(This,guidKey,guidValue);
}
static FORCEINLINE HRESULT IMFTopology_SetString(IMFTopology* This,REFGUID guidKey,LPCWSTR wszValue) {
    return This->lpVtbl->SetString(This,guidKey,wszValue);
}
static FORCEINLINE HRESULT IMFTopology_SetBlob(IMFTopology* This,REFGUID guidKey,const UINT8 *pBuf,UINT32 cbBufSize) {
    return This->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize);
}
static FORCEINLINE HRESULT IMFTopology_SetUnknown(IMFTopology* This,REFGUID guidKey,IUnknown *pUnknown) {
    return This->lpVtbl->SetUnknown(This,guidKey,pUnknown);
}
static FORCEINLINE HRESULT IMFTopology_LockStore(IMFTopology* This) {
    return This->lpVtbl->LockStore(This);
}
static FORCEINLINE HRESULT IMFTopology_UnlockStore(IMFTopology* This) {
    return This->lpVtbl->UnlockStore(This);
}
static FORCEINLINE HRESULT IMFTopology_GetCount(IMFTopology* This,UINT32 *pcItems) {
    return This->lpVtbl->GetCount(This,pcItems);
}
static FORCEINLINE HRESULT IMFTopology_GetItemByIndex(IMFTopology* This,UINT32 unIndex,GUID *pguidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue);
}
static FORCEINLINE HRESULT IMFTopology_CopyAllItems(IMFTopology* This,IMFAttributes *pDest) {
    return This->lpVtbl->CopyAllItems(This,pDest);
}
/*** IMFTopology methods ***/
static FORCEINLINE HRESULT IMFTopology_GetTopologyID(IMFTopology* This,TOPOID *pID) {
    return This->lpVtbl->GetTopologyID(This,pID);
}
static FORCEINLINE HRESULT IMFTopology_AddNode(IMFTopology* This,IMFTopologyNode *pNode) {
    return This->lpVtbl->AddNode(This,pNode);
}
static FORCEINLINE HRESULT IMFTopology_RemoveNode(IMFTopology* This,IMFTopologyNode *pNode) {
    return This->lpVtbl->RemoveNode(This,pNode);
}
static FORCEINLINE HRESULT IMFTopology_GetNodeCount(IMFTopology* This,WORD *pwNodes) {
    return This->lpVtbl->GetNodeCount(This,pwNodes);
}
static FORCEINLINE HRESULT IMFTopology_GetNode(IMFTopology* This,WORD wIndex,IMFTopologyNode **ppNode) {
    return This->lpVtbl->GetNode(This,wIndex,ppNode);
}
static FORCEINLINE HRESULT IMFTopology_Clear(IMFTopology* This) {
    return This->lpVtbl->Clear(This);
}
static FORCEINLINE HRESULT IMFTopology_CloneFrom(IMFTopology* This,IMFTopology *pTopology) {
    return This->lpVtbl->CloneFrom(This,pTopology);
}
static FORCEINLINE HRESULT IMFTopology_GetNodeByID(IMFTopology* This,TOPOID qwTopoNodeID,IMFTopologyNode **ppNode) {
    return This->lpVtbl->GetNodeByID(This,qwTopoNodeID,ppNode);
}
static FORCEINLINE HRESULT IMFTopology_GetSourceNodeCollection(IMFTopology* This,IMFCollection **ppCollection) {
    return This->lpVtbl->GetSourceNodeCollection(This,ppCollection);
}
static FORCEINLINE HRESULT IMFTopology_GetOutputNodeCollection(IMFTopology* This,IMFCollection **ppCollection) {
    return This->lpVtbl->GetOutputNodeCollection(This,ppCollection);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFTopology_GetTopologyID_Proxy(
    IMFTopology* This,
    TOPOID *pID);
void __RPC_STUB IMFTopology_GetTopologyID_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFTopology_GetNodeCount_Proxy(
    IMFTopology* This,
    WORD *pwNodes);
void __RPC_STUB IMFTopology_GetNodeCount_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFTopology_GetNode_Proxy(
    IMFTopology* This,
    WORD wIndex,
    IMFTopologyNode **ppNode);
void __RPC_STUB IMFTopology_GetNode_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFTopology_CloneFrom_Proxy(
    IMFTopology* This,
    IMFTopology *pTopology);
void __RPC_STUB IMFTopology_CloneFrom_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFTopology_GetNodeByID_Proxy(
    IMFTopology* This,
    TOPOID qwTopoNodeID,
    IMFTopologyNode **ppNode);
void __RPC_STUB IMFTopology_GetNodeByID_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFTopology_GetSourceNodeCollection_Proxy(
    IMFTopology* This,
    IMFCollection **ppCollection);
void __RPC_STUB IMFTopology_GetSourceNodeCollection_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFTopology_GetOutputNodeCollection_Proxy(
    IMFTopology* This,
    IMFCollection **ppCollection);
void __RPC_STUB IMFTopology_GetOutputNodeCollection_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFTopology_INTERFACE_DEFINED__ */

typedef LONGLONG MFTIME;
typedef enum _MF_CLOCK_STATE {
    MFCLOCK_STATE_INVALID = 0,
    MFCLOCK_STATE_RUNNING = 1,
    MFCLOCK_STATE_STOPPED = 2,
    MFCLOCK_STATE_PAUSED = 3
} MF_CLOCK_STATE;
typedef enum _MF_CLOCK_STATE MFCLOCK_STATE;
typedef struct _MFCLOCK_PROPERTIES {
    UINT64 qwCorrelationRate;
    GUID guidClockId;
    DWORD dwClockFlags;
    UINT64 qwClockFrequency;
    DWORD dwClockTolerance;
    DWORD dwClockJitter;
} MFCLOCK_PROPERTIES;
/*****************************************************************************
 * IMFClock interface
 */
#ifndef __IMFClock_INTERFACE_DEFINED__
#define __IMFClock_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFClock, 0x2eb1e945, 0x18b8, 0x4139, 0x9b,0x1a, 0xd5,0xd5,0x84,0x81,0x85,0x30);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("2eb1e945-18b8-4139-9b1a-d5d584818530")
IMFClock : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE GetClockCharacteristics(
        DWORD *pdwCharacteristics) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetCorrelatedTime(
        DWORD dwReserved,
        LONGLONG *pllClockTime,
        MFTIME *phnsSystemTime) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetContinuityKey(
        DWORD *pdwContinuityKey) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetState(
        DWORD dwReserved,
        MFCLOCK_STATE *peClockState) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetProperties(
        MFCLOCK_PROPERTIES *pClockProperties) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFClock, 0x2eb1e945, 0x18b8, 0x4139, 0x9b,0x1a, 0xd5,0xd5,0x84,0x81,0x85,0x30)
#endif
#else
typedef struct IMFClockVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFClock* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFClock* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFClock* This);

    /*** IMFClock methods ***/
    HRESULT (STDMETHODCALLTYPE *GetClockCharacteristics)(
        IMFClock* This,
        DWORD *pdwCharacteristics);

    HRESULT (STDMETHODCALLTYPE *GetCorrelatedTime)(
        IMFClock* This,
        DWORD dwReserved,
        LONGLONG *pllClockTime,
        MFTIME *phnsSystemTime);

    HRESULT (STDMETHODCALLTYPE *GetContinuityKey)(
        IMFClock* This,
        DWORD *pdwContinuityKey);

    HRESULT (STDMETHODCALLTYPE *GetState)(
        IMFClock* This,
        DWORD dwReserved,
        MFCLOCK_STATE *peClockState);

    HRESULT (STDMETHODCALLTYPE *GetProperties)(
        IMFClock* This,
        MFCLOCK_PROPERTIES *pClockProperties);

    END_INTERFACE
} IMFClockVtbl;
interface IMFClock {
    CONST_VTBL IMFClockVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFClock_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFClock_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFClock_Release(This) (This)->lpVtbl->Release(This)
/*** IMFClock methods ***/
#define IMFClock_GetClockCharacteristics(This,pdwCharacteristics) (This)->lpVtbl->GetClockCharacteristics(This,pdwCharacteristics)
#define IMFClock_GetCorrelatedTime(This,dwReserved,pllClockTime,phnsSystemTime) (This)->lpVtbl->GetCorrelatedTime(This,dwReserved,pllClockTime,phnsSystemTime)
#define IMFClock_GetContinuityKey(This,pdwContinuityKey) (This)->lpVtbl->GetContinuityKey(This,pdwContinuityKey)
#define IMFClock_GetState(This,dwReserved,peClockState) (This)->lpVtbl->GetState(This,dwReserved,peClockState)
#define IMFClock_GetProperties(This,pClockProperties) (This)->lpVtbl->GetProperties(This,pClockProperties)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFClock_QueryInterface(IMFClock* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFClock_AddRef(IMFClock* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFClock_Release(IMFClock* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFClock methods ***/
static FORCEINLINE HRESULT IMFClock_GetClockCharacteristics(IMFClock* This,DWORD *pdwCharacteristics) {
    return This->lpVtbl->GetClockCharacteristics(This,pdwCharacteristics);
}
static FORCEINLINE HRESULT IMFClock_GetCorrelatedTime(IMFClock* This,DWORD dwReserved,LONGLONG *pllClockTime,MFTIME *phnsSystemTime) {
    return This->lpVtbl->GetCorrelatedTime(This,dwReserved,pllClockTime,phnsSystemTime);
}
static FORCEINLINE HRESULT IMFClock_GetContinuityKey(IMFClock* This,DWORD *pdwContinuityKey) {
    return This->lpVtbl->GetContinuityKey(This,pdwContinuityKey);
}
static FORCEINLINE HRESULT IMFClock_GetState(IMFClock* This,DWORD dwReserved,MFCLOCK_STATE *peClockState) {
    return This->lpVtbl->GetState(This,dwReserved,peClockState);
}
static FORCEINLINE HRESULT IMFClock_GetProperties(IMFClock* This,MFCLOCK_PROPERTIES *pClockProperties) {
    return This->lpVtbl->GetProperties(This,pClockProperties);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFClock_GetClockCharacteristics_Proxy(
    IMFClock* This,
    DWORD *pdwCharacteristics);
void __RPC_STUB IMFClock_GetClockCharacteristics_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFClock_GetCorrelatedTime_Proxy(
    IMFClock* This,
    DWORD dwReserved,
    LONGLONG *pllClockTime,
    MFTIME *phnsSystemTime);
void __RPC_STUB IMFClock_GetCorrelatedTime_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFClock_GetContinuityKey_Proxy(
    IMFClock* This,
    DWORD *pdwContinuityKey);
void __RPC_STUB IMFClock_GetContinuityKey_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFClock_GetState_Proxy(
    IMFClock* This,
    DWORD dwReserved,
    MFCLOCK_STATE *peClockState);
void __RPC_STUB IMFClock_GetState_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFClock_GetProperties_Proxy(
    IMFClock* This,
    MFCLOCK_PROPERTIES *pClockProperties);
void __RPC_STUB IMFClock_GetProperties_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFClock_INTERFACE_DEFINED__ */

#define SHA_HASH_LEN 20
#define STR_HASH_LEN (SHA_HASH_LEN*2+3)
typedef struct _MFRR_COMPONENT_HASH_INFO {
  DWORD ulReason;
  WCHAR rgHeaderHash[STR_HASH_LEN];
  WCHAR rgPublicKeyHash[STR_HASH_LEN];
  WCHAR wszName[MAX_PATH];
} MFRR_COMPONENT_HASH_INFO, *PMFRR_COMPONENT_HASH_INFO;
EXTERN_GUID(MF_PD_DURATION, 0x6c990d33,0xbb8e,0x477a,0x85,0x98,0xd,0x5d,0x96,0xfc,0xd8,0x8a);
typedef enum _MF_CONNECT_METHOD {
    MF_CONNECT_DIRECT = 0x0,
    MF_CONNECT_ALLOW_CONVERTER = 0x1,
    MF_CONNECT_ALLOW_DECODER = 0x3,
    MF_CONNECT_RESOLVE_INDEPENDENT_OUTPUTTYPES = 0x4,
    MF_CONNECT_AS_OPTIONAL = 0x10000,
    MF_CONNECT_AS_OPTIONAL_BRANCH = 0x20000
} MF_CONNECT_METHOD;
/*****************************************************************************
 * IMFMediaSession interface
 */
#ifndef __IMFMediaSession_INTERFACE_DEFINED__
#define __IMFMediaSession_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFMediaSession, 0x90377834, 0x21d0, 0x4dee, 0x82,0x14, 0xba,0x2e,0x3e,0x6c,0x11,0x27);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("90377834-21d0-4dee-8214-ba2e3e6c1127")
IMFMediaSession : public IMFMediaEventGenerator
{
    virtual HRESULT STDMETHODCALLTYPE SetTopology(
        DWORD dwSetTopologyFlags,
        IMFTopology *pTopology) = 0;

    virtual HRESULT STDMETHODCALLTYPE ClearTopologies(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE Start(
        const GUID *pguidTimeFormat,
        const PROPVARIANT *pvarStartPosition) = 0;

    virtual HRESULT STDMETHODCALLTYPE Pause(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE Stop(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE Close(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE Shutdown(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetClock(
        IMFClock **ppClock) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetSessionCapabilities(
        DWORD *pdwCaps) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetFullTopology(
        DWORD dwGetFullTopologyFlags,
        TOPOID TopoId,
        IMFTopology **ppFullTopology) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFMediaSession, 0x90377834, 0x21d0, 0x4dee, 0x82,0x14, 0xba,0x2e,0x3e,0x6c,0x11,0x27)
#endif
#else
typedef struct IMFMediaSessionVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFMediaSession* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFMediaSession* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFMediaSession* This);

    /*** IMFMediaEventGenerator methods ***/
    HRESULT (STDMETHODCALLTYPE *GetEvent)(
        IMFMediaSession* This,
        DWORD dwFlags,
        IMFMediaEvent **ppEvent);

    HRESULT (STDMETHODCALLTYPE *BeginGetEvent)(
        IMFMediaSession* This,
        IMFAsyncCallback *pCallback,
        IUnknown *punkState);

    HRESULT (STDMETHODCALLTYPE *EndGetEvent)(
        IMFMediaSession* This,
        IMFAsyncResult *pResult,
        IMFMediaEvent **ppEvent);

    HRESULT (STDMETHODCALLTYPE *QueueEvent)(
        IMFMediaSession* This,
        MediaEventType met,
        REFGUID guidExtendedType,
        HRESULT hrStatus,
        const PROPVARIANT *pvValue);

    /*** IMFMediaSession methods ***/
    HRESULT (STDMETHODCALLTYPE *SetTopology)(
        IMFMediaSession* This,
        DWORD dwSetTopologyFlags,
        IMFTopology *pTopology);

    HRESULT (STDMETHODCALLTYPE *ClearTopologies)(
        IMFMediaSession* This);

    HRESULT (STDMETHODCALLTYPE *Start)(
        IMFMediaSession* This,
        const GUID *pguidTimeFormat,
        const PROPVARIANT *pvarStartPosition);

    HRESULT (STDMETHODCALLTYPE *Pause)(
        IMFMediaSession* This);

    HRESULT (STDMETHODCALLTYPE *Stop)(
        IMFMediaSession* This);

    HRESULT (STDMETHODCALLTYPE *Close)(
        IMFMediaSession* This);

    HRESULT (STDMETHODCALLTYPE *Shutdown)(
        IMFMediaSession* This);

    HRESULT (STDMETHODCALLTYPE *GetClock)(
        IMFMediaSession* This,
        IMFClock **ppClock);

    HRESULT (STDMETHODCALLTYPE *GetSessionCapabilities)(
        IMFMediaSession* This,
        DWORD *pdwCaps);

    HRESULT (STDMETHODCALLTYPE *GetFullTopology)(
        IMFMediaSession* This,
        DWORD dwGetFullTopologyFlags,
        TOPOID TopoId,
        IMFTopology **ppFullTopology);

    END_INTERFACE
} IMFMediaSessionVtbl;
interface IMFMediaSession {
    CONST_VTBL IMFMediaSessionVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFMediaSession_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFMediaSession_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFMediaSession_Release(This) (This)->lpVtbl->Release(This)
/*** IMFMediaEventGenerator methods ***/
#define IMFMediaSession_GetEvent(This,dwFlags,ppEvent) (This)->lpVtbl->GetEvent(This,dwFlags,ppEvent)
#define IMFMediaSession_BeginGetEvent(This,pCallback,punkState) (This)->lpVtbl->BeginGetEvent(This,pCallback,punkState)
#define IMFMediaSession_EndGetEvent(This,pResult,ppEvent) (This)->lpVtbl->EndGetEvent(This,pResult,ppEvent)
#define IMFMediaSession_QueueEvent(This,met,guidExtendedType,hrStatus,pvValue) (This)->lpVtbl->QueueEvent(This,met,guidExtendedType,hrStatus,pvValue)
/*** IMFMediaSession methods ***/
#define IMFMediaSession_SetTopology(This,dwSetTopologyFlags,pTopology) (This)->lpVtbl->SetTopology(This,dwSetTopologyFlags,pTopology)
#define IMFMediaSession_ClearTopologies(This) (This)->lpVtbl->ClearTopologies(This)
#define IMFMediaSession_Start(This,pguidTimeFormat,pvarStartPosition) (This)->lpVtbl->Start(This,pguidTimeFormat,pvarStartPosition)
#define IMFMediaSession_Pause(This) (This)->lpVtbl->Pause(This)
#define IMFMediaSession_Stop(This) (This)->lpVtbl->Stop(This)
#define IMFMediaSession_Close(This) (This)->lpVtbl->Close(This)
#define IMFMediaSession_Shutdown(This) (This)->lpVtbl->Shutdown(This)
#define IMFMediaSession_GetClock(This,ppClock) (This)->lpVtbl->GetClock(This,ppClock)
#define IMFMediaSession_GetSessionCapabilities(This,pdwCaps) (This)->lpVtbl->GetSessionCapabilities(This,pdwCaps)
#define IMFMediaSession_GetFullTopology(This,dwGetFullTopologyFlags,TopoId,ppFullTopology) (This)->lpVtbl->GetFullTopology(This,dwGetFullTopologyFlags,TopoId,ppFullTopology)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFMediaSession_QueryInterface(IMFMediaSession* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFMediaSession_AddRef(IMFMediaSession* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFMediaSession_Release(IMFMediaSession* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFMediaEventGenerator methods ***/
static FORCEINLINE HRESULT IMFMediaSession_GetEvent(IMFMediaSession* This,DWORD dwFlags,IMFMediaEvent **ppEvent) {
    return This->lpVtbl->GetEvent(This,dwFlags,ppEvent);
}
static FORCEINLINE HRESULT IMFMediaSession_BeginGetEvent(IMFMediaSession* This,IMFAsyncCallback *pCallback,IUnknown *punkState) {
    return This->lpVtbl->BeginGetEvent(This,pCallback,punkState);
}
static FORCEINLINE HRESULT IMFMediaSession_EndGetEvent(IMFMediaSession* This,IMFAsyncResult *pResult,IMFMediaEvent **ppEvent) {
    return This->lpVtbl->EndGetEvent(This,pResult,ppEvent);
}
static FORCEINLINE HRESULT IMFMediaSession_QueueEvent(IMFMediaSession* This,MediaEventType met,REFGUID guidExtendedType,HRESULT hrStatus,const PROPVARIANT *pvValue) {
    return This->lpVtbl->QueueEvent(This,met,guidExtendedType,hrStatus,pvValue);
}
/*** IMFMediaSession methods ***/
static FORCEINLINE HRESULT IMFMediaSession_SetTopology(IMFMediaSession* This,DWORD dwSetTopologyFlags,IMFTopology *pTopology) {
    return This->lpVtbl->SetTopology(This,dwSetTopologyFlags,pTopology);
}
static FORCEINLINE HRESULT IMFMediaSession_ClearTopologies(IMFMediaSession* This) {
    return This->lpVtbl->ClearTopologies(This);
}
static FORCEINLINE HRESULT IMFMediaSession_Start(IMFMediaSession* This,const GUID *pguidTimeFormat,const PROPVARIANT *pvarStartPosition) {
    return This->lpVtbl->Start(This,pguidTimeFormat,pvarStartPosition);
}
static FORCEINLINE HRESULT IMFMediaSession_Pause(IMFMediaSession* This) {
    return This->lpVtbl->Pause(This);
}
static FORCEINLINE HRESULT IMFMediaSession_Stop(IMFMediaSession* This) {
    return This->lpVtbl->Stop(This);
}
static FORCEINLINE HRESULT IMFMediaSession_Close(IMFMediaSession* This) {
    return This->lpVtbl->Close(This);
}
static FORCEINLINE HRESULT IMFMediaSession_Shutdown(IMFMediaSession* This) {
    return This->lpVtbl->Shutdown(This);
}
static FORCEINLINE HRESULT IMFMediaSession_GetClock(IMFMediaSession* This,IMFClock **ppClock) {
    return This->lpVtbl->GetClock(This,ppClock);
}
static FORCEINLINE HRESULT IMFMediaSession_GetSessionCapabilities(IMFMediaSession* This,DWORD *pdwCaps) {
    return This->lpVtbl->GetSessionCapabilities(This,pdwCaps);
}
static FORCEINLINE HRESULT IMFMediaSession_GetFullTopology(IMFMediaSession* This,DWORD dwGetFullTopologyFlags,TOPOID TopoId,IMFTopology **ppFullTopology) {
    return This->lpVtbl->GetFullTopology(This,dwGetFullTopologyFlags,TopoId,ppFullTopology);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFMediaSession_SetTopology_Proxy(
    IMFMediaSession* This,
    DWORD dwSetTopologyFlags,
    IMFTopology *pTopology);
void __RPC_STUB IMFMediaSession_SetTopology_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaSession_ClearTopologies_Proxy(
    IMFMediaSession* This);
void __RPC_STUB IMFMediaSession_ClearTopologies_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaSession_Start_Proxy(
    IMFMediaSession* This,
    const GUID *pguidTimeFormat,
    const PROPVARIANT *pvarStartPosition);
void __RPC_STUB IMFMediaSession_Start_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaSession_Pause_Proxy(
    IMFMediaSession* This);
void __RPC_STUB IMFMediaSession_Pause_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaSession_Stop_Proxy(
    IMFMediaSession* This);
void __RPC_STUB IMFMediaSession_Stop_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaSession_Close_Proxy(
    IMFMediaSession* This);
void __RPC_STUB IMFMediaSession_Close_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaSession_Shutdown_Proxy(
    IMFMediaSession* This);
void __RPC_STUB IMFMediaSession_Shutdown_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaSession_GetClock_Proxy(
    IMFMediaSession* This,
    IMFClock **ppClock);
void __RPC_STUB IMFMediaSession_GetClock_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaSession_GetSessionCapabilities_Proxy(
    IMFMediaSession* This,
    DWORD *pdwCaps);
void __RPC_STUB IMFMediaSession_GetSessionCapabilities_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaSession_GetFullTopology_Proxy(
    IMFMediaSession* This,
    DWORD dwGetFullTopologyFlags,
    TOPOID TopoId,
    IMFTopology **ppFullTopology);
void __RPC_STUB IMFMediaSession_GetFullTopology_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFMediaSession_INTERFACE_DEFINED__ */

/*****************************************************************************
 * IMFMediaTypeHandler interface
 */
#ifndef __IMFMediaTypeHandler_INTERFACE_DEFINED__
#define __IMFMediaTypeHandler_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFMediaTypeHandler, 0xe93dcf6c, 0x4b07, 0x4e1e, 0x81,0x23, 0xaa,0x16,0xed,0x6e,0xad,0xf5);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("e93dcf6c-4b07-4e1e-8123-aa16ed6eadf5")
IMFMediaTypeHandler : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE IsMediaTypeSupported(
        IMFMediaType *pMediaType,
        IMFMediaType **ppMediaType) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetMediaTypeCount(
        DWORD *pdwTypeCount) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetMediaTypeByIndex(
        DWORD dwIndex,
        IMFMediaType **ppType) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetCurrentMediaType(
        IMFMediaType *pMediaType) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetCurrentMediaType(
        IMFMediaType **ppMediaType) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetMajorType(
        GUID *pguidMajorType) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFMediaTypeHandler, 0xe93dcf6c, 0x4b07, 0x4e1e, 0x81,0x23, 0xaa,0x16,0xed,0x6e,0xad,0xf5)
#endif
#else
typedef struct IMFMediaTypeHandlerVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFMediaTypeHandler* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFMediaTypeHandler* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFMediaTypeHandler* This);

    /*** IMFMediaTypeHandler methods ***/
    HRESULT (STDMETHODCALLTYPE *IsMediaTypeSupported)(
        IMFMediaTypeHandler* This,
        IMFMediaType *pMediaType,
        IMFMediaType **ppMediaType);

    HRESULT (STDMETHODCALLTYPE *GetMediaTypeCount)(
        IMFMediaTypeHandler* This,
        DWORD *pdwTypeCount);

    HRESULT (STDMETHODCALLTYPE *GetMediaTypeByIndex)(
        IMFMediaTypeHandler* This,
        DWORD dwIndex,
        IMFMediaType **ppType);

    HRESULT (STDMETHODCALLTYPE *SetCurrentMediaType)(
        IMFMediaTypeHandler* This,
        IMFMediaType *pMediaType);

    HRESULT (STDMETHODCALLTYPE *GetCurrentMediaType)(
        IMFMediaTypeHandler* This,
        IMFMediaType **ppMediaType);

    HRESULT (STDMETHODCALLTYPE *GetMajorType)(
        IMFMediaTypeHandler* This,
        GUID *pguidMajorType);

    END_INTERFACE
} IMFMediaTypeHandlerVtbl;
interface IMFMediaTypeHandler {
    CONST_VTBL IMFMediaTypeHandlerVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFMediaTypeHandler_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFMediaTypeHandler_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFMediaTypeHandler_Release(This) (This)->lpVtbl->Release(This)
/*** IMFMediaTypeHandler methods ***/
#define IMFMediaTypeHandler_IsMediaTypeSupported(This,pMediaType,ppMediaType) (This)->lpVtbl->IsMediaTypeSupported(This,pMediaType,ppMediaType)
#define IMFMediaTypeHandler_GetMediaTypeCount(This,pdwTypeCount) (This)->lpVtbl->GetMediaTypeCount(This,pdwTypeCount)
#define IMFMediaTypeHandler_GetMediaTypeByIndex(This,dwIndex,ppType) (This)->lpVtbl->GetMediaTypeByIndex(This,dwIndex,ppType)
#define IMFMediaTypeHandler_SetCurrentMediaType(This,pMediaType) (This)->lpVtbl->SetCurrentMediaType(This,pMediaType)
#define IMFMediaTypeHandler_GetCurrentMediaType(This,ppMediaType) (This)->lpVtbl->GetCurrentMediaType(This,ppMediaType)
#define IMFMediaTypeHandler_GetMajorType(This,pguidMajorType) (This)->lpVtbl->GetMajorType(This,pguidMajorType)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFMediaTypeHandler_QueryInterface(IMFMediaTypeHandler* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFMediaTypeHandler_AddRef(IMFMediaTypeHandler* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFMediaTypeHandler_Release(IMFMediaTypeHandler* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFMediaTypeHandler methods ***/
static FORCEINLINE HRESULT IMFMediaTypeHandler_IsMediaTypeSupported(IMFMediaTypeHandler* This,IMFMediaType *pMediaType,IMFMediaType **ppMediaType) {
    return This->lpVtbl->IsMediaTypeSupported(This,pMediaType,ppMediaType);
}
static FORCEINLINE HRESULT IMFMediaTypeHandler_GetMediaTypeCount(IMFMediaTypeHandler* This,DWORD *pdwTypeCount) {
    return This->lpVtbl->GetMediaTypeCount(This,pdwTypeCount);
}
static FORCEINLINE HRESULT IMFMediaTypeHandler_GetMediaTypeByIndex(IMFMediaTypeHandler* This,DWORD dwIndex,IMFMediaType **ppType) {
    return This->lpVtbl->GetMediaTypeByIndex(This,dwIndex,ppType);
}
static FORCEINLINE HRESULT IMFMediaTypeHandler_SetCurrentMediaType(IMFMediaTypeHandler* This,IMFMediaType *pMediaType) {
    return This->lpVtbl->SetCurrentMediaType(This,pMediaType);
}
static FORCEINLINE HRESULT IMFMediaTypeHandler_GetCurrentMediaType(IMFMediaTypeHandler* This,IMFMediaType **ppMediaType) {
    return This->lpVtbl->GetCurrentMediaType(This,ppMediaType);
}
static FORCEINLINE HRESULT IMFMediaTypeHandler_GetMajorType(IMFMediaTypeHandler* This,GUID *pguidMajorType) {
    return This->lpVtbl->GetMajorType(This,pguidMajorType);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFMediaTypeHandler_RemoteGetCurrentMediaType_Proxy(
    IMFMediaTypeHandler* This,
    BYTE **ppbData,
    DWORD *pcbData);
void __RPC_STUB IMFMediaTypeHandler_RemoteGetCurrentMediaType_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaTypeHandler_GetMajorType_Proxy(
    IMFMediaTypeHandler* This,
    GUID *pguidMajorType);
void __RPC_STUB IMFMediaTypeHandler_GetMajorType_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT CALLBACK IMFMediaTypeHandler_GetCurrentMediaType_Proxy(
    IMFMediaTypeHandler* This,
    IMFMediaType **ppMediaType);
HRESULT __RPC_STUB IMFMediaTypeHandler_GetCurrentMediaType_Stub(
    IMFMediaTypeHandler* This,
    BYTE **ppbData,
    DWORD *pcbData);

#endif  /* __IMFMediaTypeHandler_INTERFACE_DEFINED__ */

/*****************************************************************************
 * IMFStreamDescriptor interface
 */
#ifndef __IMFStreamDescriptor_INTERFACE_DEFINED__
#define __IMFStreamDescriptor_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFStreamDescriptor, 0x56c03d9c, 0x9dbb, 0x45f5, 0xab,0x4b, 0xd8,0x0f,0x47,0xc0,0x59,0x38);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("56c03d9c-9dbb-45f5-ab4b-d80f47c05938")
IMFStreamDescriptor : public IMFAttributes
{
    virtual HRESULT STDMETHODCALLTYPE GetStreamIdentifier(
        DWORD *pdwStreamIdentifier) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetMediaTypeHandler(
        IMFMediaTypeHandler **ppMediaTypeHandler) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFStreamDescriptor, 0x56c03d9c, 0x9dbb, 0x45f5, 0xab,0x4b, 0xd8,0x0f,0x47,0xc0,0x59,0x38)
#endif
#else
typedef struct IMFStreamDescriptorVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFStreamDescriptor* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFStreamDescriptor* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFStreamDescriptor* This);

    /*** IMFAttributes methods ***/
    HRESULT (STDMETHODCALLTYPE *GetItem)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *GetItemType)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        MF_ATTRIBUTE_TYPE *pType);

    HRESULT (STDMETHODCALLTYPE *CompareItem)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        REFPROPVARIANT Value,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *Compare)(
        IMFStreamDescriptor* This,
        IMFAttributes *pTheirs,
        MF_ATTRIBUTES_MATCH_TYPE MatchType,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *GetUINT32)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        UINT32 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetUINT64)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        UINT64 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetDouble)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        double *pfValue);

    HRESULT (STDMETHODCALLTYPE *GetGUID)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        GUID *pguidValue);

    HRESULT (STDMETHODCALLTYPE *GetStringLength)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetString)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        LPWSTR pwszValue,
        UINT32 cchBufSize,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedString)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        LPWSTR *ppwszValue,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetBlobSize)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetBlob)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        UINT8 *pBuf,
        UINT32 cbBufSize,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedBlob)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        UINT8 **ppBuf,
        UINT32 *pcbSize);

    HRESULT (STDMETHODCALLTYPE *GetUnknown)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        REFIID riid,
        LPVOID *ppv);

    HRESULT (STDMETHODCALLTYPE *SetItem)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        REFPROPVARIANT Value);

    HRESULT (STDMETHODCALLTYPE *DeleteItem)(
        IMFStreamDescriptor* This,
        REFGUID guidKey);

    HRESULT (STDMETHODCALLTYPE *DeleteAllItems)(
        IMFStreamDescriptor* This);

    HRESULT (STDMETHODCALLTYPE *SetUINT32)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        UINT32 unValue);

    HRESULT (STDMETHODCALLTYPE *SetUINT64)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        UINT64 unValue);

    HRESULT (STDMETHODCALLTYPE *SetDouble)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        double fValue);

    HRESULT (STDMETHODCALLTYPE *SetGUID)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        REFGUID guidValue);

    HRESULT (STDMETHODCALLTYPE *SetString)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        LPCWSTR wszValue);

    HRESULT (STDMETHODCALLTYPE *SetBlob)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        const UINT8 *pBuf,
        UINT32 cbBufSize);

    HRESULT (STDMETHODCALLTYPE *SetUnknown)(
        IMFStreamDescriptor* This,
        REFGUID guidKey,
        IUnknown *pUnknown);

    HRESULT (STDMETHODCALLTYPE *LockStore)(
        IMFStreamDescriptor* This);

    HRESULT (STDMETHODCALLTYPE *UnlockStore)(
        IMFStreamDescriptor* This);

    HRESULT (STDMETHODCALLTYPE *GetCount)(
        IMFStreamDescriptor* This,
        UINT32 *pcItems);

    HRESULT (STDMETHODCALLTYPE *GetItemByIndex)(
        IMFStreamDescriptor* This,
        UINT32 unIndex,
        GUID *pguidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *CopyAllItems)(
        IMFStreamDescriptor* This,
        IMFAttributes *pDest);

    /*** IMFStreamDescriptor methods ***/
    HRESULT (STDMETHODCALLTYPE *GetStreamIdentifier)(
        IMFStreamDescriptor* This,
        DWORD *pdwStreamIdentifier);

    HRESULT (STDMETHODCALLTYPE *GetMediaTypeHandler)(
        IMFStreamDescriptor* This,
        IMFMediaTypeHandler **ppMediaTypeHandler);

    END_INTERFACE
} IMFStreamDescriptorVtbl;
interface IMFStreamDescriptor {
    CONST_VTBL IMFStreamDescriptorVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFStreamDescriptor_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFStreamDescriptor_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFStreamDescriptor_Release(This) (This)->lpVtbl->Release(This)
/*** IMFAttributes methods ***/
#define IMFStreamDescriptor_GetItem(This,guidKey,pValue) (This)->lpVtbl->GetItem(This,guidKey,pValue)
#define IMFStreamDescriptor_GetItemType(This,guidKey,pType) (This)->lpVtbl->GetItemType(This,guidKey,pType)
#define IMFStreamDescriptor_CompareItem(This,guidKey,Value,pbResult) (This)->lpVtbl->CompareItem(This,guidKey,Value,pbResult)
#define IMFStreamDescriptor_Compare(This,pTheirs,MatchType,pbResult) (This)->lpVtbl->Compare(This,pTheirs,MatchType,pbResult)
#define IMFStreamDescriptor_GetUINT32(This,guidKey,punValue) (This)->lpVtbl->GetUINT32(This,guidKey,punValue)
#define IMFStreamDescriptor_GetUINT64(This,guidKey,punValue) (This)->lpVtbl->GetUINT64(This,guidKey,punValue)
#define IMFStreamDescriptor_GetDouble(This,guidKey,pfValue) (This)->lpVtbl->GetDouble(This,guidKey,pfValue)
#define IMFStreamDescriptor_GetGUID(This,guidKey,pguidValue) (This)->lpVtbl->GetGUID(This,guidKey,pguidValue)
#define IMFStreamDescriptor_GetStringLength(This,guidKey,pcchLength) (This)->lpVtbl->GetStringLength(This,guidKey,pcchLength)
#define IMFStreamDescriptor_GetString(This,guidKey,pwszValue,cchBufSize,pcchLength) (This)->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength)
#define IMFStreamDescriptor_GetAllocatedString(This,guidKey,ppwszValue,pcchLength) (This)->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength)
#define IMFStreamDescriptor_GetBlobSize(This,guidKey,pcbBlobSize) (This)->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize)
#define IMFStreamDescriptor_GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize) (This)->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize)
#define IMFStreamDescriptor_GetAllocatedBlob(This,guidKey,ppBuf,pcbSize) (This)->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize)
#define IMFStreamDescriptor_GetUnknown(This,guidKey,riid,ppv) (This)->lpVtbl->GetUnknown(This,guidKey,riid,ppv)
#define IMFStreamDescriptor_SetItem(This,guidKey,Value) (This)->lpVtbl->SetItem(This,guidKey,Value)
#define IMFStreamDescriptor_DeleteItem(This,guidKey) (This)->lpVtbl->DeleteItem(This,guidKey)
#define IMFStreamDescriptor_DeleteAllItems(This) (This)->lpVtbl->DeleteAllItems(This)
#define IMFStreamDescriptor_SetUINT32(This,guidKey,unValue) (This)->lpVtbl->SetUINT32(This,guidKey,unValue)
#define IMFStreamDescriptor_SetUINT64(This,guidKey,unValue) (This)->lpVtbl->SetUINT64(This,guidKey,unValue)
#define IMFStreamDescriptor_SetDouble(This,guidKey,fValue) (This)->lpVtbl->SetDouble(This,guidKey,fValue)
#define IMFStreamDescriptor_SetGUID(This,guidKey,guidValue) (This)->lpVtbl->SetGUID(This,guidKey,guidValue)
#define IMFStreamDescriptor_SetString(This,guidKey,wszValue) (This)->lpVtbl->SetString(This,guidKey,wszValue)
#define IMFStreamDescriptor_SetBlob(This,guidKey,pBuf,cbBufSize) (This)->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize)
#define IMFStreamDescriptor_SetUnknown(This,guidKey,pUnknown) (This)->lpVtbl->SetUnknown(This,guidKey,pUnknown)
#define IMFStreamDescriptor_LockStore(This) (This)->lpVtbl->LockStore(This)
#define IMFStreamDescriptor_UnlockStore(This) (This)->lpVtbl->UnlockStore(This)
#define IMFStreamDescriptor_GetCount(This,pcItems) (This)->lpVtbl->GetCount(This,pcItems)
#define IMFStreamDescriptor_GetItemByIndex(This,unIndex,pguidKey,pValue) (This)->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue)
#define IMFStreamDescriptor_CopyAllItems(This,pDest) (This)->lpVtbl->CopyAllItems(This,pDest)
/*** IMFStreamDescriptor methods ***/
#define IMFStreamDescriptor_GetStreamIdentifier(This,pdwStreamIdentifier) (This)->lpVtbl->GetStreamIdentifier(This,pdwStreamIdentifier)
#define IMFStreamDescriptor_GetMediaTypeHandler(This,ppMediaTypeHandler) (This)->lpVtbl->GetMediaTypeHandler(This,ppMediaTypeHandler)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFStreamDescriptor_QueryInterface(IMFStreamDescriptor* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFStreamDescriptor_AddRef(IMFStreamDescriptor* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFStreamDescriptor_Release(IMFStreamDescriptor* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFAttributes methods ***/
static FORCEINLINE HRESULT IMFStreamDescriptor_GetItem(IMFStreamDescriptor* This,REFGUID guidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItem(This,guidKey,pValue);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_GetItemType(IMFStreamDescriptor* This,REFGUID guidKey,MF_ATTRIBUTE_TYPE *pType) {
    return This->lpVtbl->GetItemType(This,guidKey,pType);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_CompareItem(IMFStreamDescriptor* This,REFGUID guidKey,REFPROPVARIANT Value,WINBOOL *pbResult) {
    return This->lpVtbl->CompareItem(This,guidKey,Value,pbResult);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_Compare(IMFStreamDescriptor* This,IMFAttributes *pTheirs,MF_ATTRIBUTES_MATCH_TYPE MatchType,WINBOOL *pbResult) {
    return This->lpVtbl->Compare(This,pTheirs,MatchType,pbResult);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_GetUINT32(IMFStreamDescriptor* This,REFGUID guidKey,UINT32 *punValue) {
    return This->lpVtbl->GetUINT32(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_GetUINT64(IMFStreamDescriptor* This,REFGUID guidKey,UINT64 *punValue) {
    return This->lpVtbl->GetUINT64(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_GetDouble(IMFStreamDescriptor* This,REFGUID guidKey,double *pfValue) {
    return This->lpVtbl->GetDouble(This,guidKey,pfValue);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_GetGUID(IMFStreamDescriptor* This,REFGUID guidKey,GUID *pguidValue) {
    return This->lpVtbl->GetGUID(This,guidKey,pguidValue);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_GetStringLength(IMFStreamDescriptor* This,REFGUID guidKey,UINT32 *pcchLength) {
    return This->lpVtbl->GetStringLength(This,guidKey,pcchLength);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_GetString(IMFStreamDescriptor* This,REFGUID guidKey,LPWSTR pwszValue,UINT32 cchBufSize,UINT32 *pcchLength) {
    return This->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_GetAllocatedString(IMFStreamDescriptor* This,REFGUID guidKey,LPWSTR *ppwszValue,UINT32 *pcchLength) {
    return This->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_GetBlobSize(IMFStreamDescriptor* This,REFGUID guidKey,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_GetBlob(IMFStreamDescriptor* This,REFGUID guidKey,UINT8 *pBuf,UINT32 cbBufSize,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_GetAllocatedBlob(IMFStreamDescriptor* This,REFGUID guidKey,UINT8 **ppBuf,UINT32 *pcbSize) {
    return This->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_GetUnknown(IMFStreamDescriptor* This,REFGUID guidKey,REFIID riid,LPVOID *ppv) {
    return This->lpVtbl->GetUnknown(This,guidKey,riid,ppv);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_SetItem(IMFStreamDescriptor* This,REFGUID guidKey,REFPROPVARIANT Value) {
    return This->lpVtbl->SetItem(This,guidKey,Value);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_DeleteItem(IMFStreamDescriptor* This,REFGUID guidKey) {
    return This->lpVtbl->DeleteItem(This,guidKey);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_DeleteAllItems(IMFStreamDescriptor* This) {
    return This->lpVtbl->DeleteAllItems(This);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_SetUINT32(IMFStreamDescriptor* This,REFGUID guidKey,UINT32 unValue) {
    return This->lpVtbl->SetUINT32(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_SetUINT64(IMFStreamDescriptor* This,REFGUID guidKey,UINT64 unValue) {
    return This->lpVtbl->SetUINT64(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_SetDouble(IMFStreamDescriptor* This,REFGUID guidKey,double fValue) {
    return This->lpVtbl->SetDouble(This,guidKey,fValue);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_SetGUID(IMFStreamDescriptor* This,REFGUID guidKey,REFGUID guidValue) {
    return This->lpVtbl->SetGUID(This,guidKey,guidValue);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_SetString(IMFStreamDescriptor* This,REFGUID guidKey,LPCWSTR wszValue) {
    return This->lpVtbl->SetString(This,guidKey,wszValue);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_SetBlob(IMFStreamDescriptor* This,REFGUID guidKey,const UINT8 *pBuf,UINT32 cbBufSize) {
    return This->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_SetUnknown(IMFStreamDescriptor* This,REFGUID guidKey,IUnknown *pUnknown) {
    return This->lpVtbl->SetUnknown(This,guidKey,pUnknown);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_LockStore(IMFStreamDescriptor* This) {
    return This->lpVtbl->LockStore(This);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_UnlockStore(IMFStreamDescriptor* This) {
    return This->lpVtbl->UnlockStore(This);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_GetCount(IMFStreamDescriptor* This,UINT32 *pcItems) {
    return This->lpVtbl->GetCount(This,pcItems);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_GetItemByIndex(IMFStreamDescriptor* This,UINT32 unIndex,GUID *pguidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_CopyAllItems(IMFStreamDescriptor* This,IMFAttributes *pDest) {
    return This->lpVtbl->CopyAllItems(This,pDest);
}
/*** IMFStreamDescriptor methods ***/
static FORCEINLINE HRESULT IMFStreamDescriptor_GetStreamIdentifier(IMFStreamDescriptor* This,DWORD *pdwStreamIdentifier) {
    return This->lpVtbl->GetStreamIdentifier(This,pdwStreamIdentifier);
}
static FORCEINLINE HRESULT IMFStreamDescriptor_GetMediaTypeHandler(IMFStreamDescriptor* This,IMFMediaTypeHandler **ppMediaTypeHandler) {
    return This->lpVtbl->GetMediaTypeHandler(This,ppMediaTypeHandler);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFStreamDescriptor_GetStreamIdentifier_Proxy(
    IMFStreamDescriptor* This,
    DWORD *pdwStreamIdentifier);
void __RPC_STUB IMFStreamDescriptor_GetStreamIdentifier_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFStreamDescriptor_GetMediaTypeHandler_Proxy(
    IMFStreamDescriptor* This,
    IMFMediaTypeHandler **ppMediaTypeHandler);
void __RPC_STUB IMFStreamDescriptor_GetMediaTypeHandler_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFStreamDescriptor_INTERFACE_DEFINED__ */

/*****************************************************************************
 * IMFPresentationDescriptor interface
 */
#ifndef __IMFPresentationDescriptor_INTERFACE_DEFINED__
#define __IMFPresentationDescriptor_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFPresentationDescriptor, 0x03cb2711, 0x24d7, 0x4db6, 0xa1,0x7f, 0xf3,0xa7,0xa4,0x79,0xa5,0x36);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("03cb2711-24d7-4db6-a17f-f3a7a479a536")
IMFPresentationDescriptor : public IMFAttributes
{
    virtual HRESULT STDMETHODCALLTYPE GetStreamDescriptorCount(
        DWORD *pdwDescriptorCount) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetStreamDescriptorByIndex(
        DWORD dwIndex,
        WINBOOL *pfSelected,
        IMFStreamDescriptor **ppDescriptor) = 0;

    virtual HRESULT STDMETHODCALLTYPE SelectStream(
        DWORD dwDescriptorIndex) = 0;

    virtual HRESULT STDMETHODCALLTYPE DeselectStream(
        DWORD dwDescriptorIndex) = 0;

    virtual HRESULT STDMETHODCALLTYPE Clone(
        IMFPresentationDescriptor **ppPresentationDescriptor) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFPresentationDescriptor, 0x03cb2711, 0x24d7, 0x4db6, 0xa1,0x7f, 0xf3,0xa7,0xa4,0x79,0xa5,0x36)
#endif
#else
typedef struct IMFPresentationDescriptorVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFPresentationDescriptor* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFPresentationDescriptor* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFPresentationDescriptor* This);

    /*** IMFAttributes methods ***/
    HRESULT (STDMETHODCALLTYPE *GetItem)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *GetItemType)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        MF_ATTRIBUTE_TYPE *pType);

    HRESULT (STDMETHODCALLTYPE *CompareItem)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        REFPROPVARIANT Value,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *Compare)(
        IMFPresentationDescriptor* This,
        IMFAttributes *pTheirs,
        MF_ATTRIBUTES_MATCH_TYPE MatchType,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *GetUINT32)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        UINT32 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetUINT64)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        UINT64 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetDouble)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        double *pfValue);

    HRESULT (STDMETHODCALLTYPE *GetGUID)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        GUID *pguidValue);

    HRESULT (STDMETHODCALLTYPE *GetStringLength)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetString)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        LPWSTR pwszValue,
        UINT32 cchBufSize,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedString)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        LPWSTR *ppwszValue,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetBlobSize)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetBlob)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        UINT8 *pBuf,
        UINT32 cbBufSize,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedBlob)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        UINT8 **ppBuf,
        UINT32 *pcbSize);

    HRESULT (STDMETHODCALLTYPE *GetUnknown)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        REFIID riid,
        LPVOID *ppv);

    HRESULT (STDMETHODCALLTYPE *SetItem)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        REFPROPVARIANT Value);

    HRESULT (STDMETHODCALLTYPE *DeleteItem)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey);

    HRESULT (STDMETHODCALLTYPE *DeleteAllItems)(
        IMFPresentationDescriptor* This);

    HRESULT (STDMETHODCALLTYPE *SetUINT32)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        UINT32 unValue);

    HRESULT (STDMETHODCALLTYPE *SetUINT64)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        UINT64 unValue);

    HRESULT (STDMETHODCALLTYPE *SetDouble)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        double fValue);

    HRESULT (STDMETHODCALLTYPE *SetGUID)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        REFGUID guidValue);

    HRESULT (STDMETHODCALLTYPE *SetString)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        LPCWSTR wszValue);

    HRESULT (STDMETHODCALLTYPE *SetBlob)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        const UINT8 *pBuf,
        UINT32 cbBufSize);

    HRESULT (STDMETHODCALLTYPE *SetUnknown)(
        IMFPresentationDescriptor* This,
        REFGUID guidKey,
        IUnknown *pUnknown);

    HRESULT (STDMETHODCALLTYPE *LockStore)(
        IMFPresentationDescriptor* This);

    HRESULT (STDMETHODCALLTYPE *UnlockStore)(
        IMFPresentationDescriptor* This);

    HRESULT (STDMETHODCALLTYPE *GetCount)(
        IMFPresentationDescriptor* This,
        UINT32 *pcItems);

    HRESULT (STDMETHODCALLTYPE *GetItemByIndex)(
        IMFPresentationDescriptor* This,
        UINT32 unIndex,
        GUID *pguidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *CopyAllItems)(
        IMFPresentationDescriptor* This,
        IMFAttributes *pDest);

    /*** IMFPresentationDescriptor methods ***/
    HRESULT (STDMETHODCALLTYPE *GetStreamDescriptorCount)(
        IMFPresentationDescriptor* This,
        DWORD *pdwDescriptorCount);

    HRESULT (STDMETHODCALLTYPE *GetStreamDescriptorByIndex)(
        IMFPresentationDescriptor* This,
        DWORD dwIndex,
        WINBOOL *pfSelected,
        IMFStreamDescriptor **ppDescriptor);

    HRESULT (STDMETHODCALLTYPE *SelectStream)(
        IMFPresentationDescriptor* This,
        DWORD dwDescriptorIndex);

    HRESULT (STDMETHODCALLTYPE *DeselectStream)(
        IMFPresentationDescriptor* This,
        DWORD dwDescriptorIndex);

    HRESULT (STDMETHODCALLTYPE *Clone)(
        IMFPresentationDescriptor* This,
        IMFPresentationDescriptor **ppPresentationDescriptor);

    END_INTERFACE
} IMFPresentationDescriptorVtbl;
interface IMFPresentationDescriptor {
    CONST_VTBL IMFPresentationDescriptorVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFPresentationDescriptor_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFPresentationDescriptor_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFPresentationDescriptor_Release(This) (This)->lpVtbl->Release(This)
/*** IMFAttributes methods ***/
#define IMFPresentationDescriptor_GetItem(This,guidKey,pValue) (This)->lpVtbl->GetItem(This,guidKey,pValue)
#define IMFPresentationDescriptor_GetItemType(This,guidKey,pType) (This)->lpVtbl->GetItemType(This,guidKey,pType)
#define IMFPresentationDescriptor_CompareItem(This,guidKey,Value,pbResult) (This)->lpVtbl->CompareItem(This,guidKey,Value,pbResult)
#define IMFPresentationDescriptor_Compare(This,pTheirs,MatchType,pbResult) (This)->lpVtbl->Compare(This,pTheirs,MatchType,pbResult)
#define IMFPresentationDescriptor_GetUINT32(This,guidKey,punValue) (This)->lpVtbl->GetUINT32(This,guidKey,punValue)
#define IMFPresentationDescriptor_GetUINT64(This,guidKey,punValue) (This)->lpVtbl->GetUINT64(This,guidKey,punValue)
#define IMFPresentationDescriptor_GetDouble(This,guidKey,pfValue) (This)->lpVtbl->GetDouble(This,guidKey,pfValue)
#define IMFPresentationDescriptor_GetGUID(This,guidKey,pguidValue) (This)->lpVtbl->GetGUID(This,guidKey,pguidValue)
#define IMFPresentationDescriptor_GetStringLength(This,guidKey,pcchLength) (This)->lpVtbl->GetStringLength(This,guidKey,pcchLength)
#define IMFPresentationDescriptor_GetString(This,guidKey,pwszValue,cchBufSize,pcchLength) (This)->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength)
#define IMFPresentationDescriptor_GetAllocatedString(This,guidKey,ppwszValue,pcchLength) (This)->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength)
#define IMFPresentationDescriptor_GetBlobSize(This,guidKey,pcbBlobSize) (This)->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize)
#define IMFPresentationDescriptor_GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize) (This)->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize)
#define IMFPresentationDescriptor_GetAllocatedBlob(This,guidKey,ppBuf,pcbSize) (This)->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize)
#define IMFPresentationDescriptor_GetUnknown(This,guidKey,riid,ppv) (This)->lpVtbl->GetUnknown(This,guidKey,riid,ppv)
#define IMFPresentationDescriptor_SetItem(This,guidKey,Value) (This)->lpVtbl->SetItem(This,guidKey,Value)
#define IMFPresentationDescriptor_DeleteItem(This,guidKey) (This)->lpVtbl->DeleteItem(This,guidKey)
#define IMFPresentationDescriptor_DeleteAllItems(This) (This)->lpVtbl->DeleteAllItems(This)
#define IMFPresentationDescriptor_SetUINT32(This,guidKey,unValue) (This)->lpVtbl->SetUINT32(This,guidKey,unValue)
#define IMFPresentationDescriptor_SetUINT64(This,guidKey,unValue) (This)->lpVtbl->SetUINT64(This,guidKey,unValue)
#define IMFPresentationDescriptor_SetDouble(This,guidKey,fValue) (This)->lpVtbl->SetDouble(This,guidKey,fValue)
#define IMFPresentationDescriptor_SetGUID(This,guidKey,guidValue) (This)->lpVtbl->SetGUID(This,guidKey,guidValue)
#define IMFPresentationDescriptor_SetString(This,guidKey,wszValue) (This)->lpVtbl->SetString(This,guidKey,wszValue)
#define IMFPresentationDescriptor_SetBlob(This,guidKey,pBuf,cbBufSize) (This)->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize)
#define IMFPresentationDescriptor_SetUnknown(This,guidKey,pUnknown) (This)->lpVtbl->SetUnknown(This,guidKey,pUnknown)
#define IMFPresentationDescriptor_LockStore(This) (This)->lpVtbl->LockStore(This)
#define IMFPresentationDescriptor_UnlockStore(This) (This)->lpVtbl->UnlockStore(This)
#define IMFPresentationDescriptor_GetCount(This,pcItems) (This)->lpVtbl->GetCount(This,pcItems)
#define IMFPresentationDescriptor_GetItemByIndex(This,unIndex,pguidKey,pValue) (This)->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue)
#define IMFPresentationDescriptor_CopyAllItems(This,pDest) (This)->lpVtbl->CopyAllItems(This,pDest)
/*** IMFPresentationDescriptor methods ***/
#define IMFPresentationDescriptor_GetStreamDescriptorCount(This,pdwDescriptorCount) (This)->lpVtbl->GetStreamDescriptorCount(This,pdwDescriptorCount)
#define IMFPresentationDescriptor_GetStreamDescriptorByIndex(This,dwIndex,pfSelected,ppDescriptor) (This)->lpVtbl->GetStreamDescriptorByIndex(This,dwIndex,pfSelected,ppDescriptor)
#define IMFPresentationDescriptor_SelectStream(This,dwDescriptorIndex) (This)->lpVtbl->SelectStream(This,dwDescriptorIndex)
#define IMFPresentationDescriptor_DeselectStream(This,dwDescriptorIndex) (This)->lpVtbl->DeselectStream(This,dwDescriptorIndex)
#define IMFPresentationDescriptor_Clone(This,ppPresentationDescriptor) (This)->lpVtbl->Clone(This,ppPresentationDescriptor)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFPresentationDescriptor_QueryInterface(IMFPresentationDescriptor* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFPresentationDescriptor_AddRef(IMFPresentationDescriptor* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFPresentationDescriptor_Release(IMFPresentationDescriptor* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFAttributes methods ***/
static FORCEINLINE HRESULT IMFPresentationDescriptor_GetItem(IMFPresentationDescriptor* This,REFGUID guidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItem(This,guidKey,pValue);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_GetItemType(IMFPresentationDescriptor* This,REFGUID guidKey,MF_ATTRIBUTE_TYPE *pType) {
    return This->lpVtbl->GetItemType(This,guidKey,pType);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_CompareItem(IMFPresentationDescriptor* This,REFGUID guidKey,REFPROPVARIANT Value,WINBOOL *pbResult) {
    return This->lpVtbl->CompareItem(This,guidKey,Value,pbResult);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_Compare(IMFPresentationDescriptor* This,IMFAttributes *pTheirs,MF_ATTRIBUTES_MATCH_TYPE MatchType,WINBOOL *pbResult) {
    return This->lpVtbl->Compare(This,pTheirs,MatchType,pbResult);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_GetUINT32(IMFPresentationDescriptor* This,REFGUID guidKey,UINT32 *punValue) {
    return This->lpVtbl->GetUINT32(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_GetUINT64(IMFPresentationDescriptor* This,REFGUID guidKey,UINT64 *punValue) {
    return This->lpVtbl->GetUINT64(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_GetDouble(IMFPresentationDescriptor* This,REFGUID guidKey,double *pfValue) {
    return This->lpVtbl->GetDouble(This,guidKey,pfValue);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_GetGUID(IMFPresentationDescriptor* This,REFGUID guidKey,GUID *pguidValue) {
    return This->lpVtbl->GetGUID(This,guidKey,pguidValue);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_GetStringLength(IMFPresentationDescriptor* This,REFGUID guidKey,UINT32 *pcchLength) {
    return This->lpVtbl->GetStringLength(This,guidKey,pcchLength);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_GetString(IMFPresentationDescriptor* This,REFGUID guidKey,LPWSTR pwszValue,UINT32 cchBufSize,UINT32 *pcchLength) {
    return This->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_GetAllocatedString(IMFPresentationDescriptor* This,REFGUID guidKey,LPWSTR *ppwszValue,UINT32 *pcchLength) {
    return This->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_GetBlobSize(IMFPresentationDescriptor* This,REFGUID guidKey,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_GetBlob(IMFPresentationDescriptor* This,REFGUID guidKey,UINT8 *pBuf,UINT32 cbBufSize,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_GetAllocatedBlob(IMFPresentationDescriptor* This,REFGUID guidKey,UINT8 **ppBuf,UINT32 *pcbSize) {
    return This->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_GetUnknown(IMFPresentationDescriptor* This,REFGUID guidKey,REFIID riid,LPVOID *ppv) {
    return This->lpVtbl->GetUnknown(This,guidKey,riid,ppv);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_SetItem(IMFPresentationDescriptor* This,REFGUID guidKey,REFPROPVARIANT Value) {
    return This->lpVtbl->SetItem(This,guidKey,Value);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_DeleteItem(IMFPresentationDescriptor* This,REFGUID guidKey) {
    return This->lpVtbl->DeleteItem(This,guidKey);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_DeleteAllItems(IMFPresentationDescriptor* This) {
    return This->lpVtbl->DeleteAllItems(This);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_SetUINT32(IMFPresentationDescriptor* This,REFGUID guidKey,UINT32 unValue) {
    return This->lpVtbl->SetUINT32(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_SetUINT64(IMFPresentationDescriptor* This,REFGUID guidKey,UINT64 unValue) {
    return This->lpVtbl->SetUINT64(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_SetDouble(IMFPresentationDescriptor* This,REFGUID guidKey,double fValue) {
    return This->lpVtbl->SetDouble(This,guidKey,fValue);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_SetGUID(IMFPresentationDescriptor* This,REFGUID guidKey,REFGUID guidValue) {
    return This->lpVtbl->SetGUID(This,guidKey,guidValue);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_SetString(IMFPresentationDescriptor* This,REFGUID guidKey,LPCWSTR wszValue) {
    return This->lpVtbl->SetString(This,guidKey,wszValue);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_SetBlob(IMFPresentationDescriptor* This,REFGUID guidKey,const UINT8 *pBuf,UINT32 cbBufSize) {
    return This->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_SetUnknown(IMFPresentationDescriptor* This,REFGUID guidKey,IUnknown *pUnknown) {
    return This->lpVtbl->SetUnknown(This,guidKey,pUnknown);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_LockStore(IMFPresentationDescriptor* This) {
    return This->lpVtbl->LockStore(This);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_UnlockStore(IMFPresentationDescriptor* This) {
    return This->lpVtbl->UnlockStore(This);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_GetCount(IMFPresentationDescriptor* This,UINT32 *pcItems) {
    return This->lpVtbl->GetCount(This,pcItems);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_GetItemByIndex(IMFPresentationDescriptor* This,UINT32 unIndex,GUID *pguidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_CopyAllItems(IMFPresentationDescriptor* This,IMFAttributes *pDest) {
    return This->lpVtbl->CopyAllItems(This,pDest);
}
/*** IMFPresentationDescriptor methods ***/
static FORCEINLINE HRESULT IMFPresentationDescriptor_GetStreamDescriptorCount(IMFPresentationDescriptor* This,DWORD *pdwDescriptorCount) {
    return This->lpVtbl->GetStreamDescriptorCount(This,pdwDescriptorCount);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_GetStreamDescriptorByIndex(IMFPresentationDescriptor* This,DWORD dwIndex,WINBOOL *pfSelected,IMFStreamDescriptor **ppDescriptor) {
    return This->lpVtbl->GetStreamDescriptorByIndex(This,dwIndex,pfSelected,ppDescriptor);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_SelectStream(IMFPresentationDescriptor* This,DWORD dwDescriptorIndex) {
    return This->lpVtbl->SelectStream(This,dwDescriptorIndex);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_DeselectStream(IMFPresentationDescriptor* This,DWORD dwDescriptorIndex) {
    return This->lpVtbl->DeselectStream(This,dwDescriptorIndex);
}
static FORCEINLINE HRESULT IMFPresentationDescriptor_Clone(IMFPresentationDescriptor* This,IMFPresentationDescriptor **ppPresentationDescriptor) {
    return This->lpVtbl->Clone(This,ppPresentationDescriptor);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFPresentationDescriptor_GetStreamDescriptorCount_Proxy(
    IMFPresentationDescriptor* This,
    DWORD *pdwDescriptorCount);
void __RPC_STUB IMFPresentationDescriptor_GetStreamDescriptorCount_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFPresentationDescriptor_GetStreamDescriptorByIndex_Proxy(
    IMFPresentationDescriptor* This,
    DWORD dwIndex,
    WINBOOL *pfSelected,
    IMFStreamDescriptor **ppDescriptor);
void __RPC_STUB IMFPresentationDescriptor_GetStreamDescriptorByIndex_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFPresentationDescriptor_SelectStream_Proxy(
    IMFPresentationDescriptor* This,
    DWORD dwDescriptorIndex);
void __RPC_STUB IMFPresentationDescriptor_SelectStream_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFPresentationDescriptor_DeselectStream_Proxy(
    IMFPresentationDescriptor* This,
    DWORD dwDescriptorIndex);
void __RPC_STUB IMFPresentationDescriptor_DeselectStream_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFPresentationDescriptor_Clone_Proxy(
    IMFPresentationDescriptor* This,
    IMFPresentationDescriptor **ppPresentationDescriptor);
void __RPC_STUB IMFPresentationDescriptor_Clone_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFPresentationDescriptor_INTERFACE_DEFINED__ */

/*****************************************************************************
 * IMFMediaSource interface
 */
#ifndef __IMFMediaSource_INTERFACE_DEFINED__
#define __IMFMediaSource_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFMediaSource, 0x279a808d, 0xaec7, 0x40c8, 0x9c,0x6b, 0xa6,0xb4,0x92,0xc7,0x8a,0x66);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("279a808d-aec7-40c8-9c6b-a6b492c78a66")
IMFMediaSource : public IMFMediaEventGenerator
{
    virtual HRESULT STDMETHODCALLTYPE GetCharacteristics(
        DWORD *pdwCharacteristics) = 0;

    virtual HRESULT STDMETHODCALLTYPE CreatePresentationDescriptor(
        IMFPresentationDescriptor **ppPresentationDescriptor) = 0;

    virtual HRESULT STDMETHODCALLTYPE Start(
        IMFPresentationDescriptor *pPresentationDescriptor,
        const GUID *pguidTimeFormat,
        const PROPVARIANT *pvarStartPosition) = 0;

    virtual HRESULT STDMETHODCALLTYPE Stop(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE Pause(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE Shutdown(
        ) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFMediaSource, 0x279a808d, 0xaec7, 0x40c8, 0x9c,0x6b, 0xa6,0xb4,0x92,0xc7,0x8a,0x66)
#endif
#else
typedef struct IMFMediaSourceVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFMediaSource* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFMediaSource* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFMediaSource* This);

    /*** IMFMediaEventGenerator methods ***/
    HRESULT (STDMETHODCALLTYPE *GetEvent)(
        IMFMediaSource* This,
        DWORD dwFlags,
        IMFMediaEvent **ppEvent);

    HRESULT (STDMETHODCALLTYPE *BeginGetEvent)(
        IMFMediaSource* This,
        IMFAsyncCallback *pCallback,
        IUnknown *punkState);

    HRESULT (STDMETHODCALLTYPE *EndGetEvent)(
        IMFMediaSource* This,
        IMFAsyncResult *pResult,
        IMFMediaEvent **ppEvent);

    HRESULT (STDMETHODCALLTYPE *QueueEvent)(
        IMFMediaSource* This,
        MediaEventType met,
        REFGUID guidExtendedType,
        HRESULT hrStatus,
        const PROPVARIANT *pvValue);

    /*** IMFMediaSource methods ***/
    HRESULT (STDMETHODCALLTYPE *GetCharacteristics)(
        IMFMediaSource* This,
        DWORD *pdwCharacteristics);

    HRESULT (STDMETHODCALLTYPE *CreatePresentationDescriptor)(
        IMFMediaSource* This,
        IMFPresentationDescriptor **ppPresentationDescriptor);

    HRESULT (STDMETHODCALLTYPE *Start)(
        IMFMediaSource* This,
        IMFPresentationDescriptor *pPresentationDescriptor,
        const GUID *pguidTimeFormat,
        const PROPVARIANT *pvarStartPosition);

    HRESULT (STDMETHODCALLTYPE *Stop)(
        IMFMediaSource* This);

    HRESULT (STDMETHODCALLTYPE *Pause)(
        IMFMediaSource* This);

    HRESULT (STDMETHODCALLTYPE *Shutdown)(
        IMFMediaSource* This);

    END_INTERFACE
} IMFMediaSourceVtbl;
interface IMFMediaSource {
    CONST_VTBL IMFMediaSourceVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFMediaSource_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFMediaSource_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFMediaSource_Release(This) (This)->lpVtbl->Release(This)
/*** IMFMediaEventGenerator methods ***/
#define IMFMediaSource_GetEvent(This,dwFlags,ppEvent) (This)->lpVtbl->GetEvent(This,dwFlags,ppEvent)
#define IMFMediaSource_BeginGetEvent(This,pCallback,punkState) (This)->lpVtbl->BeginGetEvent(This,pCallback,punkState)
#define IMFMediaSource_EndGetEvent(This,pResult,ppEvent) (This)->lpVtbl->EndGetEvent(This,pResult,ppEvent)
#define IMFMediaSource_QueueEvent(This,met,guidExtendedType,hrStatus,pvValue) (This)->lpVtbl->QueueEvent(This,met,guidExtendedType,hrStatus,pvValue)
/*** IMFMediaSource methods ***/
#define IMFMediaSource_GetCharacteristics(This,pdwCharacteristics) (This)->lpVtbl->GetCharacteristics(This,pdwCharacteristics)
#define IMFMediaSource_CreatePresentationDescriptor(This,ppPresentationDescriptor) (This)->lpVtbl->CreatePresentationDescriptor(This,ppPresentationDescriptor)
#define IMFMediaSource_Start(This,pPresentationDescriptor,pguidTimeFormat,pvarStartPosition) (This)->lpVtbl->Start(This,pPresentationDescriptor,pguidTimeFormat,pvarStartPosition)
#define IMFMediaSource_Stop(This) (This)->lpVtbl->Stop(This)
#define IMFMediaSource_Pause(This) (This)->lpVtbl->Pause(This)
#define IMFMediaSource_Shutdown(This) (This)->lpVtbl->Shutdown(This)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFMediaSource_QueryInterface(IMFMediaSource* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFMediaSource_AddRef(IMFMediaSource* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFMediaSource_Release(IMFMediaSource* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFMediaEventGenerator methods ***/
static FORCEINLINE HRESULT IMFMediaSource_GetEvent(IMFMediaSource* This,DWORD dwFlags,IMFMediaEvent **ppEvent) {
    return This->lpVtbl->GetEvent(This,dwFlags,ppEvent);
}
static FORCEINLINE HRESULT IMFMediaSource_BeginGetEvent(IMFMediaSource* This,IMFAsyncCallback *pCallback,IUnknown *punkState) {
    return This->lpVtbl->BeginGetEvent(This,pCallback,punkState);
}
static FORCEINLINE HRESULT IMFMediaSource_EndGetEvent(IMFMediaSource* This,IMFAsyncResult *pResult,IMFMediaEvent **ppEvent) {
    return This->lpVtbl->EndGetEvent(This,pResult,ppEvent);
}
static FORCEINLINE HRESULT IMFMediaSource_QueueEvent(IMFMediaSource* This,MediaEventType met,REFGUID guidExtendedType,HRESULT hrStatus,const PROPVARIANT *pvValue) {
    return This->lpVtbl->QueueEvent(This,met,guidExtendedType,hrStatus,pvValue);
}
/*** IMFMediaSource methods ***/
static FORCEINLINE HRESULT IMFMediaSource_GetCharacteristics(IMFMediaSource* This,DWORD *pdwCharacteristics) {
    return This->lpVtbl->GetCharacteristics(This,pdwCharacteristics);
}
static FORCEINLINE HRESULT IMFMediaSource_CreatePresentationDescriptor(IMFMediaSource* This,IMFPresentationDescriptor **ppPresentationDescriptor) {
    return This->lpVtbl->CreatePresentationDescriptor(This,ppPresentationDescriptor);
}
static FORCEINLINE HRESULT IMFMediaSource_Start(IMFMediaSource* This,IMFPresentationDescriptor *pPresentationDescriptor,const GUID *pguidTimeFormat,const PROPVARIANT *pvarStartPosition) {
    return This->lpVtbl->Start(This,pPresentationDescriptor,pguidTimeFormat,pvarStartPosition);
}
static FORCEINLINE HRESULT IMFMediaSource_Stop(IMFMediaSource* This) {
    return This->lpVtbl->Stop(This);
}
static FORCEINLINE HRESULT IMFMediaSource_Pause(IMFMediaSource* This) {
    return This->lpVtbl->Pause(This);
}
static FORCEINLINE HRESULT IMFMediaSource_Shutdown(IMFMediaSource* This) {
    return This->lpVtbl->Shutdown(This);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFMediaSource_GetCharacteristics_Proxy(
    IMFMediaSource* This,
    DWORD *pdwCharacteristics);
void __RPC_STUB IMFMediaSource_GetCharacteristics_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaSource_RemoteCreatePresentationDescriptor_Proxy(
    IMFMediaSource* This,
    DWORD *pcbPD,
    BYTE **pbPD,
    IMFPresentationDescriptor **ppRemotePD);
void __RPC_STUB IMFMediaSource_RemoteCreatePresentationDescriptor_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaSource_Start_Proxy(
    IMFMediaSource* This,
    IMFPresentationDescriptor *pPresentationDescriptor,
    const GUID *pguidTimeFormat,
    const PROPVARIANT *pvarStartPosition);
void __RPC_STUB IMFMediaSource_Start_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaSource_Stop_Proxy(
    IMFMediaSource* This);
void __RPC_STUB IMFMediaSource_Stop_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaSource_Pause_Proxy(
    IMFMediaSource* This);
void __RPC_STUB IMFMediaSource_Pause_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaSource_Shutdown_Proxy(
    IMFMediaSource* This);
void __RPC_STUB IMFMediaSource_Shutdown_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT CALLBACK IMFMediaSource_CreatePresentationDescriptor_Proxy(
    IMFMediaSource* This,
    IMFPresentationDescriptor **ppPresentationDescriptor);
HRESULT __RPC_STUB IMFMediaSource_CreatePresentationDescriptor_Stub(
    IMFMediaSource* This,
    DWORD *pcbPD,
    BYTE **pbPD,
    IMFPresentationDescriptor **ppRemotePD);

#endif  /* __IMFMediaSource_INTERFACE_DEFINED__ */

typedef struct _MF_LEAKY_BUCKET_PAIR {
    DWORD dwBitrate;
    DWORD msBufferWindow;
} MF_LEAKY_BUCKET_PAIR;
typedef struct _MFBYTESTREAM_BUFFERING_PARAMS {
    QWORD cbTotalFileSize;
    QWORD cbPlayableDataSize;
    MF_LEAKY_BUCKET_PAIR *prgBuckets;
    DWORD cBuckets;
    QWORD qwNetBufferingTime;
    QWORD qwExtraBufferingTimeDuringSeek;
    QWORD qwPlayDuration;
    float dRate;
} MFBYTESTREAM_BUFFERING_PARAMS;
/*****************************************************************************
 * IMFByteStreamBuffering interface
 */
#ifndef __IMFByteStreamBuffering_INTERFACE_DEFINED__
#define __IMFByteStreamBuffering_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFByteStreamBuffering, 0x6d66d782, 0x1d4f, 0x4db7, 0x8c,0x63, 0xcb,0x8c,0x77,0xf1,0xef,0x5e);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("6d66d782-1d4f-4db7-8c63-cb8c77f1ef5e")
IMFByteStreamBuffering : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE SetBufferingParams(
        MFBYTESTREAM_BUFFERING_PARAMS *pParams) = 0;

    virtual HRESULT STDMETHODCALLTYPE EnableBuffering(
        WINBOOL fEnable) = 0;

    virtual HRESULT STDMETHODCALLTYPE StopBuffering(
        ) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFByteStreamBuffering, 0x6d66d782, 0x1d4f, 0x4db7, 0x8c,0x63, 0xcb,0x8c,0x77,0xf1,0xef,0x5e)
#endif
#else
typedef struct IMFByteStreamBufferingVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFByteStreamBuffering* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFByteStreamBuffering* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFByteStreamBuffering* This);

    /*** IMFByteStreamBuffering methods ***/
    HRESULT (STDMETHODCALLTYPE *SetBufferingParams)(
        IMFByteStreamBuffering* This,
        MFBYTESTREAM_BUFFERING_PARAMS *pParams);

    HRESULT (STDMETHODCALLTYPE *EnableBuffering)(
        IMFByteStreamBuffering* This,
        WINBOOL fEnable);

    HRESULT (STDMETHODCALLTYPE *StopBuffering)(
        IMFByteStreamBuffering* This);

    END_INTERFACE
} IMFByteStreamBufferingVtbl;
interface IMFByteStreamBuffering {
    CONST_VTBL IMFByteStreamBufferingVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFByteStreamBuffering_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFByteStreamBuffering_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFByteStreamBuffering_Release(This) (This)->lpVtbl->Release(This)
/*** IMFByteStreamBuffering methods ***/
#define IMFByteStreamBuffering_SetBufferingParams(This,pParams) (This)->lpVtbl->SetBufferingParams(This,pParams)
#define IMFByteStreamBuffering_EnableBuffering(This,fEnable) (This)->lpVtbl->EnableBuffering(This,fEnable)
#define IMFByteStreamBuffering_StopBuffering(This) (This)->lpVtbl->StopBuffering(This)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFByteStreamBuffering_QueryInterface(IMFByteStreamBuffering* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFByteStreamBuffering_AddRef(IMFByteStreamBuffering* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFByteStreamBuffering_Release(IMFByteStreamBuffering* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFByteStreamBuffering methods ***/
static FORCEINLINE HRESULT IMFByteStreamBuffering_SetBufferingParams(IMFByteStreamBuffering* This,MFBYTESTREAM_BUFFERING_PARAMS *pParams) {
    return This->lpVtbl->SetBufferingParams(This,pParams);
}
static FORCEINLINE HRESULT IMFByteStreamBuffering_EnableBuffering(IMFByteStreamBuffering* This,WINBOOL fEnable) {
    return This->lpVtbl->EnableBuffering(This,fEnable);
}
static FORCEINLINE HRESULT IMFByteStreamBuffering_StopBuffering(IMFByteStreamBuffering* This) {
    return This->lpVtbl->StopBuffering(This);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFByteStreamBuffering_SetBufferingParams_Proxy(
    IMFByteStreamBuffering* This,
    MFBYTESTREAM_BUFFERING_PARAMS *pParams);
void __RPC_STUB IMFByteStreamBuffering_SetBufferingParams_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFByteStreamBuffering_EnableBuffering_Proxy(
    IMFByteStreamBuffering* This,
    WINBOOL fEnable);
void __RPC_STUB IMFByteStreamBuffering_EnableBuffering_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFByteStreamBuffering_StopBuffering_Proxy(
    IMFByteStreamBuffering* This);
void __RPC_STUB IMFByteStreamBuffering_StopBuffering_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFByteStreamBuffering_INTERFACE_DEFINED__ */

HRESULT WINAPI MFRequireProtectedEnvironment(IMFPresentationDescriptor *pPresentationDescriptor);
HRESULT WINAPI MFSerializePresentationDescriptor(IMFPresentationDescriptor *pPD,DWORD *pcbData,BYTE **ppbData);
typedef DWORD MFSequencerElementId; /*Unknown type*/

typedef enum MFCLOCK_CHARACTERISTICS_FLAGS {
  MFCLOCK_CHARACTERISTICS_FLAG_FREQUENCY_10MHZ   = 0x2,
  MFCLOCK_CHARACTERISTICS_FLAG_ALWAYS_RUNNING    = 0x4,
  MFCLOCK_CHARACTERISTICS_FLAG_IS_SYSTEM_CLOCK   = 0x8
} MFCLOCK_CHARACTERISTICS_FLAGS;

#if (WINVER >= 0x0601)

typedef enum _MF_QUALITY_ADVISE_FLAGS {
  MF_QUALITY_CANNOT_KEEP_UP   = 0x1
} MF_QUALITY_ADVISE_FLAGS;

#endif /*(WINVER >= 0x0601)*/

typedef enum _MF_QUALITY_DROP_MODE {
  MF_DROP_MODE_NONE   = 0x0,
  MF_DROP_MODE_1      = 0x1,
  MF_DROP_MODE_2      = 0x2,
  MF_DROP_MODE_3      = 0x3,
  MF_DROP_MODE_4      = 0x4,
  MF_DROP_MODE_5      = 0x5,
  MF_NUM_DROP_MODES   = 0x6
} MF_QUALITY_DROP_MODE;

typedef enum _MF_QUALITY_LEVEL {
  MF_QUALITY_NORMAL           = 0x0,
  MF_QUALITY_NORMAL_MINUS_1   = 0x1,
  MF_QUALITY_NORMAL_MINUS_2   = 0x2,
  MF_QUALITY_NORMAL_MINUS_3   = 0x3,
  MF_QUALITY_NORMAL_MINUS_4   = 0x4,
  MF_QUALITY_NORMAL_MINUS_5   = 0x5,
  MF_NUM_QUALITY_LEVELS       = 0x6
} MF_QUALITY_LEVEL;

typedef enum MF_SOURCE_READER_CONTROL_FLAG {
  MF_SOURCE_READER_CONTROLF_DRAIN   = 0x00000001
} MF_SOURCE_READER_CONTROL_FLAG;

typedef enum _MF_TOPOLOGY_RESOLUTION_STATUS_FLAGS {
  MF_TOPOLOGY_RESOLUTION_SUCCEEDED              = 0x00000000,
  MF_OPTIONAL_NODE_REJECTED_MEDIA_TYPE          = 0x00000001,
  MF_OPTIONAL_NODE_REJECTED_PROTECTED_PROCESS   = 0x00000002
} MF_TOPOLOGY_RESOLUTION_STATUS_FLAGS;

typedef enum _MF_TOPONODE_DRAIN_MODE {
  MF_TOPONODE_DRAIN_DEFAULT,
  MF_TOPONODE_DRAIN_ALWAYS,
  MF_TOPONODE_DRAIN_NEVER
} MF_TOPONODE_DRAIN_MODE;

typedef enum _MF_TOPONODE_FLUSH_MODE {
  MF_TOPONODE_FLUSH_ALWAYS,
  MF_TOPONODE_FLUSH_SEEK,
  MF_TOPONODE_FLUSH_NEVER
} MF_TOPONODE_FLUSH_MODE;

#if (WINVER >= 0x0601)

typedef enum _MF_TRANSCODE_TOPOLOGY_MODE_FLAGS {
  MF_TRANSCODE_TOPOLOGYMODE_SOFTWARE_ONLY      = 0,
  MF_TRANSCODE_TOPOLOGYMODE_HARDWARE_ALLOWED   = 1
} MF_TRANSCODE_TOPOLOGYMODE_FLAGS;

#endif

typedef enum  {
  MF_LICENSE_URL_UNTRUSTED,
  MF_LICENSE_URL_TRUSTED,
  MF_LICENSE_URL_TAMPERED
} MF_URL_TRUST_STATUS;

typedef enum MFASF_INDEXERFLAGS {
  MFASF_INDEXER_WRITE_NEW_INDEX            = 0x00000001,
  MFASF_INDEXER_READ_FOR_REVERSEPLAYBACK   = 0x00000004,
  MFASF_INDEXER_WRITE_FOR_LIVEREAD         = 0x00000008
} MFASF_INDEXERFLAGS;

typedef enum _MFCLOCK_RELATIONAL_FLAGS {
  MFCLOCK_RELATIONAL_FLAG_JITTER_NEVER_AHEAD   = 0x1
} MFCLOCK_RELATIONAL_FLAGS;

typedef enum _MFMEDIASOURCE_CHARACTERISTICS {
  MFMEDIASOURCE_IS_LIVE                      = 0x1,
  MFMEDIASOURCE_CAN_SEEK                     = 0x2,
  MFMEDIASOURCE_CAN_PAUSE                    = 0x4,
  MFMEDIASOURCE_HAS_SLOW_SEEK                = 0x8,
  MFMEDIASOURCE_HAS_MULTIPLE_PRESENTATIONS   = 0x10,
  MFMEDIASOURCE_CAN_SKIPFORWARD              = 0x20,
  MFMEDIASOURCE_CAN_SKIPBACKWARD             = 0x40
} MFMEDIASOURCE_CHARACTERISTICS;

typedef enum _MFNET_PROXYSETTINGS {
  MFNET_PROXYSETTING_NONE      = 0,
  MFNET_PROXYSETTING_MANUAL    = 1,
  MFNET_PROXYSETTING_AUTO      = 2,
  MFNET_PROXYSETTING_BROWSER   = 3
} MFNET_PROXYSETTINGS;

typedef enum _MFNetAuthenticationFlags {
  MFNET_AUTHENTICATION_PROXY            = 0x00000001,
  MFNET_AUTHENTICATION_CLEAR_TEXT       = 0x00000002,
  MFNET_AUTHENTICATION_LOGGED_ON_USER
} MFNetAuthenticationFlags;

typedef enum _MFNetCredentialOptions {
  MFNET_CREDENTIAL_SAVE               = 0x00000001,
  MFNET_CREDENTIAL_DONT_CACHE         = 0x00000002,
  MFNET_CREDENTIAL_ALLOW_CLEAR_TEXT   = 0x00000004
} MFNetCredentialOptions;

typedef enum _MFNetCredentialRequirements {
  REQUIRE_PROMPT          = 0x00000001,
  REQUIRE_SAVE_SELECTED   = 0x00000002
} MFNetCredentialRequirements;

typedef enum _MFNETSOURCE_CACHE_STATE {
  MFNETSOURCE_CACHE_UNAVAILABLE,
  MFNETSOURCE_CACHE_ACTIVE_WRITING,
  MFNETSOURCE_CACHE_ACTIVE_COMPLETE
} MFNETSOURCE_CACHE_STATE;

typedef enum _MFNETSOURCE_PROTOCOL_TYPE {
  MFNETSOURCE_UNDEFINED   = 0x0,
  MFNETSOURCE_HTTP        = 0x1,
  MFNETSOURCE_RTSP        = 0x2,
  MFNETSOURCE_FILE        = 0x3,
  MFNETSOURCE_MULTICAST   = 0x4
} MFNETSOURCE_PROTOCOL_TYPE;

typedef enum _MFNETSOURCE_STATISTICS_IDS {
  MFNETSOURCE_RECVPACKETS_ID                = 0,
  MFNETSOURCE_LOSTPACKETS_ID,
  MFNETSOURCE_RESENDSREQUESTED_ID,
  MFNETSOURCE_RESENDSRECEIVED_ID,
  MFNETSOURCE_RECOVEREDBYECCPACKETS_ID,
  MFNETSOURCE_RECOVEREDBYRTXPACKETS_ID,
  MFNETSOURCE_OUTPACKETS_ID,
  MFNETSOURCE_RECVRATE_ID,
  MFNETSOURCE_AVGBANDWIDTHBPS_ID,
  MFNETSOURCE_BYTESRECEIVED_ID,
  MFNETSOURCE_PROTOCOL_ID,
  MFNETSOURCE_TRANSPORT_ID,
  MFNETSOURCE_CACHE_STATE_ID,
  MFNETSOURCE_LINKBANDWIDTH_ID,
  MFNETSOURCE_CONTENTBITRATE_ID,
  MFNETSOURCE_SPEEDFACTOR_ID,
  MFNETSOURCE_BUFFERSIZE_ID,
  MFNETSOURCE_BUFFERPROGRESS_ID,
  MFNETSOURCE_LASTBWSWITCHTS_ID,
  MFNETSOURCE_SEEKRANGESTART_ID,
  MFNETSOURCE_SEEKRANGEEND_ID,
  MFNETSOURCE_BUFFERINGCOUNT_ID,
  MFNETSOURCE_INCORRECTLYSIGNEDPACKETS_ID,
  MFNETSOURCE_SIGNEDSESSION_ID,
  MFNETSOURCE_MAXBITRATE_ID,
  MFNETSOURCE_RECEPTION_QUALITY_ID,
  MFNETSOURCE_RECOVEREDPACKETS_ID,
  MFNETSOURCE_VBR_ID,
  MFNETSOURCE_DOWNLOADPROGRESS_ID
} MFNETSOURCE_STATISTICS_IDS;

typedef enum _MFNETSOURCE_TRANSPORT_TYPE {
  MFNETSOURCE_UDP,
  MFNETSOURCE_TCP
} MFNETSOURCE_TRANSPORT_TYPE;

typedef enum MF_OBJECT_TYPE {
  MF_OBJECT_MEDIASOURCE,
  MF_OBJECT_BYTESTREAM,
  MF_OBJECT_INVALID
} MF_OBJECT_TYPE;

typedef enum _MFPOLICYMANAGER_ACTION {
  PEACTION_NO          = 0,
  PEACTION_PLAY        = 1,
  PEACTION_COPY        = 2,
  PEACTION_EXPORT      = 3,
  PEACTION_EXTRACT     = 4,
  PEACTION_RESERVED1   = 5,
  PEACTION_RESERVED2   = 6,
  PEACTION_RESERVED3   = 7,
  PEACTION_LAST        = 7
} MFPOLICYMANAGER_ACTION;

typedef enum _MFRATE_DIRECTION {
  MFRATE_FORWARD,
  MFRATE_REVERSE
} MFRATE_DIRECTION;

typedef enum _MFSequencerTopologyFlags {
  SequencerTopologyFlags_Last   = 0x00000001
} MFSequencerTopologyFlags;

typedef enum _MFSHUTDOWN_STATUS {
  MFSHUTDOWN_INITIATED,
  MFSHUTDOWN_COMPLETED
} MFSHUTDOWN_STATUS;

typedef enum _MFSINK_WMDRMACTION {
  MFSINK_WMDRMACTION_UNDEFINED    = 0,
  MFSINK_WMDRMACTION_ENCODE       = 1,
  MFSINK_WMDRMACTION_TRANSCODE    = 2,
  MFSINK_WMDRMACTION_TRANSCRYPT   = 3,
  MFSINK_WMDRMACTION_LAST         = 3
} MFSINK_WMDRMACTION;

typedef enum MFSTREAMSINK_MARKER_TYPE {
  MFSTREAMSINK_MARKER_DEFAULT,
  MFSTREAMSINK_MARKER_ENDOFSEGMENT,
  MFSTREAMSINK_MARKER_TICK,
  MFSTREAMSINK_MARKER_EVENT
} MFSTREAMSINK_MARKER_TYPE;

typedef enum MFTIMER_FLAGS {
  MFTIMER_RELATIVE   = 0x00000001
} MFTIMER_FLAGS;

#if (WINVER >= 0x0601)

typedef enum MFTOPLOGY_DXVA_MODE {
  MFTOPOLOGY_DXVA_DEFAULT   = 0,
  MFTOPOLOGY_DXVA_NONE      = 1,
  MFTOPOLOGY_DXVA_FULL      = 2
} MFTOPOLOGY_DXVA_MODE;

typedef enum MFTOPOLOGY_HARDWARE_MODE {
  MFTOPOLOGY_HWMODE_SOFTWARE_ONLY   = 0,
  MFTOPOLOGY_HWMODE_USE_HARDWARE    = 1
} MFTOPOLOGY_HARDWARE_MODE;

typedef struct _MFT_REGISTRATION_INFO {
  CLSID                  clsid;
  GUID                   guidCategory;
  UINT32                 uiFlags;
  LPCWSTR                pszName;
  DWORD                  cInTypes;
  MFT_REGISTER_TYPE_INFO *pInTypes;
  DWORD                  cOutTypes;
  MFT_REGISTER_TYPE_INFO *pOutTypes;
} MFT_REGISTRATION_INFO;

#endif /*(WINVER >= 0x0601)*/

typedef struct _ASFFlatPicture {
  BYTE  bPictureType;
  DWORD dwDataLen;
} ASF_FLAT_PICTURE;

typedef struct _ASFFlatSynchronisedLyrics {
  BYTE  bTimeStampFormat;
  BYTE  bContentType;
  DWORD dwLyricsLen;
} ASF_FLAT_SYNCHRONISED_LYRICS;

typedef enum SAMPLE_PROTECTION_VERSION {
  SAMPLE_PROTECTION_VERSION_NO           = 0,
  SAMPLE_PROTECTION_VERSION_BASIC_LOKI   = 1,
  SAMPLE_PROTECTION_VERSION_SCATTER      = 2,
  SAMPLE_PROTECTION_VERSION_RC4          = 3
} SAMPLE_PROTECTION_VERSION;

typedef struct _MFINPUTTRUSTAUTHORITY_ACTION {
  MFPOLICYMANAGER_ACTION Action;
  BYTE                   *pbTicket;
  DWORD                  cbTicket;
} MFINPUTTRUSTAUTHORITY_ACCESS_ACTION;

typedef struct _MFINPUTTRUSTAUTHORITY_ACCESS_PARAMS {
  DWORD                               dwSize;
  DWORD                               dwVer;
  DWORD                               cbSignatureOffset;
  DWORD                               cbSignatureSize;
  DWORD                               cbExtensionOffset;
  DWORD                               cbExtensionSize;
  DWORD                               cActions;
  MFINPUTTRUSTAUTHORITY_ACCESS_ACTION rgOutputActions[1];
} MFINPUTTRUSTAUTHORITY_ACCESS_PARAMS;

typedef struct _MFNetCredentialManagerGetParam {
  HRESULT hrOp;
  WINBOOL    fAllowLoggedOnUser;
  WINBOOL    fClearTextPackage;
  LPCWSTR pszUrl;
  LPCWSTR pszSite;
  LPCWSTR pszRealm;
  LPCWSTR pszPackage;
  LONG    nRetries;
} MFNetCredentialManagerGetParam;

#define MF_1_BYTE_ALIGNMENT     0x00000000
#define MF_2_BYTE_ALIGNMENT     0x00000001
#define MF_4_BYTE_ALIGNMENT     0x00000003
#define MF_8_BYTE_ALIGNMENT     0x00000007
#define MF_16_BYTE_ALIGNMENT    0x0000000F
#define MF_32_BYTE_ALIGNMENT    0x0000001F
#define MF_64_BYTE_ALIGNMENT    0x0000003F
#define MF_128_BYTE_ALIGNMENT   0x0000007F
#define MF_256_BYTE_ALIGNMENT   0x000000FF
#define MF_512_BYTE_ALIGNMENT   0x000001FF

#define MEDIASINK_FIXED_STREAMS                 0x00000001
#define MEDIASINK_CANNOT_MATCH_CLOCK            0x00000002
#define MEDIASINK_RATELESS                      0x00000004
#define MEDIASINK_CLOCK_REQUIRED                0x00000008
#define MEDIASINK_CAN_PREROLL                   0x00000010
#define MEDIASINK_REQUIRE_REFERENCE_MEDIATYPE   0x00000020

#define MF_RESOLUTION_MEDIASOURCE                                           0x00000001
#define MF_RESOLUTION_BYTESTREAM                                            0x00000002
#define MF_RESOLUTION_CONTENT_DOES_NOT_HAVE_TO_MATCH_EXTENSION_OR_MIME_TYPE 0x00000010
#define MF_RESOLUTION_KEEP_BYTE_STREAM_ALIVE_ON_FAIL                        0x00000020
#define MF_RESOLUTION_READ                                                  0x00010000
#define MF_RESOLUTION_WRITE                                                 0x00020000
#ifndef __IMFMediaSink_FWD_DEFINED__
#define __IMFMediaSink_FWD_DEFINED__
typedef interface IMFMediaSink IMFMediaSink;
#endif

#ifndef __IMFASFContentInfo_FWD_DEFINED__
#define __IMFASFContentInfo_FWD_DEFINED__
typedef interface IMFASFContentInfo IMFASFContentInfo;
#endif

#ifndef __IMFASFIndexer_FWD_DEFINED__
#define __IMFASFIndexer_FWD_DEFINED__
typedef interface IMFASFIndexer IMFASFIndexer;
#endif

#ifndef __IMFASFMultiplexer_FWD_DEFINED__
#define __IMFASFMultiplexer_FWD_DEFINED__
typedef interface IMFASFMultiplexer IMFASFMultiplexer;
#endif

#ifndef __IMFASFProfile_FWD_DEFINED__
#define __IMFASFProfile_FWD_DEFINED__
typedef interface IMFASFProfile IMFASFProfile;
#endif

#ifndef __IMFASFSplitter_FWD_DEFINED__
#define __IMFASFSplitter_FWD_DEFINED__
typedef interface IMFASFSplitter IMFASFSplitter;
#endif

#ifndef __IMFPMPServer_FWD_DEFINED__
#define __IMFPMPServer_FWD_DEFINED__
typedef interface IMFPMPServer IMFPMPServer;
#endif

#ifndef __IMFPresentationClock_FWD_DEFINED__
#define __IMFPresentationClock_FWD_DEFINED__
typedef interface IMFPresentationClock IMFPresentationClock;
#endif

#ifndef __IMFNetProxyLocator_FWD_DEFINED__
#define __IMFNetProxyLocator_FWD_DEFINED__
typedef interface IMFNetProxyLocator IMFNetProxyLocator;
#endif

#ifndef __IMFRemoteDesktopPlugin_FWD_DEFINED__
#define __IMFRemoteDesktopPlugin_FWD_DEFINED__
typedef interface IMFRemoteDesktopPlugin IMFRemoteDesktopPlugin;
#endif

#ifndef __IMFTransform_FWD_DEFINED__
#define __IMFTransform_FWD_DEFINED__
typedef interface IMFTransform IMFTransform;
#endif

#ifndef __IMFSampleGrabberSinkCallback_FWD_DEFINED__
#define __IMFSampleGrabberSinkCallback_FWD_DEFINED__
typedef interface IMFSampleGrabberSinkCallback IMFSampleGrabberSinkCallback;
#endif

#ifndef __IMFSequencerSource_FWD_DEFINED__
#define __IMFSequencerSource_FWD_DEFINED__
typedef interface IMFSequencerSource IMFSequencerSource;
#endif

#ifndef __IMFQualityManager_FWD_DEFINED__
#define __IMFQualityManager_FWD_DEFINED__
typedef interface IMFQualityManager IMFQualityManager;
#endif

#ifndef __IMFSourceResolver_FWD_DEFINED__
#define __IMFSourceResolver_FWD_DEFINED__
typedef interface IMFSourceResolver IMFSourceResolver;
#endif

#ifndef __IMFPresentationTimeSource_FWD_DEFINED__
#define __IMFPresentationTimeSource_FWD_DEFINED__
typedef interface IMFPresentationTimeSource IMFPresentationTimeSource;
#endif

#ifndef __IMFTopoLoader_FWD_DEFINED__
#define __IMFTopoLoader_FWD_DEFINED__
typedef interface IMFTopoLoader IMFTopoLoader;
#endif

#ifndef __IMFTranscodeProfile_FWD_DEFINED__
#define __IMFTranscodeProfile_FWD_DEFINED__
typedef interface IMFTranscodeProfile IMFTranscodeProfile;
#endif

HRESULT MFCreate3GPMediaSink(IMFByteStream *pIByteStream,IMFMediaType *pVideoMediaType,IMFMediaType *pAudioMediaType,IMFMediaSink **ppIMediaSink);
HRESULT MFCreateAggregateSource(IMFCollection *pSourceCollection,IMFMediaSource **ppAggSource);

HRESULT WINAPI MFCreateAlignedMemoryBuffer(DWORD cbMaxLength,DWORD fAlignmentFlags,IMFMediaBuffer **ppBuffer);
HRESULT WINAPI MFCreateASFContentInfo(IMFASFContentInfo **ppIContentInfo);
HRESULT WINAPI MFCreateASFIndexer(IMFASFIndexer **ppIIndexer);
HRESULT WINAPI MFCreateASFIndexerByteStream(IMFByteStream *pIContentByteStream,QWORD cbIndexStartOffset,IMFByteStream **pIIndexByteStream);
HRESULT WINAPI MFCreateASFMediaSink(IMFByteStream *pIByteStream,IMFMediaSink **ppIMediaSink);
HRESULT WINAPI MFCreateASFMediaSinkActivate(LPCWSTR pwszFileName,IMFASFContentInfo *pContentInfo,IMFActivate **ppIActivate);
HRESULT WINAPI MFCreateASFMultiplexer(IMFASFMultiplexer **ppIMultiplexer);
HRESULT WINAPI MFCreateASFProfile(IMFASFProfile **ppIProfile);
HRESULT WINAPI MFCreateASFProfileFromPresentationDescriptor(IMFPresentationDescriptor *pIPD,IMFASFProfile **ppIProfile);
HRESULT WINAPI MFCreateASFSplitter(IMFASFSplitter **ppISplitter);
HRESULT WINAPI MFCreateMediaSession(IMFAttributes *pConfiguration,IMFMediaSession **ppMS);
HRESULT WINAPI MFCreateMP3MediaSink(IMFByteStream *pTargetByteStream,IMFMediaSink **ppMediaSink);
HRESULT WINAPI MFCreateMPEG4MediaSink(IMFByteStream *pIByteStream,IMFMediaType *pVideoMediaType,IMFMediaType *pAudioMediaType,IMFMediaSink **ppIMediaSink);
HRESULT WINAPI MFCreateNetSchemePlugin(REFIID riid,LPVOID *ppvHandler);
HRESULT WINAPI MFCreatePMPServer(DWORD dwCreationFlags,IMFPMPServer **ppPMPServer);
HRESULT WINAPI MFCreatePMPMediaSession(DWORD dwCreationFlags,IMFAttributes *pConfiguration,IMFMediaSession **ppMediaSession,IMFActivate **ppEnablerActivate);
HRESULT WINAPI MFCreatePathFromURL(LPCWSTR pwszFileURL,LPWSTR *ppwszFilePath);
HRESULT WINAPI MFCreatePresentationClock(IMFPresentationClock **ppPresentationClock);
HRESULT WINAPI MFCreatePresentationDescriptor(DWORD cStreamDescriptors,IMFStreamDescriptor **apStreamDescriptors,IMFPresentationDescriptor **ppPresentationDescriptor);
HRESULT WINAPI MFCreatePresentationDescriptorFromASFProfile(IMFASFProfile *pIProfile,IMFPresentationDescriptor **ppIPD);
HRESULT WINAPI MFCreateProxyLocator(LPCWSTR pszProtocol,IPropertyStore *pProxyConfig,IMFNetProxyLocator **ppProxyLocator);
HRESULT WINAPI MFCreateRemoteDesktopPlugin(IMFRemoteDesktopPlugin **ppPlugin);
HRESULT WINAPI MFCreateSample(IMFSample **ppIMFSample);
HRESULT WINAPI MFCreateSampleCopierMFT(IMFTransform **ppCopierMFT);
HRESULT WINAPI MFCreateSampleGrabberSinkActivate(IMFMediaType *pIMFMediaType,IMFSampleGrabberSinkCallback *pIMFSampleGrabberSinkCallback,IMFActivate **ppIActivate);
HRESULT WINAPI MFCreateSequencerSource(IUnknown *pReserved,IMFSequencerSource **ppSequencerSource);
HRESULT WINAPI MFCreateSimpleTypeHandler(IMFMediaTypeHandler **ppHandler);
HRESULT WINAPI MFCreateStandardQualityManager(IMFQualityManager **ppQualityManager);
HRESULT WINAPI MFCreateStreamDescriptor(DWORD dwStreamIdentifier,DWORD cMediaTypes,IMFMediaType **apMediaTypes,IMFStreamDescriptor **ppDescriptor);
HRESULT WINAPI MFCreateSourceResolver(IMFSourceResolver **ppISourceResolver);
HRESULT WINAPI MFCreateSystemTimeSource(IMFPresentationTimeSource **ppSystemTimeSource);
HRESULT WINAPI MFCreateTopoLoader(IMFTopoLoader **ppObj);
HRESULT WINAPI MFCreateTopology(IMFTopology **ppTopo);
HRESULT WINAPI MFCreateTopologyNode(MF_TOPOLOGY_TYPE NodeType,IMFTopologyNode **ppNode);
HRESULT WINAPI MFCreateVideoRenderer(REFIID riidRenderer,void **ppVideoRenderer);
HRESULT WINAPI MFCreateVideoRendererActivate(HWND hwndVideo,IMFActivate **ppActivate);
HRESULT WINAPI MFGetService(IUnknown *punkObject,REFGUID guidService,REFIID riid,LPVOID *ppvObject);
HRESULT WINAPI MFGetSupportedMimeTypes(PROPVARIANT *pPropVarMimeTypeArray);
HRESULT WINAPI MFGetSupportedSchemes(PROPVARIANT *pPropVarSchemeArray);
MFTIME WINAPI MFGetSystemTime(void);
HRESULT WINAPI MFShutdownObject(IUnknown *pUnk);
HRESULT WINAPI CreateNamedPropertyStore(INamedPropertyStore **ppStore);
HRESULT WINAPI CreatePropertyStore(IPropertyStore **ppStore);
#if (WINVER >= 0x0601)

HRESULT WINAPI MFCreateTranscodeProfile(IMFTranscodeProfile **ppTranscodeProfile);
HRESULT WINAPI MFCreateTranscodeSinkActivate(IMFActivate **ppActivate);
HRESULT WINAPI MFCreateTranscodeTopology(IMFMediaSource *pSrc,LPCWSTR pwszOutputFilePath,IMFTranscodeProfile *pProfile,IMFTopology **ppTranscodeTopo);
HRESULT WINAPI MFEnumDeviceSources(IMFAttributes *pAttributes,IMFActivate ***pppSourceActivate,UINT32 *pcSourceActivate);
HRESULT WINAPI MFGetTopoNodeCurrentType(IMFTopologyNode *pNode,DWORD dwStreamIndex,WINBOOL fOutput,IMFMediaType **ppType);
HRESULT WINAPI MFTranscodeGetAudioOutputAvailableTypes(REFGUID guidSubType,DWORD dwMFTFlags,IMFAttributes *pCodecConfig,IMFCollection **ppAvailableTypes);
#endif
/* Begin additional prototypes for all interfaces */

ULONG           __RPC_USER BSTR_UserSize     (ULONG *, ULONG, BSTR *);
unsigned char * __RPC_USER BSTR_UserMarshal  (ULONG *, unsigned char *, BSTR *);
unsigned char * __RPC_USER BSTR_UserUnmarshal(ULONG *, unsigned char *, BSTR *);
void            __RPC_USER BSTR_UserFree     (ULONG *, BSTR *);
ULONG           __RPC_USER LPSAFEARRAY_UserSize     (ULONG *, ULONG, LPSAFEARRAY *);
unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal  (ULONG *, unsigned char *, LPSAFEARRAY *);
unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal(ULONG *, unsigned char *, LPSAFEARRAY *);
void            __RPC_USER LPSAFEARRAY_UserFree     (ULONG *, LPSAFEARRAY *);

/* End additional prototypes */

#ifdef __cplusplus
}
#endif

#endif /* __mfidl_h__ */
Added undroid/tclwmf/compat/mfobjects.h.






























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
/*** Autogenerated by WIDL 1.6 from include/mfobjects.idl - Do not edit ***/

#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 475
#endif

#include <rpc.h>
#include <rpcndr.h>

#ifndef COM_NO_WINDOWS_H
#include <windows.h>
#include <ole2.h>
#endif

#ifndef __mfobjects_h__
#define __mfobjects_h__

/* Forward declarations */

#ifndef __IMFAttributes_FWD_DEFINED__
#define __IMFAttributes_FWD_DEFINED__
typedef interface IMFAttributes IMFAttributes;
#endif

#ifndef __IMFMediaBuffer_FWD_DEFINED__
#define __IMFMediaBuffer_FWD_DEFINED__
typedef interface IMFMediaBuffer IMFMediaBuffer;
#endif

#ifndef __IMFSample_FWD_DEFINED__
#define __IMFSample_FWD_DEFINED__
typedef interface IMFSample IMFSample;
#endif

#ifndef __IMF2DBuffer_FWD_DEFINED__
#define __IMF2DBuffer_FWD_DEFINED__
typedef interface IMF2DBuffer IMF2DBuffer;
#endif

#ifndef __IMF2DBuffer2_FWD_DEFINED__
#define __IMF2DBuffer2_FWD_DEFINED__
typedef interface IMF2DBuffer2 IMF2DBuffer2;
#endif

#ifndef __IMFDXGIBuffer_FWD_DEFINED__
#define __IMFDXGIBuffer_FWD_DEFINED__
typedef interface IMFDXGIBuffer IMFDXGIBuffer;
#endif

#ifndef __IMFMediaType_FWD_DEFINED__
#define __IMFMediaType_FWD_DEFINED__
typedef interface IMFMediaType IMFMediaType;
#endif

#ifndef __IMFAudioMediaType_FWD_DEFINED__
#define __IMFAudioMediaType_FWD_DEFINED__
typedef interface IMFAudioMediaType IMFAudioMediaType;
#endif

#ifndef __IMFVideoMediaType_FWD_DEFINED__
#define __IMFVideoMediaType_FWD_DEFINED__
typedef interface IMFVideoMediaType IMFVideoMediaType;
#endif

#ifndef __IMFAsyncResult_FWD_DEFINED__
#define __IMFAsyncResult_FWD_DEFINED__
typedef interface IMFAsyncResult IMFAsyncResult;
#endif

#ifndef __IMFAsyncCallback_FWD_DEFINED__
#define __IMFAsyncCallback_FWD_DEFINED__
typedef interface IMFAsyncCallback IMFAsyncCallback;
#endif

#ifndef __IMFAsyncCallbackLogging_FWD_DEFINED__
#define __IMFAsyncCallbackLogging_FWD_DEFINED__
typedef interface IMFAsyncCallbackLogging IMFAsyncCallbackLogging;
#endif

#ifndef __IMFMediaEvent_FWD_DEFINED__
#define __IMFMediaEvent_FWD_DEFINED__
typedef interface IMFMediaEvent IMFMediaEvent;
#endif

#ifndef __IMFMediaEventGenerator_FWD_DEFINED__
#define __IMFMediaEventGenerator_FWD_DEFINED__
typedef interface IMFMediaEventGenerator IMFMediaEventGenerator;
#endif

#ifndef __IMFRemoteAsyncCallback_FWD_DEFINED__
#define __IMFRemoteAsyncCallback_FWD_DEFINED__
typedef interface IMFRemoteAsyncCallback IMFRemoteAsyncCallback;
#endif

#ifndef __IMFByteStream_FWD_DEFINED__
#define __IMFByteStream_FWD_DEFINED__
typedef interface IMFByteStream IMFByteStream;
#endif

#ifndef __IMFByteStreamProxyClassFactory_FWD_DEFINED__
#define __IMFByteStreamProxyClassFactory_FWD_DEFINED__
typedef interface IMFByteStreamProxyClassFactory IMFByteStreamProxyClassFactory;
#endif

#ifndef __IMFSampleOutputStream_FWD_DEFINED__
#define __IMFSampleOutputStream_FWD_DEFINED__
typedef interface IMFSampleOutputStream IMFSampleOutputStream;
#endif

#ifndef __IMFCollection_FWD_DEFINED__
#define __IMFCollection_FWD_DEFINED__
typedef interface IMFCollection IMFCollection;
#endif

#ifndef __IMFMediaEventQueue_FWD_DEFINED__
#define __IMFMediaEventQueue_FWD_DEFINED__
typedef interface IMFMediaEventQueue IMFMediaEventQueue;
#endif

#ifndef __IMFActivate_FWD_DEFINED__
#define __IMFActivate_FWD_DEFINED__
typedef interface IMFActivate IMFActivate;
#endif

#ifndef __IMFPluginControl_FWD_DEFINED__
#define __IMFPluginControl_FWD_DEFINED__
typedef interface IMFPluginControl IMFPluginControl;
#endif

#ifndef __IMFPluginControl2_FWD_DEFINED__
#define __IMFPluginControl2_FWD_DEFINED__
typedef interface IMFPluginControl2 IMFPluginControl2;
#endif

#ifndef __IMFDXGIDeviceManager_FWD_DEFINED__
#define __IMFDXGIDeviceManager_FWD_DEFINED__
typedef interface IMFDXGIDeviceManager IMFDXGIDeviceManager;
#endif

/* Headers for imported files */

#include <unknwn.h>
#include <propsys.h>
#include <mediaobj.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * This file is part of the mingw-w64 runtime package.
 * No warranty is given; refer to the file DISCLAIMER within this package.
 */

#include <winapifamily.h>


typedef ULONGLONG QWORD;

#include <mmreg.h>
#if 0
typedef struct tWAVEFORMATEX {
    WORD wFormatTag;
    WORD nChannels;
    DWORD nSamplesPerSec;
    DWORD nAvgBytesPerSec;
    WORD nBlockAlign;
    WORD wBitsPerSample;
    WORD cbSize;
    BYTE pExtraBytes[1];
} WAVEFORMATEX;
typedef struct tWAVEFORMATEX *PWAVEFORMATEX;
typedef struct tWAVEFORMATEX *NPWAVEFORMATEX;
typedef struct tWAVEFORMATEX *LPWAVEFORMATEX;
typedef struct __WIDL_mfobjects_generated_name_00000013 {
    WORD wFormatTag;
    WORD nChannels;
    DWORD nSamplesPerSec;
    DWORD nAvgBytesPerSec;
    WORD nBlockAlign;
    WORD wBitsPerSample;
    WORD cbSize;
    WORD wValidBitsPerSample;
    DWORD dwChannelMask;
    GUID SubFormat;
} WAVEFORMATEXTENSIBLE;
typedef struct __WIDL_mfobjects_generated_name_00000013 *PWAVEFORMATEXTENSIBLE;
#endif

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
typedef enum _MF_ATTRIBUTE_TYPE {
    MF_ATTRIBUTE_UINT32 = VT_UI4,
    MF_ATTRIBUTE_UINT64 = VT_UI8,
    MF_ATTRIBUTE_DOUBLE = VT_R8,
    MF_ATTRIBUTE_GUID = VT_CLSID,
    MF_ATTRIBUTE_STRING = VT_LPWSTR,
    MF_ATTRIBUTE_BLOB = VT_VECTOR | VT_UI1,
    MF_ATTRIBUTE_IUNKNOWN = VT_UNKNOWN
} MF_ATTRIBUTE_TYPE;

typedef enum _MF_ATTRIBUTES_MATCH_TYPE {
    MF_ATTRIBUTES_MATCH_OUR_ITEMS = 0,
    MF_ATTRIBUTES_MATCH_THEIR_ITEMS = 1,
    MF_ATTRIBUTES_MATCH_ALL_ITEMS = 2,
    MF_ATTRIBUTES_MATCH_INTERSECTION = 3,
    MF_ATTRIBUTES_MATCH_SMALLER = 4
} MF_ATTRIBUTES_MATCH_TYPE;

/*****************************************************************************
 * IMFAttributes interface
 */
#ifndef __IMFAttributes_INTERFACE_DEFINED__
#define __IMFAttributes_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFAttributes, 0x2cd2d921, 0xc447, 0x44a7, 0xa1,0x3c, 0x4a,0xda,0xbf,0xc2,0x47,0xe3);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("2cd2d921-c447-44a7-a13c-4adabfc247e3")
IMFAttributes : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE GetItem(
        REFGUID guidKey,
        PROPVARIANT *pValue) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetItemType(
        REFGUID guidKey,
        MF_ATTRIBUTE_TYPE *pType) = 0;

    virtual HRESULT STDMETHODCALLTYPE CompareItem(
        REFGUID guidKey,
        REFPROPVARIANT Value,
        WINBOOL *pbResult) = 0;

    virtual HRESULT STDMETHODCALLTYPE Compare(
        IMFAttributes *pTheirs,
        MF_ATTRIBUTES_MATCH_TYPE MatchType,
        WINBOOL *pbResult) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetUINT32(
        REFGUID guidKey,
        UINT32 *punValue) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetUINT64(
        REFGUID guidKey,
        UINT64 *punValue) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetDouble(
        REFGUID guidKey,
        double *pfValue) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetGUID(
        REFGUID guidKey,
        GUID *pguidValue) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetStringLength(
        REFGUID guidKey,
        UINT32 *pcchLength) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetString(
        REFGUID guidKey,
        LPWSTR pwszValue,
        UINT32 cchBufSize,
        UINT32 *pcchLength) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetAllocatedString(
        REFGUID guidKey,
        LPWSTR *ppwszValue,
        UINT32 *pcchLength) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetBlobSize(
        REFGUID guidKey,
        UINT32 *pcbBlobSize) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetBlob(
        REFGUID guidKey,
        UINT8 *pBuf,
        UINT32 cbBufSize,
        UINT32 *pcbBlobSize) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetAllocatedBlob(
        REFGUID guidKey,
        UINT8 **ppBuf,
        UINT32 *pcbSize) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetUnknown(
        REFGUID guidKey,
        REFIID riid,
        LPVOID *ppv) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetItem(
        REFGUID guidKey,
        REFPROPVARIANT Value) = 0;

    virtual HRESULT STDMETHODCALLTYPE DeleteItem(
        REFGUID guidKey) = 0;

    virtual HRESULT STDMETHODCALLTYPE DeleteAllItems(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetUINT32(
        REFGUID guidKey,
        UINT32 unValue) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetUINT64(
        REFGUID guidKey,
        UINT64 unValue) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetDouble(
        REFGUID guidKey,
        double fValue) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetGUID(
        REFGUID guidKey,
        REFGUID guidValue) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetString(
        REFGUID guidKey,
        LPCWSTR wszValue) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetBlob(
        REFGUID guidKey,
        const UINT8 *pBuf,
        UINT32 cbBufSize) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetUnknown(
        REFGUID guidKey,
        IUnknown *pUnknown) = 0;

    virtual HRESULT STDMETHODCALLTYPE LockStore(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE UnlockStore(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetCount(
        UINT32 *pcItems) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetItemByIndex(
        UINT32 unIndex,
        GUID *pguidKey,
        PROPVARIANT *pValue) = 0;

    virtual HRESULT STDMETHODCALLTYPE CopyAllItems(
        IMFAttributes *pDest) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFAttributes, 0x2cd2d921, 0xc447, 0x44a7, 0xa1,0x3c, 0x4a,0xda,0xbf,0xc2,0x47,0xe3)
#endif
#else
typedef struct IMFAttributesVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFAttributes* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFAttributes* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFAttributes* This);

    /*** IMFAttributes methods ***/
    HRESULT (STDMETHODCALLTYPE *GetItem)(
        IMFAttributes* This,
        REFGUID guidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *GetItemType)(
        IMFAttributes* This,
        REFGUID guidKey,
        MF_ATTRIBUTE_TYPE *pType);

    HRESULT (STDMETHODCALLTYPE *CompareItem)(
        IMFAttributes* This,
        REFGUID guidKey,
        REFPROPVARIANT Value,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *Compare)(
        IMFAttributes* This,
        IMFAttributes *pTheirs,
        MF_ATTRIBUTES_MATCH_TYPE MatchType,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *GetUINT32)(
        IMFAttributes* This,
        REFGUID guidKey,
        UINT32 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetUINT64)(
        IMFAttributes* This,
        REFGUID guidKey,
        UINT64 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetDouble)(
        IMFAttributes* This,
        REFGUID guidKey,
        double *pfValue);

    HRESULT (STDMETHODCALLTYPE *GetGUID)(
        IMFAttributes* This,
        REFGUID guidKey,
        GUID *pguidValue);

    HRESULT (STDMETHODCALLTYPE *GetStringLength)(
        IMFAttributes* This,
        REFGUID guidKey,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetString)(
        IMFAttributes* This,
        REFGUID guidKey,
        LPWSTR pwszValue,
        UINT32 cchBufSize,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedString)(
        IMFAttributes* This,
        REFGUID guidKey,
        LPWSTR *ppwszValue,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetBlobSize)(
        IMFAttributes* This,
        REFGUID guidKey,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetBlob)(
        IMFAttributes* This,
        REFGUID guidKey,
        UINT8 *pBuf,
        UINT32 cbBufSize,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedBlob)(
        IMFAttributes* This,
        REFGUID guidKey,
        UINT8 **ppBuf,
        UINT32 *pcbSize);

    HRESULT (STDMETHODCALLTYPE *GetUnknown)(
        IMFAttributes* This,
        REFGUID guidKey,
        REFIID riid,
        LPVOID *ppv);

    HRESULT (STDMETHODCALLTYPE *SetItem)(
        IMFAttributes* This,
        REFGUID guidKey,
        REFPROPVARIANT Value);

    HRESULT (STDMETHODCALLTYPE *DeleteItem)(
        IMFAttributes* This,
        REFGUID guidKey);

    HRESULT (STDMETHODCALLTYPE *DeleteAllItems)(
        IMFAttributes* This);

    HRESULT (STDMETHODCALLTYPE *SetUINT32)(
        IMFAttributes* This,
        REFGUID guidKey,
        UINT32 unValue);

    HRESULT (STDMETHODCALLTYPE *SetUINT64)(
        IMFAttributes* This,
        REFGUID guidKey,
        UINT64 unValue);

    HRESULT (STDMETHODCALLTYPE *SetDouble)(
        IMFAttributes* This,
        REFGUID guidKey,
        double fValue);

    HRESULT (STDMETHODCALLTYPE *SetGUID)(
        IMFAttributes* This,
        REFGUID guidKey,
        REFGUID guidValue);

    HRESULT (STDMETHODCALLTYPE *SetString)(
        IMFAttributes* This,
        REFGUID guidKey,
        LPCWSTR wszValue);

    HRESULT (STDMETHODCALLTYPE *SetBlob)(
        IMFAttributes* This,
        REFGUID guidKey,
        const UINT8 *pBuf,
        UINT32 cbBufSize);

    HRESULT (STDMETHODCALLTYPE *SetUnknown)(
        IMFAttributes* This,
        REFGUID guidKey,
        IUnknown *pUnknown);

    HRESULT (STDMETHODCALLTYPE *LockStore)(
        IMFAttributes* This);

    HRESULT (STDMETHODCALLTYPE *UnlockStore)(
        IMFAttributes* This);

    HRESULT (STDMETHODCALLTYPE *GetCount)(
        IMFAttributes* This,
        UINT32 *pcItems);

    HRESULT (STDMETHODCALLTYPE *GetItemByIndex)(
        IMFAttributes* This,
        UINT32 unIndex,
        GUID *pguidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *CopyAllItems)(
        IMFAttributes* This,
        IMFAttributes *pDest);

    END_INTERFACE
} IMFAttributesVtbl;
interface IMFAttributes {
    CONST_VTBL IMFAttributesVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFAttributes_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFAttributes_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFAttributes_Release(This) (This)->lpVtbl->Release(This)
/*** IMFAttributes methods ***/
#define IMFAttributes_GetItem(This,guidKey,pValue) (This)->lpVtbl->GetItem(This,guidKey,pValue)
#define IMFAttributes_GetItemType(This,guidKey,pType) (This)->lpVtbl->GetItemType(This,guidKey,pType)
#define IMFAttributes_CompareItem(This,guidKey,Value,pbResult) (This)->lpVtbl->CompareItem(This,guidKey,Value,pbResult)
#define IMFAttributes_Compare(This,pTheirs,MatchType,pbResult) (This)->lpVtbl->Compare(This,pTheirs,MatchType,pbResult)
#define IMFAttributes_GetUINT32(This,guidKey,punValue) (This)->lpVtbl->GetUINT32(This,guidKey,punValue)
#define IMFAttributes_GetUINT64(This,guidKey,punValue) (This)->lpVtbl->GetUINT64(This,guidKey,punValue)
#define IMFAttributes_GetDouble(This,guidKey,pfValue) (This)->lpVtbl->GetDouble(This,guidKey,pfValue)
#define IMFAttributes_GetGUID(This,guidKey,pguidValue) (This)->lpVtbl->GetGUID(This,guidKey,pguidValue)
#define IMFAttributes_GetStringLength(This,guidKey,pcchLength) (This)->lpVtbl->GetStringLength(This,guidKey,pcchLength)
#define IMFAttributes_GetString(This,guidKey,pwszValue,cchBufSize,pcchLength) (This)->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength)
#define IMFAttributes_GetAllocatedString(This,guidKey,ppwszValue,pcchLength) (This)->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength)
#define IMFAttributes_GetBlobSize(This,guidKey,pcbBlobSize) (This)->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize)
#define IMFAttributes_GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize) (This)->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize)
#define IMFAttributes_GetAllocatedBlob(This,guidKey,ppBuf,pcbSize) (This)->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize)
#define IMFAttributes_GetUnknown(This,guidKey,riid,ppv) (This)->lpVtbl->GetUnknown(This,guidKey,riid,ppv)
#define IMFAttributes_SetItem(This,guidKey,Value) (This)->lpVtbl->SetItem(This,guidKey,Value)
#define IMFAttributes_DeleteItem(This,guidKey) (This)->lpVtbl->DeleteItem(This,guidKey)
#define IMFAttributes_DeleteAllItems(This) (This)->lpVtbl->DeleteAllItems(This)
#define IMFAttributes_SetUINT32(This,guidKey,unValue) (This)->lpVtbl->SetUINT32(This,guidKey,unValue)
#define IMFAttributes_SetUINT64(This,guidKey,unValue) (This)->lpVtbl->SetUINT64(This,guidKey,unValue)
#define IMFAttributes_SetDouble(This,guidKey,fValue) (This)->lpVtbl->SetDouble(This,guidKey,fValue)
#define IMFAttributes_SetGUID(This,guidKey,guidValue) (This)->lpVtbl->SetGUID(This,guidKey,guidValue)
#define IMFAttributes_SetString(This,guidKey,wszValue) (This)->lpVtbl->SetString(This,guidKey,wszValue)
#define IMFAttributes_SetBlob(This,guidKey,pBuf,cbBufSize) (This)->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize)
#define IMFAttributes_SetUnknown(This,guidKey,pUnknown) (This)->lpVtbl->SetUnknown(This,guidKey,pUnknown)
#define IMFAttributes_LockStore(This) (This)->lpVtbl->LockStore(This)
#define IMFAttributes_UnlockStore(This) (This)->lpVtbl->UnlockStore(This)
#define IMFAttributes_GetCount(This,pcItems) (This)->lpVtbl->GetCount(This,pcItems)
#define IMFAttributes_GetItemByIndex(This,unIndex,pguidKey,pValue) (This)->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue)
#define IMFAttributes_CopyAllItems(This,pDest) (This)->lpVtbl->CopyAllItems(This,pDest)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFAttributes_QueryInterface(IMFAttributes* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFAttributes_AddRef(IMFAttributes* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFAttributes_Release(IMFAttributes* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFAttributes methods ***/
static FORCEINLINE HRESULT IMFAttributes_GetItem(IMFAttributes* This,REFGUID guidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItem(This,guidKey,pValue);
}
static FORCEINLINE HRESULT IMFAttributes_GetItemType(IMFAttributes* This,REFGUID guidKey,MF_ATTRIBUTE_TYPE *pType) {
    return This->lpVtbl->GetItemType(This,guidKey,pType);
}
static FORCEINLINE HRESULT IMFAttributes_CompareItem(IMFAttributes* This,REFGUID guidKey,REFPROPVARIANT Value,WINBOOL *pbResult) {
    return This->lpVtbl->CompareItem(This,guidKey,Value,pbResult);
}
static FORCEINLINE HRESULT IMFAttributes_Compare(IMFAttributes* This,IMFAttributes *pTheirs,MF_ATTRIBUTES_MATCH_TYPE MatchType,WINBOOL *pbResult) {
    return This->lpVtbl->Compare(This,pTheirs,MatchType,pbResult);
}
static FORCEINLINE HRESULT IMFAttributes_GetUINT32(IMFAttributes* This,REFGUID guidKey,UINT32 *punValue) {
    return This->lpVtbl->GetUINT32(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFAttributes_GetUINT64(IMFAttributes* This,REFGUID guidKey,UINT64 *punValue) {
    return This->lpVtbl->GetUINT64(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFAttributes_GetDouble(IMFAttributes* This,REFGUID guidKey,double *pfValue) {
    return This->lpVtbl->GetDouble(This,guidKey,pfValue);
}
static FORCEINLINE HRESULT IMFAttributes_GetGUID(IMFAttributes* This,REFGUID guidKey,GUID *pguidValue) {
    return This->lpVtbl->GetGUID(This,guidKey,pguidValue);
}
static FORCEINLINE HRESULT IMFAttributes_GetStringLength(IMFAttributes* This,REFGUID guidKey,UINT32 *pcchLength) {
    return This->lpVtbl->GetStringLength(This,guidKey,pcchLength);
}
static FORCEINLINE HRESULT IMFAttributes_GetString(IMFAttributes* This,REFGUID guidKey,LPWSTR pwszValue,UINT32 cchBufSize,UINT32 *pcchLength) {
    return This->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength);
}
static FORCEINLINE HRESULT IMFAttributes_GetAllocatedString(IMFAttributes* This,REFGUID guidKey,LPWSTR *ppwszValue,UINT32 *pcchLength) {
    return This->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength);
}
static FORCEINLINE HRESULT IMFAttributes_GetBlobSize(IMFAttributes* This,REFGUID guidKey,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFAttributes_GetBlob(IMFAttributes* This,REFGUID guidKey,UINT8 *pBuf,UINT32 cbBufSize,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFAttributes_GetAllocatedBlob(IMFAttributes* This,REFGUID guidKey,UINT8 **ppBuf,UINT32 *pcbSize) {
    return This->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize);
}
static FORCEINLINE HRESULT IMFAttributes_GetUnknown(IMFAttributes* This,REFGUID guidKey,REFIID riid,LPVOID *ppv) {
    return This->lpVtbl->GetUnknown(This,guidKey,riid,ppv);
}
static FORCEINLINE HRESULT IMFAttributes_SetItem(IMFAttributes* This,REFGUID guidKey,REFPROPVARIANT Value) {
    return This->lpVtbl->SetItem(This,guidKey,Value);
}
static FORCEINLINE HRESULT IMFAttributes_DeleteItem(IMFAttributes* This,REFGUID guidKey) {
    return This->lpVtbl->DeleteItem(This,guidKey);
}
static FORCEINLINE HRESULT IMFAttributes_DeleteAllItems(IMFAttributes* This) {
    return This->lpVtbl->DeleteAllItems(This);
}
static FORCEINLINE HRESULT IMFAttributes_SetUINT32(IMFAttributes* This,REFGUID guidKey,UINT32 unValue) {
    return This->lpVtbl->SetUINT32(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFAttributes_SetUINT64(IMFAttributes* This,REFGUID guidKey,UINT64 unValue) {
    return This->lpVtbl->SetUINT64(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFAttributes_SetDouble(IMFAttributes* This,REFGUID guidKey,double fValue) {
    return This->lpVtbl->SetDouble(This,guidKey,fValue);
}
static FORCEINLINE HRESULT IMFAttributes_SetGUID(IMFAttributes* This,REFGUID guidKey,REFGUID guidValue) {
    return This->lpVtbl->SetGUID(This,guidKey,guidValue);
}
static FORCEINLINE HRESULT IMFAttributes_SetString(IMFAttributes* This,REFGUID guidKey,LPCWSTR wszValue) {
    return This->lpVtbl->SetString(This,guidKey,wszValue);
}
static FORCEINLINE HRESULT IMFAttributes_SetBlob(IMFAttributes* This,REFGUID guidKey,const UINT8 *pBuf,UINT32 cbBufSize) {
    return This->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize);
}
static FORCEINLINE HRESULT IMFAttributes_SetUnknown(IMFAttributes* This,REFGUID guidKey,IUnknown *pUnknown) {
    return This->lpVtbl->SetUnknown(This,guidKey,pUnknown);
}
static FORCEINLINE HRESULT IMFAttributes_LockStore(IMFAttributes* This) {
    return This->lpVtbl->LockStore(This);
}
static FORCEINLINE HRESULT IMFAttributes_UnlockStore(IMFAttributes* This) {
    return This->lpVtbl->UnlockStore(This);
}
static FORCEINLINE HRESULT IMFAttributes_GetCount(IMFAttributes* This,UINT32 *pcItems) {
    return This->lpVtbl->GetCount(This,pcItems);
}
static FORCEINLINE HRESULT IMFAttributes_GetItemByIndex(IMFAttributes* This,UINT32 unIndex,GUID *pguidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue);
}
static FORCEINLINE HRESULT IMFAttributes_CopyAllItems(IMFAttributes* This,IMFAttributes *pDest) {
    return This->lpVtbl->CopyAllItems(This,pDest);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFAttributes_GetItem_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    PROPVARIANT *pValue);
void __RPC_STUB IMFAttributes_GetItem_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_GetItemType_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    MF_ATTRIBUTE_TYPE *pType);
void __RPC_STUB IMFAttributes_GetItemType_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_CompareItem_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    REFPROPVARIANT Value,
    WINBOOL *pbResult);
void __RPC_STUB IMFAttributes_CompareItem_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_Compare_Proxy(
    IMFAttributes* This,
    IMFAttributes *pTheirs,
    MF_ATTRIBUTES_MATCH_TYPE MatchType,
    WINBOOL *pbResult);
void __RPC_STUB IMFAttributes_Compare_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_GetUINT32_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    UINT32 *punValue);
void __RPC_STUB IMFAttributes_GetUINT32_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_GetUINT64_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    UINT64 *punValue);
void __RPC_STUB IMFAttributes_GetUINT64_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_GetDouble_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    double *pfValue);
void __RPC_STUB IMFAttributes_GetDouble_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_GetGUID_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    GUID *pguidValue);
void __RPC_STUB IMFAttributes_GetGUID_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_GetStringLength_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    UINT32 *pcchLength);
void __RPC_STUB IMFAttributes_GetStringLength_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_GetString_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    LPWSTR pwszValue,
    UINT32 cchBufSize,
    UINT32 *pcchLength);
void __RPC_STUB IMFAttributes_GetString_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_GetAllocatedString_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    LPWSTR *ppwszValue,
    UINT32 *pcchLength);
void __RPC_STUB IMFAttributes_GetAllocatedString_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_GetBlobSize_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    UINT32 *pcbBlobSize);
void __RPC_STUB IMFAttributes_GetBlobSize_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_GetBlob_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    UINT8 *pBuf,
    UINT32 cbBufSize,
    UINT32 *pcbBlobSize);
void __RPC_STUB IMFAttributes_GetBlob_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_GetAllocatedBlob_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    UINT8 **ppBuf,
    UINT32 *pcbSize);
void __RPC_STUB IMFAttributes_GetAllocatedBlob_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_GetUnknown_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    REFIID riid,
    LPVOID *ppv);
void __RPC_STUB IMFAttributes_GetUnknown_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_SetItem_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    REFPROPVARIANT Value);
void __RPC_STUB IMFAttributes_SetItem_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_DeleteItem_Proxy(
    IMFAttributes* This,
    REFGUID guidKey);
void __RPC_STUB IMFAttributes_DeleteItem_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_DeleteAllItems_Proxy(
    IMFAttributes* This);
void __RPC_STUB IMFAttributes_DeleteAllItems_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_SetUINT32_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    UINT32 unValue);
void __RPC_STUB IMFAttributes_SetUINT32_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_SetUINT64_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    UINT64 unValue);
void __RPC_STUB IMFAttributes_SetUINT64_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_SetDouble_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    double fValue);
void __RPC_STUB IMFAttributes_SetDouble_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_SetGUID_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    REFGUID guidValue);
void __RPC_STUB IMFAttributes_SetGUID_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_SetString_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    LPCWSTR wszValue);
void __RPC_STUB IMFAttributes_SetString_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_SetBlob_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    const UINT8 *pBuf,
    UINT32 cbBufSize);
void __RPC_STUB IMFAttributes_SetBlob_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_SetUnknown_Proxy(
    IMFAttributes* This,
    REFGUID guidKey,
    IUnknown *pUnknown);
void __RPC_STUB IMFAttributes_SetUnknown_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_LockStore_Proxy(
    IMFAttributes* This);
void __RPC_STUB IMFAttributes_LockStore_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_UnlockStore_Proxy(
    IMFAttributes* This);
void __RPC_STUB IMFAttributes_UnlockStore_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_GetCount_Proxy(
    IMFAttributes* This,
    UINT32 *pcItems);
void __RPC_STUB IMFAttributes_GetCount_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_GetItemByIndex_Proxy(
    IMFAttributes* This,
    UINT32 unIndex,
    GUID *pguidKey,
    PROPVARIANT *pValue);
void __RPC_STUB IMFAttributes_GetItemByIndex_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAttributes_CopyAllItems_Proxy(
    IMFAttributes* This,
    IMFAttributes *pDest);
void __RPC_STUB IMFAttributes_CopyAllItems_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFAttributes_INTERFACE_DEFINED__ */


enum MF_ATTRIBUTE_SERIALIZE_OPTIONS {
    MF_ATTRIBUTE_SERIALIZE_UNKNOWN_BYREF = 0x1
};


STDAPI MFSerializeAttributesToStream(IMFAttributes *pAttr, DWORD dwOptions, IStream *pStm);
STDAPI MFDeserializeAttributesFromStream(IMFAttributes *pAttr, DWORD dwOptions, IStream *pStm);

/*****************************************************************************
 * IMFMediaBuffer interface
 */
#ifndef __IMFMediaBuffer_INTERFACE_DEFINED__
#define __IMFMediaBuffer_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFMediaBuffer, 0x045fa593, 0x8799, 0x42b8, 0xbc,0x8d, 0x89,0x68,0xc6,0x45,0x35,0x07);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("045fa593-8799-42b8-bc8d-8968c6453507")
IMFMediaBuffer : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE Lock(
        BYTE **ppbBuffer,
        DWORD *pcbMaxLength,
        DWORD *pcbCurrentLength) = 0;

    virtual HRESULT STDMETHODCALLTYPE Unlock(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetCurrentLength(
        DWORD *pcbCurrentLength) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetCurrentLength(
        DWORD cbCurrentLength) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetMaxLength(
        DWORD *pcbMaxLength) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFMediaBuffer, 0x045fa593, 0x8799, 0x42b8, 0xbc,0x8d, 0x89,0x68,0xc6,0x45,0x35,0x07)
#endif
#else
typedef struct IMFMediaBufferVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFMediaBuffer* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFMediaBuffer* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFMediaBuffer* This);

    /*** IMFMediaBuffer methods ***/
    HRESULT (STDMETHODCALLTYPE *Lock)(
        IMFMediaBuffer* This,
        BYTE **ppbBuffer,
        DWORD *pcbMaxLength,
        DWORD *pcbCurrentLength);

    HRESULT (STDMETHODCALLTYPE *Unlock)(
        IMFMediaBuffer* This);

    HRESULT (STDMETHODCALLTYPE *GetCurrentLength)(
        IMFMediaBuffer* This,
        DWORD *pcbCurrentLength);

    HRESULT (STDMETHODCALLTYPE *SetCurrentLength)(
        IMFMediaBuffer* This,
        DWORD cbCurrentLength);

    HRESULT (STDMETHODCALLTYPE *GetMaxLength)(
        IMFMediaBuffer* This,
        DWORD *pcbMaxLength);

    END_INTERFACE
} IMFMediaBufferVtbl;
interface IMFMediaBuffer {
    CONST_VTBL IMFMediaBufferVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFMediaBuffer_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFMediaBuffer_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFMediaBuffer_Release(This) (This)->lpVtbl->Release(This)
/*** IMFMediaBuffer methods ***/
#define IMFMediaBuffer_Lock(This,ppbBuffer,pcbMaxLength,pcbCurrentLength) (This)->lpVtbl->Lock(This,ppbBuffer,pcbMaxLength,pcbCurrentLength)
#define IMFMediaBuffer_Unlock(This) (This)->lpVtbl->Unlock(This)
#define IMFMediaBuffer_GetCurrentLength(This,pcbCurrentLength) (This)->lpVtbl->GetCurrentLength(This,pcbCurrentLength)
#define IMFMediaBuffer_SetCurrentLength(This,cbCurrentLength) (This)->lpVtbl->SetCurrentLength(This,cbCurrentLength)
#define IMFMediaBuffer_GetMaxLength(This,pcbMaxLength) (This)->lpVtbl->GetMaxLength(This,pcbMaxLength)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFMediaBuffer_QueryInterface(IMFMediaBuffer* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFMediaBuffer_AddRef(IMFMediaBuffer* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFMediaBuffer_Release(IMFMediaBuffer* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFMediaBuffer methods ***/
static FORCEINLINE HRESULT IMFMediaBuffer_Lock(IMFMediaBuffer* This,BYTE **ppbBuffer,DWORD *pcbMaxLength,DWORD *pcbCurrentLength) {
    return This->lpVtbl->Lock(This,ppbBuffer,pcbMaxLength,pcbCurrentLength);
}
static FORCEINLINE HRESULT IMFMediaBuffer_Unlock(IMFMediaBuffer* This) {
    return This->lpVtbl->Unlock(This);
}
static FORCEINLINE HRESULT IMFMediaBuffer_GetCurrentLength(IMFMediaBuffer* This,DWORD *pcbCurrentLength) {
    return This->lpVtbl->GetCurrentLength(This,pcbCurrentLength);
}
static FORCEINLINE HRESULT IMFMediaBuffer_SetCurrentLength(IMFMediaBuffer* This,DWORD cbCurrentLength) {
    return This->lpVtbl->SetCurrentLength(This,cbCurrentLength);
}
static FORCEINLINE HRESULT IMFMediaBuffer_GetMaxLength(IMFMediaBuffer* This,DWORD *pcbMaxLength) {
    return This->lpVtbl->GetMaxLength(This,pcbMaxLength);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFMediaBuffer_Lock_Proxy(
    IMFMediaBuffer* This,
    BYTE **ppbBuffer,
    DWORD *pcbMaxLength,
    DWORD *pcbCurrentLength);
void __RPC_STUB IMFMediaBuffer_Lock_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaBuffer_Unlock_Proxy(
    IMFMediaBuffer* This);
void __RPC_STUB IMFMediaBuffer_Unlock_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaBuffer_GetCurrentLength_Proxy(
    IMFMediaBuffer* This,
    DWORD *pcbCurrentLength);
void __RPC_STUB IMFMediaBuffer_GetCurrentLength_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaBuffer_SetCurrentLength_Proxy(
    IMFMediaBuffer* This,
    DWORD cbCurrentLength);
void __RPC_STUB IMFMediaBuffer_SetCurrentLength_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaBuffer_GetMaxLength_Proxy(
    IMFMediaBuffer* This,
    DWORD *pcbMaxLength);
void __RPC_STUB IMFMediaBuffer_GetMaxLength_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFMediaBuffer_INTERFACE_DEFINED__ */


/*****************************************************************************
 * IMFSample interface
 */
#ifndef __IMFSample_INTERFACE_DEFINED__
#define __IMFSample_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFSample, 0xc40a00f2, 0xb93a, 0x4d80, 0xae,0x8c, 0x5a,0x1c,0x63,0x4f,0x58,0xe4);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("c40a00f2-b93a-4d80-ae8c-5a1c634f58e4")
IMFSample : public IMFAttributes
{
    virtual HRESULT STDMETHODCALLTYPE GetSampleFlags(
        DWORD *pdwSampleFlags) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetSampleFlags(
        DWORD dwSampleFlags) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetSampleTime(
        LONGLONG *phnsSampleTime) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetSampleTime(
        LONGLONG hnsSampleTime) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetSampleDuration(
        LONGLONG *phnsSampleDuration) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetSampleDuration(
        LONGLONG hnsSampleDuration) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetBufferCount(
        DWORD *pdwBufferCount) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetBufferByIndex(
        DWORD dwIndex,
        IMFMediaBuffer **ppBuffer) = 0;

    virtual HRESULT STDMETHODCALLTYPE ConvertToContiguousBuffer(
        IMFMediaBuffer **ppBuffer) = 0;

    virtual HRESULT STDMETHODCALLTYPE AddBuffer(
        IMFMediaBuffer *pBuffer) = 0;

    virtual HRESULT STDMETHODCALLTYPE RemoveBufferByIndex(
        DWORD dwIndex) = 0;

    virtual HRESULT STDMETHODCALLTYPE RemoveAllBuffers(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetTotalLength(
        DWORD *pcbTotalLength) = 0;

    virtual HRESULT STDMETHODCALLTYPE CopyToBuffer(
        IMFMediaBuffer *pBuffer) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFSample, 0xc40a00f2, 0xb93a, 0x4d80, 0xae,0x8c, 0x5a,0x1c,0x63,0x4f,0x58,0xe4)
#endif
#else
typedef struct IMFSampleVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFSample* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFSample* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFSample* This);

    /*** IMFAttributes methods ***/
    HRESULT (STDMETHODCALLTYPE *GetItem)(
        IMFSample* This,
        REFGUID guidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *GetItemType)(
        IMFSample* This,
        REFGUID guidKey,
        MF_ATTRIBUTE_TYPE *pType);

    HRESULT (STDMETHODCALLTYPE *CompareItem)(
        IMFSample* This,
        REFGUID guidKey,
        REFPROPVARIANT Value,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *Compare)(
        IMFSample* This,
        IMFAttributes *pTheirs,
        MF_ATTRIBUTES_MATCH_TYPE MatchType,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *GetUINT32)(
        IMFSample* This,
        REFGUID guidKey,
        UINT32 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetUINT64)(
        IMFSample* This,
        REFGUID guidKey,
        UINT64 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetDouble)(
        IMFSample* This,
        REFGUID guidKey,
        double *pfValue);

    HRESULT (STDMETHODCALLTYPE *GetGUID)(
        IMFSample* This,
        REFGUID guidKey,
        GUID *pguidValue);

    HRESULT (STDMETHODCALLTYPE *GetStringLength)(
        IMFSample* This,
        REFGUID guidKey,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetString)(
        IMFSample* This,
        REFGUID guidKey,
        LPWSTR pwszValue,
        UINT32 cchBufSize,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedString)(
        IMFSample* This,
        REFGUID guidKey,
        LPWSTR *ppwszValue,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetBlobSize)(
        IMFSample* This,
        REFGUID guidKey,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetBlob)(
        IMFSample* This,
        REFGUID guidKey,
        UINT8 *pBuf,
        UINT32 cbBufSize,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedBlob)(
        IMFSample* This,
        REFGUID guidKey,
        UINT8 **ppBuf,
        UINT32 *pcbSize);

    HRESULT (STDMETHODCALLTYPE *GetUnknown)(
        IMFSample* This,
        REFGUID guidKey,
        REFIID riid,
        LPVOID *ppv);

    HRESULT (STDMETHODCALLTYPE *SetItem)(
        IMFSample* This,
        REFGUID guidKey,
        REFPROPVARIANT Value);

    HRESULT (STDMETHODCALLTYPE *DeleteItem)(
        IMFSample* This,
        REFGUID guidKey);

    HRESULT (STDMETHODCALLTYPE *DeleteAllItems)(
        IMFSample* This);

    HRESULT (STDMETHODCALLTYPE *SetUINT32)(
        IMFSample* This,
        REFGUID guidKey,
        UINT32 unValue);

    HRESULT (STDMETHODCALLTYPE *SetUINT64)(
        IMFSample* This,
        REFGUID guidKey,
        UINT64 unValue);

    HRESULT (STDMETHODCALLTYPE *SetDouble)(
        IMFSample* This,
        REFGUID guidKey,
        double fValue);

    HRESULT (STDMETHODCALLTYPE *SetGUID)(
        IMFSample* This,
        REFGUID guidKey,
        REFGUID guidValue);

    HRESULT (STDMETHODCALLTYPE *SetString)(
        IMFSample* This,
        REFGUID guidKey,
        LPCWSTR wszValue);

    HRESULT (STDMETHODCALLTYPE *SetBlob)(
        IMFSample* This,
        REFGUID guidKey,
        const UINT8 *pBuf,
        UINT32 cbBufSize);

    HRESULT (STDMETHODCALLTYPE *SetUnknown)(
        IMFSample* This,
        REFGUID guidKey,
        IUnknown *pUnknown);

    HRESULT (STDMETHODCALLTYPE *LockStore)(
        IMFSample* This);

    HRESULT (STDMETHODCALLTYPE *UnlockStore)(
        IMFSample* This);

    HRESULT (STDMETHODCALLTYPE *GetCount)(
        IMFSample* This,
        UINT32 *pcItems);

    HRESULT (STDMETHODCALLTYPE *GetItemByIndex)(
        IMFSample* This,
        UINT32 unIndex,
        GUID *pguidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *CopyAllItems)(
        IMFSample* This,
        IMFAttributes *pDest);

    /*** IMFSample methods ***/
    HRESULT (STDMETHODCALLTYPE *GetSampleFlags)(
        IMFSample* This,
        DWORD *pdwSampleFlags);

    HRESULT (STDMETHODCALLTYPE *SetSampleFlags)(
        IMFSample* This,
        DWORD dwSampleFlags);

    HRESULT (STDMETHODCALLTYPE *GetSampleTime)(
        IMFSample* This,
        LONGLONG *phnsSampleTime);

    HRESULT (STDMETHODCALLTYPE *SetSampleTime)(
        IMFSample* This,
        LONGLONG hnsSampleTime);

    HRESULT (STDMETHODCALLTYPE *GetSampleDuration)(
        IMFSample* This,
        LONGLONG *phnsSampleDuration);

    HRESULT (STDMETHODCALLTYPE *SetSampleDuration)(
        IMFSample* This,
        LONGLONG hnsSampleDuration);

    HRESULT (STDMETHODCALLTYPE *GetBufferCount)(
        IMFSample* This,
        DWORD *pdwBufferCount);

    HRESULT (STDMETHODCALLTYPE *GetBufferByIndex)(
        IMFSample* This,
        DWORD dwIndex,
        IMFMediaBuffer **ppBuffer);

    HRESULT (STDMETHODCALLTYPE *ConvertToContiguousBuffer)(
        IMFSample* This,
        IMFMediaBuffer **ppBuffer);

    HRESULT (STDMETHODCALLTYPE *AddBuffer)(
        IMFSample* This,
        IMFMediaBuffer *pBuffer);

    HRESULT (STDMETHODCALLTYPE *RemoveBufferByIndex)(
        IMFSample* This,
        DWORD dwIndex);

    HRESULT (STDMETHODCALLTYPE *RemoveAllBuffers)(
        IMFSample* This);

    HRESULT (STDMETHODCALLTYPE *GetTotalLength)(
        IMFSample* This,
        DWORD *pcbTotalLength);

    HRESULT (STDMETHODCALLTYPE *CopyToBuffer)(
        IMFSample* This,
        IMFMediaBuffer *pBuffer);

    END_INTERFACE
} IMFSampleVtbl;
interface IMFSample {
    CONST_VTBL IMFSampleVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFSample_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFSample_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFSample_Release(This) (This)->lpVtbl->Release(This)
/*** IMFAttributes methods ***/
#define IMFSample_GetItem(This,guidKey,pValue) (This)->lpVtbl->GetItem(This,guidKey,pValue)
#define IMFSample_GetItemType(This,guidKey,pType) (This)->lpVtbl->GetItemType(This,guidKey,pType)
#define IMFSample_CompareItem(This,guidKey,Value,pbResult) (This)->lpVtbl->CompareItem(This,guidKey,Value,pbResult)
#define IMFSample_Compare(This,pTheirs,MatchType,pbResult) (This)->lpVtbl->Compare(This,pTheirs,MatchType,pbResult)
#define IMFSample_GetUINT32(This,guidKey,punValue) (This)->lpVtbl->GetUINT32(This,guidKey,punValue)
#define IMFSample_GetUINT64(This,guidKey,punValue) (This)->lpVtbl->GetUINT64(This,guidKey,punValue)
#define IMFSample_GetDouble(This,guidKey,pfValue) (This)->lpVtbl->GetDouble(This,guidKey,pfValue)
#define IMFSample_GetGUID(This,guidKey,pguidValue) (This)->lpVtbl->GetGUID(This,guidKey,pguidValue)
#define IMFSample_GetStringLength(This,guidKey,pcchLength) (This)->lpVtbl->GetStringLength(This,guidKey,pcchLength)
#define IMFSample_GetString(This,guidKey,pwszValue,cchBufSize,pcchLength) (This)->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength)
#define IMFSample_GetAllocatedString(This,guidKey,ppwszValue,pcchLength) (This)->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength)
#define IMFSample_GetBlobSize(This,guidKey,pcbBlobSize) (This)->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize)
#define IMFSample_GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize) (This)->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize)
#define IMFSample_GetAllocatedBlob(This,guidKey,ppBuf,pcbSize) (This)->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize)
#define IMFSample_GetUnknown(This,guidKey,riid,ppv) (This)->lpVtbl->GetUnknown(This,guidKey,riid,ppv)
#define IMFSample_SetItem(This,guidKey,Value) (This)->lpVtbl->SetItem(This,guidKey,Value)
#define IMFSample_DeleteItem(This,guidKey) (This)->lpVtbl->DeleteItem(This,guidKey)
#define IMFSample_DeleteAllItems(This) (This)->lpVtbl->DeleteAllItems(This)
#define IMFSample_SetUINT32(This,guidKey,unValue) (This)->lpVtbl->SetUINT32(This,guidKey,unValue)
#define IMFSample_SetUINT64(This,guidKey,unValue) (This)->lpVtbl->SetUINT64(This,guidKey,unValue)
#define IMFSample_SetDouble(This,guidKey,fValue) (This)->lpVtbl->SetDouble(This,guidKey,fValue)
#define IMFSample_SetGUID(This,guidKey,guidValue) (This)->lpVtbl->SetGUID(This,guidKey,guidValue)
#define IMFSample_SetString(This,guidKey,wszValue) (This)->lpVtbl->SetString(This,guidKey,wszValue)
#define IMFSample_SetBlob(This,guidKey,pBuf,cbBufSize) (This)->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize)
#define IMFSample_SetUnknown(This,guidKey,pUnknown) (This)->lpVtbl->SetUnknown(This,guidKey,pUnknown)
#define IMFSample_LockStore(This) (This)->lpVtbl->LockStore(This)
#define IMFSample_UnlockStore(This) (This)->lpVtbl->UnlockStore(This)
#define IMFSample_GetCount(This,pcItems) (This)->lpVtbl->GetCount(This,pcItems)
#define IMFSample_GetItemByIndex(This,unIndex,pguidKey,pValue) (This)->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue)
#define IMFSample_CopyAllItems(This,pDest) (This)->lpVtbl->CopyAllItems(This,pDest)
/*** IMFSample methods ***/
#define IMFSample_GetSampleFlags(This,pdwSampleFlags) (This)->lpVtbl->GetSampleFlags(This,pdwSampleFlags)
#define IMFSample_SetSampleFlags(This,dwSampleFlags) (This)->lpVtbl->SetSampleFlags(This,dwSampleFlags)
#define IMFSample_GetSampleTime(This,phnsSampleTime) (This)->lpVtbl->GetSampleTime(This,phnsSampleTime)
#define IMFSample_SetSampleTime(This,hnsSampleTime) (This)->lpVtbl->SetSampleTime(This,hnsSampleTime)
#define IMFSample_GetSampleDuration(This,phnsSampleDuration) (This)->lpVtbl->GetSampleDuration(This,phnsSampleDuration)
#define IMFSample_SetSampleDuration(This,hnsSampleDuration) (This)->lpVtbl->SetSampleDuration(This,hnsSampleDuration)
#define IMFSample_GetBufferCount(This,pdwBufferCount) (This)->lpVtbl->GetBufferCount(This,pdwBufferCount)
#define IMFSample_GetBufferByIndex(This,dwIndex,ppBuffer) (This)->lpVtbl->GetBufferByIndex(This,dwIndex,ppBuffer)
#define IMFSample_ConvertToContiguousBuffer(This,ppBuffer) (This)->lpVtbl->ConvertToContiguousBuffer(This,ppBuffer)
#define IMFSample_AddBuffer(This,pBuffer) (This)->lpVtbl->AddBuffer(This,pBuffer)
#define IMFSample_RemoveBufferByIndex(This,dwIndex) (This)->lpVtbl->RemoveBufferByIndex(This,dwIndex)
#define IMFSample_RemoveAllBuffers(This) (This)->lpVtbl->RemoveAllBuffers(This)
#define IMFSample_GetTotalLength(This,pcbTotalLength) (This)->lpVtbl->GetTotalLength(This,pcbTotalLength)
#define IMFSample_CopyToBuffer(This,pBuffer) (This)->lpVtbl->CopyToBuffer(This,pBuffer)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFSample_QueryInterface(IMFSample* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFSample_AddRef(IMFSample* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFSample_Release(IMFSample* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFAttributes methods ***/
static FORCEINLINE HRESULT IMFSample_GetItem(IMFSample* This,REFGUID guidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItem(This,guidKey,pValue);
}
static FORCEINLINE HRESULT IMFSample_GetItemType(IMFSample* This,REFGUID guidKey,MF_ATTRIBUTE_TYPE *pType) {
    return This->lpVtbl->GetItemType(This,guidKey,pType);
}
static FORCEINLINE HRESULT IMFSample_CompareItem(IMFSample* This,REFGUID guidKey,REFPROPVARIANT Value,WINBOOL *pbResult) {
    return This->lpVtbl->CompareItem(This,guidKey,Value,pbResult);
}
static FORCEINLINE HRESULT IMFSample_Compare(IMFSample* This,IMFAttributes *pTheirs,MF_ATTRIBUTES_MATCH_TYPE MatchType,WINBOOL *pbResult) {
    return This->lpVtbl->Compare(This,pTheirs,MatchType,pbResult);
}
static FORCEINLINE HRESULT IMFSample_GetUINT32(IMFSample* This,REFGUID guidKey,UINT32 *punValue) {
    return This->lpVtbl->GetUINT32(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFSample_GetUINT64(IMFSample* This,REFGUID guidKey,UINT64 *punValue) {
    return This->lpVtbl->GetUINT64(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFSample_GetDouble(IMFSample* This,REFGUID guidKey,double *pfValue) {
    return This->lpVtbl->GetDouble(This,guidKey,pfValue);
}
static FORCEINLINE HRESULT IMFSample_GetGUID(IMFSample* This,REFGUID guidKey,GUID *pguidValue) {
    return This->lpVtbl->GetGUID(This,guidKey,pguidValue);
}
static FORCEINLINE HRESULT IMFSample_GetStringLength(IMFSample* This,REFGUID guidKey,UINT32 *pcchLength) {
    return This->lpVtbl->GetStringLength(This,guidKey,pcchLength);
}
static FORCEINLINE HRESULT IMFSample_GetString(IMFSample* This,REFGUID guidKey,LPWSTR pwszValue,UINT32 cchBufSize,UINT32 *pcchLength) {
    return This->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength);
}
static FORCEINLINE HRESULT IMFSample_GetAllocatedString(IMFSample* This,REFGUID guidKey,LPWSTR *ppwszValue,UINT32 *pcchLength) {
    return This->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength);
}
static FORCEINLINE HRESULT IMFSample_GetBlobSize(IMFSample* This,REFGUID guidKey,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFSample_GetBlob(IMFSample* This,REFGUID guidKey,UINT8 *pBuf,UINT32 cbBufSize,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFSample_GetAllocatedBlob(IMFSample* This,REFGUID guidKey,UINT8 **ppBuf,UINT32 *pcbSize) {
    return This->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize);
}
static FORCEINLINE HRESULT IMFSample_GetUnknown(IMFSample* This,REFGUID guidKey,REFIID riid,LPVOID *ppv) {
    return This->lpVtbl->GetUnknown(This,guidKey,riid,ppv);
}
static FORCEINLINE HRESULT IMFSample_SetItem(IMFSample* This,REFGUID guidKey,REFPROPVARIANT Value) {
    return This->lpVtbl->SetItem(This,guidKey,Value);
}
static FORCEINLINE HRESULT IMFSample_DeleteItem(IMFSample* This,REFGUID guidKey) {
    return This->lpVtbl->DeleteItem(This,guidKey);
}
static FORCEINLINE HRESULT IMFSample_DeleteAllItems(IMFSample* This) {
    return This->lpVtbl->DeleteAllItems(This);
}
static FORCEINLINE HRESULT IMFSample_SetUINT32(IMFSample* This,REFGUID guidKey,UINT32 unValue) {
    return This->lpVtbl->SetUINT32(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFSample_SetUINT64(IMFSample* This,REFGUID guidKey,UINT64 unValue) {
    return This->lpVtbl->SetUINT64(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFSample_SetDouble(IMFSample* This,REFGUID guidKey,double fValue) {
    return This->lpVtbl->SetDouble(This,guidKey,fValue);
}
static FORCEINLINE HRESULT IMFSample_SetGUID(IMFSample* This,REFGUID guidKey,REFGUID guidValue) {
    return This->lpVtbl->SetGUID(This,guidKey,guidValue);
}
static FORCEINLINE HRESULT IMFSample_SetString(IMFSample* This,REFGUID guidKey,LPCWSTR wszValue) {
    return This->lpVtbl->SetString(This,guidKey,wszValue);
}
static FORCEINLINE HRESULT IMFSample_SetBlob(IMFSample* This,REFGUID guidKey,const UINT8 *pBuf,UINT32 cbBufSize) {
    return This->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize);
}
static FORCEINLINE HRESULT IMFSample_SetUnknown(IMFSample* This,REFGUID guidKey,IUnknown *pUnknown) {
    return This->lpVtbl->SetUnknown(This,guidKey,pUnknown);
}
static FORCEINLINE HRESULT IMFSample_LockStore(IMFSample* This) {
    return This->lpVtbl->LockStore(This);
}
static FORCEINLINE HRESULT IMFSample_UnlockStore(IMFSample* This) {
    return This->lpVtbl->UnlockStore(This);
}
static FORCEINLINE HRESULT IMFSample_GetCount(IMFSample* This,UINT32 *pcItems) {
    return This->lpVtbl->GetCount(This,pcItems);
}
static FORCEINLINE HRESULT IMFSample_GetItemByIndex(IMFSample* This,UINT32 unIndex,GUID *pguidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue);
}
static FORCEINLINE HRESULT IMFSample_CopyAllItems(IMFSample* This,IMFAttributes *pDest) {
    return This->lpVtbl->CopyAllItems(This,pDest);
}
/*** IMFSample methods ***/
static FORCEINLINE HRESULT IMFSample_GetSampleFlags(IMFSample* This,DWORD *pdwSampleFlags) {
    return This->lpVtbl->GetSampleFlags(This,pdwSampleFlags);
}
static FORCEINLINE HRESULT IMFSample_SetSampleFlags(IMFSample* This,DWORD dwSampleFlags) {
    return This->lpVtbl->SetSampleFlags(This,dwSampleFlags);
}
static FORCEINLINE HRESULT IMFSample_GetSampleTime(IMFSample* This,LONGLONG *phnsSampleTime) {
    return This->lpVtbl->GetSampleTime(This,phnsSampleTime);
}
static FORCEINLINE HRESULT IMFSample_SetSampleTime(IMFSample* This,LONGLONG hnsSampleTime) {
    return This->lpVtbl->SetSampleTime(This,hnsSampleTime);
}
static FORCEINLINE HRESULT IMFSample_GetSampleDuration(IMFSample* This,LONGLONG *phnsSampleDuration) {
    return This->lpVtbl->GetSampleDuration(This,phnsSampleDuration);
}
static FORCEINLINE HRESULT IMFSample_SetSampleDuration(IMFSample* This,LONGLONG hnsSampleDuration) {
    return This->lpVtbl->SetSampleDuration(This,hnsSampleDuration);
}
static FORCEINLINE HRESULT IMFSample_GetBufferCount(IMFSample* This,DWORD *pdwBufferCount) {
    return This->lpVtbl->GetBufferCount(This,pdwBufferCount);
}
static FORCEINLINE HRESULT IMFSample_GetBufferByIndex(IMFSample* This,DWORD dwIndex,IMFMediaBuffer **ppBuffer) {
    return This->lpVtbl->GetBufferByIndex(This,dwIndex,ppBuffer);
}
static FORCEINLINE HRESULT IMFSample_ConvertToContiguousBuffer(IMFSample* This,IMFMediaBuffer **ppBuffer) {
    return This->lpVtbl->ConvertToContiguousBuffer(This,ppBuffer);
}
static FORCEINLINE HRESULT IMFSample_AddBuffer(IMFSample* This,IMFMediaBuffer *pBuffer) {
    return This->lpVtbl->AddBuffer(This,pBuffer);
}
static FORCEINLINE HRESULT IMFSample_RemoveBufferByIndex(IMFSample* This,DWORD dwIndex) {
    return This->lpVtbl->RemoveBufferByIndex(This,dwIndex);
}
static FORCEINLINE HRESULT IMFSample_RemoveAllBuffers(IMFSample* This) {
    return This->lpVtbl->RemoveAllBuffers(This);
}
static FORCEINLINE HRESULT IMFSample_GetTotalLength(IMFSample* This,DWORD *pcbTotalLength) {
    return This->lpVtbl->GetTotalLength(This,pcbTotalLength);
}
static FORCEINLINE HRESULT IMFSample_CopyToBuffer(IMFSample* This,IMFMediaBuffer *pBuffer) {
    return This->lpVtbl->CopyToBuffer(This,pBuffer);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFSample_GetSampleFlags_Proxy(
    IMFSample* This,
    DWORD *pdwSampleFlags);
void __RPC_STUB IMFSample_GetSampleFlags_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSample_SetSampleFlags_Proxy(
    IMFSample* This,
    DWORD dwSampleFlags);
void __RPC_STUB IMFSample_SetSampleFlags_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSample_GetSampleTime_Proxy(
    IMFSample* This,
    LONGLONG *phnsSampleTime);
void __RPC_STUB IMFSample_GetSampleTime_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSample_SetSampleTime_Proxy(
    IMFSample* This,
    LONGLONG hnsSampleTime);
void __RPC_STUB IMFSample_SetSampleTime_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSample_GetSampleDuration_Proxy(
    IMFSample* This,
    LONGLONG *phnsSampleDuration);
void __RPC_STUB IMFSample_GetSampleDuration_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSample_SetSampleDuration_Proxy(
    IMFSample* This,
    LONGLONG hnsSampleDuration);
void __RPC_STUB IMFSample_SetSampleDuration_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSample_GetBufferCount_Proxy(
    IMFSample* This,
    DWORD *pdwBufferCount);
void __RPC_STUB IMFSample_GetBufferCount_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSample_GetBufferByIndex_Proxy(
    IMFSample* This,
    DWORD dwIndex,
    IMFMediaBuffer **ppBuffer);
void __RPC_STUB IMFSample_GetBufferByIndex_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSample_ConvertToContiguousBuffer_Proxy(
    IMFSample* This,
    IMFMediaBuffer **ppBuffer);
void __RPC_STUB IMFSample_ConvertToContiguousBuffer_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSample_AddBuffer_Proxy(
    IMFSample* This,
    IMFMediaBuffer *pBuffer);
void __RPC_STUB IMFSample_AddBuffer_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSample_RemoveBufferByIndex_Proxy(
    IMFSample* This,
    DWORD dwIndex);
void __RPC_STUB IMFSample_RemoveBufferByIndex_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSample_RemoveAllBuffers_Proxy(
    IMFSample* This);
void __RPC_STUB IMFSample_RemoveAllBuffers_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSample_GetTotalLength_Proxy(
    IMFSample* This,
    DWORD *pcbTotalLength);
void __RPC_STUB IMFSample_GetTotalLength_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSample_CopyToBuffer_Proxy(
    IMFSample* This,
    IMFMediaBuffer *pBuffer);
void __RPC_STUB IMFSample_CopyToBuffer_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFSample_INTERFACE_DEFINED__ */


/*****************************************************************************
 * IMF2DBuffer interface
 */
#ifndef __IMF2DBuffer_INTERFACE_DEFINED__
#define __IMF2DBuffer_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMF2DBuffer, 0x7dc9d5f9, 0x9ed9, 0x44ec, 0x9b,0xbf, 0x06,0x00,0xbb,0x58,0x9f,0xbb);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("7dc9d5f9-9ed9-44ec-9bbf-0600bb589fbb")
IMF2DBuffer : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE Lock2D(
        BYTE **ppbScanline0,
        LONG *plPitch) = 0;

    virtual HRESULT STDMETHODCALLTYPE Unlock2D(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetScanline0AndPitch(
        BYTE **pbScanline0,
        LONG *plPitch) = 0;

    virtual HRESULT STDMETHODCALLTYPE IsContiguousFormat(
        WINBOOL *pfIsContiguous) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetContiguousLength(
        DWORD *pcbLength) = 0;

    virtual HRESULT STDMETHODCALLTYPE ContiguousCopyTo(
        BYTE *pbDestBuffer,
        DWORD cbDestBuffer) = 0;

    virtual HRESULT STDMETHODCALLTYPE ContiguousCopyFrom(
        const BYTE *pbSrcBuffer,
        DWORD cbSrcBuffer) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMF2DBuffer, 0x7dc9d5f9, 0x9ed9, 0x44ec, 0x9b,0xbf, 0x06,0x00,0xbb,0x58,0x9f,0xbb)
#endif
#else
typedef struct IMF2DBufferVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMF2DBuffer* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMF2DBuffer* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMF2DBuffer* This);

    /*** IMF2DBuffer methods ***/
    HRESULT (STDMETHODCALLTYPE *Lock2D)(
        IMF2DBuffer* This,
        BYTE **ppbScanline0,
        LONG *plPitch);

    HRESULT (STDMETHODCALLTYPE *Unlock2D)(
        IMF2DBuffer* This);

    HRESULT (STDMETHODCALLTYPE *GetScanline0AndPitch)(
        IMF2DBuffer* This,
        BYTE **pbScanline0,
        LONG *plPitch);

    HRESULT (STDMETHODCALLTYPE *IsContiguousFormat)(
        IMF2DBuffer* This,
        WINBOOL *pfIsContiguous);

    HRESULT (STDMETHODCALLTYPE *GetContiguousLength)(
        IMF2DBuffer* This,
        DWORD *pcbLength);

    HRESULT (STDMETHODCALLTYPE *ContiguousCopyTo)(
        IMF2DBuffer* This,
        BYTE *pbDestBuffer,
        DWORD cbDestBuffer);

    HRESULT (STDMETHODCALLTYPE *ContiguousCopyFrom)(
        IMF2DBuffer* This,
        const BYTE *pbSrcBuffer,
        DWORD cbSrcBuffer);

    END_INTERFACE
} IMF2DBufferVtbl;
interface IMF2DBuffer {
    CONST_VTBL IMF2DBufferVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMF2DBuffer_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMF2DBuffer_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMF2DBuffer_Release(This) (This)->lpVtbl->Release(This)
/*** IMF2DBuffer methods ***/
#define IMF2DBuffer_Lock2D(This,ppbScanline0,plPitch) (This)->lpVtbl->Lock2D(This,ppbScanline0,plPitch)
#define IMF2DBuffer_Unlock2D(This) (This)->lpVtbl->Unlock2D(This)
#define IMF2DBuffer_GetScanline0AndPitch(This,pbScanline0,plPitch) (This)->lpVtbl->GetScanline0AndPitch(This,pbScanline0,plPitch)
#define IMF2DBuffer_IsContiguousFormat(This,pfIsContiguous) (This)->lpVtbl->IsContiguousFormat(This,pfIsContiguous)
#define IMF2DBuffer_GetContiguousLength(This,pcbLength) (This)->lpVtbl->GetContiguousLength(This,pcbLength)
#define IMF2DBuffer_ContiguousCopyTo(This,pbDestBuffer,cbDestBuffer) (This)->lpVtbl->ContiguousCopyTo(This,pbDestBuffer,cbDestBuffer)
#define IMF2DBuffer_ContiguousCopyFrom(This,pbSrcBuffer,cbSrcBuffer) (This)->lpVtbl->ContiguousCopyFrom(This,pbSrcBuffer,cbSrcBuffer)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMF2DBuffer_QueryInterface(IMF2DBuffer* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMF2DBuffer_AddRef(IMF2DBuffer* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMF2DBuffer_Release(IMF2DBuffer* This) {
    return This->lpVtbl->Release(This);
}
/*** IMF2DBuffer methods ***/
static FORCEINLINE HRESULT IMF2DBuffer_Lock2D(IMF2DBuffer* This,BYTE **ppbScanline0,LONG *plPitch) {
    return This->lpVtbl->Lock2D(This,ppbScanline0,plPitch);
}
static FORCEINLINE HRESULT IMF2DBuffer_Unlock2D(IMF2DBuffer* This) {
    return This->lpVtbl->Unlock2D(This);
}
static FORCEINLINE HRESULT IMF2DBuffer_GetScanline0AndPitch(IMF2DBuffer* This,BYTE **pbScanline0,LONG *plPitch) {
    return This->lpVtbl->GetScanline0AndPitch(This,pbScanline0,plPitch);
}
static FORCEINLINE HRESULT IMF2DBuffer_IsContiguousFormat(IMF2DBuffer* This,WINBOOL *pfIsContiguous) {
    return This->lpVtbl->IsContiguousFormat(This,pfIsContiguous);
}
static FORCEINLINE HRESULT IMF2DBuffer_GetContiguousLength(IMF2DBuffer* This,DWORD *pcbLength) {
    return This->lpVtbl->GetContiguousLength(This,pcbLength);
}
static FORCEINLINE HRESULT IMF2DBuffer_ContiguousCopyTo(IMF2DBuffer* This,BYTE *pbDestBuffer,DWORD cbDestBuffer) {
    return This->lpVtbl->ContiguousCopyTo(This,pbDestBuffer,cbDestBuffer);
}
static FORCEINLINE HRESULT IMF2DBuffer_ContiguousCopyFrom(IMF2DBuffer* This,const BYTE *pbSrcBuffer,DWORD cbSrcBuffer) {
    return This->lpVtbl->ContiguousCopyFrom(This,pbSrcBuffer,cbSrcBuffer);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMF2DBuffer_Lock2D_Proxy(
    IMF2DBuffer* This,
    BYTE **ppbScanline0,
    LONG *plPitch);
void __RPC_STUB IMF2DBuffer_Lock2D_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMF2DBuffer_Unlock2D_Proxy(
    IMF2DBuffer* This);
void __RPC_STUB IMF2DBuffer_Unlock2D_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMF2DBuffer_GetScanline0AndPitch_Proxy(
    IMF2DBuffer* This,
    BYTE **pbScanline0,
    LONG *plPitch);
void __RPC_STUB IMF2DBuffer_GetScanline0AndPitch_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMF2DBuffer_IsContiguousFormat_Proxy(
    IMF2DBuffer* This,
    WINBOOL *pfIsContiguous);
void __RPC_STUB IMF2DBuffer_IsContiguousFormat_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMF2DBuffer_GetContiguousLength_Proxy(
    IMF2DBuffer* This,
    DWORD *pcbLength);
void __RPC_STUB IMF2DBuffer_GetContiguousLength_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMF2DBuffer_ContiguousCopyTo_Proxy(
    IMF2DBuffer* This,
    BYTE *pbDestBuffer,
    DWORD cbDestBuffer);
void __RPC_STUB IMF2DBuffer_ContiguousCopyTo_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMF2DBuffer_ContiguousCopyFrom_Proxy(
    IMF2DBuffer* This,
    const BYTE *pbSrcBuffer,
    DWORD cbSrcBuffer);
void __RPC_STUB IMF2DBuffer_ContiguousCopyFrom_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMF2DBuffer_INTERFACE_DEFINED__ */


typedef enum _MF2DBuffer_LockFlags {
    MF2DBuffer_LockFlags_LockTypeMask = (0x1 | 0x2) | 0x3,
    MF2DBuffer_LockFlags_Read = 0x1,
    MF2DBuffer_LockFlags_Write = 0x2,
    MF2DBuffer_LockFlags_ReadWrite = 0x3,
    MF2DBuffer_LockFlags_ForceDWORD = 0x7fffffff
} MF2DBuffer_LockFlags;

/*****************************************************************************
 * IMF2DBuffer2 interface
 */
#ifndef __IMF2DBuffer2_INTERFACE_DEFINED__
#define __IMF2DBuffer2_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMF2DBuffer2, 0x33ae5ea6, 0x4316, 0x436f, 0x8d,0xdd, 0xd7,0x3d,0x22,0xf8,0x29,0xec);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("33ae5ea6-4316-436f-8ddd-d73d22f829ec")
IMF2DBuffer2 : public IMF2DBuffer
{
    virtual HRESULT STDMETHODCALLTYPE Lock2DSize(
        MF2DBuffer_LockFlags lockFlags,
        BYTE **ppbScanline0,
        LONG *plPitch,
        BYTE **ppbBufferStart,
        DWORD *pcbBufferLength) = 0;

    virtual HRESULT STDMETHODCALLTYPE Copy2DTo(
        IMF2DBuffer2 *pDestBuffer) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMF2DBuffer2, 0x33ae5ea6, 0x4316, 0x436f, 0x8d,0xdd, 0xd7,0x3d,0x22,0xf8,0x29,0xec)
#endif
#else
typedef struct IMF2DBuffer2Vtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMF2DBuffer2* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMF2DBuffer2* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMF2DBuffer2* This);

    /*** IMF2DBuffer methods ***/
    HRESULT (STDMETHODCALLTYPE *Lock2D)(
        IMF2DBuffer2* This,
        BYTE **ppbScanline0,
        LONG *plPitch);

    HRESULT (STDMETHODCALLTYPE *Unlock2D)(
        IMF2DBuffer2* This);

    HRESULT (STDMETHODCALLTYPE *GetScanline0AndPitch)(
        IMF2DBuffer2* This,
        BYTE **pbScanline0,
        LONG *plPitch);

    HRESULT (STDMETHODCALLTYPE *IsContiguousFormat)(
        IMF2DBuffer2* This,
        WINBOOL *pfIsContiguous);

    HRESULT (STDMETHODCALLTYPE *GetContiguousLength)(
        IMF2DBuffer2* This,
        DWORD *pcbLength);

    HRESULT (STDMETHODCALLTYPE *ContiguousCopyTo)(
        IMF2DBuffer2* This,
        BYTE *pbDestBuffer,
        DWORD cbDestBuffer);

    HRESULT (STDMETHODCALLTYPE *ContiguousCopyFrom)(
        IMF2DBuffer2* This,
        const BYTE *pbSrcBuffer,
        DWORD cbSrcBuffer);

    /*** IMF2DBuffer2 methods ***/
    HRESULT (STDMETHODCALLTYPE *Lock2DSize)(
        IMF2DBuffer2* This,
        MF2DBuffer_LockFlags lockFlags,
        BYTE **ppbScanline0,
        LONG *plPitch,
        BYTE **ppbBufferStart,
        DWORD *pcbBufferLength);

    HRESULT (STDMETHODCALLTYPE *Copy2DTo)(
        IMF2DBuffer2* This,
        IMF2DBuffer2 *pDestBuffer);

    END_INTERFACE
} IMF2DBuffer2Vtbl;
interface IMF2DBuffer2 {
    CONST_VTBL IMF2DBuffer2Vtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMF2DBuffer2_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMF2DBuffer2_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMF2DBuffer2_Release(This) (This)->lpVtbl->Release(This)
/*** IMF2DBuffer methods ***/
#define IMF2DBuffer2_Lock2D(This,ppbScanline0,plPitch) (This)->lpVtbl->Lock2D(This,ppbScanline0,plPitch)
#define IMF2DBuffer2_Unlock2D(This) (This)->lpVtbl->Unlock2D(This)
#define IMF2DBuffer2_GetScanline0AndPitch(This,pbScanline0,plPitch) (This)->lpVtbl->GetScanline0AndPitch(This,pbScanline0,plPitch)
#define IMF2DBuffer2_IsContiguousFormat(This,pfIsContiguous) (This)->lpVtbl->IsContiguousFormat(This,pfIsContiguous)
#define IMF2DBuffer2_GetContiguousLength(This,pcbLength) (This)->lpVtbl->GetContiguousLength(This,pcbLength)
#define IMF2DBuffer2_ContiguousCopyTo(This,pbDestBuffer,cbDestBuffer) (This)->lpVtbl->ContiguousCopyTo(This,pbDestBuffer,cbDestBuffer)
#define IMF2DBuffer2_ContiguousCopyFrom(This,pbSrcBuffer,cbSrcBuffer) (This)->lpVtbl->ContiguousCopyFrom(This,pbSrcBuffer,cbSrcBuffer)
/*** IMF2DBuffer2 methods ***/
#define IMF2DBuffer2_Lock2DSize(This,lockFlags,ppbScanline0,plPitch,ppbBufferStart,pcbBufferLength) (This)->lpVtbl->Lock2DSize(This,lockFlags,ppbScanline0,plPitch,ppbBufferStart,pcbBufferLength)
#define IMF2DBuffer2_Copy2DTo(This,pDestBuffer) (This)->lpVtbl->Copy2DTo(This,pDestBuffer)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMF2DBuffer2_QueryInterface(IMF2DBuffer2* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMF2DBuffer2_AddRef(IMF2DBuffer2* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMF2DBuffer2_Release(IMF2DBuffer2* This) {
    return This->lpVtbl->Release(This);
}
/*** IMF2DBuffer methods ***/
static FORCEINLINE HRESULT IMF2DBuffer2_Lock2D(IMF2DBuffer2* This,BYTE **ppbScanline0,LONG *plPitch) {
    return This->lpVtbl->Lock2D(This,ppbScanline0,plPitch);
}
static FORCEINLINE HRESULT IMF2DBuffer2_Unlock2D(IMF2DBuffer2* This) {
    return This->lpVtbl->Unlock2D(This);
}
static FORCEINLINE HRESULT IMF2DBuffer2_GetScanline0AndPitch(IMF2DBuffer2* This,BYTE **pbScanline0,LONG *plPitch) {
    return This->lpVtbl->GetScanline0AndPitch(This,pbScanline0,plPitch);
}
static FORCEINLINE HRESULT IMF2DBuffer2_IsContiguousFormat(IMF2DBuffer2* This,WINBOOL *pfIsContiguous) {
    return This->lpVtbl->IsContiguousFormat(This,pfIsContiguous);
}
static FORCEINLINE HRESULT IMF2DBuffer2_GetContiguousLength(IMF2DBuffer2* This,DWORD *pcbLength) {
    return This->lpVtbl->GetContiguousLength(This,pcbLength);
}
static FORCEINLINE HRESULT IMF2DBuffer2_ContiguousCopyTo(IMF2DBuffer2* This,BYTE *pbDestBuffer,DWORD cbDestBuffer) {
    return This->lpVtbl->ContiguousCopyTo(This,pbDestBuffer,cbDestBuffer);
}
static FORCEINLINE HRESULT IMF2DBuffer2_ContiguousCopyFrom(IMF2DBuffer2* This,const BYTE *pbSrcBuffer,DWORD cbSrcBuffer) {
    return This->lpVtbl->ContiguousCopyFrom(This,pbSrcBuffer,cbSrcBuffer);
}
/*** IMF2DBuffer2 methods ***/
static FORCEINLINE HRESULT IMF2DBuffer2_Lock2DSize(IMF2DBuffer2* This,MF2DBuffer_LockFlags lockFlags,BYTE **ppbScanline0,LONG *plPitch,BYTE **ppbBufferStart,DWORD *pcbBufferLength) {
    return This->lpVtbl->Lock2DSize(This,lockFlags,ppbScanline0,plPitch,ppbBufferStart,pcbBufferLength);
}
static FORCEINLINE HRESULT IMF2DBuffer2_Copy2DTo(IMF2DBuffer2* This,IMF2DBuffer2 *pDestBuffer) {
    return This->lpVtbl->Copy2DTo(This,pDestBuffer);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMF2DBuffer2_Lock2DSize_Proxy(
    IMF2DBuffer2* This,
    MF2DBuffer_LockFlags lockFlags,
    BYTE **ppbScanline0,
    LONG *plPitch,
    BYTE **ppbBufferStart,
    DWORD *pcbBufferLength);
void __RPC_STUB IMF2DBuffer2_Lock2DSize_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMF2DBuffer2_Copy2DTo_Proxy(
    IMF2DBuffer2* This,
    IMF2DBuffer2 *pDestBuffer);
void __RPC_STUB IMF2DBuffer2_Copy2DTo_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMF2DBuffer2_INTERFACE_DEFINED__ */


/*****************************************************************************
 * IMFDXGIBuffer interface
 */
#ifndef __IMFDXGIBuffer_INTERFACE_DEFINED__
#define __IMFDXGIBuffer_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFDXGIBuffer, 0xe7174cfa, 0x1c9e, 0x48b1, 0x88,0x66, 0x62,0x62,0x26,0xbf,0xc2,0x58);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("e7174cfa-1c9e-48b1-8866-626226bfc258")
IMFDXGIBuffer : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE GetResource(
        REFIID riid,
        LPVOID *ppvObject) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetSubresourceIndex(
        UINT *puSubresource) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetUnknown(
        REFIID guid,
        REFIID riid,
        LPVOID *ppvObject) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetUnknown(
        REFIID guid,
        IUnknown *pUnkData) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFDXGIBuffer, 0xe7174cfa, 0x1c9e, 0x48b1, 0x88,0x66, 0x62,0x62,0x26,0xbf,0xc2,0x58)
#endif
#else
typedef struct IMFDXGIBufferVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFDXGIBuffer* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFDXGIBuffer* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFDXGIBuffer* This);

    /*** IMFDXGIBuffer methods ***/
    HRESULT (STDMETHODCALLTYPE *GetResource)(
        IMFDXGIBuffer* This,
        REFIID riid,
        LPVOID *ppvObject);

    HRESULT (STDMETHODCALLTYPE *GetSubresourceIndex)(
        IMFDXGIBuffer* This,
        UINT *puSubresource);

    HRESULT (STDMETHODCALLTYPE *GetUnknown)(
        IMFDXGIBuffer* This,
        REFIID guid,
        REFIID riid,
        LPVOID *ppvObject);

    HRESULT (STDMETHODCALLTYPE *SetUnknown)(
        IMFDXGIBuffer* This,
        REFIID guid,
        IUnknown *pUnkData);

    END_INTERFACE
} IMFDXGIBufferVtbl;
interface IMFDXGIBuffer {
    CONST_VTBL IMFDXGIBufferVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFDXGIBuffer_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFDXGIBuffer_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFDXGIBuffer_Release(This) (This)->lpVtbl->Release(This)
/*** IMFDXGIBuffer methods ***/
#define IMFDXGIBuffer_GetResource(This,riid,ppvObject) (This)->lpVtbl->GetResource(This,riid,ppvObject)
#define IMFDXGIBuffer_GetSubresourceIndex(This,puSubresource) (This)->lpVtbl->GetSubresourceIndex(This,puSubresource)
#define IMFDXGIBuffer_GetUnknown(This,guid,riid,ppvObject) (This)->lpVtbl->GetUnknown(This,guid,riid,ppvObject)
#define IMFDXGIBuffer_SetUnknown(This,guid,pUnkData) (This)->lpVtbl->SetUnknown(This,guid,pUnkData)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFDXGIBuffer_QueryInterface(IMFDXGIBuffer* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFDXGIBuffer_AddRef(IMFDXGIBuffer* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFDXGIBuffer_Release(IMFDXGIBuffer* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFDXGIBuffer methods ***/
static FORCEINLINE HRESULT IMFDXGIBuffer_GetResource(IMFDXGIBuffer* This,REFIID riid,LPVOID *ppvObject) {
    return This->lpVtbl->GetResource(This,riid,ppvObject);
}
static FORCEINLINE HRESULT IMFDXGIBuffer_GetSubresourceIndex(IMFDXGIBuffer* This,UINT *puSubresource) {
    return This->lpVtbl->GetSubresourceIndex(This,puSubresource);
}
static FORCEINLINE HRESULT IMFDXGIBuffer_GetUnknown(IMFDXGIBuffer* This,REFIID guid,REFIID riid,LPVOID *ppvObject) {
    return This->lpVtbl->GetUnknown(This,guid,riid,ppvObject);
}
static FORCEINLINE HRESULT IMFDXGIBuffer_SetUnknown(IMFDXGIBuffer* This,REFIID guid,IUnknown *pUnkData) {
    return This->lpVtbl->SetUnknown(This,guid,pUnkData);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFDXGIBuffer_GetResource_Proxy(
    IMFDXGIBuffer* This,
    REFIID riid,
    LPVOID *ppvObject);
void __RPC_STUB IMFDXGIBuffer_GetResource_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFDXGIBuffer_GetSubresourceIndex_Proxy(
    IMFDXGIBuffer* This,
    UINT *puSubresource);
void __RPC_STUB IMFDXGIBuffer_GetSubresourceIndex_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFDXGIBuffer_GetUnknown_Proxy(
    IMFDXGIBuffer* This,
    REFIID guid,
    REFIID riid,
    LPVOID *ppvObject);
void __RPC_STUB IMFDXGIBuffer_GetUnknown_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFDXGIBuffer_SetUnknown_Proxy(
    IMFDXGIBuffer* This,
    REFIID guid,
    IUnknown *pUnkData);
void __RPC_STUB IMFDXGIBuffer_SetUnknown_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFDXGIBuffer_INTERFACE_DEFINED__ */


/*****************************************************************************
 * IMFMediaType interface
 */
#ifndef __IMFMediaType_INTERFACE_DEFINED__
#define __IMFMediaType_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFMediaType, 0x44ae0fa8, 0xea31, 0x4109, 0x8d,0x2e, 0x4c,0xae,0x49,0x97,0xc5,0x55);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("44ae0fa8-ea31-4109-8d2e-4cae4997c555")
IMFMediaType : public IMFAttributes
{
    virtual HRESULT STDMETHODCALLTYPE GetMajorType(
        GUID *pguidMajorType) = 0;

    virtual HRESULT STDMETHODCALLTYPE IsCompressedFormat(
        WINBOOL *pfCompressed) = 0;

    virtual HRESULT STDMETHODCALLTYPE IsEqual(
        IMFMediaType *pIMediaType,
        DWORD *pdwFlags) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetRepresentation(
        GUID guidRepresentation,
        LPVOID *ppvRepresentation) = 0;

    virtual HRESULT STDMETHODCALLTYPE FreeRepresentation(
        GUID guidRepresentation,
        LPVOID pvRepresentation) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFMediaType, 0x44ae0fa8, 0xea31, 0x4109, 0x8d,0x2e, 0x4c,0xae,0x49,0x97,0xc5,0x55)
#endif
#else
typedef struct IMFMediaTypeVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFMediaType* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFMediaType* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFMediaType* This);

    /*** IMFAttributes methods ***/
    HRESULT (STDMETHODCALLTYPE *GetItem)(
        IMFMediaType* This,
        REFGUID guidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *GetItemType)(
        IMFMediaType* This,
        REFGUID guidKey,
        MF_ATTRIBUTE_TYPE *pType);

    HRESULT (STDMETHODCALLTYPE *CompareItem)(
        IMFMediaType* This,
        REFGUID guidKey,
        REFPROPVARIANT Value,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *Compare)(
        IMFMediaType* This,
        IMFAttributes *pTheirs,
        MF_ATTRIBUTES_MATCH_TYPE MatchType,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *GetUINT32)(
        IMFMediaType* This,
        REFGUID guidKey,
        UINT32 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetUINT64)(
        IMFMediaType* This,
        REFGUID guidKey,
        UINT64 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetDouble)(
        IMFMediaType* This,
        REFGUID guidKey,
        double *pfValue);

    HRESULT (STDMETHODCALLTYPE *GetGUID)(
        IMFMediaType* This,
        REFGUID guidKey,
        GUID *pguidValue);

    HRESULT (STDMETHODCALLTYPE *GetStringLength)(
        IMFMediaType* This,
        REFGUID guidKey,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetString)(
        IMFMediaType* This,
        REFGUID guidKey,
        LPWSTR pwszValue,
        UINT32 cchBufSize,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedString)(
        IMFMediaType* This,
        REFGUID guidKey,
        LPWSTR *ppwszValue,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetBlobSize)(
        IMFMediaType* This,
        REFGUID guidKey,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetBlob)(
        IMFMediaType* This,
        REFGUID guidKey,
        UINT8 *pBuf,
        UINT32 cbBufSize,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedBlob)(
        IMFMediaType* This,
        REFGUID guidKey,
        UINT8 **ppBuf,
        UINT32 *pcbSize);

    HRESULT (STDMETHODCALLTYPE *GetUnknown)(
        IMFMediaType* This,
        REFGUID guidKey,
        REFIID riid,
        LPVOID *ppv);

    HRESULT (STDMETHODCALLTYPE *SetItem)(
        IMFMediaType* This,
        REFGUID guidKey,
        REFPROPVARIANT Value);

    HRESULT (STDMETHODCALLTYPE *DeleteItem)(
        IMFMediaType* This,
        REFGUID guidKey);

    HRESULT (STDMETHODCALLTYPE *DeleteAllItems)(
        IMFMediaType* This);

    HRESULT (STDMETHODCALLTYPE *SetUINT32)(
        IMFMediaType* This,
        REFGUID guidKey,
        UINT32 unValue);

    HRESULT (STDMETHODCALLTYPE *SetUINT64)(
        IMFMediaType* This,
        REFGUID guidKey,
        UINT64 unValue);

    HRESULT (STDMETHODCALLTYPE *SetDouble)(
        IMFMediaType* This,
        REFGUID guidKey,
        double fValue);

    HRESULT (STDMETHODCALLTYPE *SetGUID)(
        IMFMediaType* This,
        REFGUID guidKey,
        REFGUID guidValue);

    HRESULT (STDMETHODCALLTYPE *SetString)(
        IMFMediaType* This,
        REFGUID guidKey,
        LPCWSTR wszValue);

    HRESULT (STDMETHODCALLTYPE *SetBlob)(
        IMFMediaType* This,
        REFGUID guidKey,
        const UINT8 *pBuf,
        UINT32 cbBufSize);

    HRESULT (STDMETHODCALLTYPE *SetUnknown)(
        IMFMediaType* This,
        REFGUID guidKey,
        IUnknown *pUnknown);

    HRESULT (STDMETHODCALLTYPE *LockStore)(
        IMFMediaType* This);

    HRESULT (STDMETHODCALLTYPE *UnlockStore)(
        IMFMediaType* This);

    HRESULT (STDMETHODCALLTYPE *GetCount)(
        IMFMediaType* This,
        UINT32 *pcItems);

    HRESULT (STDMETHODCALLTYPE *GetItemByIndex)(
        IMFMediaType* This,
        UINT32 unIndex,
        GUID *pguidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *CopyAllItems)(
        IMFMediaType* This,
        IMFAttributes *pDest);

    /*** IMFMediaType methods ***/
    HRESULT (STDMETHODCALLTYPE *GetMajorType)(
        IMFMediaType* This,
        GUID *pguidMajorType);

    HRESULT (STDMETHODCALLTYPE *IsCompressedFormat)(
        IMFMediaType* This,
        WINBOOL *pfCompressed);

    HRESULT (STDMETHODCALLTYPE *IsEqual)(
        IMFMediaType* This,
        IMFMediaType *pIMediaType,
        DWORD *pdwFlags);

    HRESULT (STDMETHODCALLTYPE *GetRepresentation)(
        IMFMediaType* This,
        GUID guidRepresentation,
        LPVOID *ppvRepresentation);

    HRESULT (STDMETHODCALLTYPE *FreeRepresentation)(
        IMFMediaType* This,
        GUID guidRepresentation,
        LPVOID pvRepresentation);

    END_INTERFACE
} IMFMediaTypeVtbl;
interface IMFMediaType {
    CONST_VTBL IMFMediaTypeVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFMediaType_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFMediaType_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFMediaType_Release(This) (This)->lpVtbl->Release(This)
/*** IMFAttributes methods ***/
#define IMFMediaType_GetItem(This,guidKey,pValue) (This)->lpVtbl->GetItem(This,guidKey,pValue)
#define IMFMediaType_GetItemType(This,guidKey,pType) (This)->lpVtbl->GetItemType(This,guidKey,pType)
#define IMFMediaType_CompareItem(This,guidKey,Value,pbResult) (This)->lpVtbl->CompareItem(This,guidKey,Value,pbResult)
#define IMFMediaType_Compare(This,pTheirs,MatchType,pbResult) (This)->lpVtbl->Compare(This,pTheirs,MatchType,pbResult)
#define IMFMediaType_GetUINT32(This,guidKey,punValue) (This)->lpVtbl->GetUINT32(This,guidKey,punValue)
#define IMFMediaType_GetUINT64(This,guidKey,punValue) (This)->lpVtbl->GetUINT64(This,guidKey,punValue)
#define IMFMediaType_GetDouble(This,guidKey,pfValue) (This)->lpVtbl->GetDouble(This,guidKey,pfValue)
#define IMFMediaType_GetGUID(This,guidKey,pguidValue) (This)->lpVtbl->GetGUID(This,guidKey,pguidValue)
#define IMFMediaType_GetStringLength(This,guidKey,pcchLength) (This)->lpVtbl->GetStringLength(This,guidKey,pcchLength)
#define IMFMediaType_GetString(This,guidKey,pwszValue,cchBufSize,pcchLength) (This)->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength)
#define IMFMediaType_GetAllocatedString(This,guidKey,ppwszValue,pcchLength) (This)->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength)
#define IMFMediaType_GetBlobSize(This,guidKey,pcbBlobSize) (This)->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize)
#define IMFMediaType_GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize) (This)->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize)
#define IMFMediaType_GetAllocatedBlob(This,guidKey,ppBuf,pcbSize) (This)->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize)
#define IMFMediaType_GetUnknown(This,guidKey,riid,ppv) (This)->lpVtbl->GetUnknown(This,guidKey,riid,ppv)
#define IMFMediaType_SetItem(This,guidKey,Value) (This)->lpVtbl->SetItem(This,guidKey,Value)
#define IMFMediaType_DeleteItem(This,guidKey) (This)->lpVtbl->DeleteItem(This,guidKey)
#define IMFMediaType_DeleteAllItems(This) (This)->lpVtbl->DeleteAllItems(This)
#define IMFMediaType_SetUINT32(This,guidKey,unValue) (This)->lpVtbl->SetUINT32(This,guidKey,unValue)
#define IMFMediaType_SetUINT64(This,guidKey,unValue) (This)->lpVtbl->SetUINT64(This,guidKey,unValue)
#define IMFMediaType_SetDouble(This,guidKey,fValue) (This)->lpVtbl->SetDouble(This,guidKey,fValue)
#define IMFMediaType_SetGUID(This,guidKey,guidValue) (This)->lpVtbl->SetGUID(This,guidKey,guidValue)
#define IMFMediaType_SetString(This,guidKey,wszValue) (This)->lpVtbl->SetString(This,guidKey,wszValue)
#define IMFMediaType_SetBlob(This,guidKey,pBuf,cbBufSize) (This)->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize)
#define IMFMediaType_SetUnknown(This,guidKey,pUnknown) (This)->lpVtbl->SetUnknown(This,guidKey,pUnknown)
#define IMFMediaType_LockStore(This) (This)->lpVtbl->LockStore(This)
#define IMFMediaType_UnlockStore(This) (This)->lpVtbl->UnlockStore(This)
#define IMFMediaType_GetCount(This,pcItems) (This)->lpVtbl->GetCount(This,pcItems)
#define IMFMediaType_GetItemByIndex(This,unIndex,pguidKey,pValue) (This)->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue)
#define IMFMediaType_CopyAllItems(This,pDest) (This)->lpVtbl->CopyAllItems(This,pDest)
/*** IMFMediaType methods ***/
#define IMFMediaType_GetMajorType(This,pguidMajorType) (This)->lpVtbl->GetMajorType(This,pguidMajorType)
#define IMFMediaType_IsCompressedFormat(This,pfCompressed) (This)->lpVtbl->IsCompressedFormat(This,pfCompressed)
#define IMFMediaType_IsEqual(This,pIMediaType,pdwFlags) (This)->lpVtbl->IsEqual(This,pIMediaType,pdwFlags)
#define IMFMediaType_GetRepresentation(This,guidRepresentation,ppvRepresentation) (This)->lpVtbl->GetRepresentation(This,guidRepresentation,ppvRepresentation)
#define IMFMediaType_FreeRepresentation(This,guidRepresentation,pvRepresentation) (This)->lpVtbl->FreeRepresentation(This,guidRepresentation,pvRepresentation)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFMediaType_QueryInterface(IMFMediaType* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFMediaType_AddRef(IMFMediaType* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFMediaType_Release(IMFMediaType* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFAttributes methods ***/
static FORCEINLINE HRESULT IMFMediaType_GetItem(IMFMediaType* This,REFGUID guidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItem(This,guidKey,pValue);
}
static FORCEINLINE HRESULT IMFMediaType_GetItemType(IMFMediaType* This,REFGUID guidKey,MF_ATTRIBUTE_TYPE *pType) {
    return This->lpVtbl->GetItemType(This,guidKey,pType);
}
static FORCEINLINE HRESULT IMFMediaType_CompareItem(IMFMediaType* This,REFGUID guidKey,REFPROPVARIANT Value,WINBOOL *pbResult) {
    return This->lpVtbl->CompareItem(This,guidKey,Value,pbResult);
}
static FORCEINLINE HRESULT IMFMediaType_Compare(IMFMediaType* This,IMFAttributes *pTheirs,MF_ATTRIBUTES_MATCH_TYPE MatchType,WINBOOL *pbResult) {
    return This->lpVtbl->Compare(This,pTheirs,MatchType,pbResult);
}
static FORCEINLINE HRESULT IMFMediaType_GetUINT32(IMFMediaType* This,REFGUID guidKey,UINT32 *punValue) {
    return This->lpVtbl->GetUINT32(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFMediaType_GetUINT64(IMFMediaType* This,REFGUID guidKey,UINT64 *punValue) {
    return This->lpVtbl->GetUINT64(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFMediaType_GetDouble(IMFMediaType* This,REFGUID guidKey,double *pfValue) {
    return This->lpVtbl->GetDouble(This,guidKey,pfValue);
}
static FORCEINLINE HRESULT IMFMediaType_GetGUID(IMFMediaType* This,REFGUID guidKey,GUID *pguidValue) {
    return This->lpVtbl->GetGUID(This,guidKey,pguidValue);
}
static FORCEINLINE HRESULT IMFMediaType_GetStringLength(IMFMediaType* This,REFGUID guidKey,UINT32 *pcchLength) {
    return This->lpVtbl->GetStringLength(This,guidKey,pcchLength);
}
static FORCEINLINE HRESULT IMFMediaType_GetString(IMFMediaType* This,REFGUID guidKey,LPWSTR pwszValue,UINT32 cchBufSize,UINT32 *pcchLength) {
    return This->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength);
}
static FORCEINLINE HRESULT IMFMediaType_GetAllocatedString(IMFMediaType* This,REFGUID guidKey,LPWSTR *ppwszValue,UINT32 *pcchLength) {
    return This->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength);
}
static FORCEINLINE HRESULT IMFMediaType_GetBlobSize(IMFMediaType* This,REFGUID guidKey,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFMediaType_GetBlob(IMFMediaType* This,REFGUID guidKey,UINT8 *pBuf,UINT32 cbBufSize,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFMediaType_GetAllocatedBlob(IMFMediaType* This,REFGUID guidKey,UINT8 **ppBuf,UINT32 *pcbSize) {
    return This->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize);
}
static FORCEINLINE HRESULT IMFMediaType_GetUnknown(IMFMediaType* This,REFGUID guidKey,REFIID riid,LPVOID *ppv) {
    return This->lpVtbl->GetUnknown(This,guidKey,riid,ppv);
}
static FORCEINLINE HRESULT IMFMediaType_SetItem(IMFMediaType* This,REFGUID guidKey,REFPROPVARIANT Value) {
    return This->lpVtbl->SetItem(This,guidKey,Value);
}
static FORCEINLINE HRESULT IMFMediaType_DeleteItem(IMFMediaType* This,REFGUID guidKey) {
    return This->lpVtbl->DeleteItem(This,guidKey);
}
static FORCEINLINE HRESULT IMFMediaType_DeleteAllItems(IMFMediaType* This) {
    return This->lpVtbl->DeleteAllItems(This);
}
static FORCEINLINE HRESULT IMFMediaType_SetUINT32(IMFMediaType* This,REFGUID guidKey,UINT32 unValue) {
    return This->lpVtbl->SetUINT32(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFMediaType_SetUINT64(IMFMediaType* This,REFGUID guidKey,UINT64 unValue) {
    return This->lpVtbl->SetUINT64(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFMediaType_SetDouble(IMFMediaType* This,REFGUID guidKey,double fValue) {
    return This->lpVtbl->SetDouble(This,guidKey,fValue);
}
static FORCEINLINE HRESULT IMFMediaType_SetGUID(IMFMediaType* This,REFGUID guidKey,REFGUID guidValue) {
    return This->lpVtbl->SetGUID(This,guidKey,guidValue);
}
static FORCEINLINE HRESULT IMFMediaType_SetString(IMFMediaType* This,REFGUID guidKey,LPCWSTR wszValue) {
    return This->lpVtbl->SetString(This,guidKey,wszValue);
}
static FORCEINLINE HRESULT IMFMediaType_SetBlob(IMFMediaType* This,REFGUID guidKey,const UINT8 *pBuf,UINT32 cbBufSize) {
    return This->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize);
}
static FORCEINLINE HRESULT IMFMediaType_SetUnknown(IMFMediaType* This,REFGUID guidKey,IUnknown *pUnknown) {
    return This->lpVtbl->SetUnknown(This,guidKey,pUnknown);
}
static FORCEINLINE HRESULT IMFMediaType_LockStore(IMFMediaType* This) {
    return This->lpVtbl->LockStore(This);
}
static FORCEINLINE HRESULT IMFMediaType_UnlockStore(IMFMediaType* This) {
    return This->lpVtbl->UnlockStore(This);
}
static FORCEINLINE HRESULT IMFMediaType_GetCount(IMFMediaType* This,UINT32 *pcItems) {
    return This->lpVtbl->GetCount(This,pcItems);
}
static FORCEINLINE HRESULT IMFMediaType_GetItemByIndex(IMFMediaType* This,UINT32 unIndex,GUID *pguidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue);
}
static FORCEINLINE HRESULT IMFMediaType_CopyAllItems(IMFMediaType* This,IMFAttributes *pDest) {
    return This->lpVtbl->CopyAllItems(This,pDest);
}
/*** IMFMediaType methods ***/
static FORCEINLINE HRESULT IMFMediaType_GetMajorType(IMFMediaType* This,GUID *pguidMajorType) {
    return This->lpVtbl->GetMajorType(This,pguidMajorType);
}
static FORCEINLINE HRESULT IMFMediaType_IsCompressedFormat(IMFMediaType* This,WINBOOL *pfCompressed) {
    return This->lpVtbl->IsCompressedFormat(This,pfCompressed);
}
static FORCEINLINE HRESULT IMFMediaType_IsEqual(IMFMediaType* This,IMFMediaType *pIMediaType,DWORD *pdwFlags) {
    return This->lpVtbl->IsEqual(This,pIMediaType,pdwFlags);
}
static FORCEINLINE HRESULT IMFMediaType_GetRepresentation(IMFMediaType* This,GUID guidRepresentation,LPVOID *ppvRepresentation) {
    return This->lpVtbl->GetRepresentation(This,guidRepresentation,ppvRepresentation);
}
static FORCEINLINE HRESULT IMFMediaType_FreeRepresentation(IMFMediaType* This,GUID guidRepresentation,LPVOID pvRepresentation) {
    return This->lpVtbl->FreeRepresentation(This,guidRepresentation,pvRepresentation);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFMediaType_GetMajorType_Proxy(
    IMFMediaType* This,
    GUID *pguidMajorType);
void __RPC_STUB IMFMediaType_GetMajorType_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaType_IsCompressedFormat_Proxy(
    IMFMediaType* This,
    WINBOOL *pfCompressed);
void __RPC_STUB IMFMediaType_IsCompressedFormat_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaType_IsEqual_Proxy(
    IMFMediaType* This,
    IMFMediaType *pIMediaType,
    DWORD *pdwFlags);
void __RPC_STUB IMFMediaType_IsEqual_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaType_GetRepresentation_Proxy(
    IMFMediaType* This,
    GUID guidRepresentation,
    LPVOID *ppvRepresentation);
void __RPC_STUB IMFMediaType_GetRepresentation_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaType_FreeRepresentation_Proxy(
    IMFMediaType* This,
    GUID guidRepresentation,
    LPVOID pvRepresentation);
void __RPC_STUB IMFMediaType_FreeRepresentation_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFMediaType_INTERFACE_DEFINED__ */


#define MF_MEDIATYPE_EQUAL_MAJOR_TYPES 0x00000001
#define MF_MEDIATYPE_EQUAL_FORMAT_TYPES 0x00000002
#define MF_MEDIATYPE_EQUAL_FORMAT_DATA 0x00000004
#define MF_MEDIATYPE_EQUAL_FORMAT_USER_DATA 0x00000008
#endif

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
/*****************************************************************************
 * IMFAudioMediaType interface
 */
#ifndef __IMFAudioMediaType_INTERFACE_DEFINED__
#define __IMFAudioMediaType_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFAudioMediaType, 0x26a0adc3, 0xce26, 0x4672, 0x93,0x04, 0x69,0x55,0x2e,0xdd,0x3f,0xaf);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("26a0adc3-ce26-4672-9304-69552edd3faf")
IMFAudioMediaType : public IMFMediaType
{
    virtual const WAVEFORMATEX * STDMETHODCALLTYPE GetAudioFormat(
        ) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFAudioMediaType, 0x26a0adc3, 0xce26, 0x4672, 0x93,0x04, 0x69,0x55,0x2e,0xdd,0x3f,0xaf)
#endif
#else
typedef struct IMFAudioMediaTypeVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFAudioMediaType* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFAudioMediaType* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFAudioMediaType* This);

    /*** IMFAttributes methods ***/
    HRESULT (STDMETHODCALLTYPE *GetItem)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *GetItemType)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        MF_ATTRIBUTE_TYPE *pType);

    HRESULT (STDMETHODCALLTYPE *CompareItem)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        REFPROPVARIANT Value,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *Compare)(
        IMFAudioMediaType* This,
        IMFAttributes *pTheirs,
        MF_ATTRIBUTES_MATCH_TYPE MatchType,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *GetUINT32)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        UINT32 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetUINT64)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        UINT64 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetDouble)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        double *pfValue);

    HRESULT (STDMETHODCALLTYPE *GetGUID)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        GUID *pguidValue);

    HRESULT (STDMETHODCALLTYPE *GetStringLength)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetString)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        LPWSTR pwszValue,
        UINT32 cchBufSize,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedString)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        LPWSTR *ppwszValue,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetBlobSize)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetBlob)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        UINT8 *pBuf,
        UINT32 cbBufSize,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedBlob)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        UINT8 **ppBuf,
        UINT32 *pcbSize);

    HRESULT (STDMETHODCALLTYPE *GetUnknown)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        REFIID riid,
        LPVOID *ppv);

    HRESULT (STDMETHODCALLTYPE *SetItem)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        REFPROPVARIANT Value);

    HRESULT (STDMETHODCALLTYPE *DeleteItem)(
        IMFAudioMediaType* This,
        REFGUID guidKey);

    HRESULT (STDMETHODCALLTYPE *DeleteAllItems)(
        IMFAudioMediaType* This);

    HRESULT (STDMETHODCALLTYPE *SetUINT32)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        UINT32 unValue);

    HRESULT (STDMETHODCALLTYPE *SetUINT64)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        UINT64 unValue);

    HRESULT (STDMETHODCALLTYPE *SetDouble)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        double fValue);

    HRESULT (STDMETHODCALLTYPE *SetGUID)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        REFGUID guidValue);

    HRESULT (STDMETHODCALLTYPE *SetString)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        LPCWSTR wszValue);

    HRESULT (STDMETHODCALLTYPE *SetBlob)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        const UINT8 *pBuf,
        UINT32 cbBufSize);

    HRESULT (STDMETHODCALLTYPE *SetUnknown)(
        IMFAudioMediaType* This,
        REFGUID guidKey,
        IUnknown *pUnknown);

    HRESULT (STDMETHODCALLTYPE *LockStore)(
        IMFAudioMediaType* This);

    HRESULT (STDMETHODCALLTYPE *UnlockStore)(
        IMFAudioMediaType* This);

    HRESULT (STDMETHODCALLTYPE *GetCount)(
        IMFAudioMediaType* This,
        UINT32 *pcItems);

    HRESULT (STDMETHODCALLTYPE *GetItemByIndex)(
        IMFAudioMediaType* This,
        UINT32 unIndex,
        GUID *pguidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *CopyAllItems)(
        IMFAudioMediaType* This,
        IMFAttributes *pDest);

    /*** IMFMediaType methods ***/
    HRESULT (STDMETHODCALLTYPE *GetMajorType)(
        IMFAudioMediaType* This,
        GUID *pguidMajorType);

    HRESULT (STDMETHODCALLTYPE *IsCompressedFormat)(
        IMFAudioMediaType* This,
        WINBOOL *pfCompressed);

    HRESULT (STDMETHODCALLTYPE *IsEqual)(
        IMFAudioMediaType* This,
        IMFMediaType *pIMediaType,
        DWORD *pdwFlags);

    HRESULT (STDMETHODCALLTYPE *GetRepresentation)(
        IMFAudioMediaType* This,
        GUID guidRepresentation,
        LPVOID *ppvRepresentation);

    HRESULT (STDMETHODCALLTYPE *FreeRepresentation)(
        IMFAudioMediaType* This,
        GUID guidRepresentation,
        LPVOID pvRepresentation);

    /*** IMFAudioMediaType methods ***/
    const WAVEFORMATEX * (STDMETHODCALLTYPE *GetAudioFormat)(
        IMFAudioMediaType* This);

    END_INTERFACE
} IMFAudioMediaTypeVtbl;
interface IMFAudioMediaType {
    CONST_VTBL IMFAudioMediaTypeVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFAudioMediaType_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFAudioMediaType_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFAudioMediaType_Release(This) (This)->lpVtbl->Release(This)
/*** IMFAttributes methods ***/
#define IMFAudioMediaType_GetItem(This,guidKey,pValue) (This)->lpVtbl->GetItem(This,guidKey,pValue)
#define IMFAudioMediaType_GetItemType(This,guidKey,pType) (This)->lpVtbl->GetItemType(This,guidKey,pType)
#define IMFAudioMediaType_CompareItem(This,guidKey,Value,pbResult) (This)->lpVtbl->CompareItem(This,guidKey,Value,pbResult)
#define IMFAudioMediaType_Compare(This,pTheirs,MatchType,pbResult) (This)->lpVtbl->Compare(This,pTheirs,MatchType,pbResult)
#define IMFAudioMediaType_GetUINT32(This,guidKey,punValue) (This)->lpVtbl->GetUINT32(This,guidKey,punValue)
#define IMFAudioMediaType_GetUINT64(This,guidKey,punValue) (This)->lpVtbl->GetUINT64(This,guidKey,punValue)
#define IMFAudioMediaType_GetDouble(This,guidKey,pfValue) (This)->lpVtbl->GetDouble(This,guidKey,pfValue)
#define IMFAudioMediaType_GetGUID(This,guidKey,pguidValue) (This)->lpVtbl->GetGUID(This,guidKey,pguidValue)
#define IMFAudioMediaType_GetStringLength(This,guidKey,pcchLength) (This)->lpVtbl->GetStringLength(This,guidKey,pcchLength)
#define IMFAudioMediaType_GetString(This,guidKey,pwszValue,cchBufSize,pcchLength) (This)->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength)
#define IMFAudioMediaType_GetAllocatedString(This,guidKey,ppwszValue,pcchLength) (This)->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength)
#define IMFAudioMediaType_GetBlobSize(This,guidKey,pcbBlobSize) (This)->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize)
#define IMFAudioMediaType_GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize) (This)->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize)
#define IMFAudioMediaType_GetAllocatedBlob(This,guidKey,ppBuf,pcbSize) (This)->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize)
#define IMFAudioMediaType_GetUnknown(This,guidKey,riid,ppv) (This)->lpVtbl->GetUnknown(This,guidKey,riid,ppv)
#define IMFAudioMediaType_SetItem(This,guidKey,Value) (This)->lpVtbl->SetItem(This,guidKey,Value)
#define IMFAudioMediaType_DeleteItem(This,guidKey) (This)->lpVtbl->DeleteItem(This,guidKey)
#define IMFAudioMediaType_DeleteAllItems(This) (This)->lpVtbl->DeleteAllItems(This)
#define IMFAudioMediaType_SetUINT32(This,guidKey,unValue) (This)->lpVtbl->SetUINT32(This,guidKey,unValue)
#define IMFAudioMediaType_SetUINT64(This,guidKey,unValue) (This)->lpVtbl->SetUINT64(This,guidKey,unValue)
#define IMFAudioMediaType_SetDouble(This,guidKey,fValue) (This)->lpVtbl->SetDouble(This,guidKey,fValue)
#define IMFAudioMediaType_SetGUID(This,guidKey,guidValue) (This)->lpVtbl->SetGUID(This,guidKey,guidValue)
#define IMFAudioMediaType_SetString(This,guidKey,wszValue) (This)->lpVtbl->SetString(This,guidKey,wszValue)
#define IMFAudioMediaType_SetBlob(This,guidKey,pBuf,cbBufSize) (This)->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize)
#define IMFAudioMediaType_SetUnknown(This,guidKey,pUnknown) (This)->lpVtbl->SetUnknown(This,guidKey,pUnknown)
#define IMFAudioMediaType_LockStore(This) (This)->lpVtbl->LockStore(This)
#define IMFAudioMediaType_UnlockStore(This) (This)->lpVtbl->UnlockStore(This)
#define IMFAudioMediaType_GetCount(This,pcItems) (This)->lpVtbl->GetCount(This,pcItems)
#define IMFAudioMediaType_GetItemByIndex(This,unIndex,pguidKey,pValue) (This)->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue)
#define IMFAudioMediaType_CopyAllItems(This,pDest) (This)->lpVtbl->CopyAllItems(This,pDest)
/*** IMFMediaType methods ***/
#define IMFAudioMediaType_GetMajorType(This,pguidMajorType) (This)->lpVtbl->GetMajorType(This,pguidMajorType)
#define IMFAudioMediaType_IsCompressedFormat(This,pfCompressed) (This)->lpVtbl->IsCompressedFormat(This,pfCompressed)
#define IMFAudioMediaType_IsEqual(This,pIMediaType,pdwFlags) (This)->lpVtbl->IsEqual(This,pIMediaType,pdwFlags)
#define IMFAudioMediaType_GetRepresentation(This,guidRepresentation,ppvRepresentation) (This)->lpVtbl->GetRepresentation(This,guidRepresentation,ppvRepresentation)
#define IMFAudioMediaType_FreeRepresentation(This,guidRepresentation,pvRepresentation) (This)->lpVtbl->FreeRepresentation(This,guidRepresentation,pvRepresentation)
/*** IMFAudioMediaType methods ***/
#define IMFAudioMediaType_GetAudioFormat(This) (This)->lpVtbl->GetAudioFormat(This)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFAudioMediaType_QueryInterface(IMFAudioMediaType* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFAudioMediaType_AddRef(IMFAudioMediaType* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFAudioMediaType_Release(IMFAudioMediaType* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFAttributes methods ***/
static FORCEINLINE HRESULT IMFAudioMediaType_GetItem(IMFAudioMediaType* This,REFGUID guidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItem(This,guidKey,pValue);
}
static FORCEINLINE HRESULT IMFAudioMediaType_GetItemType(IMFAudioMediaType* This,REFGUID guidKey,MF_ATTRIBUTE_TYPE *pType) {
    return This->lpVtbl->GetItemType(This,guidKey,pType);
}
static FORCEINLINE HRESULT IMFAudioMediaType_CompareItem(IMFAudioMediaType* This,REFGUID guidKey,REFPROPVARIANT Value,WINBOOL *pbResult) {
    return This->lpVtbl->CompareItem(This,guidKey,Value,pbResult);
}
static FORCEINLINE HRESULT IMFAudioMediaType_Compare(IMFAudioMediaType* This,IMFAttributes *pTheirs,MF_ATTRIBUTES_MATCH_TYPE MatchType,WINBOOL *pbResult) {
    return This->lpVtbl->Compare(This,pTheirs,MatchType,pbResult);
}
static FORCEINLINE HRESULT IMFAudioMediaType_GetUINT32(IMFAudioMediaType* This,REFGUID guidKey,UINT32 *punValue) {
    return This->lpVtbl->GetUINT32(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFAudioMediaType_GetUINT64(IMFAudioMediaType* This,REFGUID guidKey,UINT64 *punValue) {
    return This->lpVtbl->GetUINT64(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFAudioMediaType_GetDouble(IMFAudioMediaType* This,REFGUID guidKey,double *pfValue) {
    return This->lpVtbl->GetDouble(This,guidKey,pfValue);
}
static FORCEINLINE HRESULT IMFAudioMediaType_GetGUID(IMFAudioMediaType* This,REFGUID guidKey,GUID *pguidValue) {
    return This->lpVtbl->GetGUID(This,guidKey,pguidValue);
}
static FORCEINLINE HRESULT IMFAudioMediaType_GetStringLength(IMFAudioMediaType* This,REFGUID guidKey,UINT32 *pcchLength) {
    return This->lpVtbl->GetStringLength(This,guidKey,pcchLength);
}
static FORCEINLINE HRESULT IMFAudioMediaType_GetString(IMFAudioMediaType* This,REFGUID guidKey,LPWSTR pwszValue,UINT32 cchBufSize,UINT32 *pcchLength) {
    return This->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength);
}
static FORCEINLINE HRESULT IMFAudioMediaType_GetAllocatedString(IMFAudioMediaType* This,REFGUID guidKey,LPWSTR *ppwszValue,UINT32 *pcchLength) {
    return This->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength);
}
static FORCEINLINE HRESULT IMFAudioMediaType_GetBlobSize(IMFAudioMediaType* This,REFGUID guidKey,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFAudioMediaType_GetBlob(IMFAudioMediaType* This,REFGUID guidKey,UINT8 *pBuf,UINT32 cbBufSize,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFAudioMediaType_GetAllocatedBlob(IMFAudioMediaType* This,REFGUID guidKey,UINT8 **ppBuf,UINT32 *pcbSize) {
    return This->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize);
}
static FORCEINLINE HRESULT IMFAudioMediaType_GetUnknown(IMFAudioMediaType* This,REFGUID guidKey,REFIID riid,LPVOID *ppv) {
    return This->lpVtbl->GetUnknown(This,guidKey,riid,ppv);
}
static FORCEINLINE HRESULT IMFAudioMediaType_SetItem(IMFAudioMediaType* This,REFGUID guidKey,REFPROPVARIANT Value) {
    return This->lpVtbl->SetItem(This,guidKey,Value);
}
static FORCEINLINE HRESULT IMFAudioMediaType_DeleteItem(IMFAudioMediaType* This,REFGUID guidKey) {
    return This->lpVtbl->DeleteItem(This,guidKey);
}
static FORCEINLINE HRESULT IMFAudioMediaType_DeleteAllItems(IMFAudioMediaType* This) {
    return This->lpVtbl->DeleteAllItems(This);
}
static FORCEINLINE HRESULT IMFAudioMediaType_SetUINT32(IMFAudioMediaType* This,REFGUID guidKey,UINT32 unValue) {
    return This->lpVtbl->SetUINT32(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFAudioMediaType_SetUINT64(IMFAudioMediaType* This,REFGUID guidKey,UINT64 unValue) {
    return This->lpVtbl->SetUINT64(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFAudioMediaType_SetDouble(IMFAudioMediaType* This,REFGUID guidKey,double fValue) {
    return This->lpVtbl->SetDouble(This,guidKey,fValue);
}
static FORCEINLINE HRESULT IMFAudioMediaType_SetGUID(IMFAudioMediaType* This,REFGUID guidKey,REFGUID guidValue) {
    return This->lpVtbl->SetGUID(This,guidKey,guidValue);
}
static FORCEINLINE HRESULT IMFAudioMediaType_SetString(IMFAudioMediaType* This,REFGUID guidKey,LPCWSTR wszValue) {
    return This->lpVtbl->SetString(This,guidKey,wszValue);
}
static FORCEINLINE HRESULT IMFAudioMediaType_SetBlob(IMFAudioMediaType* This,REFGUID guidKey,const UINT8 *pBuf,UINT32 cbBufSize) {
    return This->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize);
}
static FORCEINLINE HRESULT IMFAudioMediaType_SetUnknown(IMFAudioMediaType* This,REFGUID guidKey,IUnknown *pUnknown) {
    return This->lpVtbl->SetUnknown(This,guidKey,pUnknown);
}
static FORCEINLINE HRESULT IMFAudioMediaType_LockStore(IMFAudioMediaType* This) {
    return This->lpVtbl->LockStore(This);
}
static FORCEINLINE HRESULT IMFAudioMediaType_UnlockStore(IMFAudioMediaType* This) {
    return This->lpVtbl->UnlockStore(This);
}
static FORCEINLINE HRESULT IMFAudioMediaType_GetCount(IMFAudioMediaType* This,UINT32 *pcItems) {
    return This->lpVtbl->GetCount(This,pcItems);
}
static FORCEINLINE HRESULT IMFAudioMediaType_GetItemByIndex(IMFAudioMediaType* This,UINT32 unIndex,GUID *pguidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue);
}
static FORCEINLINE HRESULT IMFAudioMediaType_CopyAllItems(IMFAudioMediaType* This,IMFAttributes *pDest) {
    return This->lpVtbl->CopyAllItems(This,pDest);
}
/*** IMFMediaType methods ***/
static FORCEINLINE HRESULT IMFAudioMediaType_GetMajorType(IMFAudioMediaType* This,GUID *pguidMajorType) {
    return This->lpVtbl->GetMajorType(This,pguidMajorType);
}
static FORCEINLINE HRESULT IMFAudioMediaType_IsCompressedFormat(IMFAudioMediaType* This,WINBOOL *pfCompressed) {
    return This->lpVtbl->IsCompressedFormat(This,pfCompressed);
}
static FORCEINLINE HRESULT IMFAudioMediaType_IsEqual(IMFAudioMediaType* This,IMFMediaType *pIMediaType,DWORD *pdwFlags) {
    return This->lpVtbl->IsEqual(This,pIMediaType,pdwFlags);
}
static FORCEINLINE HRESULT IMFAudioMediaType_GetRepresentation(IMFAudioMediaType* This,GUID guidRepresentation,LPVOID *ppvRepresentation) {
    return This->lpVtbl->GetRepresentation(This,guidRepresentation,ppvRepresentation);
}
static FORCEINLINE HRESULT IMFAudioMediaType_FreeRepresentation(IMFAudioMediaType* This,GUID guidRepresentation,LPVOID pvRepresentation) {
    return This->lpVtbl->FreeRepresentation(This,guidRepresentation,pvRepresentation);
}
/*** IMFAudioMediaType methods ***/
static FORCEINLINE const WAVEFORMATEX * IMFAudioMediaType_GetAudioFormat(IMFAudioMediaType* This) {
    return This->lpVtbl->GetAudioFormat(This);
}
#endif
#endif

#endif

const WAVEFORMATEX * STDMETHODCALLTYPE IMFAudioMediaType_GetAudioFormat_Proxy(
    IMFAudioMediaType* This);
void __RPC_STUB IMFAudioMediaType_GetAudioFormat_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFAudioMediaType_INTERFACE_DEFINED__ */


#ifndef _WINGDI_
typedef DWORD RGBQUAD;

typedef struct __WIDL_mfobjects_generated_name_00000014 {
    DWORD biSize;
    LONG biWidth;
    LONG biHeight;
    WORD biPlanes;
    WORD biBitCount;
    DWORD biCompression;
    DWORD biSizeImage;
    LONG biXPelsPerMeter;
    LONG biYPelsPerMeter;
    DWORD biClrUsed;
    DWORD biClrImportant;
} BITMAPINFOHEADER;

typedef struct __WIDL_mfobjects_generated_name_00000015 {
    BITMAPINFOHEADER bmiHeader;
    RGBQUAD bmiColors[1];
} BITMAPINFO;
#endif

typedef struct __WIDL_mfobjects_generated_name_00000016 {
    GUID guidMajorType;
    GUID guidSubtype;
} MFT_REGISTER_TYPE_INFO;
#endif
#ifndef _MFVIDEOFORMAT_
#define _MFVIDEOFORMAT_

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
typedef enum _MFVideoInterlaceMode {
    MFVideoInterlace_Unknown = 0,
    MFVideoInterlace_Progressive = 2,
    MFVideoInterlace_FieldInterleavedUpperFirst = 3,
    MFVideoInterlace_FieldInterleavedLowerFirst = 4,
    MFVideoInterlace_FieldSingleUpper = 5,
    MFVideoInterlace_FieldSingleLower = 6,
    MFVideoInterlace_MixedInterlaceOrProgressive = 7,
    MFVideoInterlace_Last = 8,
    MFVideoInterlace_ForceDWORD = 0x7fffffff
} MFVideoInterlaceMode;

#define MFVideoInterlace_FieldSingleUpperFirst MFVideoInterlace_FieldSingleUpper
#define MFVideoInterlace_FieldSingleLowerFirst MFVideoInterlace_FieldSingleLower

typedef enum _MFVideoTransferFunction {
    MFVideoTransFunc_Unknown = 0,
    MFVideoTransFunc_10 = 1,
    MFVideoTransFunc_18 = 2,
    MFVideoTransFunc_20 = 3,
    MFVideoTransFunc_22 = 4,
    MFVideoTransFunc_709 = 5,
    MFVideoTransFunc_240M = 6,
    MFVideoTransFunc_sRGB = 7,
    MFVideoTransFunc_28 = 8,
    MFVideoTransFunc_Last = 9,
    MFVideoTransFunc_ForceDWORD = 0x7fffffff
} MFVideoTransferFunction;

typedef enum _MFVideoPrimaries {
    MFVideoPrimaries_Unknown = 0,
    MFVideoPrimaries_reserved = 1,
    MFVideoPrimaries_BT709 = 2,
    MFVideoPrimaries_BT470_2_SysM = 3,
    MFVideoPrimaries_BT470_2_SysBG = 4,
    MFVideoPrimaries_SMPTE170M = 5,
    MFVideoPrimaries_SMPTE240M = 6,
    MFVideoPrimaries_EBU3213 = 7,
    MFVideoPrimaries_SMPTE_C = 8,
    MFVideoPrimaries_Last = 9,
    MFVideoPrimaries_ForceDWORD = 0x7fffffff
} MFVideoPrimaries;

typedef enum _MFVideoLighting {
    MFVideoLighting_Unknown = 0,
    MFVideoLighting_bright = 1,
    MFVideoLighting_office = 2,
    MFVideoLighting_dim = 3,
    MFVideoLighting_dark = 4,
    MFVideoLighting_Last = 5,
    MFVideoLighting_ForceDWORD = 0x7fffffff
} MFVideoLighting;

typedef enum _MFVideoTransferMatrix {
    MFVideoTransferMatrix_Unknown = 0,
    MFVideoTransferMatrix_BT709 = 1,
    MFVideoTransferMatrix_BT601 = 2,
    MFVideoTransferMatrix_SMPTE240M = 3,
    MFVideoTransferMatrix_Last = 4,
    MFVideoTransferMatrix_ForceDWORD = 0x7fffffff
} MFVideoTransferMatrix;

typedef enum _MFVideoChromaSubsampling {
    MFVideoChromaSubsampling_Unknown = 0,
    MFVideoChromaSubsampling_ProgressiveChroma = 0x8,
    MFVideoChromaSubsampling_Horizontally_Cosited = 0x4,
    MFVideoChromaSubsampling_Vertically_Cosited = 0x2,
    MFVideoChromaSubsampling_Vertically_AlignedChromaPlanes = 0x1,
    MFVideoChromaSubsampling_MPEG2 = MFVideoChromaSubsampling_Horizontally_Cosited | MFVideoChromaSubsampling_Vertically_AlignedChromaPlanes,
    MFVideoChromaSubsampling_MPEG1 = MFVideoChromaSubsampling_Vertically_AlignedChromaPlanes,
    MFVideoChromaSubsampling_DV_PAL = MFVideoChromaSubsampling_Horizontally_Cosited | MFVideoChromaSubsampling_Vertically_Cosited,
    MFVideoChromaSubsampling_Cosited = (MFVideoChromaSubsampling_Horizontally_Cosited | MFVideoChromaSubsampling_Vertically_Cosited) | MFVideoChromaSubsampling_Vertically_AlignedChromaPlanes,
    MFVideoChromaSubsampling_Last = MFVideoChromaSubsampling_Cosited + 1,
    MFVideoChromaSubsampling_ForceDWORD = 0x7fffffff
} MFVideoChromaSubsampling;

typedef enum _MFNominalRange {
    MFNominalRange_Unknown = 0,
    MFNominalRange_Normal = 1,
    MFNominalRange_Wide = 2,
    MFNominalRange_0_255 = 1,
    MFNominalRange_16_235 = 2,
    MFNominalRange_48_208 = 3,
    MFNominalRange_Last = 4,
    MFNominalRange_ForceDWORD = 0x7fffffff
} MFNominalRange;
#endif

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
typedef enum _MFVideoFlags {
    MFVideoFlag_PAD_TO_Mask = 0x1 | 0x2,
    MFVideoFlag_PAD_TO_None = 0 * 0x1,
    MFVideoFlag_PAD_TO_4x3 = 1 * 0x1,
    MFVideoFlag_PAD_TO_16x9 = 2 * 0x1,
    MFVideoFlag_SrcContentHintMask = (0x4 | 0x8) | 0x10,
    MFVideoFlag_SrcContentHintNone = 0 * 0x4,
    MFVideoFlag_SrcContentHint16x9 = 1 * 0x4,
    MFVideoFlag_SrcContentHint235_1 = 2 * 0x4,
    MFVideoFlag_AnalogProtected = 0x20,
    MFVideoFlag_DigitallyProtected = 0x40,
    MFVideoFlag_ProgressiveContent = 0x80,
    MFVideoFlag_FieldRepeatCountMask = (0x100 | 0x200) | 0x400,
    MFVideoFlag_FieldRepeatCountShift = 8,
    MFVideoFlag_ProgressiveSeqReset = 0x800,
    MFVideoFlag_PanScanEnabled = 0x20000,
    MFVideoFlag_LowerFieldFirst = 0x40000,
    MFVideoFlag_BottomUpLinearRep = 0x80000,
    MFVideoFlags_DXVASurface = 0x100000,
    MFVideoFlags_RenderTargetSurface = 0x400000,
    MFVideoFlags_ForceQWORD = 0x7fffffff
} MFVideoFlags;
#endif

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
typedef struct _MFRatio {
    DWORD Numerator;
    DWORD Denominator;
} MFRatio;

typedef struct _MFOffset {
    WORD fract;
    short value;
} MFOffset;
typedef struct _MFVideoArea {
    MFOffset OffsetX;
    MFOffset OffsetY;
    SIZE Area;
} MFVideoArea;
#endif

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
typedef struct _MFVideoInfo {
    DWORD dwWidth;
    DWORD dwHeight;
    MFRatio PixelAspectRatio;
    MFVideoChromaSubsampling SourceChromaSubsampling;
    MFVideoInterlaceMode InterlaceMode;
    MFVideoTransferFunction TransferFunction;
    MFVideoPrimaries ColorPrimaries;
    MFVideoTransferMatrix TransferMatrix;
    MFVideoLighting SourceLighting;
    MFRatio FramesPerSecond;
    MFNominalRange NominalRange;
    MFVideoArea GeometricAperture;
    MFVideoArea MinimumDisplayAperture;
    MFVideoArea PanScanAperture;
    UINT64 VideoFlags;
} MFVideoInfo;
#endif

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
typedef struct __MFAYUVSample {
    BYTE bCrValue;
    BYTE bCbValue;
    BYTE bYValue;
    BYTE bSampleAlpha8;
} MFAYUVSample;

typedef struct _MFARGB {
    BYTE rgbBlue;
    BYTE rgbGreen;
    BYTE rgbRed;
    BYTE rgbAlpha;
} MFARGB;

typedef union _MFPaletteEntry {
    MFARGB ARGB;
    MFAYUVSample AYCbCr;
} MFPaletteEntry;
#endif

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
typedef struct _MFVideoSurfaceInfo {
    DWORD Format;
    DWORD PaletteEntries;
    MFPaletteEntry Palette[1];
} MFVideoSurfaceInfo;

typedef struct _MFVideoCompressedInfo {
    LONGLONG AvgBitrate;
    LONGLONG AvgBitErrorRate;
    DWORD MaxKeyFrameSpacing;
} MFVideoCompressedInfo;

typedef struct _MFVIDEOFORMAT {
    DWORD dwSize;
    MFVideoInfo videoInfo;
    GUID guidFormat;
    MFVideoCompressedInfo compressedInfo;
    MFVideoSurfaceInfo surfaceInfo;
} MFVIDEOFORMAT;

typedef enum _MFStandardVideoFormat {
    MFStdVideoFormat_reserved = 0,
    MFStdVideoFormat_NTSC = 1,
    MFStdVideoFormat_PAL = 2,
    MFStdVideoFormat_DVD_NTSC = 3,
    MFStdVideoFormat_DVD_PAL = 4,
    MFStdVideoFormat_DV_PAL = 5,
    MFStdVideoFormat_DV_NTSC = 6,
    MFStdVideoFormat_ATSC_SD480i = 7,
    MFStdVideoFormat_ATSC_HD1080i = 8,
    MFStdVideoFormat_ATSC_HD720p = 9
} MFStandardVideoFormat;
#endif
#endif

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
/*****************************************************************************
 * IMFVideoMediaType interface
 */
#ifndef __IMFVideoMediaType_INTERFACE_DEFINED__
#define __IMFVideoMediaType_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFVideoMediaType, 0xb99f381f, 0xa8f9, 0x47a2, 0xa5,0xaf, 0xca,0x3a,0x22,0x5a,0x38,0x90);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("b99f381f-a8f9-47a2-a5af-ca3a225a3890")
IMFVideoMediaType : public IMFMediaType
{
    virtual const MFVIDEOFORMAT * STDMETHODCALLTYPE GetVideoFormat(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetVideoRepresentation(
        GUID guidRepresentation,
        LPVOID *ppvRepresentation,
        LONG lStride) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFVideoMediaType, 0xb99f381f, 0xa8f9, 0x47a2, 0xa5,0xaf, 0xca,0x3a,0x22,0x5a,0x38,0x90)
#endif
#else
typedef struct IMFVideoMediaTypeVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFVideoMediaType* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFVideoMediaType* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFVideoMediaType* This);

    /*** IMFAttributes methods ***/
    HRESULT (STDMETHODCALLTYPE *GetItem)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *GetItemType)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        MF_ATTRIBUTE_TYPE *pType);

    HRESULT (STDMETHODCALLTYPE *CompareItem)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        REFPROPVARIANT Value,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *Compare)(
        IMFVideoMediaType* This,
        IMFAttributes *pTheirs,
        MF_ATTRIBUTES_MATCH_TYPE MatchType,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *GetUINT32)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        UINT32 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetUINT64)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        UINT64 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetDouble)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        double *pfValue);

    HRESULT (STDMETHODCALLTYPE *GetGUID)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        GUID *pguidValue);

    HRESULT (STDMETHODCALLTYPE *GetStringLength)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetString)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        LPWSTR pwszValue,
        UINT32 cchBufSize,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedString)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        LPWSTR *ppwszValue,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetBlobSize)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetBlob)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        UINT8 *pBuf,
        UINT32 cbBufSize,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedBlob)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        UINT8 **ppBuf,
        UINT32 *pcbSize);

    HRESULT (STDMETHODCALLTYPE *GetUnknown)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        REFIID riid,
        LPVOID *ppv);

    HRESULT (STDMETHODCALLTYPE *SetItem)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        REFPROPVARIANT Value);

    HRESULT (STDMETHODCALLTYPE *DeleteItem)(
        IMFVideoMediaType* This,
        REFGUID guidKey);

    HRESULT (STDMETHODCALLTYPE *DeleteAllItems)(
        IMFVideoMediaType* This);

    HRESULT (STDMETHODCALLTYPE *SetUINT32)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        UINT32 unValue);

    HRESULT (STDMETHODCALLTYPE *SetUINT64)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        UINT64 unValue);

    HRESULT (STDMETHODCALLTYPE *SetDouble)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        double fValue);

    HRESULT (STDMETHODCALLTYPE *SetGUID)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        REFGUID guidValue);

    HRESULT (STDMETHODCALLTYPE *SetString)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        LPCWSTR wszValue);

    HRESULT (STDMETHODCALLTYPE *SetBlob)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        const UINT8 *pBuf,
        UINT32 cbBufSize);

    HRESULT (STDMETHODCALLTYPE *SetUnknown)(
        IMFVideoMediaType* This,
        REFGUID guidKey,
        IUnknown *pUnknown);

    HRESULT (STDMETHODCALLTYPE *LockStore)(
        IMFVideoMediaType* This);

    HRESULT (STDMETHODCALLTYPE *UnlockStore)(
        IMFVideoMediaType* This);

    HRESULT (STDMETHODCALLTYPE *GetCount)(
        IMFVideoMediaType* This,
        UINT32 *pcItems);

    HRESULT (STDMETHODCALLTYPE *GetItemByIndex)(
        IMFVideoMediaType* This,
        UINT32 unIndex,
        GUID *pguidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *CopyAllItems)(
        IMFVideoMediaType* This,
        IMFAttributes *pDest);

    /*** IMFMediaType methods ***/
    HRESULT (STDMETHODCALLTYPE *GetMajorType)(
        IMFVideoMediaType* This,
        GUID *pguidMajorType);

    HRESULT (STDMETHODCALLTYPE *IsCompressedFormat)(
        IMFVideoMediaType* This,
        WINBOOL *pfCompressed);

    HRESULT (STDMETHODCALLTYPE *IsEqual)(
        IMFVideoMediaType* This,
        IMFMediaType *pIMediaType,
        DWORD *pdwFlags);

    HRESULT (STDMETHODCALLTYPE *GetRepresentation)(
        IMFVideoMediaType* This,
        GUID guidRepresentation,
        LPVOID *ppvRepresentation);

    HRESULT (STDMETHODCALLTYPE *FreeRepresentation)(
        IMFVideoMediaType* This,
        GUID guidRepresentation,
        LPVOID pvRepresentation);

    /*** IMFVideoMediaType methods ***/
    const MFVIDEOFORMAT * (STDMETHODCALLTYPE *GetVideoFormat)(
        IMFVideoMediaType* This);

    HRESULT (STDMETHODCALLTYPE *GetVideoRepresentation)(
        IMFVideoMediaType* This,
        GUID guidRepresentation,
        LPVOID *ppvRepresentation,
        LONG lStride);

    END_INTERFACE
} IMFVideoMediaTypeVtbl;
interface IMFVideoMediaType {
    CONST_VTBL IMFVideoMediaTypeVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFVideoMediaType_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFVideoMediaType_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFVideoMediaType_Release(This) (This)->lpVtbl->Release(This)
/*** IMFAttributes methods ***/
#define IMFVideoMediaType_GetItem(This,guidKey,pValue) (This)->lpVtbl->GetItem(This,guidKey,pValue)
#define IMFVideoMediaType_GetItemType(This,guidKey,pType) (This)->lpVtbl->GetItemType(This,guidKey,pType)
#define IMFVideoMediaType_CompareItem(This,guidKey,Value,pbResult) (This)->lpVtbl->CompareItem(This,guidKey,Value,pbResult)
#define IMFVideoMediaType_Compare(This,pTheirs,MatchType,pbResult) (This)->lpVtbl->Compare(This,pTheirs,MatchType,pbResult)
#define IMFVideoMediaType_GetUINT32(This,guidKey,punValue) (This)->lpVtbl->GetUINT32(This,guidKey,punValue)
#define IMFVideoMediaType_GetUINT64(This,guidKey,punValue) (This)->lpVtbl->GetUINT64(This,guidKey,punValue)
#define IMFVideoMediaType_GetDouble(This,guidKey,pfValue) (This)->lpVtbl->GetDouble(This,guidKey,pfValue)
#define IMFVideoMediaType_GetGUID(This,guidKey,pguidValue) (This)->lpVtbl->GetGUID(This,guidKey,pguidValue)
#define IMFVideoMediaType_GetStringLength(This,guidKey,pcchLength) (This)->lpVtbl->GetStringLength(This,guidKey,pcchLength)
#define IMFVideoMediaType_GetString(This,guidKey,pwszValue,cchBufSize,pcchLength) (This)->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength)
#define IMFVideoMediaType_GetAllocatedString(This,guidKey,ppwszValue,pcchLength) (This)->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength)
#define IMFVideoMediaType_GetBlobSize(This,guidKey,pcbBlobSize) (This)->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize)
#define IMFVideoMediaType_GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize) (This)->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize)
#define IMFVideoMediaType_GetAllocatedBlob(This,guidKey,ppBuf,pcbSize) (This)->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize)
#define IMFVideoMediaType_GetUnknown(This,guidKey,riid,ppv) (This)->lpVtbl->GetUnknown(This,guidKey,riid,ppv)
#define IMFVideoMediaType_SetItem(This,guidKey,Value) (This)->lpVtbl->SetItem(This,guidKey,Value)
#define IMFVideoMediaType_DeleteItem(This,guidKey) (This)->lpVtbl->DeleteItem(This,guidKey)
#define IMFVideoMediaType_DeleteAllItems(This) (This)->lpVtbl->DeleteAllItems(This)
#define IMFVideoMediaType_SetUINT32(This,guidKey,unValue) (This)->lpVtbl->SetUINT32(This,guidKey,unValue)
#define IMFVideoMediaType_SetUINT64(This,guidKey,unValue) (This)->lpVtbl->SetUINT64(This,guidKey,unValue)
#define IMFVideoMediaType_SetDouble(This,guidKey,fValue) (This)->lpVtbl->SetDouble(This,guidKey,fValue)
#define IMFVideoMediaType_SetGUID(This,guidKey,guidValue) (This)->lpVtbl->SetGUID(This,guidKey,guidValue)
#define IMFVideoMediaType_SetString(This,guidKey,wszValue) (This)->lpVtbl->SetString(This,guidKey,wszValue)
#define IMFVideoMediaType_SetBlob(This,guidKey,pBuf,cbBufSize) (This)->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize)
#define IMFVideoMediaType_SetUnknown(This,guidKey,pUnknown) (This)->lpVtbl->SetUnknown(This,guidKey,pUnknown)
#define IMFVideoMediaType_LockStore(This) (This)->lpVtbl->LockStore(This)
#define IMFVideoMediaType_UnlockStore(This) (This)->lpVtbl->UnlockStore(This)
#define IMFVideoMediaType_GetCount(This,pcItems) (This)->lpVtbl->GetCount(This,pcItems)
#define IMFVideoMediaType_GetItemByIndex(This,unIndex,pguidKey,pValue) (This)->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue)
#define IMFVideoMediaType_CopyAllItems(This,pDest) (This)->lpVtbl->CopyAllItems(This,pDest)
/*** IMFMediaType methods ***/
#define IMFVideoMediaType_GetMajorType(This,pguidMajorType) (This)->lpVtbl->GetMajorType(This,pguidMajorType)
#define IMFVideoMediaType_IsCompressedFormat(This,pfCompressed) (This)->lpVtbl->IsCompressedFormat(This,pfCompressed)
#define IMFVideoMediaType_IsEqual(This,pIMediaType,pdwFlags) (This)->lpVtbl->IsEqual(This,pIMediaType,pdwFlags)
#define IMFVideoMediaType_GetRepresentation(This,guidRepresentation,ppvRepresentation) (This)->lpVtbl->GetRepresentation(This,guidRepresentation,ppvRepresentation)
#define IMFVideoMediaType_FreeRepresentation(This,guidRepresentation,pvRepresentation) (This)->lpVtbl->FreeRepresentation(This,guidRepresentation,pvRepresentation)
/*** IMFVideoMediaType methods ***/
#define IMFVideoMediaType_GetVideoFormat(This) (This)->lpVtbl->GetVideoFormat(This)
#define IMFVideoMediaType_GetVideoRepresentation(This,guidRepresentation,ppvRepresentation,lStride) (This)->lpVtbl->GetVideoRepresentation(This,guidRepresentation,ppvRepresentation,lStride)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFVideoMediaType_QueryInterface(IMFVideoMediaType* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFVideoMediaType_AddRef(IMFVideoMediaType* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFVideoMediaType_Release(IMFVideoMediaType* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFAttributes methods ***/
static FORCEINLINE HRESULT IMFVideoMediaType_GetItem(IMFVideoMediaType* This,REFGUID guidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItem(This,guidKey,pValue);
}
static FORCEINLINE HRESULT IMFVideoMediaType_GetItemType(IMFVideoMediaType* This,REFGUID guidKey,MF_ATTRIBUTE_TYPE *pType) {
    return This->lpVtbl->GetItemType(This,guidKey,pType);
}
static FORCEINLINE HRESULT IMFVideoMediaType_CompareItem(IMFVideoMediaType* This,REFGUID guidKey,REFPROPVARIANT Value,WINBOOL *pbResult) {
    return This->lpVtbl->CompareItem(This,guidKey,Value,pbResult);
}
static FORCEINLINE HRESULT IMFVideoMediaType_Compare(IMFVideoMediaType* This,IMFAttributes *pTheirs,MF_ATTRIBUTES_MATCH_TYPE MatchType,WINBOOL *pbResult) {
    return This->lpVtbl->Compare(This,pTheirs,MatchType,pbResult);
}
static FORCEINLINE HRESULT IMFVideoMediaType_GetUINT32(IMFVideoMediaType* This,REFGUID guidKey,UINT32 *punValue) {
    return This->lpVtbl->GetUINT32(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFVideoMediaType_GetUINT64(IMFVideoMediaType* This,REFGUID guidKey,UINT64 *punValue) {
    return This->lpVtbl->GetUINT64(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFVideoMediaType_GetDouble(IMFVideoMediaType* This,REFGUID guidKey,double *pfValue) {
    return This->lpVtbl->GetDouble(This,guidKey,pfValue);
}
static FORCEINLINE HRESULT IMFVideoMediaType_GetGUID(IMFVideoMediaType* This,REFGUID guidKey,GUID *pguidValue) {
    return This->lpVtbl->GetGUID(This,guidKey,pguidValue);
}
static FORCEINLINE HRESULT IMFVideoMediaType_GetStringLength(IMFVideoMediaType* This,REFGUID guidKey,UINT32 *pcchLength) {
    return This->lpVtbl->GetStringLength(This,guidKey,pcchLength);
}
static FORCEINLINE HRESULT IMFVideoMediaType_GetString(IMFVideoMediaType* This,REFGUID guidKey,LPWSTR pwszValue,UINT32 cchBufSize,UINT32 *pcchLength) {
    return This->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength);
}
static FORCEINLINE HRESULT IMFVideoMediaType_GetAllocatedString(IMFVideoMediaType* This,REFGUID guidKey,LPWSTR *ppwszValue,UINT32 *pcchLength) {
    return This->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength);
}
static FORCEINLINE HRESULT IMFVideoMediaType_GetBlobSize(IMFVideoMediaType* This,REFGUID guidKey,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFVideoMediaType_GetBlob(IMFVideoMediaType* This,REFGUID guidKey,UINT8 *pBuf,UINT32 cbBufSize,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFVideoMediaType_GetAllocatedBlob(IMFVideoMediaType* This,REFGUID guidKey,UINT8 **ppBuf,UINT32 *pcbSize) {
    return This->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize);
}
static FORCEINLINE HRESULT IMFVideoMediaType_GetUnknown(IMFVideoMediaType* This,REFGUID guidKey,REFIID riid,LPVOID *ppv) {
    return This->lpVtbl->GetUnknown(This,guidKey,riid,ppv);
}
static FORCEINLINE HRESULT IMFVideoMediaType_SetItem(IMFVideoMediaType* This,REFGUID guidKey,REFPROPVARIANT Value) {
    return This->lpVtbl->SetItem(This,guidKey,Value);
}
static FORCEINLINE HRESULT IMFVideoMediaType_DeleteItem(IMFVideoMediaType* This,REFGUID guidKey) {
    return This->lpVtbl->DeleteItem(This,guidKey);
}
static FORCEINLINE HRESULT IMFVideoMediaType_DeleteAllItems(IMFVideoMediaType* This) {
    return This->lpVtbl->DeleteAllItems(This);
}
static FORCEINLINE HRESULT IMFVideoMediaType_SetUINT32(IMFVideoMediaType* This,REFGUID guidKey,UINT32 unValue) {
    return This->lpVtbl->SetUINT32(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFVideoMediaType_SetUINT64(IMFVideoMediaType* This,REFGUID guidKey,UINT64 unValue) {
    return This->lpVtbl->SetUINT64(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFVideoMediaType_SetDouble(IMFVideoMediaType* This,REFGUID guidKey,double fValue) {
    return This->lpVtbl->SetDouble(This,guidKey,fValue);
}
static FORCEINLINE HRESULT IMFVideoMediaType_SetGUID(IMFVideoMediaType* This,REFGUID guidKey,REFGUID guidValue) {
    return This->lpVtbl->SetGUID(This,guidKey,guidValue);
}
static FORCEINLINE HRESULT IMFVideoMediaType_SetString(IMFVideoMediaType* This,REFGUID guidKey,LPCWSTR wszValue) {
    return This->lpVtbl->SetString(This,guidKey,wszValue);
}
static FORCEINLINE HRESULT IMFVideoMediaType_SetBlob(IMFVideoMediaType* This,REFGUID guidKey,const UINT8 *pBuf,UINT32 cbBufSize) {
    return This->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize);
}
static FORCEINLINE HRESULT IMFVideoMediaType_SetUnknown(IMFVideoMediaType* This,REFGUID guidKey,IUnknown *pUnknown) {
    return This->lpVtbl->SetUnknown(This,guidKey,pUnknown);
}
static FORCEINLINE HRESULT IMFVideoMediaType_LockStore(IMFVideoMediaType* This) {
    return This->lpVtbl->LockStore(This);
}
static FORCEINLINE HRESULT IMFVideoMediaType_UnlockStore(IMFVideoMediaType* This) {
    return This->lpVtbl->UnlockStore(This);
}
static FORCEINLINE HRESULT IMFVideoMediaType_GetCount(IMFVideoMediaType* This,UINT32 *pcItems) {
    return This->lpVtbl->GetCount(This,pcItems);
}
static FORCEINLINE HRESULT IMFVideoMediaType_GetItemByIndex(IMFVideoMediaType* This,UINT32 unIndex,GUID *pguidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue);
}
static FORCEINLINE HRESULT IMFVideoMediaType_CopyAllItems(IMFVideoMediaType* This,IMFAttributes *pDest) {
    return This->lpVtbl->CopyAllItems(This,pDest);
}
/*** IMFMediaType methods ***/
static FORCEINLINE HRESULT IMFVideoMediaType_GetMajorType(IMFVideoMediaType* This,GUID *pguidMajorType) {
    return This->lpVtbl->GetMajorType(This,pguidMajorType);
}
static FORCEINLINE HRESULT IMFVideoMediaType_IsCompressedFormat(IMFVideoMediaType* This,WINBOOL *pfCompressed) {
    return This->lpVtbl->IsCompressedFormat(This,pfCompressed);
}
static FORCEINLINE HRESULT IMFVideoMediaType_IsEqual(IMFVideoMediaType* This,IMFMediaType *pIMediaType,DWORD *pdwFlags) {
    return This->lpVtbl->IsEqual(This,pIMediaType,pdwFlags);
}
static FORCEINLINE HRESULT IMFVideoMediaType_GetRepresentation(IMFVideoMediaType* This,GUID guidRepresentation,LPVOID *ppvRepresentation) {
    return This->lpVtbl->GetRepresentation(This,guidRepresentation,ppvRepresentation);
}
static FORCEINLINE HRESULT IMFVideoMediaType_FreeRepresentation(IMFVideoMediaType* This,GUID guidRepresentation,LPVOID pvRepresentation) {
    return This->lpVtbl->FreeRepresentation(This,guidRepresentation,pvRepresentation);
}
/*** IMFVideoMediaType methods ***/
static FORCEINLINE const MFVIDEOFORMAT * IMFVideoMediaType_GetVideoFormat(IMFVideoMediaType* This) {
    return This->lpVtbl->GetVideoFormat(This);
}
static FORCEINLINE HRESULT IMFVideoMediaType_GetVideoRepresentation(IMFVideoMediaType* This,GUID guidRepresentation,LPVOID *ppvRepresentation,LONG lStride) {
    return This->lpVtbl->GetVideoRepresentation(This,guidRepresentation,ppvRepresentation,lStride);
}
#endif
#endif

#endif

const MFVIDEOFORMAT * STDMETHODCALLTYPE IMFVideoMediaType_GetVideoFormat_Proxy(
    IMFVideoMediaType* This);
void __RPC_STUB IMFVideoMediaType_GetVideoFormat_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFVideoMediaType_GetVideoRepresentation_Proxy(
    IMFVideoMediaType* This,
    GUID guidRepresentation,
    LPVOID *ppvRepresentation,
    LONG lStride);
void __RPC_STUB IMFVideoMediaType_GetVideoRepresentation_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFVideoMediaType_INTERFACE_DEFINED__ */

#endif

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
/*****************************************************************************
 * IMFAsyncResult interface
 */
#ifndef __IMFAsyncResult_INTERFACE_DEFINED__
#define __IMFAsyncResult_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFAsyncResult, 0xac6b7889, 0x0740, 0x4d51, 0x86,0x19, 0x90,0x59,0x94,0xa5,0x5c,0xc6);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("ac6b7889-0740-4d51-8619-905994a55cc6")
IMFAsyncResult : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE GetState(
        IUnknown **ppunkState) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetStatus(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetStatus(
        HRESULT hrStatus) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetObject(
        IUnknown **ppObject) = 0;

    virtual IUnknown * STDMETHODCALLTYPE GetStateNoAddRef(
        ) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFAsyncResult, 0xac6b7889, 0x0740, 0x4d51, 0x86,0x19, 0x90,0x59,0x94,0xa5,0x5c,0xc6)
#endif
#else
typedef struct IMFAsyncResultVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFAsyncResult* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFAsyncResult* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFAsyncResult* This);

    /*** IMFAsyncResult methods ***/
    HRESULT (STDMETHODCALLTYPE *GetState)(
        IMFAsyncResult* This,
        IUnknown **ppunkState);

    HRESULT (STDMETHODCALLTYPE *GetStatus)(
        IMFAsyncResult* This);

    HRESULT (STDMETHODCALLTYPE *SetStatus)(
        IMFAsyncResult* This,
        HRESULT hrStatus);

    HRESULT (STDMETHODCALLTYPE *GetObject)(
        IMFAsyncResult* This,
        IUnknown **ppObject);

    IUnknown * (STDMETHODCALLTYPE *GetStateNoAddRef)(
        IMFAsyncResult* This);

    END_INTERFACE
} IMFAsyncResultVtbl;
interface IMFAsyncResult {
    CONST_VTBL IMFAsyncResultVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFAsyncResult_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFAsyncResult_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFAsyncResult_Release(This) (This)->lpVtbl->Release(This)
/*** IMFAsyncResult methods ***/
#define IMFAsyncResult_GetState(This,ppunkState) (This)->lpVtbl->GetState(This,ppunkState)
#define IMFAsyncResult_GetStatus(This) (This)->lpVtbl->GetStatus(This)
#define IMFAsyncResult_SetStatus(This,hrStatus) (This)->lpVtbl->SetStatus(This,hrStatus)
#define IMFAsyncResult_GetObject(This,ppObject) (This)->lpVtbl->GetObject(This,ppObject)
#define IMFAsyncResult_GetStateNoAddRef(This) (This)->lpVtbl->GetStateNoAddRef(This)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFAsyncResult_QueryInterface(IMFAsyncResult* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFAsyncResult_AddRef(IMFAsyncResult* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFAsyncResult_Release(IMFAsyncResult* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFAsyncResult methods ***/
static FORCEINLINE HRESULT IMFAsyncResult_GetState(IMFAsyncResult* This,IUnknown **ppunkState) {
    return This->lpVtbl->GetState(This,ppunkState);
}
static FORCEINLINE HRESULT IMFAsyncResult_GetStatus(IMFAsyncResult* This) {
    return This->lpVtbl->GetStatus(This);
}
static FORCEINLINE HRESULT IMFAsyncResult_SetStatus(IMFAsyncResult* This,HRESULT hrStatus) {
    return This->lpVtbl->SetStatus(This,hrStatus);
}
static FORCEINLINE HRESULT IMFAsyncResult_GetObject(IMFAsyncResult* This,IUnknown **ppObject) {
    return This->lpVtbl->GetObject(This,ppObject);
}
static FORCEINLINE IUnknown * IMFAsyncResult_GetStateNoAddRef(IMFAsyncResult* This) {
    return This->lpVtbl->GetStateNoAddRef(This);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFAsyncResult_GetState_Proxy(
    IMFAsyncResult* This,
    IUnknown **ppunkState);
void __RPC_STUB IMFAsyncResult_GetState_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAsyncResult_GetStatus_Proxy(
    IMFAsyncResult* This);
void __RPC_STUB IMFAsyncResult_GetStatus_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAsyncResult_SetStatus_Proxy(
    IMFAsyncResult* This,
    HRESULT hrStatus);
void __RPC_STUB IMFAsyncResult_SetStatus_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAsyncResult_GetObject_Proxy(
    IMFAsyncResult* This,
    IUnknown **ppObject);
void __RPC_STUB IMFAsyncResult_GetObject_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFAsyncResult_INTERFACE_DEFINED__ */


/*****************************************************************************
 * IMFAsyncCallback interface
 */
#ifndef __IMFAsyncCallback_INTERFACE_DEFINED__
#define __IMFAsyncCallback_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFAsyncCallback, 0xa27003cf, 0x2354, 0x4f2a, 0x8d,0x6a, 0xab,0x7c,0xff,0x15,0x43,0x7e);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("a27003cf-2354-4f2a-8d6a-ab7cff15437e")
IMFAsyncCallback : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE GetParameters(
        DWORD *pdwFlags,
        DWORD *pdwQueue) = 0;

    virtual HRESULT STDMETHODCALLTYPE Invoke(
        IMFAsyncResult *pAsyncResult) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFAsyncCallback, 0xa27003cf, 0x2354, 0x4f2a, 0x8d,0x6a, 0xab,0x7c,0xff,0x15,0x43,0x7e)
#endif
#else
typedef struct IMFAsyncCallbackVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFAsyncCallback* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFAsyncCallback* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFAsyncCallback* This);

    /*** IMFAsyncCallback methods ***/
    HRESULT (STDMETHODCALLTYPE *GetParameters)(
        IMFAsyncCallback* This,
        DWORD *pdwFlags,
        DWORD *pdwQueue);

    HRESULT (STDMETHODCALLTYPE *Invoke)(
        IMFAsyncCallback* This,
        IMFAsyncResult *pAsyncResult);

    END_INTERFACE
} IMFAsyncCallbackVtbl;
interface IMFAsyncCallback {
    CONST_VTBL IMFAsyncCallbackVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFAsyncCallback_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFAsyncCallback_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFAsyncCallback_Release(This) (This)->lpVtbl->Release(This)
/*** IMFAsyncCallback methods ***/
#define IMFAsyncCallback_GetParameters(This,pdwFlags,pdwQueue) (This)->lpVtbl->GetParameters(This,pdwFlags,pdwQueue)
#define IMFAsyncCallback_Invoke(This,pAsyncResult) (This)->lpVtbl->Invoke(This,pAsyncResult)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFAsyncCallback_QueryInterface(IMFAsyncCallback* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFAsyncCallback_AddRef(IMFAsyncCallback* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFAsyncCallback_Release(IMFAsyncCallback* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFAsyncCallback methods ***/
static FORCEINLINE HRESULT IMFAsyncCallback_GetParameters(IMFAsyncCallback* This,DWORD *pdwFlags,DWORD *pdwQueue) {
    return This->lpVtbl->GetParameters(This,pdwFlags,pdwQueue);
}
static FORCEINLINE HRESULT IMFAsyncCallback_Invoke(IMFAsyncCallback* This,IMFAsyncResult *pAsyncResult) {
    return This->lpVtbl->Invoke(This,pAsyncResult);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFAsyncCallback_GetParameters_Proxy(
    IMFAsyncCallback* This,
    DWORD *pdwFlags,
    DWORD *pdwQueue);
void __RPC_STUB IMFAsyncCallback_GetParameters_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFAsyncCallback_Invoke_Proxy(
    IMFAsyncCallback* This,
    IMFAsyncResult *pAsyncResult);
void __RPC_STUB IMFAsyncCallback_Invoke_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFAsyncCallback_INTERFACE_DEFINED__ */

#endif

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
/*****************************************************************************
 * IMFAsyncCallbackLogging interface
 */
#ifndef __IMFAsyncCallbackLogging_INTERFACE_DEFINED__
#define __IMFAsyncCallbackLogging_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFAsyncCallbackLogging, 0xc7a4dca1, 0xf5f0, 0x47b6, 0xb9,0x2b, 0xbf,0x01,0x06,0xd2,0x57,0x91);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("c7a4dca1-f5f0-47b6-b92b-bf0106d25791")
IMFAsyncCallbackLogging : public IMFAsyncCallback
{
    virtual void * STDMETHODCALLTYPE GetObjectPointer(
        ) = 0;

    virtual DWORD STDMETHODCALLTYPE GetObjectTag(
        ) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFAsyncCallbackLogging, 0xc7a4dca1, 0xf5f0, 0x47b6, 0xb9,0x2b, 0xbf,0x01,0x06,0xd2,0x57,0x91)
#endif
#else
typedef struct IMFAsyncCallbackLoggingVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFAsyncCallbackLogging* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFAsyncCallbackLogging* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFAsyncCallbackLogging* This);

    /*** IMFAsyncCallback methods ***/
    HRESULT (STDMETHODCALLTYPE *GetParameters)(
        IMFAsyncCallbackLogging* This,
        DWORD *pdwFlags,
        DWORD *pdwQueue);

    HRESULT (STDMETHODCALLTYPE *Invoke)(
        IMFAsyncCallbackLogging* This,
        IMFAsyncResult *pAsyncResult);

    /*** IMFAsyncCallbackLogging methods ***/
    void * (STDMETHODCALLTYPE *GetObjectPointer)(
        IMFAsyncCallbackLogging* This);

    DWORD (STDMETHODCALLTYPE *GetObjectTag)(
        IMFAsyncCallbackLogging* This);

    END_INTERFACE
} IMFAsyncCallbackLoggingVtbl;
interface IMFAsyncCallbackLogging {
    CONST_VTBL IMFAsyncCallbackLoggingVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFAsyncCallbackLogging_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFAsyncCallbackLogging_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFAsyncCallbackLogging_Release(This) (This)->lpVtbl->Release(This)
/*** IMFAsyncCallback methods ***/
#define IMFAsyncCallbackLogging_GetParameters(This,pdwFlags,pdwQueue) (This)->lpVtbl->GetParameters(This,pdwFlags,pdwQueue)
#define IMFAsyncCallbackLogging_Invoke(This,pAsyncResult) (This)->lpVtbl->Invoke(This,pAsyncResult)
/*** IMFAsyncCallbackLogging methods ***/
#define IMFAsyncCallbackLogging_GetObjectPointer(This) (This)->lpVtbl->GetObjectPointer(This)
#define IMFAsyncCallbackLogging_GetObjectTag(This) (This)->lpVtbl->GetObjectTag(This)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFAsyncCallbackLogging_QueryInterface(IMFAsyncCallbackLogging* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFAsyncCallbackLogging_AddRef(IMFAsyncCallbackLogging* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFAsyncCallbackLogging_Release(IMFAsyncCallbackLogging* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFAsyncCallback methods ***/
static FORCEINLINE HRESULT IMFAsyncCallbackLogging_GetParameters(IMFAsyncCallbackLogging* This,DWORD *pdwFlags,DWORD *pdwQueue) {
    return This->lpVtbl->GetParameters(This,pdwFlags,pdwQueue);
}
static FORCEINLINE HRESULT IMFAsyncCallbackLogging_Invoke(IMFAsyncCallbackLogging* This,IMFAsyncResult *pAsyncResult) {
    return This->lpVtbl->Invoke(This,pAsyncResult);
}
/*** IMFAsyncCallbackLogging methods ***/
static FORCEINLINE void * IMFAsyncCallbackLogging_GetObjectPointer(IMFAsyncCallbackLogging* This) {
    return This->lpVtbl->GetObjectPointer(This);
}
static FORCEINLINE DWORD IMFAsyncCallbackLogging_GetObjectTag(IMFAsyncCallbackLogging* This) {
    return This->lpVtbl->GetObjectTag(This);
}
#endif
#endif

#endif

void * STDMETHODCALLTYPE IMFAsyncCallbackLogging_GetObjectPointer_Proxy(
    IMFAsyncCallbackLogging* This);
void __RPC_STUB IMFAsyncCallbackLogging_GetObjectPointer_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
DWORD STDMETHODCALLTYPE IMFAsyncCallbackLogging_GetObjectTag_Proxy(
    IMFAsyncCallbackLogging* This);
void __RPC_STUB IMFAsyncCallbackLogging_GetObjectTag_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFAsyncCallbackLogging_INTERFACE_DEFINED__ */

#endif

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
#define MFASYNC_FAST_IO_PROCESSING_CALLBACK 0x00000001
#define MFASYNC_SIGNAL_CALLBACK 0x00000002
#define MFASYNC_BLOCKING_CALLBACK 0x00000004
#define MFASYNC_REPLY_CALLBACK 0x00000008
#define MFASYNC_LOCALIZE_REMOTE_CALLBACK 0x00000010

#define MFASYNC_CALLBACK_QUEUE_UNDEFINED 0x00000000
#define MFASYNC_CALLBACK_QUEUE_STANDARD 0x00000001
#define MFASYNC_CALLBACK_QUEUE_RT 0x00000002
#define MFASYNC_CALLBACK_QUEUE_IO 0x00000003
#define MFASYNC_CALLBACK_QUEUE_TIMER 0x00000004
#define MFASYNC_CALLBACK_QUEUE_MULTITHREADED 0x00000005
#define MFASYNC_CALLBACK_QUEUE_LONG_FUNCTION 0x00000007
#define MFASYNC_CALLBACK_QUEUE_PRIVATE_MASK 0xFFFF0000
#define MFASYNC_CALLBACK_QUEUE_ALL 0xFFFFFFFF

enum {
    MEUnknown = 0,
    MEError = 1,
    MEExtendedType = 2,
    MENonFatalError = 3,
    MEGenericV1Anchor = MENonFatalError,
    MESessionUnknown = 100,
    MESessionTopologySet = 101,
    MESessionTopologiesCleared = 102,
    MESessionStarted = 103,
    MESessionPaused = 104,
    MESessionStopped = 105,
    MESessionClosed = 106,
    MESessionEnded = 107,
    MESessionRateChanged = 108,
    MESessionScrubSampleComplete = 109,
    MESessionCapabilitiesChanged = 110,
    MESessionTopologyStatus = 111,
    MESessionNotifyPresentationTime = 112,
    MENewPresentation = 113,
    MELicenseAcquisitionStart = 114,
    MELicenseAcquisitionCompleted = 115,
    MEIndividualizationStart = 116,
    MEIndividualizationCompleted = 117,
    MEEnablerProgress = 118,
    MEEnablerCompleted = 119,
    MEPolicyError = 120,
    MEPolicyReport = 121,
    MEBufferingStarted = 122,
    MEBufferingStopped = 123,
    MEConnectStart = 124,
    MEConnectEnd = 125,
    MEReconnectStart = 126,
    MEReconnectEnd = 127,
    MERendererEvent = 128,
    MESessionStreamSinkFormatChanged = 129,
    MESessionV1Anchor = MESessionStreamSinkFormatChanged,
    MESourceUnknown = 200,
    MESourceStarted = 201,
    MEStreamStarted = 202,
    MESourceSeeked = 203,
    MEStreamSeeked = 204,
    MENewStream = 205,
    MEUpdatedStream = 206,
    MESourceStopped = 207,
    MEStreamStopped = 208,
    MESourcePaused = 209,
    MEStreamPaused = 210,
    MEEndOfPresentation = 211,
    MEEndOfStream = 212,
    MEMediaSample = 213,
    MEStreamTick = 214,
    MEStreamThinMode = 215,
    MEStreamFormatChanged = 216,
    MESourceRateChanged = 217,
    MEEndOfPresentationSegment = 218,
    MESourceCharacteristicsChanged = 219,
    MESourceRateChangeRequested = 220,
    MESourceMetadataChanged = 221,
    MESequencerSourceTopologyUpdated = 222,
    MESourceV1Anchor = MESequencerSourceTopologyUpdated,
    MESinkUnknown = 300,
    MEStreamSinkStarted = 301,
    MEStreamSinkStopped = 302,
    MEStreamSinkPaused = 303,
    MEStreamSinkRateChanged = 304,
    MEStreamSinkRequestSample = 305,
    MEStreamSinkMarker = 306,
    MEStreamSinkPrerolled = 307,
    MEStreamSinkScrubSampleComplete = 308,
    MEStreamSinkFormatChanged = 309,
    MEStreamSinkDeviceChanged = 310,
    MEQualityNotify = 311,
    MESinkInvalidated = 312,
    MEAudioSessionNameChanged = 313,
    MEAudioSessionVolumeChanged = 314,
    MEAudioSessionDeviceRemoved = 315,
    MEAudioSessionServerShutdown = 316,
    MEAudioSessionGroupingParamChanged = 317,
    MEAudioSessionIconChanged = 318,
    MEAudioSessionFormatChanged = 319,
    MEAudioSessionDisconnected = 320,
    MEAudioSessionExclusiveModeOverride = 321,
    MESinkV1Anchor = MEAudioSessionExclusiveModeOverride,
    METrustUnknown = 400,
    MEPolicyChanged = 401,
    MEContentProtectionMessage = 402,
    MEPolicySet = 403,
    METrustV1Anchor = MEPolicySet,
    MEWMDRMLicenseBackupCompleted = 500,
    MEWMDRMLicenseBackupProgress = 501,
    MEWMDRMLicenseRestoreCompleted = 502,
    MEWMDRMLicenseRestoreProgress = 503,
    MEWMDRMLicenseAcquisitionCompleted = 506,
    MEWMDRMIndividualizationCompleted = 508,
    MEWMDRMIndividualizationProgress = 513,
    MEWMDRMProximityCompleted = 514,
    MEWMDRMLicenseStoreCleaned = 515,
    MEWMDRMRevocationDownloadCompleted = 516,
    MEWMDRMV1Anchor = MEWMDRMRevocationDownloadCompleted,
    MEReservedMax = 10000
};


typedef DWORD MediaEventType;

/*****************************************************************************
 * IMFMediaEvent interface
 */
#ifndef __IMFMediaEvent_INTERFACE_DEFINED__
#define __IMFMediaEvent_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFMediaEvent, 0xdf598932, 0xf10c, 0x4e39, 0xbb,0xa2, 0xc3,0x08,0xf1,0x01,0xda,0xa3);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("df598932-f10c-4e39-bba2-c308f101daa3")
IMFMediaEvent : public IMFAttributes
{
    virtual HRESULT STDMETHODCALLTYPE GetType(
        MediaEventType *pmet) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetExtendedType(
        GUID *pguidExtendedType) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetStatus(
        HRESULT *phrStatus) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetValue(
        PROPVARIANT *pvValue) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFMediaEvent, 0xdf598932, 0xf10c, 0x4e39, 0xbb,0xa2, 0xc3,0x08,0xf1,0x01,0xda,0xa3)
#endif
#else
typedef struct IMFMediaEventVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFMediaEvent* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFMediaEvent* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFMediaEvent* This);

    /*** IMFAttributes methods ***/
    HRESULT (STDMETHODCALLTYPE *GetItem)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *GetItemType)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        MF_ATTRIBUTE_TYPE *pType);

    HRESULT (STDMETHODCALLTYPE *CompareItem)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        REFPROPVARIANT Value,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *Compare)(
        IMFMediaEvent* This,
        IMFAttributes *pTheirs,
        MF_ATTRIBUTES_MATCH_TYPE MatchType,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *GetUINT32)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        UINT32 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetUINT64)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        UINT64 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetDouble)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        double *pfValue);

    HRESULT (STDMETHODCALLTYPE *GetGUID)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        GUID *pguidValue);

    HRESULT (STDMETHODCALLTYPE *GetStringLength)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetString)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        LPWSTR pwszValue,
        UINT32 cchBufSize,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedString)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        LPWSTR *ppwszValue,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetBlobSize)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetBlob)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        UINT8 *pBuf,
        UINT32 cbBufSize,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedBlob)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        UINT8 **ppBuf,
        UINT32 *pcbSize);

    HRESULT (STDMETHODCALLTYPE *GetUnknown)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        REFIID riid,
        LPVOID *ppv);

    HRESULT (STDMETHODCALLTYPE *SetItem)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        REFPROPVARIANT Value);

    HRESULT (STDMETHODCALLTYPE *DeleteItem)(
        IMFMediaEvent* This,
        REFGUID guidKey);

    HRESULT (STDMETHODCALLTYPE *DeleteAllItems)(
        IMFMediaEvent* This);

    HRESULT (STDMETHODCALLTYPE *SetUINT32)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        UINT32 unValue);

    HRESULT (STDMETHODCALLTYPE *SetUINT64)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        UINT64 unValue);

    HRESULT (STDMETHODCALLTYPE *SetDouble)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        double fValue);

    HRESULT (STDMETHODCALLTYPE *SetGUID)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        REFGUID guidValue);

    HRESULT (STDMETHODCALLTYPE *SetString)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        LPCWSTR wszValue);

    HRESULT (STDMETHODCALLTYPE *SetBlob)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        const UINT8 *pBuf,
        UINT32 cbBufSize);

    HRESULT (STDMETHODCALLTYPE *SetUnknown)(
        IMFMediaEvent* This,
        REFGUID guidKey,
        IUnknown *pUnknown);

    HRESULT (STDMETHODCALLTYPE *LockStore)(
        IMFMediaEvent* This);

    HRESULT (STDMETHODCALLTYPE *UnlockStore)(
        IMFMediaEvent* This);

    HRESULT (STDMETHODCALLTYPE *GetCount)(
        IMFMediaEvent* This,
        UINT32 *pcItems);

    HRESULT (STDMETHODCALLTYPE *GetItemByIndex)(
        IMFMediaEvent* This,
        UINT32 unIndex,
        GUID *pguidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *CopyAllItems)(
        IMFMediaEvent* This,
        IMFAttributes *pDest);

    /*** IMFMediaEvent methods ***/
    HRESULT (STDMETHODCALLTYPE *GetType)(
        IMFMediaEvent* This,
        MediaEventType *pmet);

    HRESULT (STDMETHODCALLTYPE *GetExtendedType)(
        IMFMediaEvent* This,
        GUID *pguidExtendedType);

    HRESULT (STDMETHODCALLTYPE *GetStatus)(
        IMFMediaEvent* This,
        HRESULT *phrStatus);

    HRESULT (STDMETHODCALLTYPE *GetValue)(
        IMFMediaEvent* This,
        PROPVARIANT *pvValue);

    END_INTERFACE
} IMFMediaEventVtbl;
interface IMFMediaEvent {
    CONST_VTBL IMFMediaEventVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFMediaEvent_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFMediaEvent_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFMediaEvent_Release(This) (This)->lpVtbl->Release(This)
/*** IMFAttributes methods ***/
#define IMFMediaEvent_GetItem(This,guidKey,pValue) (This)->lpVtbl->GetItem(This,guidKey,pValue)
#define IMFMediaEvent_GetItemType(This,guidKey,pType) (This)->lpVtbl->GetItemType(This,guidKey,pType)
#define IMFMediaEvent_CompareItem(This,guidKey,Value,pbResult) (This)->lpVtbl->CompareItem(This,guidKey,Value,pbResult)
#define IMFMediaEvent_Compare(This,pTheirs,MatchType,pbResult) (This)->lpVtbl->Compare(This,pTheirs,MatchType,pbResult)
#define IMFMediaEvent_GetUINT32(This,guidKey,punValue) (This)->lpVtbl->GetUINT32(This,guidKey,punValue)
#define IMFMediaEvent_GetUINT64(This,guidKey,punValue) (This)->lpVtbl->GetUINT64(This,guidKey,punValue)
#define IMFMediaEvent_GetDouble(This,guidKey,pfValue) (This)->lpVtbl->GetDouble(This,guidKey,pfValue)
#define IMFMediaEvent_GetGUID(This,guidKey,pguidValue) (This)->lpVtbl->GetGUID(This,guidKey,pguidValue)
#define IMFMediaEvent_GetStringLength(This,guidKey,pcchLength) (This)->lpVtbl->GetStringLength(This,guidKey,pcchLength)
#define IMFMediaEvent_GetString(This,guidKey,pwszValue,cchBufSize,pcchLength) (This)->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength)
#define IMFMediaEvent_GetAllocatedString(This,guidKey,ppwszValue,pcchLength) (This)->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength)
#define IMFMediaEvent_GetBlobSize(This,guidKey,pcbBlobSize) (This)->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize)
#define IMFMediaEvent_GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize) (This)->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize)
#define IMFMediaEvent_GetAllocatedBlob(This,guidKey,ppBuf,pcbSize) (This)->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize)
#define IMFMediaEvent_GetUnknown(This,guidKey,riid,ppv) (This)->lpVtbl->GetUnknown(This,guidKey,riid,ppv)
#define IMFMediaEvent_SetItem(This,guidKey,Value) (This)->lpVtbl->SetItem(This,guidKey,Value)
#define IMFMediaEvent_DeleteItem(This,guidKey) (This)->lpVtbl->DeleteItem(This,guidKey)
#define IMFMediaEvent_DeleteAllItems(This) (This)->lpVtbl->DeleteAllItems(This)
#define IMFMediaEvent_SetUINT32(This,guidKey,unValue) (This)->lpVtbl->SetUINT32(This,guidKey,unValue)
#define IMFMediaEvent_SetUINT64(This,guidKey,unValue) (This)->lpVtbl->SetUINT64(This,guidKey,unValue)
#define IMFMediaEvent_SetDouble(This,guidKey,fValue) (This)->lpVtbl->SetDouble(This,guidKey,fValue)
#define IMFMediaEvent_SetGUID(This,guidKey,guidValue) (This)->lpVtbl->SetGUID(This,guidKey,guidValue)
#define IMFMediaEvent_SetString(This,guidKey,wszValue) (This)->lpVtbl->SetString(This,guidKey,wszValue)
#define IMFMediaEvent_SetBlob(This,guidKey,pBuf,cbBufSize) (This)->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize)
#define IMFMediaEvent_SetUnknown(This,guidKey,pUnknown) (This)->lpVtbl->SetUnknown(This,guidKey,pUnknown)
#define IMFMediaEvent_LockStore(This) (This)->lpVtbl->LockStore(This)
#define IMFMediaEvent_UnlockStore(This) (This)->lpVtbl->UnlockStore(This)
#define IMFMediaEvent_GetCount(This,pcItems) (This)->lpVtbl->GetCount(This,pcItems)
#define IMFMediaEvent_GetItemByIndex(This,unIndex,pguidKey,pValue) (This)->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue)
#define IMFMediaEvent_CopyAllItems(This,pDest) (This)->lpVtbl->CopyAllItems(This,pDest)
/*** IMFMediaEvent methods ***/
#define IMFMediaEvent_GetType(This,pmet) (This)->lpVtbl->GetType(This,pmet)
#define IMFMediaEvent_GetExtendedType(This,pguidExtendedType) (This)->lpVtbl->GetExtendedType(This,pguidExtendedType)
#define IMFMediaEvent_GetStatus(This,phrStatus) (This)->lpVtbl->GetStatus(This,phrStatus)
#define IMFMediaEvent_GetValue(This,pvValue) (This)->lpVtbl->GetValue(This,pvValue)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFMediaEvent_QueryInterface(IMFMediaEvent* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFMediaEvent_AddRef(IMFMediaEvent* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFMediaEvent_Release(IMFMediaEvent* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFAttributes methods ***/
static FORCEINLINE HRESULT IMFMediaEvent_GetItem(IMFMediaEvent* This,REFGUID guidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItem(This,guidKey,pValue);
}
static FORCEINLINE HRESULT IMFMediaEvent_GetItemType(IMFMediaEvent* This,REFGUID guidKey,MF_ATTRIBUTE_TYPE *pType) {
    return This->lpVtbl->GetItemType(This,guidKey,pType);
}
static FORCEINLINE HRESULT IMFMediaEvent_CompareItem(IMFMediaEvent* This,REFGUID guidKey,REFPROPVARIANT Value,WINBOOL *pbResult) {
    return This->lpVtbl->CompareItem(This,guidKey,Value,pbResult);
}
static FORCEINLINE HRESULT IMFMediaEvent_Compare(IMFMediaEvent* This,IMFAttributes *pTheirs,MF_ATTRIBUTES_MATCH_TYPE MatchType,WINBOOL *pbResult) {
    return This->lpVtbl->Compare(This,pTheirs,MatchType,pbResult);
}
static FORCEINLINE HRESULT IMFMediaEvent_GetUINT32(IMFMediaEvent* This,REFGUID guidKey,UINT32 *punValue) {
    return This->lpVtbl->GetUINT32(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFMediaEvent_GetUINT64(IMFMediaEvent* This,REFGUID guidKey,UINT64 *punValue) {
    return This->lpVtbl->GetUINT64(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFMediaEvent_GetDouble(IMFMediaEvent* This,REFGUID guidKey,double *pfValue) {
    return This->lpVtbl->GetDouble(This,guidKey,pfValue);
}
static FORCEINLINE HRESULT IMFMediaEvent_GetGUID(IMFMediaEvent* This,REFGUID guidKey,GUID *pguidValue) {
    return This->lpVtbl->GetGUID(This,guidKey,pguidValue);
}
static FORCEINLINE HRESULT IMFMediaEvent_GetStringLength(IMFMediaEvent* This,REFGUID guidKey,UINT32 *pcchLength) {
    return This->lpVtbl->GetStringLength(This,guidKey,pcchLength);
}
static FORCEINLINE HRESULT IMFMediaEvent_GetString(IMFMediaEvent* This,REFGUID guidKey,LPWSTR pwszValue,UINT32 cchBufSize,UINT32 *pcchLength) {
    return This->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength);
}
static FORCEINLINE HRESULT IMFMediaEvent_GetAllocatedString(IMFMediaEvent* This,REFGUID guidKey,LPWSTR *ppwszValue,UINT32 *pcchLength) {
    return This->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength);
}
static FORCEINLINE HRESULT IMFMediaEvent_GetBlobSize(IMFMediaEvent* This,REFGUID guidKey,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFMediaEvent_GetBlob(IMFMediaEvent* This,REFGUID guidKey,UINT8 *pBuf,UINT32 cbBufSize,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFMediaEvent_GetAllocatedBlob(IMFMediaEvent* This,REFGUID guidKey,UINT8 **ppBuf,UINT32 *pcbSize) {
    return This->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize);
}
static FORCEINLINE HRESULT IMFMediaEvent_GetUnknown(IMFMediaEvent* This,REFGUID guidKey,REFIID riid,LPVOID *ppv) {
    return This->lpVtbl->GetUnknown(This,guidKey,riid,ppv);
}
static FORCEINLINE HRESULT IMFMediaEvent_SetItem(IMFMediaEvent* This,REFGUID guidKey,REFPROPVARIANT Value) {
    return This->lpVtbl->SetItem(This,guidKey,Value);
}
static FORCEINLINE HRESULT IMFMediaEvent_DeleteItem(IMFMediaEvent* This,REFGUID guidKey) {
    return This->lpVtbl->DeleteItem(This,guidKey);
}
static FORCEINLINE HRESULT IMFMediaEvent_DeleteAllItems(IMFMediaEvent* This) {
    return This->lpVtbl->DeleteAllItems(This);
}
static FORCEINLINE HRESULT IMFMediaEvent_SetUINT32(IMFMediaEvent* This,REFGUID guidKey,UINT32 unValue) {
    return This->lpVtbl->SetUINT32(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFMediaEvent_SetUINT64(IMFMediaEvent* This,REFGUID guidKey,UINT64 unValue) {
    return This->lpVtbl->SetUINT64(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFMediaEvent_SetDouble(IMFMediaEvent* This,REFGUID guidKey,double fValue) {
    return This->lpVtbl->SetDouble(This,guidKey,fValue);
}
static FORCEINLINE HRESULT IMFMediaEvent_SetGUID(IMFMediaEvent* This,REFGUID guidKey,REFGUID guidValue) {
    return This->lpVtbl->SetGUID(This,guidKey,guidValue);
}
static FORCEINLINE HRESULT IMFMediaEvent_SetString(IMFMediaEvent* This,REFGUID guidKey,LPCWSTR wszValue) {
    return This->lpVtbl->SetString(This,guidKey,wszValue);
}
static FORCEINLINE HRESULT IMFMediaEvent_SetBlob(IMFMediaEvent* This,REFGUID guidKey,const UINT8 *pBuf,UINT32 cbBufSize) {
    return This->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize);
}
static FORCEINLINE HRESULT IMFMediaEvent_SetUnknown(IMFMediaEvent* This,REFGUID guidKey,IUnknown *pUnknown) {
    return This->lpVtbl->SetUnknown(This,guidKey,pUnknown);
}
static FORCEINLINE HRESULT IMFMediaEvent_LockStore(IMFMediaEvent* This) {
    return This->lpVtbl->LockStore(This);
}
static FORCEINLINE HRESULT IMFMediaEvent_UnlockStore(IMFMediaEvent* This) {
    return This->lpVtbl->UnlockStore(This);
}
static FORCEINLINE HRESULT IMFMediaEvent_GetCount(IMFMediaEvent* This,UINT32 *pcItems) {
    return This->lpVtbl->GetCount(This,pcItems);
}
static FORCEINLINE HRESULT IMFMediaEvent_GetItemByIndex(IMFMediaEvent* This,UINT32 unIndex,GUID *pguidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue);
}
static FORCEINLINE HRESULT IMFMediaEvent_CopyAllItems(IMFMediaEvent* This,IMFAttributes *pDest) {
    return This->lpVtbl->CopyAllItems(This,pDest);
}
/*** IMFMediaEvent methods ***/
static FORCEINLINE HRESULT IMFMediaEvent_GetType(IMFMediaEvent* This,MediaEventType *pmet) {
    return This->lpVtbl->GetType(This,pmet);
}
static FORCEINLINE HRESULT IMFMediaEvent_GetExtendedType(IMFMediaEvent* This,GUID *pguidExtendedType) {
    return This->lpVtbl->GetExtendedType(This,pguidExtendedType);
}
static FORCEINLINE HRESULT IMFMediaEvent_GetStatus(IMFMediaEvent* This,HRESULT *phrStatus) {
    return This->lpVtbl->GetStatus(This,phrStatus);
}
static FORCEINLINE HRESULT IMFMediaEvent_GetValue(IMFMediaEvent* This,PROPVARIANT *pvValue) {
    return This->lpVtbl->GetValue(This,pvValue);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFMediaEvent_GetType_Proxy(
    IMFMediaEvent* This,
    MediaEventType *pmet);
void __RPC_STUB IMFMediaEvent_GetType_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaEvent_GetExtendedType_Proxy(
    IMFMediaEvent* This,
    GUID *pguidExtendedType);
void __RPC_STUB IMFMediaEvent_GetExtendedType_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaEvent_GetStatus_Proxy(
    IMFMediaEvent* This,
    HRESULT *phrStatus);
void __RPC_STUB IMFMediaEvent_GetStatus_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaEvent_GetValue_Proxy(
    IMFMediaEvent* This,
    PROPVARIANT *pvValue);
void __RPC_STUB IMFMediaEvent_GetValue_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFMediaEvent_INTERFACE_DEFINED__ */


#define MF_EVENT_FLAG_NO_WAIT 0x00000001

#ifndef __IMFRemoteAsyncCallback_FWD_DEFINED__
#define __IMFRemoteAsyncCallback_FWD_DEFINED__
typedef interface IMFRemoteAsyncCallback IMFRemoteAsyncCallback;
#endif


/*****************************************************************************
 * IMFMediaEventGenerator interface
 */
#ifndef __IMFMediaEventGenerator_INTERFACE_DEFINED__
#define __IMFMediaEventGenerator_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFMediaEventGenerator, 0x2cd0bd52, 0xbcd5, 0x4b89, 0xb6,0x2c, 0xea,0xdc,0x0c,0x03,0x1e,0x7d);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("2cd0bd52-bcd5-4b89-b62c-eadc0c031e7d")
IMFMediaEventGenerator : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE GetEvent(
        DWORD dwFlags,
        IMFMediaEvent **ppEvent) = 0;

    virtual HRESULT STDMETHODCALLTYPE BeginGetEvent(
        IMFAsyncCallback *pCallback,
        IUnknown *punkState) = 0;

    virtual HRESULT STDMETHODCALLTYPE EndGetEvent(
        IMFAsyncResult *pResult,
        IMFMediaEvent **ppEvent) = 0;

    virtual HRESULT STDMETHODCALLTYPE QueueEvent(
        MediaEventType met,
        REFGUID guidExtendedType,
        HRESULT hrStatus,
        const PROPVARIANT *pvValue) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFMediaEventGenerator, 0x2cd0bd52, 0xbcd5, 0x4b89, 0xb6,0x2c, 0xea,0xdc,0x0c,0x03,0x1e,0x7d)
#endif
#else
typedef struct IMFMediaEventGeneratorVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFMediaEventGenerator* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFMediaEventGenerator* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFMediaEventGenerator* This);

    /*** IMFMediaEventGenerator methods ***/
    HRESULT (STDMETHODCALLTYPE *GetEvent)(
        IMFMediaEventGenerator* This,
        DWORD dwFlags,
        IMFMediaEvent **ppEvent);

    HRESULT (STDMETHODCALLTYPE *BeginGetEvent)(
        IMFMediaEventGenerator* This,
        IMFAsyncCallback *pCallback,
        IUnknown *punkState);

    HRESULT (STDMETHODCALLTYPE *EndGetEvent)(
        IMFMediaEventGenerator* This,
        IMFAsyncResult *pResult,
        IMFMediaEvent **ppEvent);

    HRESULT (STDMETHODCALLTYPE *QueueEvent)(
        IMFMediaEventGenerator* This,
        MediaEventType met,
        REFGUID guidExtendedType,
        HRESULT hrStatus,
        const PROPVARIANT *pvValue);

    END_INTERFACE
} IMFMediaEventGeneratorVtbl;
interface IMFMediaEventGenerator {
    CONST_VTBL IMFMediaEventGeneratorVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFMediaEventGenerator_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFMediaEventGenerator_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFMediaEventGenerator_Release(This) (This)->lpVtbl->Release(This)
/*** IMFMediaEventGenerator methods ***/
#define IMFMediaEventGenerator_GetEvent(This,dwFlags,ppEvent) (This)->lpVtbl->GetEvent(This,dwFlags,ppEvent)
#define IMFMediaEventGenerator_BeginGetEvent(This,pCallback,punkState) (This)->lpVtbl->BeginGetEvent(This,pCallback,punkState)
#define IMFMediaEventGenerator_EndGetEvent(This,pResult,ppEvent) (This)->lpVtbl->EndGetEvent(This,pResult,ppEvent)
#define IMFMediaEventGenerator_QueueEvent(This,met,guidExtendedType,hrStatus,pvValue) (This)->lpVtbl->QueueEvent(This,met,guidExtendedType,hrStatus,pvValue)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFMediaEventGenerator_QueryInterface(IMFMediaEventGenerator* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFMediaEventGenerator_AddRef(IMFMediaEventGenerator* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFMediaEventGenerator_Release(IMFMediaEventGenerator* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFMediaEventGenerator methods ***/
static FORCEINLINE HRESULT IMFMediaEventGenerator_GetEvent(IMFMediaEventGenerator* This,DWORD dwFlags,IMFMediaEvent **ppEvent) {
    return This->lpVtbl->GetEvent(This,dwFlags,ppEvent);
}
static FORCEINLINE HRESULT IMFMediaEventGenerator_BeginGetEvent(IMFMediaEventGenerator* This,IMFAsyncCallback *pCallback,IUnknown *punkState) {
    return This->lpVtbl->BeginGetEvent(This,pCallback,punkState);
}
static FORCEINLINE HRESULT IMFMediaEventGenerator_EndGetEvent(IMFMediaEventGenerator* This,IMFAsyncResult *pResult,IMFMediaEvent **ppEvent) {
    return This->lpVtbl->EndGetEvent(This,pResult,ppEvent);
}
static FORCEINLINE HRESULT IMFMediaEventGenerator_QueueEvent(IMFMediaEventGenerator* This,MediaEventType met,REFGUID guidExtendedType,HRESULT hrStatus,const PROPVARIANT *pvValue) {
    return This->lpVtbl->QueueEvent(This,met,guidExtendedType,hrStatus,pvValue);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFMediaEventGenerator_GetEvent_Proxy(
    IMFMediaEventGenerator* This,
    DWORD dwFlags,
    IMFMediaEvent **ppEvent);
void __RPC_STUB IMFMediaEventGenerator_GetEvent_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaEventGenerator_RemoteBeginGetEvent_Proxy(
    IMFMediaEventGenerator* This,
    IMFRemoteAsyncCallback *pCallback);
void __RPC_STUB IMFMediaEventGenerator_RemoteBeginGetEvent_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaEventGenerator_RemoteEndGetEvent_Proxy(
    IMFMediaEventGenerator* This,
    IUnknown *pResult,
    DWORD *pcbEvent,
    BYTE **ppbEvent);
void __RPC_STUB IMFMediaEventGenerator_RemoteEndGetEvent_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaEventGenerator_QueueEvent_Proxy(
    IMFMediaEventGenerator* This,
    MediaEventType met,
    REFGUID guidExtendedType,
    HRESULT hrStatus,
    const PROPVARIANT *pvValue);
void __RPC_STUB IMFMediaEventGenerator_QueueEvent_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT CALLBACK IMFMediaEventGenerator_BeginGetEvent_Proxy(
    IMFMediaEventGenerator* This,
    IMFAsyncCallback *pCallback,
    IUnknown *punkState);
HRESULT __RPC_STUB IMFMediaEventGenerator_BeginGetEvent_Stub(
    IMFMediaEventGenerator* This,
    IMFRemoteAsyncCallback *pCallback);
HRESULT CALLBACK IMFMediaEventGenerator_EndGetEvent_Proxy(
    IMFMediaEventGenerator* This,
    IMFAsyncResult *pResult,
    IMFMediaEvent **ppEvent);
HRESULT __RPC_STUB IMFMediaEventGenerator_EndGetEvent_Stub(
    IMFMediaEventGenerator* This,
    IUnknown *pResult,
    DWORD *pcbEvent,
    BYTE **ppbEvent);

#endif  /* __IMFMediaEventGenerator_INTERFACE_DEFINED__ */

#endif

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
/*****************************************************************************
 * IMFRemoteAsyncCallback interface
 */
#ifndef __IMFRemoteAsyncCallback_INTERFACE_DEFINED__
#define __IMFRemoteAsyncCallback_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFRemoteAsyncCallback, 0xa27003d0, 0x2354, 0x4f2a, 0x8d,0x6a, 0xab,0x7c,0xff,0x15,0x43,0x7e);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("a27003d0-2354-4f2a-8d6a-ab7cff15437e")
IMFRemoteAsyncCallback : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE Invoke(
        HRESULT hr,
        IUnknown *pRemoteResult) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFRemoteAsyncCallback, 0xa27003d0, 0x2354, 0x4f2a, 0x8d,0x6a, 0xab,0x7c,0xff,0x15,0x43,0x7e)
#endif
#else
typedef struct IMFRemoteAsyncCallbackVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFRemoteAsyncCallback* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFRemoteAsyncCallback* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFRemoteAsyncCallback* This);

    /*** IMFRemoteAsyncCallback methods ***/
    HRESULT (STDMETHODCALLTYPE *Invoke)(
        IMFRemoteAsyncCallback* This,
        HRESULT hr,
        IUnknown *pRemoteResult);

    END_INTERFACE
} IMFRemoteAsyncCallbackVtbl;
interface IMFRemoteAsyncCallback {
    CONST_VTBL IMFRemoteAsyncCallbackVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFRemoteAsyncCallback_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFRemoteAsyncCallback_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFRemoteAsyncCallback_Release(This) (This)->lpVtbl->Release(This)
/*** IMFRemoteAsyncCallback methods ***/
#define IMFRemoteAsyncCallback_Invoke(This,hr,pRemoteResult) (This)->lpVtbl->Invoke(This,hr,pRemoteResult)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFRemoteAsyncCallback_QueryInterface(IMFRemoteAsyncCallback* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFRemoteAsyncCallback_AddRef(IMFRemoteAsyncCallback* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFRemoteAsyncCallback_Release(IMFRemoteAsyncCallback* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFRemoteAsyncCallback methods ***/
static FORCEINLINE HRESULT IMFRemoteAsyncCallback_Invoke(IMFRemoteAsyncCallback* This,HRESULT hr,IUnknown *pRemoteResult) {
    return This->lpVtbl->Invoke(This,hr,pRemoteResult);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFRemoteAsyncCallback_Invoke_Proxy(
    IMFRemoteAsyncCallback* This,
    HRESULT hr,
    IUnknown *pRemoteResult);
void __RPC_STUB IMFRemoteAsyncCallback_Invoke_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFRemoteAsyncCallback_INTERFACE_DEFINED__ */

#endif

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)

typedef enum _MFBYTESTREAM_SEEK_ORIGIN {
    msoBegin = 0,
    msoCurrent = 1
} MFBYTESTREAM_SEEK_ORIGIN;

/*****************************************************************************
 * IMFByteStream interface
 */
#ifndef __IMFByteStream_INTERFACE_DEFINED__
#define __IMFByteStream_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFByteStream, 0xad4c1b00, 0x4bf7, 0x422f, 0x91,0x75, 0x75,0x66,0x93,0xd9,0x13,0x0d);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("ad4c1b00-4bf7-422f-9175-756693d9130d")
IMFByteStream : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE GetCapabilities(
        DWORD *pdwCapabilities) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetLength(
        QWORD *pqwLength) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetLength(
        QWORD qwLength) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetCurrentPosition(
        QWORD *pqwPosition) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetCurrentPosition(
        QWORD qwPosition) = 0;

    virtual HRESULT STDMETHODCALLTYPE IsEndOfStream(
        WINBOOL *pfEndOfStream) = 0;

    virtual HRESULT STDMETHODCALLTYPE Read(
        BYTE *pb,
        ULONG cb,
        ULONG *pcbRead) = 0;

    virtual HRESULT STDMETHODCALLTYPE BeginRead(
        BYTE *pb,
        ULONG cb,
        IMFAsyncCallback *pCallback,
        IUnknown *punkState) = 0;

    virtual HRESULT STDMETHODCALLTYPE EndRead(
        IMFAsyncResult *pResult,
        ULONG *pcbRead) = 0;

    virtual HRESULT STDMETHODCALLTYPE Write(
        const BYTE *pb,
        ULONG cb,
        ULONG *pcbWritten) = 0;

    virtual HRESULT STDMETHODCALLTYPE BeginWrite(
        const BYTE *pb,
        ULONG cb,
        IMFAsyncCallback *pCallback,
        IUnknown *punkState) = 0;

    virtual HRESULT STDMETHODCALLTYPE EndWrite(
        IMFAsyncResult *pResult,
        ULONG *pcbWritten) = 0;

    virtual HRESULT STDMETHODCALLTYPE Seek(
        MFBYTESTREAM_SEEK_ORIGIN SeekOrigin,
        LONGLONG llSeekOffset,
        DWORD dwSeekFlags,
        QWORD *pqwCurrentPosition) = 0;

    virtual HRESULT STDMETHODCALLTYPE Flush(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE Close(
        ) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFByteStream, 0xad4c1b00, 0x4bf7, 0x422f, 0x91,0x75, 0x75,0x66,0x93,0xd9,0x13,0x0d)
#endif
#else
typedef struct IMFByteStreamVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFByteStream* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFByteStream* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFByteStream* This);

    /*** IMFByteStream methods ***/
    HRESULT (STDMETHODCALLTYPE *GetCapabilities)(
        IMFByteStream* This,
        DWORD *pdwCapabilities);

    HRESULT (STDMETHODCALLTYPE *GetLength)(
        IMFByteStream* This,
        QWORD *pqwLength);

    HRESULT (STDMETHODCALLTYPE *SetLength)(
        IMFByteStream* This,
        QWORD qwLength);

    HRESULT (STDMETHODCALLTYPE *GetCurrentPosition)(
        IMFByteStream* This,
        QWORD *pqwPosition);

    HRESULT (STDMETHODCALLTYPE *SetCurrentPosition)(
        IMFByteStream* This,
        QWORD qwPosition);

    HRESULT (STDMETHODCALLTYPE *IsEndOfStream)(
        IMFByteStream* This,
        WINBOOL *pfEndOfStream);

    HRESULT (STDMETHODCALLTYPE *Read)(
        IMFByteStream* This,
        BYTE *pb,
        ULONG cb,
        ULONG *pcbRead);

    HRESULT (STDMETHODCALLTYPE *BeginRead)(
        IMFByteStream* This,
        BYTE *pb,
        ULONG cb,
        IMFAsyncCallback *pCallback,
        IUnknown *punkState);

    HRESULT (STDMETHODCALLTYPE *EndRead)(
        IMFByteStream* This,
        IMFAsyncResult *pResult,
        ULONG *pcbRead);

    HRESULT (STDMETHODCALLTYPE *Write)(
        IMFByteStream* This,
        const BYTE *pb,
        ULONG cb,
        ULONG *pcbWritten);

    HRESULT (STDMETHODCALLTYPE *BeginWrite)(
        IMFByteStream* This,
        const BYTE *pb,
        ULONG cb,
        IMFAsyncCallback *pCallback,
        IUnknown *punkState);

    HRESULT (STDMETHODCALLTYPE *EndWrite)(
        IMFByteStream* This,
        IMFAsyncResult *pResult,
        ULONG *pcbWritten);

    HRESULT (STDMETHODCALLTYPE *Seek)(
        IMFByteStream* This,
        MFBYTESTREAM_SEEK_ORIGIN SeekOrigin,
        LONGLONG llSeekOffset,
        DWORD dwSeekFlags,
        QWORD *pqwCurrentPosition);

    HRESULT (STDMETHODCALLTYPE *Flush)(
        IMFByteStream* This);

    HRESULT (STDMETHODCALLTYPE *Close)(
        IMFByteStream* This);

    END_INTERFACE
} IMFByteStreamVtbl;
interface IMFByteStream {
    CONST_VTBL IMFByteStreamVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFByteStream_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFByteStream_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFByteStream_Release(This) (This)->lpVtbl->Release(This)
/*** IMFByteStream methods ***/
#define IMFByteStream_GetCapabilities(This,pdwCapabilities) (This)->lpVtbl->GetCapabilities(This,pdwCapabilities)
#define IMFByteStream_GetLength(This,pqwLength) (This)->lpVtbl->GetLength(This,pqwLength)
#define IMFByteStream_SetLength(This,qwLength) (This)->lpVtbl->SetLength(This,qwLength)
#define IMFByteStream_GetCurrentPosition(This,pqwPosition) (This)->lpVtbl->GetCurrentPosition(This,pqwPosition)
#define IMFByteStream_SetCurrentPosition(This,qwPosition) (This)->lpVtbl->SetCurrentPosition(This,qwPosition)
#define IMFByteStream_IsEndOfStream(This,pfEndOfStream) (This)->lpVtbl->IsEndOfStream(This,pfEndOfStream)
#define IMFByteStream_Read(This,pb,cb,pcbRead) (This)->lpVtbl->Read(This,pb,cb,pcbRead)
#define IMFByteStream_BeginRead(This,pb,cb,pCallback,punkState) (This)->lpVtbl->BeginRead(This,pb,cb,pCallback,punkState)
#define IMFByteStream_EndRead(This,pResult,pcbRead) (This)->lpVtbl->EndRead(This,pResult,pcbRead)
#define IMFByteStream_Write(This,pb,cb,pcbWritten) (This)->lpVtbl->Write(This,pb,cb,pcbWritten)
#define IMFByteStream_BeginWrite(This,pb,cb,pCallback,punkState) (This)->lpVtbl->BeginWrite(This,pb,cb,pCallback,punkState)
#define IMFByteStream_EndWrite(This,pResult,pcbWritten) (This)->lpVtbl->EndWrite(This,pResult,pcbWritten)
#define IMFByteStream_Seek(This,SeekOrigin,llSeekOffset,dwSeekFlags,pqwCurrentPosition) (This)->lpVtbl->Seek(This,SeekOrigin,llSeekOffset,dwSeekFlags,pqwCurrentPosition)
#define IMFByteStream_Flush(This) (This)->lpVtbl->Flush(This)
#define IMFByteStream_Close(This) (This)->lpVtbl->Close(This)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFByteStream_QueryInterface(IMFByteStream* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFByteStream_AddRef(IMFByteStream* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFByteStream_Release(IMFByteStream* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFByteStream methods ***/
static FORCEINLINE HRESULT IMFByteStream_GetCapabilities(IMFByteStream* This,DWORD *pdwCapabilities) {
    return This->lpVtbl->GetCapabilities(This,pdwCapabilities);
}
static FORCEINLINE HRESULT IMFByteStream_GetLength(IMFByteStream* This,QWORD *pqwLength) {
    return This->lpVtbl->GetLength(This,pqwLength);
}
static FORCEINLINE HRESULT IMFByteStream_SetLength(IMFByteStream* This,QWORD qwLength) {
    return This->lpVtbl->SetLength(This,qwLength);
}
static FORCEINLINE HRESULT IMFByteStream_GetCurrentPosition(IMFByteStream* This,QWORD *pqwPosition) {
    return This->lpVtbl->GetCurrentPosition(This,pqwPosition);
}
static FORCEINLINE HRESULT IMFByteStream_SetCurrentPosition(IMFByteStream* This,QWORD qwPosition) {
    return This->lpVtbl->SetCurrentPosition(This,qwPosition);
}
static FORCEINLINE HRESULT IMFByteStream_IsEndOfStream(IMFByteStream* This,WINBOOL *pfEndOfStream) {
    return This->lpVtbl->IsEndOfStream(This,pfEndOfStream);
}
static FORCEINLINE HRESULT IMFByteStream_Read(IMFByteStream* This,BYTE *pb,ULONG cb,ULONG *pcbRead) {
    return This->lpVtbl->Read(This,pb,cb,pcbRead);
}
static FORCEINLINE HRESULT IMFByteStream_BeginRead(IMFByteStream* This,BYTE *pb,ULONG cb,IMFAsyncCallback *pCallback,IUnknown *punkState) {
    return This->lpVtbl->BeginRead(This,pb,cb,pCallback,punkState);
}
static FORCEINLINE HRESULT IMFByteStream_EndRead(IMFByteStream* This,IMFAsyncResult *pResult,ULONG *pcbRead) {
    return This->lpVtbl->EndRead(This,pResult,pcbRead);
}
static FORCEINLINE HRESULT IMFByteStream_Write(IMFByteStream* This,const BYTE *pb,ULONG cb,ULONG *pcbWritten) {
    return This->lpVtbl->Write(This,pb,cb,pcbWritten);
}
static FORCEINLINE HRESULT IMFByteStream_BeginWrite(IMFByteStream* This,const BYTE *pb,ULONG cb,IMFAsyncCallback *pCallback,IUnknown *punkState) {
    return This->lpVtbl->BeginWrite(This,pb,cb,pCallback,punkState);
}
static FORCEINLINE HRESULT IMFByteStream_EndWrite(IMFByteStream* This,IMFAsyncResult *pResult,ULONG *pcbWritten) {
    return This->lpVtbl->EndWrite(This,pResult,pcbWritten);
}
static FORCEINLINE HRESULT IMFByteStream_Seek(IMFByteStream* This,MFBYTESTREAM_SEEK_ORIGIN SeekOrigin,LONGLONG llSeekOffset,DWORD dwSeekFlags,QWORD *pqwCurrentPosition) {
    return This->lpVtbl->Seek(This,SeekOrigin,llSeekOffset,dwSeekFlags,pqwCurrentPosition);
}
static FORCEINLINE HRESULT IMFByteStream_Flush(IMFByteStream* This) {
    return This->lpVtbl->Flush(This);
}
static FORCEINLINE HRESULT IMFByteStream_Close(IMFByteStream* This) {
    return This->lpVtbl->Close(This);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFByteStream_GetCapabilities_Proxy(
    IMFByteStream* This,
    DWORD *pdwCapabilities);
void __RPC_STUB IMFByteStream_GetCapabilities_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFByteStream_GetLength_Proxy(
    IMFByteStream* This,
    QWORD *pqwLength);
void __RPC_STUB IMFByteStream_GetLength_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFByteStream_SetLength_Proxy(
    IMFByteStream* This,
    QWORD qwLength);
void __RPC_STUB IMFByteStream_SetLength_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFByteStream_GetCurrentPosition_Proxy(
    IMFByteStream* This,
    QWORD *pqwPosition);
void __RPC_STUB IMFByteStream_GetCurrentPosition_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFByteStream_SetCurrentPosition_Proxy(
    IMFByteStream* This,
    QWORD qwPosition);
void __RPC_STUB IMFByteStream_SetCurrentPosition_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFByteStream_IsEndOfStream_Proxy(
    IMFByteStream* This,
    WINBOOL *pfEndOfStream);
void __RPC_STUB IMFByteStream_IsEndOfStream_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFByteStream_Read_Proxy(
    IMFByteStream* This,
    BYTE *pb,
    ULONG cb,
    ULONG *pcbRead);
void __RPC_STUB IMFByteStream_Read_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFByteStream_RemoteBeginRead_Proxy(
    IMFByteStream* This,
    ULONG cb,
    IMFRemoteAsyncCallback *pCallback);
void __RPC_STUB IMFByteStream_RemoteBeginRead_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFByteStream_RemoteEndRead_Proxy(
    IMFByteStream* This,
    IUnknown *punkResult,
    BYTE *pb,
    ULONG cb,
    ULONG *pcbRead);
void __RPC_STUB IMFByteStream_RemoteEndRead_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFByteStream_Write_Proxy(
    IMFByteStream* This,
    const BYTE *pb,
    ULONG cb,
    ULONG *pcbWritten);
void __RPC_STUB IMFByteStream_Write_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFByteStream_RemoteBeginWrite_Proxy(
    IMFByteStream* This,
    const BYTE *pb,
    ULONG cb,
    IMFRemoteAsyncCallback *pCallback);
void __RPC_STUB IMFByteStream_RemoteBeginWrite_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFByteStream_RemoteEndWrite_Proxy(
    IMFByteStream* This,
    IUnknown *punkResult,
    ULONG *pcbWritten);
void __RPC_STUB IMFByteStream_RemoteEndWrite_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFByteStream_Seek_Proxy(
    IMFByteStream* This,
    MFBYTESTREAM_SEEK_ORIGIN SeekOrigin,
    LONGLONG llSeekOffset,
    DWORD dwSeekFlags,
    QWORD *pqwCurrentPosition);
void __RPC_STUB IMFByteStream_Seek_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFByteStream_Flush_Proxy(
    IMFByteStream* This);
void __RPC_STUB IMFByteStream_Flush_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFByteStream_Close_Proxy(
    IMFByteStream* This);
void __RPC_STUB IMFByteStream_Close_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT CALLBACK IMFByteStream_BeginRead_Proxy(
    IMFByteStream* This,
    BYTE *pb,
    ULONG cb,
    IMFAsyncCallback *pCallback,
    IUnknown *punkState);
HRESULT __RPC_STUB IMFByteStream_BeginRead_Stub(
    IMFByteStream* This,
    ULONG cb,
    IMFRemoteAsyncCallback *pCallback);
HRESULT CALLBACK IMFByteStream_EndRead_Proxy(
    IMFByteStream* This,
    IMFAsyncResult *pResult,
    ULONG *pcbRead);
HRESULT __RPC_STUB IMFByteStream_EndRead_Stub(
    IMFByteStream* This,
    IUnknown *punkResult,
    BYTE *pb,
    ULONG cb,
    ULONG *pcbRead);
HRESULT CALLBACK IMFByteStream_BeginWrite_Proxy(
    IMFByteStream* This,
    const BYTE *pb,
    ULONG cb,
    IMFAsyncCallback *pCallback,
    IUnknown *punkState);
HRESULT __RPC_STUB IMFByteStream_BeginWrite_Stub(
    IMFByteStream* This,
    const BYTE *pb,
    ULONG cb,
    IMFRemoteAsyncCallback *pCallback);
HRESULT CALLBACK IMFByteStream_EndWrite_Proxy(
    IMFByteStream* This,
    IMFAsyncResult *pResult,
    ULONG *pcbWritten);
HRESULT __RPC_STUB IMFByteStream_EndWrite_Stub(
    IMFByteStream* This,
    IUnknown *punkResult,
    ULONG *pcbWritten);

#endif  /* __IMFByteStream_INTERFACE_DEFINED__ */


#define MFBYTESTREAM_IS_READABLE 0x00000001
#define MFBYTESTREAM_IS_WRITABLE 0x00000002
#define MFBYTESTREAM_IS_SEEKABLE 0x00000004
#define MFBYTESTREAM_IS_REMOTE 0x00000008
#define MFBYTESTREAM_IS_DIRECTORY 0x00000080
#define MFBYTESTREAM_HAS_SLOW_SEEK 0x00000100
#define MFBYTESTREAM_IS_PARTIALLY_DOWNLOADED 0x00000200
#if WINVER >= _WIN32_WINNT_WIN7
#define MFBYTESTREAM_SHARE_WRITE 0x00000400
#endif
#if WINVER >= _WIN32_WINNT_WIN8
#define MFBYTESTREAM_DOES_NOT_USE_NETWORK 0x00000800
#endif

#define MFBYTESTREAM_SEEK_FLAG_CANCEL_PENDING_IO 0x00000001

EXTERN_GUID( MF_BYTESTREAM_ORIGIN_NAME, 0xfc358288, 0x3cb6, 0x460c, 0xa4, 0x24, 0xb6, 0x68, 0x12, 0x60, 0x37, 0x5a);
EXTERN_GUID( MF_BYTESTREAM_CONTENT_TYPE, 0xfc358289, 0x3cb6, 0x460c, 0xa4, 0x24, 0xb6, 0x68, 0x12, 0x60, 0x37, 0x5a);
EXTERN_GUID( MF_BYTESTREAM_DURATION, 0xfc35828a, 0x3cb6, 0x460c, 0xa4, 0x24, 0xb6, 0x68, 0x12, 0x60, 0x37, 0x5a);
EXTERN_GUID( MF_BYTESTREAM_LAST_MODIFIED_TIME, 0xfc35828b, 0x3cb6, 0x460c, 0xa4, 0x24, 0xb6, 0x68, 0x12, 0x60, 0x37, 0x5a);
#if (WINVER >= _WIN32_WINNT_WIN7)
EXTERN_GUID( MF_BYTESTREAM_IFO_FILE_URI, 0xfc35828c, 0x3cb6, 0x460c, 0xa4, 0x24, 0xb6, 0x68, 0x12, 0x60, 0x37, 0x5a);
EXTERN_GUID( MF_BYTESTREAM_DLNA_PROFILE_ID, 0xfc35828d, 0x3cb6, 0x460c, 0xa4, 0x24, 0xb6, 0x68, 0x12, 0x60, 0x37, 0x5a);
EXTERN_GUID( MF_BYTESTREAM_EFFECTIVE_URL, 0x9afa0209, 0x89d1, 0x42af, 0x84, 0x56, 0x1d, 0xe6, 0xb5, 0x62, 0xd6, 0x91);
EXTERN_GUID( MF_BYTESTREAM_TRANSCODED, 0xb6c5c282, 0x4dc9, 0x4db9, 0xab, 0x48, 0xcf, 0x3b, 0x6d, 0x8b, 0xc5, 0xe0 );
#endif
#endif

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
EXTERN_GUID(CLSID_MFByteStreamProxyClassFactory, 0x770e8e77, 0x4916, 0x441c, 0xa9, 0xa7, 0xb3, 0x42, 0xd0, 0xee, 0xbc, 0x71 );

/*****************************************************************************
 * IMFByteStreamProxyClassFactory interface
 */
#ifndef __IMFByteStreamProxyClassFactory_INTERFACE_DEFINED__
#define __IMFByteStreamProxyClassFactory_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFByteStreamProxyClassFactory, 0xa6b43f84, 0x5c0a, 0x42e8, 0xa4,0x4d, 0xb1,0x85,0x7a,0x76,0x99,0x2f);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("a6b43f84-5c0a-42e8-a44d-b1857a76992f")
IMFByteStreamProxyClassFactory : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE CreateByteStreamProxy(
        IMFByteStream *pByteStream,
        IMFAttributes *pAttributes,
        REFIID riid,
        LPVOID *ppvObject) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFByteStreamProxyClassFactory, 0xa6b43f84, 0x5c0a, 0x42e8, 0xa4,0x4d, 0xb1,0x85,0x7a,0x76,0x99,0x2f)
#endif
#else
typedef struct IMFByteStreamProxyClassFactoryVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFByteStreamProxyClassFactory* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFByteStreamProxyClassFactory* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFByteStreamProxyClassFactory* This);

    /*** IMFByteStreamProxyClassFactory methods ***/
    HRESULT (STDMETHODCALLTYPE *CreateByteStreamProxy)(
        IMFByteStreamProxyClassFactory* This,
        IMFByteStream *pByteStream,
        IMFAttributes *pAttributes,
        REFIID riid,
        LPVOID *ppvObject);

    END_INTERFACE
} IMFByteStreamProxyClassFactoryVtbl;
interface IMFByteStreamProxyClassFactory {
    CONST_VTBL IMFByteStreamProxyClassFactoryVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFByteStreamProxyClassFactory_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFByteStreamProxyClassFactory_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFByteStreamProxyClassFactory_Release(This) (This)->lpVtbl->Release(This)
/*** IMFByteStreamProxyClassFactory methods ***/
#define IMFByteStreamProxyClassFactory_CreateByteStreamProxy(This,pByteStream,pAttributes,riid,ppvObject) (This)->lpVtbl->CreateByteStreamProxy(This,pByteStream,pAttributes,riid,ppvObject)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFByteStreamProxyClassFactory_QueryInterface(IMFByteStreamProxyClassFactory* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFByteStreamProxyClassFactory_AddRef(IMFByteStreamProxyClassFactory* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFByteStreamProxyClassFactory_Release(IMFByteStreamProxyClassFactory* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFByteStreamProxyClassFactory methods ***/
static FORCEINLINE HRESULT IMFByteStreamProxyClassFactory_CreateByteStreamProxy(IMFByteStreamProxyClassFactory* This,IMFByteStream *pByteStream,IMFAttributes *pAttributes,REFIID riid,LPVOID *ppvObject) {
    return This->lpVtbl->CreateByteStreamProxy(This,pByteStream,pAttributes,riid,ppvObject);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFByteStreamProxyClassFactory_CreateByteStreamProxy_Proxy(
    IMFByteStreamProxyClassFactory* This,
    IMFByteStream *pByteStream,
    IMFAttributes *pAttributes,
    REFIID riid,
    LPVOID *ppvObject);
void __RPC_STUB IMFByteStreamProxyClassFactory_CreateByteStreamProxy_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFByteStreamProxyClassFactory_INTERFACE_DEFINED__ */


typedef enum __WIDL_mfobjects_generated_name_00000017 {
    MF_ACCESSMODE_READ = 1,
    MF_ACCESSMODE_WRITE = 2,
    MF_ACCESSMODE_READWRITE = 3
} MF_FILE_ACCESSMODE;

typedef enum __WIDL_mfobjects_generated_name_00000018 {
    MF_OPENMODE_FAIL_IF_NOT_EXIST = 0,
    MF_OPENMODE_FAIL_IF_EXIST = 1,
    MF_OPENMODE_RESET_IF_EXIST = 2,
    MF_OPENMODE_APPEND_IF_EXIST = 3,
    MF_OPENMODE_DELETE_IF_EXIST = 4
} MF_FILE_OPENMODE;

typedef enum __WIDL_mfobjects_generated_name_00000019 {
    MF_FILEFLAGS_NONE = 0x0,
    MF_FILEFLAGS_NOBUFFERING = 0x1
} MF_FILE_FLAGS;
#endif

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
/*****************************************************************************
 * IMFSampleOutputStream interface
 */
#ifndef __IMFSampleOutputStream_INTERFACE_DEFINED__
#define __IMFSampleOutputStream_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFSampleOutputStream, 0x8feed468, 0x6f7e, 0x440d, 0x86,0x9a, 0x49,0xbd,0xd2,0x83,0xad,0x0d);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("8feed468-6f7e-440d-869a-49bdd283ad0d")
IMFSampleOutputStream : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE BeginWriteSample(
        IMFSample *pSample,
        IMFAsyncCallback *pCallback,
        IUnknown *punkState) = 0;

    virtual HRESULT STDMETHODCALLTYPE EndWriteSample(
        IMFAsyncResult *pResult) = 0;

    virtual HRESULT STDMETHODCALLTYPE Close(
        ) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFSampleOutputStream, 0x8feed468, 0x6f7e, 0x440d, 0x86,0x9a, 0x49,0xbd,0xd2,0x83,0xad,0x0d)
#endif
#else
typedef struct IMFSampleOutputStreamVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFSampleOutputStream* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFSampleOutputStream* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFSampleOutputStream* This);

    /*** IMFSampleOutputStream methods ***/
    HRESULT (STDMETHODCALLTYPE *BeginWriteSample)(
        IMFSampleOutputStream* This,
        IMFSample *pSample,
        IMFAsyncCallback *pCallback,
        IUnknown *punkState);

    HRESULT (STDMETHODCALLTYPE *EndWriteSample)(
        IMFSampleOutputStream* This,
        IMFAsyncResult *pResult);

    HRESULT (STDMETHODCALLTYPE *Close)(
        IMFSampleOutputStream* This);

    END_INTERFACE
} IMFSampleOutputStreamVtbl;
interface IMFSampleOutputStream {
    CONST_VTBL IMFSampleOutputStreamVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFSampleOutputStream_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFSampleOutputStream_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFSampleOutputStream_Release(This) (This)->lpVtbl->Release(This)
/*** IMFSampleOutputStream methods ***/
#define IMFSampleOutputStream_BeginWriteSample(This,pSample,pCallback,punkState) (This)->lpVtbl->BeginWriteSample(This,pSample,pCallback,punkState)
#define IMFSampleOutputStream_EndWriteSample(This,pResult) (This)->lpVtbl->EndWriteSample(This,pResult)
#define IMFSampleOutputStream_Close(This) (This)->lpVtbl->Close(This)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFSampleOutputStream_QueryInterface(IMFSampleOutputStream* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFSampleOutputStream_AddRef(IMFSampleOutputStream* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFSampleOutputStream_Release(IMFSampleOutputStream* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFSampleOutputStream methods ***/
static FORCEINLINE HRESULT IMFSampleOutputStream_BeginWriteSample(IMFSampleOutputStream* This,IMFSample *pSample,IMFAsyncCallback *pCallback,IUnknown *punkState) {
    return This->lpVtbl->BeginWriteSample(This,pSample,pCallback,punkState);
}
static FORCEINLINE HRESULT IMFSampleOutputStream_EndWriteSample(IMFSampleOutputStream* This,IMFAsyncResult *pResult) {
    return This->lpVtbl->EndWriteSample(This,pResult);
}
static FORCEINLINE HRESULT IMFSampleOutputStream_Close(IMFSampleOutputStream* This) {
    return This->lpVtbl->Close(This);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFSampleOutputStream_BeginWriteSample_Proxy(
    IMFSampleOutputStream* This,
    IMFSample *pSample,
    IMFAsyncCallback *pCallback,
    IUnknown *punkState);
void __RPC_STUB IMFSampleOutputStream_BeginWriteSample_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSampleOutputStream_EndWriteSample_Proxy(
    IMFSampleOutputStream* This,
    IMFAsyncResult *pResult);
void __RPC_STUB IMFSampleOutputStream_EndWriteSample_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSampleOutputStream_Close_Proxy(
    IMFSampleOutputStream* This);
void __RPC_STUB IMFSampleOutputStream_Close_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFSampleOutputStream_INTERFACE_DEFINED__ */


/*****************************************************************************
 * IMFCollection interface
 */
#ifndef __IMFCollection_INTERFACE_DEFINED__
#define __IMFCollection_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFCollection, 0x5bc8a76b, 0x869a, 0x46a3, 0x9b,0x03, 0xfa,0x21,0x8a,0x66,0xae,0xbe);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("5bc8a76b-869a-46a3-9b03-fa218a66aebe")
IMFCollection : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE GetElementCount(
        DWORD *pcElements) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetElement(
        DWORD dwElementIndex,
        IUnknown **ppUnkElement) = 0;

    virtual HRESULT STDMETHODCALLTYPE AddElement(
        IUnknown *pUnkElement) = 0;

    virtual HRESULT STDMETHODCALLTYPE RemoveElement(
        DWORD dwElementIndex,
        IUnknown **ppUnkElement) = 0;

    virtual HRESULT STDMETHODCALLTYPE InsertElementAt(
        DWORD dwIndex,
        IUnknown *pUnknown) = 0;

    virtual HRESULT STDMETHODCALLTYPE RemoveAllElements(
        ) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFCollection, 0x5bc8a76b, 0x869a, 0x46a3, 0x9b,0x03, 0xfa,0x21,0x8a,0x66,0xae,0xbe)
#endif
#else
typedef struct IMFCollectionVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFCollection* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFCollection* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFCollection* This);

    /*** IMFCollection methods ***/
    HRESULT (STDMETHODCALLTYPE *GetElementCount)(
        IMFCollection* This,
        DWORD *pcElements);

    HRESULT (STDMETHODCALLTYPE *GetElement)(
        IMFCollection* This,
        DWORD dwElementIndex,
        IUnknown **ppUnkElement);

    HRESULT (STDMETHODCALLTYPE *AddElement)(
        IMFCollection* This,
        IUnknown *pUnkElement);

    HRESULT (STDMETHODCALLTYPE *RemoveElement)(
        IMFCollection* This,
        DWORD dwElementIndex,
        IUnknown **ppUnkElement);

    HRESULT (STDMETHODCALLTYPE *InsertElementAt)(
        IMFCollection* This,
        DWORD dwIndex,
        IUnknown *pUnknown);

    HRESULT (STDMETHODCALLTYPE *RemoveAllElements)(
        IMFCollection* This);

    END_INTERFACE
} IMFCollectionVtbl;
interface IMFCollection {
    CONST_VTBL IMFCollectionVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFCollection_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFCollection_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFCollection_Release(This) (This)->lpVtbl->Release(This)
/*** IMFCollection methods ***/
#define IMFCollection_GetElementCount(This,pcElements) (This)->lpVtbl->GetElementCount(This,pcElements)
#define IMFCollection_GetElement(This,dwElementIndex,ppUnkElement) (This)->lpVtbl->GetElement(This,dwElementIndex,ppUnkElement)
#define IMFCollection_AddElement(This,pUnkElement) (This)->lpVtbl->AddElement(This,pUnkElement)
#define IMFCollection_RemoveElement(This,dwElementIndex,ppUnkElement) (This)->lpVtbl->RemoveElement(This,dwElementIndex,ppUnkElement)
#define IMFCollection_InsertElementAt(This,dwIndex,pUnknown) (This)->lpVtbl->InsertElementAt(This,dwIndex,pUnknown)
#define IMFCollection_RemoveAllElements(This) (This)->lpVtbl->RemoveAllElements(This)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFCollection_QueryInterface(IMFCollection* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFCollection_AddRef(IMFCollection* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFCollection_Release(IMFCollection* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFCollection methods ***/
static FORCEINLINE HRESULT IMFCollection_GetElementCount(IMFCollection* This,DWORD *pcElements) {
    return This->lpVtbl->GetElementCount(This,pcElements);
}
static FORCEINLINE HRESULT IMFCollection_GetElement(IMFCollection* This,DWORD dwElementIndex,IUnknown **ppUnkElement) {
    return This->lpVtbl->GetElement(This,dwElementIndex,ppUnkElement);
}
static FORCEINLINE HRESULT IMFCollection_AddElement(IMFCollection* This,IUnknown *pUnkElement) {
    return This->lpVtbl->AddElement(This,pUnkElement);
}
static FORCEINLINE HRESULT IMFCollection_RemoveElement(IMFCollection* This,DWORD dwElementIndex,IUnknown **ppUnkElement) {
    return This->lpVtbl->RemoveElement(This,dwElementIndex,ppUnkElement);
}
static FORCEINLINE HRESULT IMFCollection_InsertElementAt(IMFCollection* This,DWORD dwIndex,IUnknown *pUnknown) {
    return This->lpVtbl->InsertElementAt(This,dwIndex,pUnknown);
}
static FORCEINLINE HRESULT IMFCollection_RemoveAllElements(IMFCollection* This) {
    return This->lpVtbl->RemoveAllElements(This);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFCollection_GetElementCount_Proxy(
    IMFCollection* This,
    DWORD *pcElements);
void __RPC_STUB IMFCollection_GetElementCount_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFCollection_GetElement_Proxy(
    IMFCollection* This,
    DWORD dwElementIndex,
    IUnknown **ppUnkElement);
void __RPC_STUB IMFCollection_GetElement_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFCollection_AddElement_Proxy(
    IMFCollection* This,
    IUnknown *pUnkElement);
void __RPC_STUB IMFCollection_AddElement_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFCollection_RemoveElement_Proxy(
    IMFCollection* This,
    DWORD dwElementIndex,
    IUnknown **ppUnkElement);
void __RPC_STUB IMFCollection_RemoveElement_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFCollection_InsertElementAt_Proxy(
    IMFCollection* This,
    DWORD dwIndex,
    IUnknown *pUnknown);
void __RPC_STUB IMFCollection_InsertElementAt_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFCollection_RemoveAllElements_Proxy(
    IMFCollection* This);
void __RPC_STUB IMFCollection_RemoveAllElements_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFCollection_INTERFACE_DEFINED__ */


/*****************************************************************************
 * IMFMediaEventQueue interface
 */
#ifndef __IMFMediaEventQueue_INTERFACE_DEFINED__
#define __IMFMediaEventQueue_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFMediaEventQueue, 0x36f846fc, 0x2256, 0x48b6, 0xb5,0x8e, 0xe2,0xb6,0x38,0x31,0x65,0x81);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("36f846fc-2256-48b6-b58e-e2b638316581")
IMFMediaEventQueue : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE GetEvent(
        DWORD dwFlags,
        IMFMediaEvent **ppEvent) = 0;

    virtual HRESULT STDMETHODCALLTYPE BeginGetEvent(
        IMFAsyncCallback *pCallback,
        IUnknown *punkState) = 0;

    virtual HRESULT STDMETHODCALLTYPE EndGetEvent(
        IMFAsyncResult *pResult,
        IMFMediaEvent **ppEvent) = 0;

    virtual HRESULT STDMETHODCALLTYPE QueueEvent(
        IMFMediaEvent *pEvent) = 0;

    virtual HRESULT STDMETHODCALLTYPE QueueEventParamVar(
        MediaEventType met,
        REFGUID guidExtendedType,
        HRESULT hrStatus,
        const PROPVARIANT *pvValue) = 0;

    virtual HRESULT STDMETHODCALLTYPE QueueEventParamUnk(
        MediaEventType met,
        REFGUID guidExtendedType,
        HRESULT hrStatus,
        IUnknown *pUnk) = 0;

    virtual HRESULT STDMETHODCALLTYPE Shutdown(
        ) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFMediaEventQueue, 0x36f846fc, 0x2256, 0x48b6, 0xb5,0x8e, 0xe2,0xb6,0x38,0x31,0x65,0x81)
#endif
#else
typedef struct IMFMediaEventQueueVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFMediaEventQueue* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFMediaEventQueue* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFMediaEventQueue* This);

    /*** IMFMediaEventQueue methods ***/
    HRESULT (STDMETHODCALLTYPE *GetEvent)(
        IMFMediaEventQueue* This,
        DWORD dwFlags,
        IMFMediaEvent **ppEvent);

    HRESULT (STDMETHODCALLTYPE *BeginGetEvent)(
        IMFMediaEventQueue* This,
        IMFAsyncCallback *pCallback,
        IUnknown *punkState);

    HRESULT (STDMETHODCALLTYPE *EndGetEvent)(
        IMFMediaEventQueue* This,
        IMFAsyncResult *pResult,
        IMFMediaEvent **ppEvent);

    HRESULT (STDMETHODCALLTYPE *QueueEvent)(
        IMFMediaEventQueue* This,
        IMFMediaEvent *pEvent);

    HRESULT (STDMETHODCALLTYPE *QueueEventParamVar)(
        IMFMediaEventQueue* This,
        MediaEventType met,
        REFGUID guidExtendedType,
        HRESULT hrStatus,
        const PROPVARIANT *pvValue);

    HRESULT (STDMETHODCALLTYPE *QueueEventParamUnk)(
        IMFMediaEventQueue* This,
        MediaEventType met,
        REFGUID guidExtendedType,
        HRESULT hrStatus,
        IUnknown *pUnk);

    HRESULT (STDMETHODCALLTYPE *Shutdown)(
        IMFMediaEventQueue* This);

    END_INTERFACE
} IMFMediaEventQueueVtbl;
interface IMFMediaEventQueue {
    CONST_VTBL IMFMediaEventQueueVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFMediaEventQueue_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFMediaEventQueue_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFMediaEventQueue_Release(This) (This)->lpVtbl->Release(This)
/*** IMFMediaEventQueue methods ***/
#define IMFMediaEventQueue_GetEvent(This,dwFlags,ppEvent) (This)->lpVtbl->GetEvent(This,dwFlags,ppEvent)
#define IMFMediaEventQueue_BeginGetEvent(This,pCallback,punkState) (This)->lpVtbl->BeginGetEvent(This,pCallback,punkState)
#define IMFMediaEventQueue_EndGetEvent(This,pResult,ppEvent) (This)->lpVtbl->EndGetEvent(This,pResult,ppEvent)
#define IMFMediaEventQueue_QueueEvent(This,pEvent) (This)->lpVtbl->QueueEvent(This,pEvent)
#define IMFMediaEventQueue_QueueEventParamVar(This,met,guidExtendedType,hrStatus,pvValue) (This)->lpVtbl->QueueEventParamVar(This,met,guidExtendedType,hrStatus,pvValue)
#define IMFMediaEventQueue_QueueEventParamUnk(This,met,guidExtendedType,hrStatus,pUnk) (This)->lpVtbl->QueueEventParamUnk(This,met,guidExtendedType,hrStatus,pUnk)
#define IMFMediaEventQueue_Shutdown(This) (This)->lpVtbl->Shutdown(This)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFMediaEventQueue_QueryInterface(IMFMediaEventQueue* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFMediaEventQueue_AddRef(IMFMediaEventQueue* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFMediaEventQueue_Release(IMFMediaEventQueue* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFMediaEventQueue methods ***/
static FORCEINLINE HRESULT IMFMediaEventQueue_GetEvent(IMFMediaEventQueue* This,DWORD dwFlags,IMFMediaEvent **ppEvent) {
    return This->lpVtbl->GetEvent(This,dwFlags,ppEvent);
}
static FORCEINLINE HRESULT IMFMediaEventQueue_BeginGetEvent(IMFMediaEventQueue* This,IMFAsyncCallback *pCallback,IUnknown *punkState) {
    return This->lpVtbl->BeginGetEvent(This,pCallback,punkState);
}
static FORCEINLINE HRESULT IMFMediaEventQueue_EndGetEvent(IMFMediaEventQueue* This,IMFAsyncResult *pResult,IMFMediaEvent **ppEvent) {
    return This->lpVtbl->EndGetEvent(This,pResult,ppEvent);
}
static FORCEINLINE HRESULT IMFMediaEventQueue_QueueEvent(IMFMediaEventQueue* This,IMFMediaEvent *pEvent) {
    return This->lpVtbl->QueueEvent(This,pEvent);
}
static FORCEINLINE HRESULT IMFMediaEventQueue_QueueEventParamVar(IMFMediaEventQueue* This,MediaEventType met,REFGUID guidExtendedType,HRESULT hrStatus,const PROPVARIANT *pvValue) {
    return This->lpVtbl->QueueEventParamVar(This,met,guidExtendedType,hrStatus,pvValue);
}
static FORCEINLINE HRESULT IMFMediaEventQueue_QueueEventParamUnk(IMFMediaEventQueue* This,MediaEventType met,REFGUID guidExtendedType,HRESULT hrStatus,IUnknown *pUnk) {
    return This->lpVtbl->QueueEventParamUnk(This,met,guidExtendedType,hrStatus,pUnk);
}
static FORCEINLINE HRESULT IMFMediaEventQueue_Shutdown(IMFMediaEventQueue* This) {
    return This->lpVtbl->Shutdown(This);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFMediaEventQueue_GetEvent_Proxy(
    IMFMediaEventQueue* This,
    DWORD dwFlags,
    IMFMediaEvent **ppEvent);
void __RPC_STUB IMFMediaEventQueue_GetEvent_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaEventQueue_BeginGetEvent_Proxy(
    IMFMediaEventQueue* This,
    IMFAsyncCallback *pCallback,
    IUnknown *punkState);
void __RPC_STUB IMFMediaEventQueue_BeginGetEvent_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaEventQueue_EndGetEvent_Proxy(
    IMFMediaEventQueue* This,
    IMFAsyncResult *pResult,
    IMFMediaEvent **ppEvent);
void __RPC_STUB IMFMediaEventQueue_EndGetEvent_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaEventQueue_QueueEvent_Proxy(
    IMFMediaEventQueue* This,
    IMFMediaEvent *pEvent);
void __RPC_STUB IMFMediaEventQueue_QueueEvent_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaEventQueue_QueueEventParamVar_Proxy(
    IMFMediaEventQueue* This,
    MediaEventType met,
    REFGUID guidExtendedType,
    HRESULT hrStatus,
    const PROPVARIANT *pvValue);
void __RPC_STUB IMFMediaEventQueue_QueueEventParamVar_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaEventQueue_QueueEventParamUnk_Proxy(
    IMFMediaEventQueue* This,
    MediaEventType met,
    REFGUID guidExtendedType,
    HRESULT hrStatus,
    IUnknown *pUnk);
void __RPC_STUB IMFMediaEventQueue_QueueEventParamUnk_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFMediaEventQueue_Shutdown_Proxy(
    IMFMediaEventQueue* This);
void __RPC_STUB IMFMediaEventQueue_Shutdown_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFMediaEventQueue_INTERFACE_DEFINED__ */


/*****************************************************************************
 * IMFActivate interface
 */
#ifndef __IMFActivate_INTERFACE_DEFINED__
#define __IMFActivate_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFActivate, 0x7fee9e9a, 0x4a89, 0x47a6, 0x89,0x9c, 0xb6,0xa5,0x3a,0x70,0xfb,0x67);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("7fee9e9a-4a89-47a6-899c-b6a53a70fb67")
IMFActivate : public IMFAttributes
{
    virtual HRESULT STDMETHODCALLTYPE ActivateObject(
        REFIID riid,
        void **ppv) = 0;

    virtual HRESULT STDMETHODCALLTYPE ShutdownObject(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE DetachObject(
        ) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFActivate, 0x7fee9e9a, 0x4a89, 0x47a6, 0x89,0x9c, 0xb6,0xa5,0x3a,0x70,0xfb,0x67)
#endif
#else
typedef struct IMFActivateVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFActivate* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFActivate* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFActivate* This);

    /*** IMFAttributes methods ***/
    HRESULT (STDMETHODCALLTYPE *GetItem)(
        IMFActivate* This,
        REFGUID guidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *GetItemType)(
        IMFActivate* This,
        REFGUID guidKey,
        MF_ATTRIBUTE_TYPE *pType);

    HRESULT (STDMETHODCALLTYPE *CompareItem)(
        IMFActivate* This,
        REFGUID guidKey,
        REFPROPVARIANT Value,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *Compare)(
        IMFActivate* This,
        IMFAttributes *pTheirs,
        MF_ATTRIBUTES_MATCH_TYPE MatchType,
        WINBOOL *pbResult);

    HRESULT (STDMETHODCALLTYPE *GetUINT32)(
        IMFActivate* This,
        REFGUID guidKey,
        UINT32 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetUINT64)(
        IMFActivate* This,
        REFGUID guidKey,
        UINT64 *punValue);

    HRESULT (STDMETHODCALLTYPE *GetDouble)(
        IMFActivate* This,
        REFGUID guidKey,
        double *pfValue);

    HRESULT (STDMETHODCALLTYPE *GetGUID)(
        IMFActivate* This,
        REFGUID guidKey,
        GUID *pguidValue);

    HRESULT (STDMETHODCALLTYPE *GetStringLength)(
        IMFActivate* This,
        REFGUID guidKey,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetString)(
        IMFActivate* This,
        REFGUID guidKey,
        LPWSTR pwszValue,
        UINT32 cchBufSize,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedString)(
        IMFActivate* This,
        REFGUID guidKey,
        LPWSTR *ppwszValue,
        UINT32 *pcchLength);

    HRESULT (STDMETHODCALLTYPE *GetBlobSize)(
        IMFActivate* This,
        REFGUID guidKey,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetBlob)(
        IMFActivate* This,
        REFGUID guidKey,
        UINT8 *pBuf,
        UINT32 cbBufSize,
        UINT32 *pcbBlobSize);

    HRESULT (STDMETHODCALLTYPE *GetAllocatedBlob)(
        IMFActivate* This,
        REFGUID guidKey,
        UINT8 **ppBuf,
        UINT32 *pcbSize);

    HRESULT (STDMETHODCALLTYPE *GetUnknown)(
        IMFActivate* This,
        REFGUID guidKey,
        REFIID riid,
        LPVOID *ppv);

    HRESULT (STDMETHODCALLTYPE *SetItem)(
        IMFActivate* This,
        REFGUID guidKey,
        REFPROPVARIANT Value);

    HRESULT (STDMETHODCALLTYPE *DeleteItem)(
        IMFActivate* This,
        REFGUID guidKey);

    HRESULT (STDMETHODCALLTYPE *DeleteAllItems)(
        IMFActivate* This);

    HRESULT (STDMETHODCALLTYPE *SetUINT32)(
        IMFActivate* This,
        REFGUID guidKey,
        UINT32 unValue);

    HRESULT (STDMETHODCALLTYPE *SetUINT64)(
        IMFActivate* This,
        REFGUID guidKey,
        UINT64 unValue);

    HRESULT (STDMETHODCALLTYPE *SetDouble)(
        IMFActivate* This,
        REFGUID guidKey,
        double fValue);

    HRESULT (STDMETHODCALLTYPE *SetGUID)(
        IMFActivate* This,
        REFGUID guidKey,
        REFGUID guidValue);

    HRESULT (STDMETHODCALLTYPE *SetString)(
        IMFActivate* This,
        REFGUID guidKey,
        LPCWSTR wszValue);

    HRESULT (STDMETHODCALLTYPE *SetBlob)(
        IMFActivate* This,
        REFGUID guidKey,
        const UINT8 *pBuf,
        UINT32 cbBufSize);

    HRESULT (STDMETHODCALLTYPE *SetUnknown)(
        IMFActivate* This,
        REFGUID guidKey,
        IUnknown *pUnknown);

    HRESULT (STDMETHODCALLTYPE *LockStore)(
        IMFActivate* This);

    HRESULT (STDMETHODCALLTYPE *UnlockStore)(
        IMFActivate* This);

    HRESULT (STDMETHODCALLTYPE *GetCount)(
        IMFActivate* This,
        UINT32 *pcItems);

    HRESULT (STDMETHODCALLTYPE *GetItemByIndex)(
        IMFActivate* This,
        UINT32 unIndex,
        GUID *pguidKey,
        PROPVARIANT *pValue);

    HRESULT (STDMETHODCALLTYPE *CopyAllItems)(
        IMFActivate* This,
        IMFAttributes *pDest);

    /*** IMFActivate methods ***/
    HRESULT (STDMETHODCALLTYPE *ActivateObject)(
        IMFActivate* This,
        REFIID riid,
        void **ppv);

    HRESULT (STDMETHODCALLTYPE *ShutdownObject)(
        IMFActivate* This);

    HRESULT (STDMETHODCALLTYPE *DetachObject)(
        IMFActivate* This);

    END_INTERFACE
} IMFActivateVtbl;
interface IMFActivate {
    CONST_VTBL IMFActivateVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFActivate_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFActivate_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFActivate_Release(This) (This)->lpVtbl->Release(This)
/*** IMFAttributes methods ***/
#define IMFActivate_GetItem(This,guidKey,pValue) (This)->lpVtbl->GetItem(This,guidKey,pValue)
#define IMFActivate_GetItemType(This,guidKey,pType) (This)->lpVtbl->GetItemType(This,guidKey,pType)
#define IMFActivate_CompareItem(This,guidKey,Value,pbResult) (This)->lpVtbl->CompareItem(This,guidKey,Value,pbResult)
#define IMFActivate_Compare(This,pTheirs,MatchType,pbResult) (This)->lpVtbl->Compare(This,pTheirs,MatchType,pbResult)
#define IMFActivate_GetUINT32(This,guidKey,punValue) (This)->lpVtbl->GetUINT32(This,guidKey,punValue)
#define IMFActivate_GetUINT64(This,guidKey,punValue) (This)->lpVtbl->GetUINT64(This,guidKey,punValue)
#define IMFActivate_GetDouble(This,guidKey,pfValue) (This)->lpVtbl->GetDouble(This,guidKey,pfValue)
#define IMFActivate_GetGUID(This,guidKey,pguidValue) (This)->lpVtbl->GetGUID(This,guidKey,pguidValue)
#define IMFActivate_GetStringLength(This,guidKey,pcchLength) (This)->lpVtbl->GetStringLength(This,guidKey,pcchLength)
#define IMFActivate_GetString(This,guidKey,pwszValue,cchBufSize,pcchLength) (This)->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength)
#define IMFActivate_GetAllocatedString(This,guidKey,ppwszValue,pcchLength) (This)->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength)
#define IMFActivate_GetBlobSize(This,guidKey,pcbBlobSize) (This)->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize)
#define IMFActivate_GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize) (This)->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize)
#define IMFActivate_GetAllocatedBlob(This,guidKey,ppBuf,pcbSize) (This)->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize)
#define IMFActivate_GetUnknown(This,guidKey,riid,ppv) (This)->lpVtbl->GetUnknown(This,guidKey,riid,ppv)
#define IMFActivate_SetItem(This,guidKey,Value) (This)->lpVtbl->SetItem(This,guidKey,Value)
#define IMFActivate_DeleteItem(This,guidKey) (This)->lpVtbl->DeleteItem(This,guidKey)
#define IMFActivate_DeleteAllItems(This) (This)->lpVtbl->DeleteAllItems(This)
#define IMFActivate_SetUINT32(This,guidKey,unValue) (This)->lpVtbl->SetUINT32(This,guidKey,unValue)
#define IMFActivate_SetUINT64(This,guidKey,unValue) (This)->lpVtbl->SetUINT64(This,guidKey,unValue)
#define IMFActivate_SetDouble(This,guidKey,fValue) (This)->lpVtbl->SetDouble(This,guidKey,fValue)
#define IMFActivate_SetGUID(This,guidKey,guidValue) (This)->lpVtbl->SetGUID(This,guidKey,guidValue)
#define IMFActivate_SetString(This,guidKey,wszValue) (This)->lpVtbl->SetString(This,guidKey,wszValue)
#define IMFActivate_SetBlob(This,guidKey,pBuf,cbBufSize) (This)->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize)
#define IMFActivate_SetUnknown(This,guidKey,pUnknown) (This)->lpVtbl->SetUnknown(This,guidKey,pUnknown)
#define IMFActivate_LockStore(This) (This)->lpVtbl->LockStore(This)
#define IMFActivate_UnlockStore(This) (This)->lpVtbl->UnlockStore(This)
#define IMFActivate_GetCount(This,pcItems) (This)->lpVtbl->GetCount(This,pcItems)
#define IMFActivate_GetItemByIndex(This,unIndex,pguidKey,pValue) (This)->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue)
#define IMFActivate_CopyAllItems(This,pDest) (This)->lpVtbl->CopyAllItems(This,pDest)
/*** IMFActivate methods ***/
#define IMFActivate_ActivateObject(This,riid,ppv) (This)->lpVtbl->ActivateObject(This,riid,ppv)
#define IMFActivate_ShutdownObject(This) (This)->lpVtbl->ShutdownObject(This)
#define IMFActivate_DetachObject(This) (This)->lpVtbl->DetachObject(This)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFActivate_QueryInterface(IMFActivate* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFActivate_AddRef(IMFActivate* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFActivate_Release(IMFActivate* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFAttributes methods ***/
static FORCEINLINE HRESULT IMFActivate_GetItem(IMFActivate* This,REFGUID guidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItem(This,guidKey,pValue);
}
static FORCEINLINE HRESULT IMFActivate_GetItemType(IMFActivate* This,REFGUID guidKey,MF_ATTRIBUTE_TYPE *pType) {
    return This->lpVtbl->GetItemType(This,guidKey,pType);
}
static FORCEINLINE HRESULT IMFActivate_CompareItem(IMFActivate* This,REFGUID guidKey,REFPROPVARIANT Value,WINBOOL *pbResult) {
    return This->lpVtbl->CompareItem(This,guidKey,Value,pbResult);
}
static FORCEINLINE HRESULT IMFActivate_Compare(IMFActivate* This,IMFAttributes *pTheirs,MF_ATTRIBUTES_MATCH_TYPE MatchType,WINBOOL *pbResult) {
    return This->lpVtbl->Compare(This,pTheirs,MatchType,pbResult);
}
static FORCEINLINE HRESULT IMFActivate_GetUINT32(IMFActivate* This,REFGUID guidKey,UINT32 *punValue) {
    return This->lpVtbl->GetUINT32(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFActivate_GetUINT64(IMFActivate* This,REFGUID guidKey,UINT64 *punValue) {
    return This->lpVtbl->GetUINT64(This,guidKey,punValue);
}
static FORCEINLINE HRESULT IMFActivate_GetDouble(IMFActivate* This,REFGUID guidKey,double *pfValue) {
    return This->lpVtbl->GetDouble(This,guidKey,pfValue);
}
static FORCEINLINE HRESULT IMFActivate_GetGUID(IMFActivate* This,REFGUID guidKey,GUID *pguidValue) {
    return This->lpVtbl->GetGUID(This,guidKey,pguidValue);
}
static FORCEINLINE HRESULT IMFActivate_GetStringLength(IMFActivate* This,REFGUID guidKey,UINT32 *pcchLength) {
    return This->lpVtbl->GetStringLength(This,guidKey,pcchLength);
}
static FORCEINLINE HRESULT IMFActivate_GetString(IMFActivate* This,REFGUID guidKey,LPWSTR pwszValue,UINT32 cchBufSize,UINT32 *pcchLength) {
    return This->lpVtbl->GetString(This,guidKey,pwszValue,cchBufSize,pcchLength);
}
static FORCEINLINE HRESULT IMFActivate_GetAllocatedString(IMFActivate* This,REFGUID guidKey,LPWSTR *ppwszValue,UINT32 *pcchLength) {
    return This->lpVtbl->GetAllocatedString(This,guidKey,ppwszValue,pcchLength);
}
static FORCEINLINE HRESULT IMFActivate_GetBlobSize(IMFActivate* This,REFGUID guidKey,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlobSize(This,guidKey,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFActivate_GetBlob(IMFActivate* This,REFGUID guidKey,UINT8 *pBuf,UINT32 cbBufSize,UINT32 *pcbBlobSize) {
    return This->lpVtbl->GetBlob(This,guidKey,pBuf,cbBufSize,pcbBlobSize);
}
static FORCEINLINE HRESULT IMFActivate_GetAllocatedBlob(IMFActivate* This,REFGUID guidKey,UINT8 **ppBuf,UINT32 *pcbSize) {
    return This->lpVtbl->GetAllocatedBlob(This,guidKey,ppBuf,pcbSize);
}
static FORCEINLINE HRESULT IMFActivate_GetUnknown(IMFActivate* This,REFGUID guidKey,REFIID riid,LPVOID *ppv) {
    return This->lpVtbl->GetUnknown(This,guidKey,riid,ppv);
}
static FORCEINLINE HRESULT IMFActivate_SetItem(IMFActivate* This,REFGUID guidKey,REFPROPVARIANT Value) {
    return This->lpVtbl->SetItem(This,guidKey,Value);
}
static FORCEINLINE HRESULT IMFActivate_DeleteItem(IMFActivate* This,REFGUID guidKey) {
    return This->lpVtbl->DeleteItem(This,guidKey);
}
static FORCEINLINE HRESULT IMFActivate_DeleteAllItems(IMFActivate* This) {
    return This->lpVtbl->DeleteAllItems(This);
}
static FORCEINLINE HRESULT IMFActivate_SetUINT32(IMFActivate* This,REFGUID guidKey,UINT32 unValue) {
    return This->lpVtbl->SetUINT32(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFActivate_SetUINT64(IMFActivate* This,REFGUID guidKey,UINT64 unValue) {
    return This->lpVtbl->SetUINT64(This,guidKey,unValue);
}
static FORCEINLINE HRESULT IMFActivate_SetDouble(IMFActivate* This,REFGUID guidKey,double fValue) {
    return This->lpVtbl->SetDouble(This,guidKey,fValue);
}
static FORCEINLINE HRESULT IMFActivate_SetGUID(IMFActivate* This,REFGUID guidKey,REFGUID guidValue) {
    return This->lpVtbl->SetGUID(This,guidKey,guidValue);
}
static FORCEINLINE HRESULT IMFActivate_SetString(IMFActivate* This,REFGUID guidKey,LPCWSTR wszValue) {
    return This->lpVtbl->SetString(This,guidKey,wszValue);
}
static FORCEINLINE HRESULT IMFActivate_SetBlob(IMFActivate* This,REFGUID guidKey,const UINT8 *pBuf,UINT32 cbBufSize) {
    return This->lpVtbl->SetBlob(This,guidKey,pBuf,cbBufSize);
}
static FORCEINLINE HRESULT IMFActivate_SetUnknown(IMFActivate* This,REFGUID guidKey,IUnknown *pUnknown) {
    return This->lpVtbl->SetUnknown(This,guidKey,pUnknown);
}
static FORCEINLINE HRESULT IMFActivate_LockStore(IMFActivate* This) {
    return This->lpVtbl->LockStore(This);
}
static FORCEINLINE HRESULT IMFActivate_UnlockStore(IMFActivate* This) {
    return This->lpVtbl->UnlockStore(This);
}
static FORCEINLINE HRESULT IMFActivate_GetCount(IMFActivate* This,UINT32 *pcItems) {
    return This->lpVtbl->GetCount(This,pcItems);
}
static FORCEINLINE HRESULT IMFActivate_GetItemByIndex(IMFActivate* This,UINT32 unIndex,GUID *pguidKey,PROPVARIANT *pValue) {
    return This->lpVtbl->GetItemByIndex(This,unIndex,pguidKey,pValue);
}
static FORCEINLINE HRESULT IMFActivate_CopyAllItems(IMFActivate* This,IMFAttributes *pDest) {
    return This->lpVtbl->CopyAllItems(This,pDest);
}
/*** IMFActivate methods ***/
static FORCEINLINE HRESULT IMFActivate_ActivateObject(IMFActivate* This,REFIID riid,void **ppv) {
    return This->lpVtbl->ActivateObject(This,riid,ppv);
}
static FORCEINLINE HRESULT IMFActivate_ShutdownObject(IMFActivate* This) {
    return This->lpVtbl->ShutdownObject(This);
}
static FORCEINLINE HRESULT IMFActivate_DetachObject(IMFActivate* This) {
    return This->lpVtbl->DetachObject(This);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFActivate_ActivateObject_Proxy(
    IMFActivate* This,
    REFIID riid,
    void **ppv);
void __RPC_STUB IMFActivate_ActivateObject_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFActivate_ShutdownObject_Proxy(
    IMFActivate* This);
void __RPC_STUB IMFActivate_ShutdownObject_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFActivate_DetachObject_Proxy(
    IMFActivate* This);
void __RPC_STUB IMFActivate_DetachObject_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFActivate_INTERFACE_DEFINED__ */

#endif

#if WINVER >= _WIN32_WINNT_WIN7
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
typedef enum _MF_Plugin_Type {
    MF_Plugin_Type_MFT = 0,
    MF_Plugin_Type_MediaSource = 1,
    MF_Plugin_Type_MFT_MatchOutputType = 2,
    MF_Plugin_Type_Other = (DWORD)-1
} MF_Plugin_Type;

/*****************************************************************************
 * IMFPluginControl interface
 */
#ifndef __IMFPluginControl_INTERFACE_DEFINED__
#define __IMFPluginControl_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFPluginControl, 0x5c6c44bf, 0x1db6, 0x435b, 0x92,0x49, 0xe8,0xcd,0x10,0xfd,0xec,0x96);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("5c6c44bf-1db6-435b-9249-e8cd10fdec96")
IMFPluginControl : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE GetPreferredClsid(
        DWORD pluginType,
        LPCWSTR selector,
        CLSID *clsid) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetPreferredClsidByIndex(
        DWORD pluginType,
        DWORD index,
        LPWSTR *selector,
        CLSID *clsid) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetPreferredClsid(
        DWORD pluginType,
        LPCWSTR selector,
        const CLSID *clsid) = 0;

    virtual HRESULT STDMETHODCALLTYPE IsDisabled(
        DWORD pluginType,
        REFCLSID clsid) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetDisabledByIndex(
        DWORD pluginType,
        DWORD index,
        CLSID *clsid) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetDisabled(
        DWORD pluginType,
        REFCLSID clsid,
        WINBOOL disabled) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFPluginControl, 0x5c6c44bf, 0x1db6, 0x435b, 0x92,0x49, 0xe8,0xcd,0x10,0xfd,0xec,0x96)
#endif
#else
typedef struct IMFPluginControlVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFPluginControl* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFPluginControl* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFPluginControl* This);

    /*** IMFPluginControl methods ***/
    HRESULT (STDMETHODCALLTYPE *GetPreferredClsid)(
        IMFPluginControl* This,
        DWORD pluginType,
        LPCWSTR selector,
        CLSID *clsid);

    HRESULT (STDMETHODCALLTYPE *GetPreferredClsidByIndex)(
        IMFPluginControl* This,
        DWORD pluginType,
        DWORD index,
        LPWSTR *selector,
        CLSID *clsid);

    HRESULT (STDMETHODCALLTYPE *SetPreferredClsid)(
        IMFPluginControl* This,
        DWORD pluginType,
        LPCWSTR selector,
        const CLSID *clsid);

    HRESULT (STDMETHODCALLTYPE *IsDisabled)(
        IMFPluginControl* This,
        DWORD pluginType,
        REFCLSID clsid);

    HRESULT (STDMETHODCALLTYPE *GetDisabledByIndex)(
        IMFPluginControl* This,
        DWORD pluginType,
        DWORD index,
        CLSID *clsid);

    HRESULT (STDMETHODCALLTYPE *SetDisabled)(
        IMFPluginControl* This,
        DWORD pluginType,
        REFCLSID clsid,
        WINBOOL disabled);

    END_INTERFACE
} IMFPluginControlVtbl;
interface IMFPluginControl {
    CONST_VTBL IMFPluginControlVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFPluginControl_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFPluginControl_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFPluginControl_Release(This) (This)->lpVtbl->Release(This)
/*** IMFPluginControl methods ***/
#define IMFPluginControl_GetPreferredClsid(This,pluginType,selector,clsid) (This)->lpVtbl->GetPreferredClsid(This,pluginType,selector,clsid)
#define IMFPluginControl_GetPreferredClsidByIndex(This,pluginType,index,selector,clsid) (This)->lpVtbl->GetPreferredClsidByIndex(This,pluginType,index,selector,clsid)
#define IMFPluginControl_SetPreferredClsid(This,pluginType,selector,clsid) (This)->lpVtbl->SetPreferredClsid(This,pluginType,selector,clsid)
#define IMFPluginControl_IsDisabled(This,pluginType,clsid) (This)->lpVtbl->IsDisabled(This,pluginType,clsid)
#define IMFPluginControl_GetDisabledByIndex(This,pluginType,index,clsid) (This)->lpVtbl->GetDisabledByIndex(This,pluginType,index,clsid)
#define IMFPluginControl_SetDisabled(This,pluginType,clsid,disabled) (This)->lpVtbl->SetDisabled(This,pluginType,clsid,disabled)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFPluginControl_QueryInterface(IMFPluginControl* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFPluginControl_AddRef(IMFPluginControl* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFPluginControl_Release(IMFPluginControl* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFPluginControl methods ***/
static FORCEINLINE HRESULT IMFPluginControl_GetPreferredClsid(IMFPluginControl* This,DWORD pluginType,LPCWSTR selector,CLSID *clsid) {
    return This->lpVtbl->GetPreferredClsid(This,pluginType,selector,clsid);
}
static FORCEINLINE HRESULT IMFPluginControl_GetPreferredClsidByIndex(IMFPluginControl* This,DWORD pluginType,DWORD index,LPWSTR *selector,CLSID *clsid) {
    return This->lpVtbl->GetPreferredClsidByIndex(This,pluginType,index,selector,clsid);
}
static FORCEINLINE HRESULT IMFPluginControl_SetPreferredClsid(IMFPluginControl* This,DWORD pluginType,LPCWSTR selector,const CLSID *clsid) {
    return This->lpVtbl->SetPreferredClsid(This,pluginType,selector,clsid);
}
static FORCEINLINE HRESULT IMFPluginControl_IsDisabled(IMFPluginControl* This,DWORD pluginType,REFCLSID clsid) {
    return This->lpVtbl->IsDisabled(This,pluginType,clsid);
}
static FORCEINLINE HRESULT IMFPluginControl_GetDisabledByIndex(IMFPluginControl* This,DWORD pluginType,DWORD index,CLSID *clsid) {
    return This->lpVtbl->GetDisabledByIndex(This,pluginType,index,clsid);
}
static FORCEINLINE HRESULT IMFPluginControl_SetDisabled(IMFPluginControl* This,DWORD pluginType,REFCLSID clsid,WINBOOL disabled) {
    return This->lpVtbl->SetDisabled(This,pluginType,clsid,disabled);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFPluginControl_GetPreferredClsid_Proxy(
    IMFPluginControl* This,
    DWORD pluginType,
    LPCWSTR selector,
    CLSID *clsid);
void __RPC_STUB IMFPluginControl_GetPreferredClsid_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFPluginControl_GetPreferredClsidByIndex_Proxy(
    IMFPluginControl* This,
    DWORD pluginType,
    DWORD index,
    LPWSTR *selector,
    CLSID *clsid);
void __RPC_STUB IMFPluginControl_GetPreferredClsidByIndex_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFPluginControl_SetPreferredClsid_Proxy(
    IMFPluginControl* This,
    DWORD pluginType,
    LPCWSTR selector,
    const CLSID *clsid);
void __RPC_STUB IMFPluginControl_SetPreferredClsid_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFPluginControl_IsDisabled_Proxy(
    IMFPluginControl* This,
    DWORD pluginType,
    REFCLSID clsid);
void __RPC_STUB IMFPluginControl_IsDisabled_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFPluginControl_GetDisabledByIndex_Proxy(
    IMFPluginControl* This,
    DWORD pluginType,
    DWORD index,
    CLSID *clsid);
void __RPC_STUB IMFPluginControl_GetDisabledByIndex_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFPluginControl_SetDisabled_Proxy(
    IMFPluginControl* This,
    DWORD pluginType,
    REFCLSID clsid,
    WINBOOL disabled);
void __RPC_STUB IMFPluginControl_SetDisabled_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFPluginControl_INTERFACE_DEFINED__ */


typedef enum MF_PLUGIN_CONTROL_POLICY {
    MF_PLUGIN_CONTROL_POLICY_USE_ALL_PLUGINS = 0,
    MF_PLUGIN_CONTROL_POLICY_USE_APPROVED_PLUGINS = 1,
    MF_PLUGIN_CONTROL_POLICY_USE_WEB_PLUGINS = 2
} MF_PLUGIN_CONTROL_POLICY;

/*****************************************************************************
 * IMFPluginControl2 interface
 */
#ifndef __IMFPluginControl2_INTERFACE_DEFINED__
#define __IMFPluginControl2_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFPluginControl2, 0xc6982083, 0x3ddc, 0x45cb, 0xaf,0x5e, 0x0f,0x7a,0x8c,0xe4,0xde,0x77);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("c6982083-3ddc-45cb-af5e-0f7a8ce4de77")
IMFPluginControl2 : public IMFPluginControl
{
    virtual HRESULT STDMETHODCALLTYPE SetPolicy(
        MF_PLUGIN_CONTROL_POLICY policy) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFPluginControl2, 0xc6982083, 0x3ddc, 0x45cb, 0xaf,0x5e, 0x0f,0x7a,0x8c,0xe4,0xde,0x77)
#endif
#else
typedef struct IMFPluginControl2Vtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFPluginControl2* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFPluginControl2* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFPluginControl2* This);

    /*** IMFPluginControl methods ***/
    HRESULT (STDMETHODCALLTYPE *GetPreferredClsid)(
        IMFPluginControl2* This,
        DWORD pluginType,
        LPCWSTR selector,
        CLSID *clsid);

    HRESULT (STDMETHODCALLTYPE *GetPreferredClsidByIndex)(
        IMFPluginControl2* This,
        DWORD pluginType,
        DWORD index,
        LPWSTR *selector,
        CLSID *clsid);

    HRESULT (STDMETHODCALLTYPE *SetPreferredClsid)(
        IMFPluginControl2* This,
        DWORD pluginType,
        LPCWSTR selector,
        const CLSID *clsid);

    HRESULT (STDMETHODCALLTYPE *IsDisabled)(
        IMFPluginControl2* This,
        DWORD pluginType,
        REFCLSID clsid);

    HRESULT (STDMETHODCALLTYPE *GetDisabledByIndex)(
        IMFPluginControl2* This,
        DWORD pluginType,
        DWORD index,
        CLSID *clsid);

    HRESULT (STDMETHODCALLTYPE *SetDisabled)(
        IMFPluginControl2* This,
        DWORD pluginType,
        REFCLSID clsid,
        WINBOOL disabled);

    /*** IMFPluginControl2 methods ***/
    HRESULT (STDMETHODCALLTYPE *SetPolicy)(
        IMFPluginControl2* This,
        MF_PLUGIN_CONTROL_POLICY policy);

    END_INTERFACE
} IMFPluginControl2Vtbl;
interface IMFPluginControl2 {
    CONST_VTBL IMFPluginControl2Vtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFPluginControl2_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFPluginControl2_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFPluginControl2_Release(This) (This)->lpVtbl->Release(This)
/*** IMFPluginControl methods ***/
#define IMFPluginControl2_GetPreferredClsid(This,pluginType,selector,clsid) (This)->lpVtbl->GetPreferredClsid(This,pluginType,selector,clsid)
#define IMFPluginControl2_GetPreferredClsidByIndex(This,pluginType,index,selector,clsid) (This)->lpVtbl->GetPreferredClsidByIndex(This,pluginType,index,selector,clsid)
#define IMFPluginControl2_SetPreferredClsid(This,pluginType,selector,clsid) (This)->lpVtbl->SetPreferredClsid(This,pluginType,selector,clsid)
#define IMFPluginControl2_IsDisabled(This,pluginType,clsid) (This)->lpVtbl->IsDisabled(This,pluginType,clsid)
#define IMFPluginControl2_GetDisabledByIndex(This,pluginType,index,clsid) (This)->lpVtbl->GetDisabledByIndex(This,pluginType,index,clsid)
#define IMFPluginControl2_SetDisabled(This,pluginType,clsid,disabled) (This)->lpVtbl->SetDisabled(This,pluginType,clsid,disabled)
/*** IMFPluginControl2 methods ***/
#define IMFPluginControl2_SetPolicy(This,policy) (This)->lpVtbl->SetPolicy(This,policy)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFPluginControl2_QueryInterface(IMFPluginControl2* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFPluginControl2_AddRef(IMFPluginControl2* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFPluginControl2_Release(IMFPluginControl2* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFPluginControl methods ***/
static FORCEINLINE HRESULT IMFPluginControl2_GetPreferredClsid(IMFPluginControl2* This,DWORD pluginType,LPCWSTR selector,CLSID *clsid) {
    return This->lpVtbl->GetPreferredClsid(This,pluginType,selector,clsid);
}
static FORCEINLINE HRESULT IMFPluginControl2_GetPreferredClsidByIndex(IMFPluginControl2* This,DWORD pluginType,DWORD index,LPWSTR *selector,CLSID *clsid) {
    return This->lpVtbl->GetPreferredClsidByIndex(This,pluginType,index,selector,clsid);
}
static FORCEINLINE HRESULT IMFPluginControl2_SetPreferredClsid(IMFPluginControl2* This,DWORD pluginType,LPCWSTR selector,const CLSID *clsid) {
    return This->lpVtbl->SetPreferredClsid(This,pluginType,selector,clsid);
}
static FORCEINLINE HRESULT IMFPluginControl2_IsDisabled(IMFPluginControl2* This,DWORD pluginType,REFCLSID clsid) {
    return This->lpVtbl->IsDisabled(This,pluginType,clsid);
}
static FORCEINLINE HRESULT IMFPluginControl2_GetDisabledByIndex(IMFPluginControl2* This,DWORD pluginType,DWORD index,CLSID *clsid) {
    return This->lpVtbl->GetDisabledByIndex(This,pluginType,index,clsid);
}
static FORCEINLINE HRESULT IMFPluginControl2_SetDisabled(IMFPluginControl2* This,DWORD pluginType,REFCLSID clsid,WINBOOL disabled) {
    return This->lpVtbl->SetDisabled(This,pluginType,clsid,disabled);
}
/*** IMFPluginControl2 methods ***/
static FORCEINLINE HRESULT IMFPluginControl2_SetPolicy(IMFPluginControl2* This,MF_PLUGIN_CONTROL_POLICY policy) {
    return This->lpVtbl->SetPolicy(This,policy);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFPluginControl2_SetPolicy_Proxy(
    IMFPluginControl2* This,
    MF_PLUGIN_CONTROL_POLICY policy);
void __RPC_STUB IMFPluginControl2_SetPolicy_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFPluginControl2_INTERFACE_DEFINED__ */

#endif

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
/*****************************************************************************
 * IMFDXGIDeviceManager interface
 */
#ifndef __IMFDXGIDeviceManager_INTERFACE_DEFINED__
#define __IMFDXGIDeviceManager_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFDXGIDeviceManager, 0xeb533d5d, 0x2db6, 0x40f8, 0x97,0xa9, 0x49,0x46,0x92,0x01,0x4f,0x07);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("eb533d5d-2db6-40f8-97a9-494692014f07")
IMFDXGIDeviceManager : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE CloseDeviceHandle(
        HANDLE hDevice) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetVideoService(
        HANDLE hDevice,
        REFIID riid,
        void **ppService) = 0;

    virtual HRESULT STDMETHODCALLTYPE LockDevice(
        HANDLE hDevice,
        REFIID riid,
        void **ppUnkDevice,
        WINBOOL fBlock) = 0;

    virtual HRESULT STDMETHODCALLTYPE OpenDeviceHandle(
        HANDLE *phDevice) = 0;

    virtual HRESULT STDMETHODCALLTYPE ResetDevice(
        IUnknown *pUnkDevice,
        UINT resetToken) = 0;

    virtual HRESULT STDMETHODCALLTYPE TestDevice(
        HANDLE hDevice) = 0;

    virtual HRESULT STDMETHODCALLTYPE UnlockDevice(
        HANDLE hDevice,
        WINBOOL fSaveState) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFDXGIDeviceManager, 0xeb533d5d, 0x2db6, 0x40f8, 0x97,0xa9, 0x49,0x46,0x92,0x01,0x4f,0x07)
#endif
#else
typedef struct IMFDXGIDeviceManagerVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFDXGIDeviceManager* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFDXGIDeviceManager* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFDXGIDeviceManager* This);

    /*** IMFDXGIDeviceManager methods ***/
    HRESULT (STDMETHODCALLTYPE *CloseDeviceHandle)(
        IMFDXGIDeviceManager* This,
        HANDLE hDevice);

    HRESULT (STDMETHODCALLTYPE *GetVideoService)(
        IMFDXGIDeviceManager* This,
        HANDLE hDevice,
        REFIID riid,
        void **ppService);

    HRESULT (STDMETHODCALLTYPE *LockDevice)(
        IMFDXGIDeviceManager* This,
        HANDLE hDevice,
        REFIID riid,
        void **ppUnkDevice,
        WINBOOL fBlock);

    HRESULT (STDMETHODCALLTYPE *OpenDeviceHandle)(
        IMFDXGIDeviceManager* This,
        HANDLE *phDevice);

    HRESULT (STDMETHODCALLTYPE *ResetDevice)(
        IMFDXGIDeviceManager* This,
        IUnknown *pUnkDevice,
        UINT resetToken);

    HRESULT (STDMETHODCALLTYPE *TestDevice)(
        IMFDXGIDeviceManager* This,
        HANDLE hDevice);

    HRESULT (STDMETHODCALLTYPE *UnlockDevice)(
        IMFDXGIDeviceManager* This,
        HANDLE hDevice,
        WINBOOL fSaveState);

    END_INTERFACE
} IMFDXGIDeviceManagerVtbl;
interface IMFDXGIDeviceManager {
    CONST_VTBL IMFDXGIDeviceManagerVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFDXGIDeviceManager_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFDXGIDeviceManager_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFDXGIDeviceManager_Release(This) (This)->lpVtbl->Release(This)
/*** IMFDXGIDeviceManager methods ***/
#define IMFDXGIDeviceManager_CloseDeviceHandle(This,hDevice) (This)->lpVtbl->CloseDeviceHandle(This,hDevice)
#define IMFDXGIDeviceManager_GetVideoService(This,hDevice,riid,ppService) (This)->lpVtbl->GetVideoService(This,hDevice,riid,ppService)
#define IMFDXGIDeviceManager_LockDevice(This,hDevice,riid,ppUnkDevice,fBlock) (This)->lpVtbl->LockDevice(This,hDevice,riid,ppUnkDevice,fBlock)
#define IMFDXGIDeviceManager_OpenDeviceHandle(This,phDevice) (This)->lpVtbl->OpenDeviceHandle(This,phDevice)
#define IMFDXGIDeviceManager_ResetDevice(This,pUnkDevice,resetToken) (This)->lpVtbl->ResetDevice(This,pUnkDevice,resetToken)
#define IMFDXGIDeviceManager_TestDevice(This,hDevice) (This)->lpVtbl->TestDevice(This,hDevice)
#define IMFDXGIDeviceManager_UnlockDevice(This,hDevice,fSaveState) (This)->lpVtbl->UnlockDevice(This,hDevice,fSaveState)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFDXGIDeviceManager_QueryInterface(IMFDXGIDeviceManager* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFDXGIDeviceManager_AddRef(IMFDXGIDeviceManager* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFDXGIDeviceManager_Release(IMFDXGIDeviceManager* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFDXGIDeviceManager methods ***/
static FORCEINLINE HRESULT IMFDXGIDeviceManager_CloseDeviceHandle(IMFDXGIDeviceManager* This,HANDLE hDevice) {
    return This->lpVtbl->CloseDeviceHandle(This,hDevice);
}
static FORCEINLINE HRESULT IMFDXGIDeviceManager_GetVideoService(IMFDXGIDeviceManager* This,HANDLE hDevice,REFIID riid,void **ppService) {
    return This->lpVtbl->GetVideoService(This,hDevice,riid,ppService);
}
static FORCEINLINE HRESULT IMFDXGIDeviceManager_LockDevice(IMFDXGIDeviceManager* This,HANDLE hDevice,REFIID riid,void **ppUnkDevice,WINBOOL fBlock) {
    return This->lpVtbl->LockDevice(This,hDevice,riid,ppUnkDevice,fBlock);
}
static FORCEINLINE HRESULT IMFDXGIDeviceManager_OpenDeviceHandle(IMFDXGIDeviceManager* This,HANDLE *phDevice) {
    return This->lpVtbl->OpenDeviceHandle(This,phDevice);
}
static FORCEINLINE HRESULT IMFDXGIDeviceManager_ResetDevice(IMFDXGIDeviceManager* This,IUnknown *pUnkDevice,UINT resetToken) {
    return This->lpVtbl->ResetDevice(This,pUnkDevice,resetToken);
}
static FORCEINLINE HRESULT IMFDXGIDeviceManager_TestDevice(IMFDXGIDeviceManager* This,HANDLE hDevice) {
    return This->lpVtbl->TestDevice(This,hDevice);
}
static FORCEINLINE HRESULT IMFDXGIDeviceManager_UnlockDevice(IMFDXGIDeviceManager* This,HANDLE hDevice,WINBOOL fSaveState) {
    return This->lpVtbl->UnlockDevice(This,hDevice,fSaveState);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFDXGIDeviceManager_CloseDeviceHandle_Proxy(
    IMFDXGIDeviceManager* This,
    HANDLE hDevice);
void __RPC_STUB IMFDXGIDeviceManager_CloseDeviceHandle_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFDXGIDeviceManager_GetVideoService_Proxy(
    IMFDXGIDeviceManager* This,
    HANDLE hDevice,
    REFIID riid,
    void **ppService);
void __RPC_STUB IMFDXGIDeviceManager_GetVideoService_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFDXGIDeviceManager_LockDevice_Proxy(
    IMFDXGIDeviceManager* This,
    HANDLE hDevice,
    REFIID riid,
    void **ppUnkDevice,
    WINBOOL fBlock);
void __RPC_STUB IMFDXGIDeviceManager_LockDevice_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFDXGIDeviceManager_OpenDeviceHandle_Proxy(
    IMFDXGIDeviceManager* This,
    HANDLE *phDevice);
void __RPC_STUB IMFDXGIDeviceManager_OpenDeviceHandle_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFDXGIDeviceManager_ResetDevice_Proxy(
    IMFDXGIDeviceManager* This,
    IUnknown *pUnkDevice,
    UINT resetToken);
void __RPC_STUB IMFDXGIDeviceManager_ResetDevice_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFDXGIDeviceManager_TestDevice_Proxy(
    IMFDXGIDeviceManager* This,
    HANDLE hDevice);
void __RPC_STUB IMFDXGIDeviceManager_TestDevice_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFDXGIDeviceManager_UnlockDevice_Proxy(
    IMFDXGIDeviceManager* This,
    HANDLE hDevice,
    WINBOOL fSaveState);
void __RPC_STUB IMFDXGIDeviceManager_UnlockDevice_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFDXGIDeviceManager_INTERFACE_DEFINED__ */

#endif

#endif
/* Begin additional prototypes for all interfaces */

ULONG           __RPC_USER BSTR_UserSize     (ULONG *, ULONG, BSTR *);
unsigned char * __RPC_USER BSTR_UserMarshal  (ULONG *, unsigned char *, BSTR *);
unsigned char * __RPC_USER BSTR_UserUnmarshal(ULONG *, unsigned char *, BSTR *);
void            __RPC_USER BSTR_UserFree     (ULONG *, BSTR *);
ULONG           __RPC_USER LPSAFEARRAY_UserSize     (ULONG *, ULONG, LPSAFEARRAY *);
unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal  (ULONG *, unsigned char *, LPSAFEARRAY *);
unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal(ULONG *, unsigned char *, LPSAFEARRAY *);
void            __RPC_USER LPSAFEARRAY_UserFree     (ULONG *, LPSAFEARRAY *);

/* End additional prototypes */

#ifdef __cplusplus
}
#endif

#endif /* __mfobjects_h__ */
Added undroid/tclwmf/compat/mfreadwrite.h.


























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
/*** Autogenerated by WIDL 1.6 from include/mfreadwrite.idl - Do not edit ***/

#ifndef __REQUIRED_RPCNDR_H_VERSION__
#define __REQUIRED_RPCNDR_H_VERSION__ 475
#endif

#include <rpc.h>
#include <rpcndr.h>

#ifndef COM_NO_WINDOWS_H
#include <windows.h>
#include <ole2.h>
#endif

#ifndef __mfreadwrite_h__
#define __mfreadwrite_h__

/* Forward declarations */

#ifndef __IMFSourceReader_FWD_DEFINED__
#define __IMFSourceReader_FWD_DEFINED__
typedef interface IMFSourceReader IMFSourceReader;
#endif

#ifndef __IMFSinkWriter_FWD_DEFINED__
#define __IMFSinkWriter_FWD_DEFINED__
typedef interface IMFSinkWriter IMFSinkWriter;
#endif

#ifndef __IMFSourceReaderCallback_FWD_DEFINED__
#define __IMFSourceReaderCallback_FWD_DEFINED__
typedef interface IMFSourceReaderCallback IMFSourceReaderCallback;
#endif

/* Headers for imported files */

#include <mfobjects.h>

#ifdef __cplusplus
extern "C" {
#endif

EXTERN_GUID(MF_SOURCE_READER_ASYNC_CALLBACK, 0x1e3dbeac,0xbb43,0x4c35,0xb5,0x07,0xcd,0x64,0x44,0x64,0xc9,0x65);
EXTERN_GUID(MF_SOURCE_READER_D3D_MANAGER, 0xec822da2,0xe1e9,0x4b29,0xa0,0xd8,0x56,0x3c,0x71,0x9f,0x52,0x69);
EXTERN_GUID(MF_SOURCE_READER_DISABLE_DXVA, 0xaa456cfd,0x3943,0x4a1e,0xa7,0x7d,0x18,0x38,0xc0,0xea,0x2e,0x35);
EXTERN_GUID(MF_SOURCE_READER_MEDIASOURCE_CONFIG, 0x9085abeb,0x0354,0x48f9,0xab,0xb5,0x20,0x0d,0xf8,0x38,0xc6,0x8e);
EXTERN_GUID(MF_SOURCE_READER_MEDIASOURCE_CHARACTERISTICS, 0x6d23f5c8,0xc5d7,0x4a9b,0x99,0x71,0x5d,0x11,0xf8,0xbc,0xa8,0x80);
EXTERN_GUID(MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING, 0xfb394f3d,0xccf1,0x42ee,0xbb,0xb3,0xf9,0xb8,0x45,0xd5,0x68,0x1d);
EXTERN_GUID(MF_SOURCE_READER_DISCONNECT_MEDIASOURCE_ON_SHUTDOWN, 0x56b67165,0x219e,0x456d,0xa2,0x2e,0x2d,0x30,0x04,0xc7,0xfe,0x56);
typedef enum MF_SOURCE_READER_FLAG {
    MF_SOURCE_READERF_ERROR = 0x1,
    MF_SOURCE_READERF_ENDOFSTREAM = 0x2,
    MF_SOURCE_READERF_NEWSTREAM = 0x4,
    MF_SOURCE_READERF_NATIVEMEDIATYPECHANGED = 0x10,
    MF_SOURCE_READERF_CURRENTMEDIATYPECHANGED = 0x20,
    MF_SOURCE_READERF_STREAMTICK = 0x100
} MF_SOURCE_READER_FLAG;
typedef struct _MF_SINK_WRITER_STATISTICS {
    DWORD cb;
    LONGLONG llLastTimestampReceived;
    LONGLONG llLastTimestampEncoded;
    LONGLONG llLastTimestampProcessed;
    LONGLONG llLastStreamTickReceived;
    LONGLONG llLastSinkSampleRequest;
    QWORD qwNumSamplesReceived;
    QWORD qwNumSamplesEncoded;
    QWORD qwNumSamplesProcessed;
    QWORD qwNumStreamTicksReceived;
    DWORD dwByteCountQueued;
    QWORD qwByteCountProcessed;
    DWORD dwNumOutstandingSinkSampleRequests;
    DWORD dwAverageSampleRateReceived;
    DWORD dwAverageSampleRateEncoded;
    DWORD dwAverageSampleRateProcessed;
} MF_SINK_WRITER_STATISTICS;
enum {
    MF_SOURCE_READER_INVALID_STREAM_INDEX = 0xffffffff,
    MF_SOURCE_READER_ALL_STREAMS = 0xfffffffe,
    MF_SOURCE_READER_ANY_STREAM = 0xfffffffe,
    MF_SOURCE_READER_FIRST_AUDIO_STREAM = 0xfffffffd,
    MF_SOURCE_READER_FIRST_VIDEO_STREAM = 0xfffffffc,
    MF_SOURCE_READER_MEDIASOURCE = 0xffffffff
};

/*****************************************************************************
 * IMFSourceReader interface
 */
#ifndef __IMFSourceReader_INTERFACE_DEFINED__
#define __IMFSourceReader_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFSourceReader, 0x70ae66f2, 0xc809, 0x4e4f, 0x89,0x15, 0xbd,0xcb,0x40,0x6b,0x79,0x93);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("70ae66f2-c809-4e4f-8915-bdcb406b7993")
IMFSourceReader : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE GetStreamSelection(
        DWORD dwStreamIndex,
        WINBOOL *pfSelected) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetStreamSelection(
        DWORD dwStreamIndex,
        WINBOOL fSelected) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetNativeMediaType(
        DWORD dwStreamIndex,
        DWORD dwMediaTypeIndex,
        IMFMediaType **ppMediaType) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetCurrentMediaType(
        DWORD dwStreamIndex,
        IMFMediaType **ppMediaType) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetCurrentMediaType(
        DWORD dwStreamIndex,
        DWORD *pdwReserved,
        IMFMediaType *pMediaType) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetCurrentPosition(
        REFGUID guidTimeFormat,
        REFPROPVARIANT varPosition) = 0;

    virtual HRESULT STDMETHODCALLTYPE ReadSample(
        DWORD dwStreamIndex,
        DWORD dwControlFlags,
        DWORD *pdwActualStreamIndex,
        DWORD *pdwStreamFlags,
        LONGLONG *pllTimestamp,
        IMFSample **ppSample) = 0;

    virtual HRESULT STDMETHODCALLTYPE Flush(
        DWORD dwStreamIndex) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetServiceForStream(
        DWORD dwStreamIndex,
        REFGUID guidService,
        REFIID riid,
        LPVOID *ppvObject) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetPresentationAttribute(
        DWORD dwStreamIndex,
        REFGUID guidAttribute,
        PROPVARIANT *pvarAttribute) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFSourceReader, 0x70ae66f2, 0xc809, 0x4e4f, 0x89,0x15, 0xbd,0xcb,0x40,0x6b,0x79,0x93)
#endif
#else
typedef struct IMFSourceReaderVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFSourceReader* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFSourceReader* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFSourceReader* This);

    /*** IMFSourceReader methods ***/
    HRESULT (STDMETHODCALLTYPE *GetStreamSelection)(
        IMFSourceReader* This,
        DWORD dwStreamIndex,
        WINBOOL *pfSelected);

    HRESULT (STDMETHODCALLTYPE *SetStreamSelection)(
        IMFSourceReader* This,
        DWORD dwStreamIndex,
        WINBOOL fSelected);

    HRESULT (STDMETHODCALLTYPE *GetNativeMediaType)(
        IMFSourceReader* This,
        DWORD dwStreamIndex,
        DWORD dwMediaTypeIndex,
        IMFMediaType **ppMediaType);

    HRESULT (STDMETHODCALLTYPE *GetCurrentMediaType)(
        IMFSourceReader* This,
        DWORD dwStreamIndex,
        IMFMediaType **ppMediaType);

    HRESULT (STDMETHODCALLTYPE *SetCurrentMediaType)(
        IMFSourceReader* This,
        DWORD dwStreamIndex,
        DWORD *pdwReserved,
        IMFMediaType *pMediaType);

    HRESULT (STDMETHODCALLTYPE *SetCurrentPosition)(
        IMFSourceReader* This,
        REFGUID guidTimeFormat,
        REFPROPVARIANT varPosition);

    HRESULT (STDMETHODCALLTYPE *ReadSample)(
        IMFSourceReader* This,
        DWORD dwStreamIndex,
        DWORD dwControlFlags,
        DWORD *pdwActualStreamIndex,
        DWORD *pdwStreamFlags,
        LONGLONG *pllTimestamp,
        IMFSample **ppSample);

    HRESULT (STDMETHODCALLTYPE *Flush)(
        IMFSourceReader* This,
        DWORD dwStreamIndex);

    HRESULT (STDMETHODCALLTYPE *GetServiceForStream)(
        IMFSourceReader* This,
        DWORD dwStreamIndex,
        REFGUID guidService,
        REFIID riid,
        LPVOID *ppvObject);

    HRESULT (STDMETHODCALLTYPE *GetPresentationAttribute)(
        IMFSourceReader* This,
        DWORD dwStreamIndex,
        REFGUID guidAttribute,
        PROPVARIANT *pvarAttribute);

    END_INTERFACE
} IMFSourceReaderVtbl;
interface IMFSourceReader {
    CONST_VTBL IMFSourceReaderVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFSourceReader_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFSourceReader_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFSourceReader_Release(This) (This)->lpVtbl->Release(This)
/*** IMFSourceReader methods ***/
#define IMFSourceReader_GetStreamSelection(This,dwStreamIndex,pfSelected) (This)->lpVtbl->GetStreamSelection(This,dwStreamIndex,pfSelected)
#define IMFSourceReader_SetStreamSelection(This,dwStreamIndex,fSelected) (This)->lpVtbl->SetStreamSelection(This,dwStreamIndex,fSelected)
#define IMFSourceReader_GetNativeMediaType(This,dwStreamIndex,dwMediaTypeIndex,ppMediaType) (This)->lpVtbl->GetNativeMediaType(This,dwStreamIndex,dwMediaTypeIndex,ppMediaType)
#define IMFSourceReader_GetCurrentMediaType(This,dwStreamIndex,ppMediaType) (This)->lpVtbl->GetCurrentMediaType(This,dwStreamIndex,ppMediaType)
#define IMFSourceReader_SetCurrentMediaType(This,dwStreamIndex,pdwReserved,pMediaType) (This)->lpVtbl->SetCurrentMediaType(This,dwStreamIndex,pdwReserved,pMediaType)
#define IMFSourceReader_SetCurrentPosition(This,guidTimeFormat,varPosition) (This)->lpVtbl->SetCurrentPosition(This,guidTimeFormat,varPosition)
#define IMFSourceReader_ReadSample(This,dwStreamIndex,dwControlFlags,pdwActualStreamIndex,pdwStreamFlags,pllTimestamp,ppSample) (This)->lpVtbl->ReadSample(This,dwStreamIndex,dwControlFlags,pdwActualStreamIndex,pdwStreamFlags,pllTimestamp,ppSample)
#define IMFSourceReader_Flush(This,dwStreamIndex) (This)->lpVtbl->Flush(This,dwStreamIndex)
#define IMFSourceReader_GetServiceForStream(This,dwStreamIndex,guidService,riid,ppvObject) (This)->lpVtbl->GetServiceForStream(This,dwStreamIndex,guidService,riid,ppvObject)
#define IMFSourceReader_GetPresentationAttribute(This,dwStreamIndex,guidAttribute,pvarAttribute) (This)->lpVtbl->GetPresentationAttribute(This,dwStreamIndex,guidAttribute,pvarAttribute)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFSourceReader_QueryInterface(IMFSourceReader* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFSourceReader_AddRef(IMFSourceReader* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFSourceReader_Release(IMFSourceReader* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFSourceReader methods ***/
static FORCEINLINE HRESULT IMFSourceReader_GetStreamSelection(IMFSourceReader* This,DWORD dwStreamIndex,WINBOOL *pfSelected) {
    return This->lpVtbl->GetStreamSelection(This,dwStreamIndex,pfSelected);
}
static FORCEINLINE HRESULT IMFSourceReader_SetStreamSelection(IMFSourceReader* This,DWORD dwStreamIndex,WINBOOL fSelected) {
    return This->lpVtbl->SetStreamSelection(This,dwStreamIndex,fSelected);
}
static FORCEINLINE HRESULT IMFSourceReader_GetNativeMediaType(IMFSourceReader* This,DWORD dwStreamIndex,DWORD dwMediaTypeIndex,IMFMediaType **ppMediaType) {
    return This->lpVtbl->GetNativeMediaType(This,dwStreamIndex,dwMediaTypeIndex,ppMediaType);
}
static FORCEINLINE HRESULT IMFSourceReader_GetCurrentMediaType(IMFSourceReader* This,DWORD dwStreamIndex,IMFMediaType **ppMediaType) {
    return This->lpVtbl->GetCurrentMediaType(This,dwStreamIndex,ppMediaType);
}
static FORCEINLINE HRESULT IMFSourceReader_SetCurrentMediaType(IMFSourceReader* This,DWORD dwStreamIndex,DWORD *pdwReserved,IMFMediaType *pMediaType) {
    return This->lpVtbl->SetCurrentMediaType(This,dwStreamIndex,pdwReserved,pMediaType);
}
static FORCEINLINE HRESULT IMFSourceReader_SetCurrentPosition(IMFSourceReader* This,REFGUID guidTimeFormat,REFPROPVARIANT varPosition) {
    return This->lpVtbl->SetCurrentPosition(This,guidTimeFormat,varPosition);
}
static FORCEINLINE HRESULT IMFSourceReader_ReadSample(IMFSourceReader* This,DWORD dwStreamIndex,DWORD dwControlFlags,DWORD *pdwActualStreamIndex,DWORD *pdwStreamFlags,LONGLONG *pllTimestamp,IMFSample **ppSample) {
    return This->lpVtbl->ReadSample(This,dwStreamIndex,dwControlFlags,pdwActualStreamIndex,pdwStreamFlags,pllTimestamp,ppSample);
}
static FORCEINLINE HRESULT IMFSourceReader_Flush(IMFSourceReader* This,DWORD dwStreamIndex) {
    return This->lpVtbl->Flush(This,dwStreamIndex);
}
static FORCEINLINE HRESULT IMFSourceReader_GetServiceForStream(IMFSourceReader* This,DWORD dwStreamIndex,REFGUID guidService,REFIID riid,LPVOID *ppvObject) {
    return This->lpVtbl->GetServiceForStream(This,dwStreamIndex,guidService,riid,ppvObject);
}
static FORCEINLINE HRESULT IMFSourceReader_GetPresentationAttribute(IMFSourceReader* This,DWORD dwStreamIndex,REFGUID guidAttribute,PROPVARIANT *pvarAttribute) {
    return This->lpVtbl->GetPresentationAttribute(This,dwStreamIndex,guidAttribute,pvarAttribute);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFSourceReader_GetStreamSelection_Proxy(
    IMFSourceReader* This,
    DWORD dwStreamIndex,
    WINBOOL *pfSelected);
void __RPC_STUB IMFSourceReader_GetStreamSelection_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSourceReader_SetStreamSelection_Proxy(
    IMFSourceReader* This,
    DWORD dwStreamIndex,
    WINBOOL fSelected);
void __RPC_STUB IMFSourceReader_SetStreamSelection_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSourceReader_GetNativeMediaType_Proxy(
    IMFSourceReader* This,
    DWORD dwStreamIndex,
    DWORD dwMediaTypeIndex,
    IMFMediaType **ppMediaType);
void __RPC_STUB IMFSourceReader_GetNativeMediaType_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSourceReader_GetCurrentMediaType_Proxy(
    IMFSourceReader* This,
    DWORD dwStreamIndex,
    IMFMediaType **ppMediaType);
void __RPC_STUB IMFSourceReader_GetCurrentMediaType_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSourceReader_SetCurrentMediaType_Proxy(
    IMFSourceReader* This,
    DWORD dwStreamIndex,
    DWORD *pdwReserved,
    IMFMediaType *pMediaType);
void __RPC_STUB IMFSourceReader_SetCurrentMediaType_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSourceReader_SetCurrentPosition_Proxy(
    IMFSourceReader* This,
    REFGUID guidTimeFormat,
    REFPROPVARIANT varPosition);
void __RPC_STUB IMFSourceReader_SetCurrentPosition_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSourceReader_ReadSample_Proxy(
    IMFSourceReader* This,
    DWORD dwStreamIndex,
    DWORD dwControlFlags,
    DWORD *pdwActualStreamIndex,
    DWORD *pdwStreamFlags,
    LONGLONG *pllTimestamp,
    IMFSample **ppSample);
void __RPC_STUB IMFSourceReader_ReadSample_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSourceReader_Flush_Proxy(
    IMFSourceReader* This,
    DWORD dwStreamIndex);
void __RPC_STUB IMFSourceReader_Flush_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSourceReader_GetServiceForStream_Proxy(
    IMFSourceReader* This,
    DWORD dwStreamIndex,
    REFGUID guidService,
    REFIID riid,
    LPVOID *ppvObject);
void __RPC_STUB IMFSourceReader_GetServiceForStream_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSourceReader_GetPresentationAttribute_Proxy(
    IMFSourceReader* This,
    DWORD dwStreamIndex,
    REFGUID guidAttribute,
    PROPVARIANT *pvarAttribute);
void __RPC_STUB IMFSourceReader_GetPresentationAttribute_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFSourceReader_INTERFACE_DEFINED__ */

/*****************************************************************************
 * IMFSinkWriter interface
 */
#ifndef __IMFSinkWriter_INTERFACE_DEFINED__
#define __IMFSinkWriter_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFSinkWriter, 0x3137f1cd, 0xfe5e, 0x4805, 0xa5,0xd8, 0xfb,0x47,0x74,0x48,0xcb,0x3d);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("3137f1cd-fe5e-4805-a5d8-fb477448cb3d")
IMFSinkWriter : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE AddStream(
        IMFMediaType *pTargetMediaType,
        DWORD *pdwStreamIndex) = 0;

    virtual HRESULT STDMETHODCALLTYPE SetInputMediaType(
        DWORD dwStreamIndex,
        IMFMediaType *pInputMediaType,
        IMFAttributes *pEncodingParameters) = 0;

    virtual HRESULT STDMETHODCALLTYPE BeginWriting(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE WriteSample(
        DWORD dwStreamIndex,
        IMFSample *pSample) = 0;

    virtual HRESULT STDMETHODCALLTYPE SendStreamTick(
        DWORD dwStreamIndex,
        LONGLONG llTimestamp) = 0;

    virtual HRESULT STDMETHODCALLTYPE PlaceMarker(
        DWORD dwStreamIndex,
        LPVOID pvContext) = 0;

    virtual HRESULT STDMETHODCALLTYPE NotifyEndOfSegment(
        DWORD dwStreamIndex) = 0;

    virtual HRESULT STDMETHODCALLTYPE Flush(
        DWORD dwStreamIndex) = 0;

    virtual HRESULT STDMETHODCALLTYPE Finalize(
        ) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetServiceForStream(
        DWORD dwStreamIndex,
        REFGUID guidService,
        REFIID riid,
        LPVOID *ppvObject) = 0;

    virtual HRESULT STDMETHODCALLTYPE GetStatistics(
        DWORD dwStreamIndex,
        MF_SINK_WRITER_STATISTICS *pStats) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFSinkWriter, 0x3137f1cd, 0xfe5e, 0x4805, 0xa5,0xd8, 0xfb,0x47,0x74,0x48,0xcb,0x3d)
#endif
#else
typedef struct IMFSinkWriterVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFSinkWriter* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFSinkWriter* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFSinkWriter* This);

    /*** IMFSinkWriter methods ***/
    HRESULT (STDMETHODCALLTYPE *AddStream)(
        IMFSinkWriter* This,
        IMFMediaType *pTargetMediaType,
        DWORD *pdwStreamIndex);

    HRESULT (STDMETHODCALLTYPE *SetInputMediaType)(
        IMFSinkWriter* This,
        DWORD dwStreamIndex,
        IMFMediaType *pInputMediaType,
        IMFAttributes *pEncodingParameters);

    HRESULT (STDMETHODCALLTYPE *BeginWriting)(
        IMFSinkWriter* This);

    HRESULT (STDMETHODCALLTYPE *WriteSample)(
        IMFSinkWriter* This,
        DWORD dwStreamIndex,
        IMFSample *pSample);

    HRESULT (STDMETHODCALLTYPE *SendStreamTick)(
        IMFSinkWriter* This,
        DWORD dwStreamIndex,
        LONGLONG llTimestamp);

    HRESULT (STDMETHODCALLTYPE *PlaceMarker)(
        IMFSinkWriter* This,
        DWORD dwStreamIndex,
        LPVOID pvContext);

    HRESULT (STDMETHODCALLTYPE *NotifyEndOfSegment)(
        IMFSinkWriter* This,
        DWORD dwStreamIndex);

    HRESULT (STDMETHODCALLTYPE *Flush)(
        IMFSinkWriter* This,
        DWORD dwStreamIndex);

    HRESULT (STDMETHODCALLTYPE *Finalize)(
        IMFSinkWriter* This);

    HRESULT (STDMETHODCALLTYPE *GetServiceForStream)(
        IMFSinkWriter* This,
        DWORD dwStreamIndex,
        REFGUID guidService,
        REFIID riid,
        LPVOID *ppvObject);

    HRESULT (STDMETHODCALLTYPE *GetStatistics)(
        IMFSinkWriter* This,
        DWORD dwStreamIndex,
        MF_SINK_WRITER_STATISTICS *pStats);

    END_INTERFACE
} IMFSinkWriterVtbl;
interface IMFSinkWriter {
    CONST_VTBL IMFSinkWriterVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFSinkWriter_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFSinkWriter_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFSinkWriter_Release(This) (This)->lpVtbl->Release(This)
/*** IMFSinkWriter methods ***/
#define IMFSinkWriter_AddStream(This,pTargetMediaType,pdwStreamIndex) (This)->lpVtbl->AddStream(This,pTargetMediaType,pdwStreamIndex)
#define IMFSinkWriter_SetInputMediaType(This,dwStreamIndex,pInputMediaType,pEncodingParameters) (This)->lpVtbl->SetInputMediaType(This,dwStreamIndex,pInputMediaType,pEncodingParameters)
#define IMFSinkWriter_BeginWriting(This) (This)->lpVtbl->BeginWriting(This)
#define IMFSinkWriter_WriteSample(This,dwStreamIndex,pSample) (This)->lpVtbl->WriteSample(This,dwStreamIndex,pSample)
#define IMFSinkWriter_SendStreamTick(This,dwStreamIndex,llTimestamp) (This)->lpVtbl->SendStreamTick(This,dwStreamIndex,llTimestamp)
#define IMFSinkWriter_PlaceMarker(This,dwStreamIndex,pvContext) (This)->lpVtbl->PlaceMarker(This,dwStreamIndex,pvContext)
#define IMFSinkWriter_NotifyEndOfSegment(This,dwStreamIndex) (This)->lpVtbl->NotifyEndOfSegment(This,dwStreamIndex)
#define IMFSinkWriter_Flush(This,dwStreamIndex) (This)->lpVtbl->Flush(This,dwStreamIndex)
#define IMFSinkWriter_Finalize(This) (This)->lpVtbl->Finalize(This)
#define IMFSinkWriter_GetServiceForStream(This,dwStreamIndex,guidService,riid,ppvObject) (This)->lpVtbl->GetServiceForStream(This,dwStreamIndex,guidService,riid,ppvObject)
#define IMFSinkWriter_GetStatistics(This,dwStreamIndex,pStats) (This)->lpVtbl->GetStatistics(This,dwStreamIndex,pStats)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFSinkWriter_QueryInterface(IMFSinkWriter* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFSinkWriter_AddRef(IMFSinkWriter* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFSinkWriter_Release(IMFSinkWriter* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFSinkWriter methods ***/
static FORCEINLINE HRESULT IMFSinkWriter_AddStream(IMFSinkWriter* This,IMFMediaType *pTargetMediaType,DWORD *pdwStreamIndex) {
    return This->lpVtbl->AddStream(This,pTargetMediaType,pdwStreamIndex);
}
static FORCEINLINE HRESULT IMFSinkWriter_SetInputMediaType(IMFSinkWriter* This,DWORD dwStreamIndex,IMFMediaType *pInputMediaType,IMFAttributes *pEncodingParameters) {
    return This->lpVtbl->SetInputMediaType(This,dwStreamIndex,pInputMediaType,pEncodingParameters);
}
static FORCEINLINE HRESULT IMFSinkWriter_BeginWriting(IMFSinkWriter* This) {
    return This->lpVtbl->BeginWriting(This);
}
static FORCEINLINE HRESULT IMFSinkWriter_WriteSample(IMFSinkWriter* This,DWORD dwStreamIndex,IMFSample *pSample) {
    return This->lpVtbl->WriteSample(This,dwStreamIndex,pSample);
}
static FORCEINLINE HRESULT IMFSinkWriter_SendStreamTick(IMFSinkWriter* This,DWORD dwStreamIndex,LONGLONG llTimestamp) {
    return This->lpVtbl->SendStreamTick(This,dwStreamIndex,llTimestamp);
}
static FORCEINLINE HRESULT IMFSinkWriter_PlaceMarker(IMFSinkWriter* This,DWORD dwStreamIndex,LPVOID pvContext) {
    return This->lpVtbl->PlaceMarker(This,dwStreamIndex,pvContext);
}
static FORCEINLINE HRESULT IMFSinkWriter_NotifyEndOfSegment(IMFSinkWriter* This,DWORD dwStreamIndex) {
    return This->lpVtbl->NotifyEndOfSegment(This,dwStreamIndex);
}
static FORCEINLINE HRESULT IMFSinkWriter_Flush(IMFSinkWriter* This,DWORD dwStreamIndex) {
    return This->lpVtbl->Flush(This,dwStreamIndex);
}
static FORCEINLINE HRESULT IMFSinkWriter_Finalize(IMFSinkWriter* This) {
    return This->lpVtbl->Finalize(This);
}
static FORCEINLINE HRESULT IMFSinkWriter_GetServiceForStream(IMFSinkWriter* This,DWORD dwStreamIndex,REFGUID guidService,REFIID riid,LPVOID *ppvObject) {
    return This->lpVtbl->GetServiceForStream(This,dwStreamIndex,guidService,riid,ppvObject);
}
static FORCEINLINE HRESULT IMFSinkWriter_GetStatistics(IMFSinkWriter* This,DWORD dwStreamIndex,MF_SINK_WRITER_STATISTICS *pStats) {
    return This->lpVtbl->GetStatistics(This,dwStreamIndex,pStats);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFSinkWriter_AddStream_Proxy(
    IMFSinkWriter* This,
    IMFMediaType *pTargetMediaType,
    DWORD *pdwStreamIndex);
void __RPC_STUB IMFSinkWriter_AddStream_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSinkWriter_SetInputMediaType_Proxy(
    IMFSinkWriter* This,
    DWORD dwStreamIndex,
    IMFMediaType *pInputMediaType,
    IMFAttributes *pEncodingParameters);
void __RPC_STUB IMFSinkWriter_SetInputMediaType_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSinkWriter_BeginWriting_Proxy(
    IMFSinkWriter* This);
void __RPC_STUB IMFSinkWriter_BeginWriting_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSinkWriter_WriteSample_Proxy(
    IMFSinkWriter* This,
    DWORD dwStreamIndex,
    IMFSample *pSample);
void __RPC_STUB IMFSinkWriter_WriteSample_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSinkWriter_SendStreamTick_Proxy(
    IMFSinkWriter* This,
    DWORD dwStreamIndex,
    LONGLONG llTimestamp);
void __RPC_STUB IMFSinkWriter_SendStreamTick_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSinkWriter_PlaceMarker_Proxy(
    IMFSinkWriter* This,
    DWORD dwStreamIndex,
    LPVOID pvContext);
void __RPC_STUB IMFSinkWriter_PlaceMarker_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSinkWriter_NotifyEndOfSegment_Proxy(
    IMFSinkWriter* This,
    DWORD dwStreamIndex);
void __RPC_STUB IMFSinkWriter_NotifyEndOfSegment_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSinkWriter_Flush_Proxy(
    IMFSinkWriter* This,
    DWORD dwStreamIndex);
void __RPC_STUB IMFSinkWriter_Flush_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSinkWriter_Finalize_Proxy(
    IMFSinkWriter* This);
void __RPC_STUB IMFSinkWriter_Finalize_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSinkWriter_GetServiceForStream_Proxy(
    IMFSinkWriter* This,
    DWORD dwStreamIndex,
    REFGUID guidService,
    REFIID riid,
    LPVOID *ppvObject);
void __RPC_STUB IMFSinkWriter_GetServiceForStream_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSinkWriter_GetStatistics_Proxy(
    IMFSinkWriter* This,
    DWORD dwStreamIndex,
    MF_SINK_WRITER_STATISTICS *pStats);
void __RPC_STUB IMFSinkWriter_GetStatistics_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFSinkWriter_INTERFACE_DEFINED__ */

/*****************************************************************************
 * IMFSourceReaderCallback interface
 */
#ifndef __IMFSourceReaderCallback_INTERFACE_DEFINED__
#define __IMFSourceReaderCallback_INTERFACE_DEFINED__

DEFINE_GUID(IID_IMFSourceReaderCallback, 0xdeec8d99, 0xfa1d, 0x4d82, 0x84,0xc2, 0x2c,0x89,0x69,0x94,0x48,0x67);
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("deec8d99-fa1d-4d82-84c2-2c8969944867")
IMFSourceReaderCallback : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE OnReadSample(
        HRESULT hrStatus,
        DWORD dwStreamIndex,
        DWORD dwStreamFlags,
        LONGLONG llTimestamp,
        IMFSample *pSample) = 0;

    virtual HRESULT STDMETHODCALLTYPE OnFlush(
        DWORD dwStreamIndex) = 0;

    virtual HRESULT STDMETHODCALLTYPE OnEvent(
        DWORD dwStreamIndex,
        IMFMediaEvent *pEvent) = 0;

};
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IMFSourceReaderCallback, 0xdeec8d99, 0xfa1d, 0x4d82, 0x84,0xc2, 0x2c,0x89,0x69,0x94,0x48,0x67)
#endif
#else
typedef struct IMFSourceReaderCallbackVtbl {
    BEGIN_INTERFACE

    /*** IUnknown methods ***/
    HRESULT (STDMETHODCALLTYPE *QueryInterface)(
        IMFSourceReaderCallback* This,
        REFIID riid,
        void **ppvObject);

    ULONG (STDMETHODCALLTYPE *AddRef)(
        IMFSourceReaderCallback* This);

    ULONG (STDMETHODCALLTYPE *Release)(
        IMFSourceReaderCallback* This);

    /*** IMFSourceReaderCallback methods ***/
    HRESULT (STDMETHODCALLTYPE *OnReadSample)(
        IMFSourceReaderCallback* This,
        HRESULT hrStatus,
        DWORD dwStreamIndex,
        DWORD dwStreamFlags,
        LONGLONG llTimestamp,
        IMFSample *pSample);

    HRESULT (STDMETHODCALLTYPE *OnFlush)(
        IMFSourceReaderCallback* This,
        DWORD dwStreamIndex);

    HRESULT (STDMETHODCALLTYPE *OnEvent)(
        IMFSourceReaderCallback* This,
        DWORD dwStreamIndex,
        IMFMediaEvent *pEvent);

    END_INTERFACE
} IMFSourceReaderCallbackVtbl;
interface IMFSourceReaderCallback {
    CONST_VTBL IMFSourceReaderCallbackVtbl* lpVtbl;
};

#ifdef COBJMACROS
#ifndef WIDL_C_INLINE_WRAPPERS
/*** IUnknown methods ***/
#define IMFSourceReaderCallback_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject)
#define IMFSourceReaderCallback_AddRef(This) (This)->lpVtbl->AddRef(This)
#define IMFSourceReaderCallback_Release(This) (This)->lpVtbl->Release(This)
/*** IMFSourceReaderCallback methods ***/
#define IMFSourceReaderCallback_OnReadSample(This,hrStatus,dwStreamIndex,dwStreamFlags,llTimestamp,pSample) (This)->lpVtbl->OnReadSample(This,hrStatus,dwStreamIndex,dwStreamFlags,llTimestamp,pSample)
#define IMFSourceReaderCallback_OnFlush(This,dwStreamIndex) (This)->lpVtbl->OnFlush(This,dwStreamIndex)
#define IMFSourceReaderCallback_OnEvent(This,dwStreamIndex,pEvent) (This)->lpVtbl->OnEvent(This,dwStreamIndex,pEvent)
#else
/*** IUnknown methods ***/
static FORCEINLINE HRESULT IMFSourceReaderCallback_QueryInterface(IMFSourceReaderCallback* This,REFIID riid,void **ppvObject) {
    return This->lpVtbl->QueryInterface(This,riid,ppvObject);
}
static FORCEINLINE ULONG IMFSourceReaderCallback_AddRef(IMFSourceReaderCallback* This) {
    return This->lpVtbl->AddRef(This);
}
static FORCEINLINE ULONG IMFSourceReaderCallback_Release(IMFSourceReaderCallback* This) {
    return This->lpVtbl->Release(This);
}
/*** IMFSourceReaderCallback methods ***/
static FORCEINLINE HRESULT IMFSourceReaderCallback_OnReadSample(IMFSourceReaderCallback* This,HRESULT hrStatus,DWORD dwStreamIndex,DWORD dwStreamFlags,LONGLONG llTimestamp,IMFSample *pSample) {
    return This->lpVtbl->OnReadSample(This,hrStatus,dwStreamIndex,dwStreamFlags,llTimestamp,pSample);
}
static FORCEINLINE HRESULT IMFSourceReaderCallback_OnFlush(IMFSourceReaderCallback* This,DWORD dwStreamIndex) {
    return This->lpVtbl->OnFlush(This,dwStreamIndex);
}
static FORCEINLINE HRESULT IMFSourceReaderCallback_OnEvent(IMFSourceReaderCallback* This,DWORD dwStreamIndex,IMFMediaEvent *pEvent) {
    return This->lpVtbl->OnEvent(This,dwStreamIndex,pEvent);
}
#endif
#endif

#endif

HRESULT STDMETHODCALLTYPE IMFSourceReaderCallback_OnReadSample_Proxy(
    IMFSourceReaderCallback* This,
    HRESULT hrStatus,
    DWORD dwStreamIndex,
    DWORD dwStreamFlags,
    LONGLONG llTimestamp,
    IMFSample *pSample);
void __RPC_STUB IMFSourceReaderCallback_OnReadSample_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSourceReaderCallback_OnFlush_Proxy(
    IMFSourceReaderCallback* This,
    DWORD dwStreamIndex);
void __RPC_STUB IMFSourceReaderCallback_OnFlush_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);
HRESULT STDMETHODCALLTYPE IMFSourceReaderCallback_OnEvent_Proxy(
    IMFSourceReaderCallback* This,
    DWORD dwStreamIndex,
    IMFMediaEvent *pEvent);
void __RPC_STUB IMFSourceReaderCallback_OnEvent_Stub(
    IRpcStubBuffer* This,
    IRpcChannelBuffer* pRpcChannelBuffer,
    PRPC_MESSAGE pRpcMessage,
    DWORD* pdwStubPhase);

#endif  /* __IMFSourceReaderCallback_INTERFACE_DEFINED__ */

HRESULT WINAPI MFCreateSinkWriterFromMediaSink(IMFMediaSink *pMediaSink,IMFAttributes *pAttributes,IMFSinkWriter **ppSinkWriter);
HRESULT WINAPI MFCreateSinkWriterFromURL(LPCWSTR pwszOutputURL,IMFByteStream *pByteStream,IMFAttributes *pAttributes,IMFSinkWriter **ppSinkWriter);
HRESULT WINAPI MFCreateSourceReaderFromByteStream(IMFByteStream *pByteStream,IMFAttributes *pAttributes,IMFSourceReader **ppSourceReader);
HRESULT WINAPI MFCreateSourceReaderFromMediaSource(IMFMediaSource *pMediaSource,IMFAttributes *pAttributes,IMFSourceReader **ppSourceReader);
HRESULT WINAPI MFCreateSourceReaderFromURL(LPCWSTR pwszURL,IMFAttributes *pAttributes,IMFSourceReader **ppSourceReader);
/* Begin additional prototypes for all interfaces */


/* End additional prototypes */

#ifdef __cplusplus
}
#endif

#endif /* __mfreadwrite_h__ */
Added undroid/tclwmf/compat/winapifamily.h.
















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
 * This file is part of the mingw-w64 runtime package.
 * No warranty is given; refer to the file DISCLAIMER within this package.
 */

#ifndef _INC_WINAPIFAMILY
#define _INC_WINAPIFAMILY

#define WINAPI_PARTITION_DESKTOP 0x1
#define WINAPI_PARTITION_APP     0x2    

#define WINAPI_FAMILY_APP WINAPI_PARTITION_APP
#define WINAPI_FAMILY_DESKTOP_APP (WINAPI_PARTITION_DESKTOP \
				   | WINAPI_PARTITION_APP)    

/* WINAPI_FAMILY can be either desktop + App, or App.  */
#ifndef WINAPI_FAMILY
#define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP
#endif

#define WINAPI_FAMILY_PARTITION(v) ((WINAPI_FAMILY & v) == v)
#define WINAPI_FAMILY_ONE_PARTITION(vset, v) ((WINAPI_FAMILY & vset) == v)

#endif 
Added undroid/tclwmf/configure.

more than 10,000 changes

Added undroid/tclwmf/configure.in.










































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#! /bin/bash -norc
#
#--------------------------------------------------------------------
# Sample configure.in for Tcl Extensions.  The only places you should
# need to modify this file are marked by the string __CHANGE__
#--------------------------------------------------------------------

#-----------------------------------------------------------------------
# __CHANGE__
# Set your package name and version numbers here.
#
# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION
# set as provided.  These will also be added as -D defs in your Makefile
# so you can encode the package version directly into the source files.
#-----------------------------------------------------------------------

AC_INIT([tclwmf], [0.1])

#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
#--------------------------------------------------------------------

TEA_INIT([3.9])

AC_CONFIG_AUX_DIR(tclconfig)

#--------------------------------------------------------------------
# Load the tclConfig.sh file
#--------------------------------------------------------------------

TEA_PATH_TCLCONFIG
TEA_LOAD_TCLCONFIG

#--------------------------------------------------------------------
# Load the tkConfig.sh file if necessary (Tk extension)
#--------------------------------------------------------------------

TEA_PATH_TKCONFIG
TEA_LOAD_TKCONFIG

#-----------------------------------------------------------------------
# Handle the --prefix=... option by defaulting to what Tcl gave.
# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER.
#-----------------------------------------------------------------------

TEA_PREFIX

#-----------------------------------------------------------------------
# Standard compiler checks.
# This sets up CC by using the CC env var, or looks for gcc otherwise.
# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create
# the basic setup necessary to compile executables.
#-----------------------------------------------------------------------

TEA_SETUP_COMPILER

#-----------------------------------------------------------------------
# __CHANGE__
# Specify the C source files to compile in TEA_ADD_SOURCES,
# public headers that need to be installed in TEA_ADD_HEADERS,
# stub library C source files to compile in TEA_ADD_STUB_SOURCES,
# and runtime Tcl library files in TEA_ADD_TCL_SOURCES.
# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS
# and PKG_TCL_SOURCES.
#-----------------------------------------------------------------------

TEA_ADD_SOURCES([tclwmf.c])
TEA_ADD_CFLAGS([-Icompat])
TEA_ADD_STUB_SOURCES([])
#TEA_ADD_LIBS([kernel32.lib advapi32.lib user32.lib ole32.lib mfplat.lib])
TEA_ADD_LIBS([kernel32.lib advapi32.lib user32.lib ole32.lib uuid.lib])
#TEA_ADD_TCL_SOURCES([library/...])

#--------------------------------------------------------------------
# __CHANGE__
# Choose which headers you need.  Extension authors should try very
# hard to only rely on the Tcl public header files.  Internal headers
# contain private data structures and are subject to change without
# notice.
# This MUST be called after TEA_PATH_TCLCONFIG/TEA_LOAD_TCLCONFIG
#--------------------------------------------------------------------

TEA_PUBLIC_TCL_HEADERS
TEA_PUBLIC_TK_HEADERS
#TEA_PRIVATE_TCL_HEADERS
#TEA_PRIVATE_TK_HEADERS

#--------------------------------------------------------------------
# For Unix/Tk builds, make sure that the X libraries/headers are found.
#--------------------------------------------------------------------

#TEA_PATH_X

#--------------------------------------------------------------------
# __CHANGE__
# A few miscellaneous platform-specific items:
#
# Define a special symbol for Windows (BUILD_Tktable in this case) so
# that we create the export library with the dll.
#
# Windows creates a few extra files that need to be cleaned up.
# You can add more files to clean if your extension creates any extra
# files.
#
# TEA_ADD any extra compiler/build info here.
#--------------------------------------------------------------------

TEA_ADD_CLEANFILES([pkgIndex.tcl])

#--------------------------------------------------------------------
# Check whether --enable-threads or --disable-threads was given.
# So far only Tcl responds to this one.
#--------------------------------------------------------------------

TEA_ENABLE_THREADS

#--------------------------------------------------------------------
# The statement below defines a collection of symbols related to
# building as a shared library instead of a static library.
#--------------------------------------------------------------------

TEA_ENABLE_SHARED

#--------------------------------------------------------------------
# This macro figures out what flags to use with the compiler/linker
# when building shared/static debug/optimized objects.  This information
# can be taken from the tclConfig.sh file, but this figures it all out.
#--------------------------------------------------------------------

TEA_CONFIG_CFLAGS

#--------------------------------------------------------------------
# Set the default compiler switches based on the --enable-symbols
# option.
#--------------------------------------------------------------------

TEA_ENABLE_SYMBOLS

#--------------------------------------------------------------------
# Everyone should be linking against the Tcl stub library.  If you
# can't for some reason, remove this definition.  If you aren't using
# stubs, you also need to modify the SHLIB_LD_LIBS setting below to
# link against the non-stubbed Tcl library.
#--------------------------------------------------------------------

AC_DEFINE(USE_TCL_STUBS)
AC_DEFINE(USE_TK_STUBS)

#--------------------------------------------------------------------
# This macro generates a line to use when building a library.  It
# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS,
# and TEA_LOAD_TCLCONFIG macros above.
#--------------------------------------------------------------------

TEA_MAKE_LIB

#--------------------------------------------------------------------
# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl
# file during the install process.  Don't run the TCLSH_PROG through
# ${CYGPATH} because it's being used directly by make.
# Require that we use a tclsh shell version 8.2 or later since earlier
# versions have bugs in the pkg_mkIndex routine.
#--------------------------------------------------------------------

TEA_PROG_TCLSH
TEA_PROG_WISH

#--------------------------------------------------------------------
# Finally, substitute all of the various values into the Makefile.
#--------------------------------------------------------------------

case ${TK_DEFS} in
    *PLATFORM_SDL*)
	TEA_ADD_CFLAGS([-DPLATFORM_SDL=1])
	TEA_ADD_INCLUDES([-I\"`${CYGPATH} ${TK_SRC_DIR}/sdl`\"])
	;;
esac

AC_OUTPUT([Makefile])
Added undroid/tclwmf/demos/3ddemo.tcl.




































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package require Tk
package require Canvas3d
package require tclwmf

if {[info command "sdltk"] eq "sdltk"} {
    wm attributes . -fullscreen 1
}

canvas3d .w1
pack .w1 -expand yes -fill both -side top
.w1 configure -width 300 -height 300 -background black

bind all <Break> exit
bind all <Key-q> exit
bind all <Escape> exit

# Mouse control
bind .w1 <B1-Motion> {
    set ry [expr 360.0 * (%y  - $::Y) / [%W cget -height]]
    set rx [expr 360.0 * (%x  - $::X) / [%W cget -width]]
    %W transform -camera type(light) [list orbitup $ry orbitleft $rx]
    set ::X %x
    set ::Y %y
}

bind .w1 <1> {
    set ::X %x
    set ::Y %y
}

# Mouse wheel for zoom in/out
bind .w1 <5> {%W transform -camera type(light) {movein 0.98}}
bind .w1 <4> {%W transform -camera type(light) {movein 1.02}}
bind .w1 <MouseWheel> \
    {%W transform -camera type(light) [list movein [expr {%D * 0.00007 + 1.0}]]}

# Rotate around the scene center:
bind .w1 <Up> {%W transform -camera type(light) {orbitup 5.0}}
bind .w1 <Down> {%W transform -camera type(light) {orbitdown 5.0}}
bind .w1 <Left> {%W transform -camera type(light) {orbitright 5.0}}
bind .w1 <Right> {%W transform -camera type(light) {orbitleft 5.0}}

# Zoom in and out:
bind .w1 <Key-s> {%W transform -camera type(light) {movein 0.9}}
bind .w1 <Key-x> {%W transform -camera type(light) {movein 1.1}}

# Rotate camera around line of sight:
bind .w1 <Key-c> {%W transform -camera type(light) {twistright 5.0}}
bind .w1 <Key-z> {%W transform -camera type(light) {twistleft 5.0}}
bind .w1 <Key-y> {%W transform -camera type(light) {twistleft 5.0}}

# Look to the left or right.
bind .w1 <Key-d> {%W transform -camera type(light) {panright 5.0}}
bind .w1 <Key-a> {%W transform -camera type(lignt) {panleft 5.0}}

# Lookat!
bind .w1 <Key-l> {%W transform -camera type(light) {lookat all}}

proc cube {w sidelength tag} {
    set p [expr $sidelength / 2.0]
    set m [expr $sidelength / -2.0]

    $w create polygon [list $p $p $p  $m $p $p  $m $p $m  $p $p $m] -tags x0
    $w create polygon [list $p $m $p  $m $m $p  $m $m $m  $p $m $m] -tags x1 

    $w create polygon [list $p $p $p  $p $m $p  $p $m $m  $p $p $m] -tags x2 
    $w create polygon [list $m $p $p  $m $m $p  $m $m $m  $m $p $m] -tags x3
}

cube .w1 1.0 cube_one
.w1 create light {0.0 0.0 4.0}
.w1 transform -camera light {lookat all}

proc imagecb {w img dev ind} {
    if {$ind ne "capture"} {
	return
    }
    set found 0
    lassign [winfo pointerxy $w] x y
    set x [expr {$x - [winfo rootx $w]}]
    set y [expr {$y - [winfo rooty $w]}]
    foreach id [$w find -sortbydepth viewport($x,$y)] {
	set tag [$w gettag $id]
	if {[string match "x*" $tag]} {
	    set found 1
	    break
	}
    }
    if {!$found} {
	set tag x[expr {$::icount % 4}]
    }
    wmf image $dev $img
    $w itemconfigure $tag -teximage {}
    $w itemconfigure $tag -teximage $img
    set ::icount [expr {($::icount + 1) % 100}]
}

proc startstop {dev} {
    if {[wmf state $dev] eq "capture"} {
	wmf stop $dev
    } else {
	wmf start $dev
    }
}

focus .w1
set img [image create photo]
set dev [wmf open [lindex [wmf devices] 0] [list imagecb .w1 $img]]

bind .w1 <Key-space> [list startstop $dev]

set icount 0
wmf start $dev

Added undroid/tclwmf/demos/simple.tcl.






























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package require Tk
package require tclwmf

# callback: image ready or error
proc imagecb {but img dev ind} {
    if {$ind ne "capture"} {
	$but configure -text "Start"
    } else {
	wmf image $dev $img
    }
}

# button handler: start/stop image capture
proc startstop {but} {
    set dev [wmf info]
    if {$dev eq ""} {
	return
    }
    switch -glob -- [wmf state $dev] {
	capture {
	    wmf stop $dev
	    $but configure -text "Start"
	}
	* {
	    wmf start $dev
	    $but configure -text "Stop"
	}
    }
}

# init device
proc init {but img {name {}}} {
    if {$name eq ""} { 
	set name [lindex [wmf devices] 0]
    }
    if {$name eq ""} {
	$but configure -text "No Camera"
	return
    }
    set dev [wmf open $name [list imagecb $but $img]]
    array set d [wmf parameters $dev]
    if {[info exists d(frame-size)] &&
	[scan $d(frame-size) %dx%d w h] == 2} {
	$img configure -width $w -height $h
	$img blank
    }
    $but configure -text "Start"
}

proc changemirror {w} {
    set dev [wmf info]
    if {$dev ne ""} {
	lassign [wmf mirror $dev] x y
	set n [expr {$x + $y * 2 + 1}]
	wmf mirror $dev [expr {$n & 1}] [expr {$n & 2}]
    }
}

proc changeorientation {w} {
    set dev [wmf info]
    if {$dev ne ""} {
	set n [wmf orientation $dev]
	set n [expr {($n + 90) % 360}]
	wmf orientation $dev $n
	set img [$w cget -image]
	$img configure -width 1 -height 1
	$img configure -width 0 -height 0
    }
}

# user interface
button .b -command [list startstop .b]
label .l -image [image create photo]
pack .b .l -side top
bind .l <1> {changemirror %W}
bind .l <3> {changeorientation %W}

# try to init device
init .b [.l cget -image]
Added undroid/tclwmf/demos/tkpdemo.tcl.










































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package require Tk
package require tkpath
package require tclwmf

if {[info command "sdltk"] eq "sdltk"} {
    wm attributes . -fullscreen 1
}

pack [tkp::canvas .c -bg "#c6ceef" -highlightthickness 0] -fill both -expand 1

set dev [lindex [wmf devices] 0]
set dev [wmf open $dev getimage]

set width 320
set height 240

set x0 [expr {1.5 * $width - 20}]
set y0 $x0
set dx [expr {$width * 1.3}]
set dy $dx

set anchors [list nw n ne w c e sw s se]
for {set i 0} {$i < [llength $anchors] } {incr i} {
    set a [lindex $anchors $i]
    set x [expr {$x0 + $i%3 * $dx}]
    set y [expr {$x0 + $i/3 * $dy}]
    set t $a
    image create photo img$i
    img$i configure -width $width -height $height
    .c create pimage $x $y -image img$i -anchor $a -tags $a
    .c create ptext $x $y -text $t -fontfamily "Times" \
	-fontsize 23 -fill black -stroke white -strokewidth 3 \
	-filloverstroke 1 -textanchor middle
    .c create path "M $x $y m -5 0 h 10 m -5 -5 v 10" -stroke red
}

proc getimage {dev ind} {
    if {$ind ne "capture"} {
        return
    }
    set i [expr {$::icount % [llength $::anchors]}]
    wmf image $dev img$i
    if {$i != 4} {
	# full rate in center image
        wmf image $dev img4
    }
    set ::icount [expr {($::icount + 1) % 90}]
}

proc ticker {deg step tim} {
    if {[winfo exists .c]} {
	after $tim [list ticker [expr {[incr deg $step] % 360}] $step $tim]
	set phi [expr 2*$deg*3.14159/360.0]
	for {set i 0} {$i < [llength $::anchors]} {incr i} {
	    set a [lindex $::anchors $i]
	    set x [expr {$::x0 + $i%3 * $::dx}]
	    set y [expr {$::y0 + $i/3 * $::dy}]
	    set m [::tkp::matrix rotate $phi $x $y]
	    .c itemconfigure $a -m $m
	}
    }
}

bind all <Key-q> exit
bind all <Escape> exit

ticker 0 1 100
set icount 0
wmf start $dev
Added undroid/tclwmf/doc/wmf.n.














































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
'\"
'\" Copyright (c) 1993 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
'\" Copyright (c) 2016 Christian Werner <chw at ch minus werner dot de>
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.TH wmf n 8.6 Tk "Tk Extension Commands"
.\" ---- man.macros begin ----
.\" The -*- nroff -*- definitions below are for supplemental macros used
.\" in Tcl/Tk manual entries.
.\"
.\" .AP type name in/out ?indent?
.\"	Start paragraph describing an argument to a library procedure.
.\"	type is type of argument (int, etc.), in/out is either "in", "out",
.\"	or "in/out" to describe whether procedure reads or modifies arg,
.\"	and indent is equivalent to second arg of .IP (shouldn't ever be
.\"	needed;  use .AS below instead)
.\"
.\" .AS ?type? ?name?
.\"	Give maximum sizes of arguments for setting tab stops.  Type and
.\"	name are examples of largest possible arguments that will be passed
.\"	to .AP later.  If args are omitted, default tab stops are used.
.\"
.\" .BS
.\"	Start box enclosure.  From here until next .BE, everything will be
.\"	enclosed in one large box.
.\"
.\" .BE
.\"	End of box enclosure.
.\"
.\" .CS
.\"	Begin code excerpt.
.\"
.\" .CE
.\"	End code excerpt.
.\"
.\" .VS ?version? ?br?
.\"	Begin vertical sidebar, for use in marking newly-changed parts
.\"	of man pages.  The first argument is ignored and used for recording
.\"	the version when the .VS was added, so that the sidebars can be
.\"	found and removed when they reach a certain age.  If another argument
.\"	is present, then a line break is forced before starting the sidebar.
.\"
.\" .VE
.\"	End of vertical sidebar.
.\"
.\" .DS
.\"	Begin an indented unfilled display.
.\"
.\" .DE
.\"	End of indented unfilled display.
.\"
.\" .SO ?manpage?
.\"	Start of list of standard options for a Tk widget. The manpage
.\"	argument defines where to look up the standard options; if
.\"	omitted, defaults to "options". The options follow on successive
.\"	lines, in three columns separated by tabs.
.\"
.\" .SE
.\"	End of list of standard options for a Tk widget.
.\"
.\" .OP cmdName dbName dbClass
.\"	Start of description of a specific option.  cmdName gives the
.\"	option's name as specified in the class command, dbName gives
.\"	the option's name in the option database, and dbClass gives
.\"	the option's class in the option database.
.\"
.\" .UL arg1 arg2
.\"	Print arg1 underlined, then print arg2 normally.
.\"
.\" .QW arg1 ?arg2?
.\"	Print arg1 in quotes, then arg2 normally (for trailing punctuation).
.\"
.\" .PQ arg1 ?arg2?
.\"	Print an open parenthesis, arg1 in quotes, then arg2 normally
.\"	(for trailing punctuation) and then a closing parenthesis.
.\"
.\"	# Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
.\"	# Start an argument description
.de AP
.ie !"\\$4"" .TP \\$4
.el \{\
.   ie !"\\$2"" .TP \\n()Cu
.   el          .TP 15
.\}
.ta \\n()Au \\n()Bu
.ie !"\\$3"" \{\
\&\\$1 \\fI\\$2\\fP (\\$3)
.\".b
.\}
.el \{\
.br
.ie !"\\$2"" \{\
\&\\$1	\\fI\\$2\\fP
.\}
.el \{\
\&\\fI\\$1\\fP
.\}
.\}
..
.\"	# define tabbing values for .AP
.de AS
.nr )A 10n
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
.nr )B \\n()Au+15n
.\"
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
.nr )C \\n()Bu+\\w'(in/out)'u+2n
..
.AS Tcl_Interp Tcl_CreateInterp in/out
.\"	# BS - start boxed text
.\"	# ^y = starting y location
.\"	# ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
.\"	# BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\"	Draw four-sided box normally, but don't draw top of
.\"	box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
.\"	# VS - start vertical sidebar
.\"	# ^Y = starting y location
.\"	# ^v = 1 (for troff;  for nroff this doesn't matter)
.de VS
.if !"\\$2"" .br
.mk ^Y
.ie n 'mc \s12\(br\s0
.el .nr ^v 1u
..
.\"	# VE - end of vertical sidebar
.de VE
.ie n 'mc
.el \{\
.ev 2
.nf
.ti 0
.mk ^t
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
.sp -1
.fi
.ev
.\}
.nr ^v 0
..
.\"	# Special macro to handle page bottom:  finish off current
.\"	# box/sidebar if in box/sidebar mode, then invoked standard
.\"	# page bottom macro.
.de ^B
.ev 2
'ti 0
'nf
.mk ^t
.if \\n(^b \{\
.\"	Draw three-sided box if this is the box's first page,
.\"	draw two sides but no top otherwise.
.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
.\}
.if \\n(^v \{\
.nr ^x \\n(^tu+1v-\\n(^Yu
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
.\}
.bp
'fi
.ev
.if \\n(^b \{\
.mk ^y
.nr ^b 2
.\}
.if \\n(^v \{\
.mk ^Y
.\}
..
.\"	# DS - begin display
.de DS
.RS
.nf
.sp
..
.\"	# DE - end display
.de DE
.fi
.RE
.sp
..
.\"	# SO - start of list of standard options
.de SO
'ie '\\$1'' .ds So \\fBoptions\\fR
'el .ds So \\fB\\$1\\fR
.SH "STANDARD OPTIONS"
.LP
.nf
.ta 5.5c 11c
.ft B
..
.\"	# SE - end of list of standard options
.de SE
.fi
.ft R
.LP
See the \\*(So manual entry for details on the standard options.
..
.\"	# OP - start of full description for a single option
.de OP
.LP
.nf
.ta 4c
Command-Line Name:	\\fB\\$1\\fR
Database Name:	\\fB\\$2\\fR
Database Class:	\\fB\\$3\\fR
.fi
.IP
..
.\"	# CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
.\"	# CE - end code excerpt
.de CE
.fi
.RE
..
.\"	# UL - underline word
.de UL
\\$1\l'|0\(ul'\\$2
..
.\"	# QW - apply quotation marks to word
.de QW
.ie '\\*(lq'"' ``\\$1''\\$2
.\"" fix emacs highlighting
.el \\*(lq\\$1\\*(rq\\$2
..
.\"	# PQ - apply parens and quotation marks to word
.de PQ
.ie '\\*(lq'"' (``\\$1''\\$2)\\$3
.\"" fix emacs highlighting
.el (\\*(lq\\$1\\*(rq\\$2)\\$3
..
.\"	# QR - quoted range
.de QR
.ie '\\*(lq'"' ``\\$1''\\-``\\$2''\\$3
.\"" fix emacs highlighting
.el \\*(lq\\$1\\*(rq\\-\\*(lq\\$2\\*(rq\\$3
..
.\"	# MT - "empty" string
.de MT
.QW ""
..
.\" ---- man.macros end ----
.BS
'\" Note:  do not modify the .SH NAME line immediately below!
.SH NAME
wmf \- Interface to cameras using Windows Media Foundation
.SH SYNOPSIS
\fBwmf \fIoption\fR ?\fIarg ...\fR?
.BE
.SH DESCRIPTION
.PP
This command provides several operations to interface cameras using
the infrastructure provided by Windows Media Foundation. \fIOption\fR
indicates which operation to carry out. Any unique abbreviation for
\fIoption\fR is acceptable. The valid options are:
.TP
\fBwmf close \fIdevid\fR
.
Closes the device identified by \fIdevid\fR which has been opened before
using \fBwmf open\fR.
.TP
\fBwmf devices\fR
.
Returns a list of device names which can be used for \fBwmf open\fR.
Each device adds two elements to the list: its symbolic link to be
used in \fBwmf open\fR and its friendly name for presentation.
.TP
.
\fBwmf image\fR \fIdevid\fR ?\fIphotoImage\fR?
.
Copies the most recent captured image of the device \fIdevid\fR into
the photo image identified by \fIphotoImage\fR and returns non-zero on
success or zero if no data transfer has taken place.
If \fIphotoImage\fR is omitted, a four element list is returned with the
first element being the image width, the second the image height,
the third the number of bytes per pixel, and the last the image's RGB
values with 3 bytes per pixel in red, green, blue order as a byte array.
In this case an error is indicated by throwing an exception.
.TP
\fBwmf info\fR ?\fIdevid\fR?
.
Returns information on open devices. If \fIdevid\fR is specified,
a list of two elements is returned, the first being the device symbolic
link and the second the image callback command for that device, i.e. the
same arguments which were used on \fBwmf open\fR. If \fIdevid\fR is omitted,
a list of \fIdevid\fRs, i.e. all currently opened devices is returned.
.TP
\fBwmf mirror\fR \fIdevid\fR ?\fIx y\fR?
.
Retrieves or sets flags to mirror captured images along the X or Y axis.
Parameters \fIx\fR and \fIy\fR if specified must be boolean values.
.TP
\fBwmf open\fR \fIdevname callback\fR
.
Opens the device with device symbolic link \fIdevname\fR and establishes
\fIcallback\fR as command to be invoked on captured images and
finally returns a \fIdevid\fR, i.e. a handle to further deal with
the device. Two additional parameters are appended when \fIcallback\fR
is invoked: the \fIdevid\fR of the device and the current capture
state as in \fBwmf state\fR. For the format of
\fIdevname\fR see the description of \fBwmf devices\fR.
.TP
\fBwmf orientation\fR \fIdevid\fR ?\fIdegrees\fR?
.
Retrieves or sets the orientation of captured images regarding image
rotation. \fIDegrees\fR if specified must be an integer number.
.TP
\fBwmf parameters\fR \fIdevid\fR ?\fIkey value ...\fR?
.
Returns or changes device parameters for the device identified by \fIdevid\fR
given as key-value pairs, e.g. \fBframe-size 320x240\fR will change the size
of captured images to width 320 and height 240. The command returns the
current device parameters (after the potential change, when keys and values
where given) as a key-value list which can be processed with \fBarray set\fR
or \fBdict get\fR. Currently, this command does nothing. 
.TP
\fBwmf start\fR \fIdevid\fR
Starts capturing images of the device identified by \fIdevid\fR. When
an image is ready, the callback command set on \fBwmf open\fR is
invoked.
.
.TP
\fBwmf state\fR \fIdevid\fR
Returns the image capture state of the device identified by \fIdevid\fR.
The result is the string \fBcapture\fR if the device is started or
\fBstop\fR if the device is stopped.
.
.TP
\fBwmf stop\fR \fIdevid\fR
Stops capturing images of the device identified by \fIdevid\fR.
.
.SH "SEE ALSO"
photo(n), image(n)
.SH KEYWORDS
files, image, photo, video, camera
'\" Local Variables:
'\" mode: nroff
'\" fill-column: 78
'\" End:
Added undroid/tclwmf/license.terms.


















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
		   * COPYRIGHT AND LICENSE TERMS *

(This file blatantly stolen from Tcl/Tk license and adapted - thus assume
it falls under similar license terms).

This software is copyrighted by Christian Werner <chw at ch minus werner
dot de>.  The following terms apply to all files associated with the
software unless explicitly disclaimed in individual files.

The authors hereby grant permission to use, copy, modify, distribute, and
license this software and its documentation for any purpose, provided that
existing copyright notices are retained in all copies and that this notice
is included verbatim in any distributions.  No written agreement, license,
or royalty fee is required for any of the authorized uses.  Modifications
to this software may be copyrighted by their authors and need not follow
the licensing terms described here, provided that the new terms are clearly
indicated on the first page of each file where they apply.

IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE IS
PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO
OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.

GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2).  If you
are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the
Government shall have only "Restricted Rights" as defined in Clause
252.227-7014 (b) (3) of DFARs.  Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
terms specified in this license.
Added undroid/tclwmf/tclconfig/README.txt.




















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
These files comprise the basic building blocks for a Tcl Extension
Architecture (TEA) extension.  For more information on TEA see:

	http://www.tcl.tk/doc/tea/

This package is part of the Tcl project at SourceForge, and latest
sources should be available there:

	http://tcl.sourceforge.net/

This package is a freely available open source package.  You can do
virtually anything you like with it, such as modifying it, redistributing
it, and selling it either in whole or in part.

CONTENTS
========
The following is a short description of the files you will find in
the sample extension.

README.txt	This file

install-sh	Program used for copying binaries and script files
		to their install locations.

tcl.m4		Collection of Tcl autoconf macros.  Included by a package's
		aclocal.m4 to define SC_* macros.
Added undroid/tclwmf/tclconfig/install-sh.
































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
#!/bin/sh
# install - install a program, script, or datafile

scriptversion=2011-04-20.01; # UTC

# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.

nl='
'
IFS=" ""	$nl"

# set DOITPROG to echo to test this script

# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
  doit_exec=exec
else
  doit_exec=$doit
fi

# Put in absolute file names if you don't have them in your path;
# or use environment vars.

chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}

posix_glob='?'
initialize_posix_glob='
  test "$posix_glob" != "?" || {
    if (set -f) 2>/dev/null; then
      posix_glob=
    else
      posix_glob=:
    fi
  }
'

posix_mkdir=

# Desired mode of installed file.
mode=0755

chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=

src=
dst=
dir_arg=
dst_arg=

copy_on_change=false
no_target_directory=

usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
   or: $0 [OPTION]... SRCFILES... DIRECTORY
   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
   or: $0 [OPTION]... -d DIRECTORIES...

In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.

Options:
     --help     display this help and exit.
     --version  display version info and exit.

  -c            (ignored)
  -C            install only if different (preserve the last data modification time)
  -d            create directories instead of installing files.
  -g GROUP      $chgrpprog installed files to GROUP.
  -m MODE       $chmodprog installed files to MODE.
  -o USER       $chownprog installed files to USER.
  -s            $stripprog installed files.
  -S            $stripprog installed files.
  -t DIRECTORY  install into DIRECTORY.
  -T            report an error if DSTFILE is a directory.

Environment variables override the default commands:
  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
  RMPROG STRIPPROG
"

while test $# -ne 0; do
  case $1 in
    -c) ;;

    -C) copy_on_change=true;;

    -d) dir_arg=true;;

    -g) chgrpcmd="$chgrpprog $2"
	shift;;

    --help) echo "$usage"; exit $?;;

    -m) mode=$2
	case $mode in
	  *' '* | *'	'* | *'
'*	  | *'*'* | *'?'* | *'['*)
	    echo "$0: invalid mode: $mode" >&2
	    exit 1;;
	esac
	shift;;

    -o) chowncmd="$chownprog $2"
	shift;;

    -s) stripcmd=$stripprog;;

    -S) stripcmd="$stripprog $2"
	shift;;

    -t) dst_arg=$2
	shift;;

    -T) no_target_directory=true;;

    --version) echo "$0 $scriptversion"; exit $?;;

    --)	shift
	break;;

    -*)	echo "$0: invalid option: $1" >&2
	exit 1;;

    *)  break;;
  esac
  shift
done

if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
  # When -d is used, all remaining arguments are directories to create.
  # When -t is used, the destination is already specified.
  # Otherwise, the last argument is the destination.  Remove it from $@.
  for arg
  do
    if test -n "$dst_arg"; then
      # $@ is not empty: it contains at least $arg.
      set fnord "$@" "$dst_arg"
      shift # fnord
    fi
    shift # arg
    dst_arg=$arg
  done
fi

if test $# -eq 0; then
  if test -z "$dir_arg"; then
    echo "$0: no input file specified." >&2
    exit 1
  fi
  # It's OK to call `install-sh -d' without argument.
  # This can happen when creating conditional directories.
  exit 0
fi

if test -z "$dir_arg"; then
  do_exit='(exit $ret); exit $ret'
  trap "ret=129; $do_exit" 1
  trap "ret=130; $do_exit" 2
  trap "ret=141; $do_exit" 13
  trap "ret=143; $do_exit" 15

  # Set umask so as not to create temps with too-generous modes.
  # However, 'strip' requires both read and write access to temps.
  case $mode in
    # Optimize common cases.
    *644) cp_umask=133;;
    *755) cp_umask=22;;

    *[0-7])
      if test -z "$stripcmd"; then
	u_plus_rw=
      else
	u_plus_rw='% 200'
      fi
      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
    *)
      if test -z "$stripcmd"; then
	u_plus_rw=
      else
	u_plus_rw=,u+rw
      fi
      cp_umask=$mode$u_plus_rw;;
  esac
fi

for src
do
  # Protect names starting with `-'.
  case $src in
    -*) src=./$src;;
  esac

  if test -n "$dir_arg"; then
    dst=$src
    dstdir=$dst
    test -d "$dstdir"
    dstdir_status=$?
  else

    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
    # might cause directories to be created, which would be especially bad
    # if $src (and thus $dsttmp) contains '*'.
    if test ! -f "$src" && test ! -d "$src"; then
      echo "$0: $src does not exist." >&2
      exit 1
    fi

    if test -z "$dst_arg"; then
      echo "$0: no destination specified." >&2
      exit 1
    fi

    dst=$dst_arg
    # Protect names starting with `-'.
    case $dst in
      -*) dst=./$dst;;
    esac

    # If destination is a directory, append the input filename; won't work
    # if double slashes aren't ignored.
    if test -d "$dst"; then
      if test -n "$no_target_directory"; then
	echo "$0: $dst_arg: Is a directory" >&2
	exit 1
      fi
      dstdir=$dst
      dst=$dstdir/`basename "$src"`
      dstdir_status=0
    else
      # Prefer dirname, but fall back on a substitute if dirname fails.
      dstdir=`
	(dirname "$dst") 2>/dev/null ||
	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	     X"$dst" : 'X\(//\)[^/]' \| \
	     X"$dst" : 'X\(//\)$' \| \
	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
	echo X"$dst" |
	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
		   s//\1/
		   q
		 }
		 /^X\(\/\/\)[^/].*/{
		   s//\1/
		   q
		 }
		 /^X\(\/\/\)$/{
		   s//\1/
		   q
		 }
		 /^X\(\/\).*/{
		   s//\1/
		   q
		 }
		 s/.*/./; q'
      `

      test -d "$dstdir"
      dstdir_status=$?
    fi
  fi

  obsolete_mkdir_used=false

  if test $dstdir_status != 0; then
    case $posix_mkdir in
      '')
	# Create intermediate dirs using mode 755 as modified by the umask.
	# This is like FreeBSD 'install' as of 1997-10-28.
	umask=`umask`
	case $stripcmd.$umask in
	  # Optimize common cases.
	  *[2367][2367]) mkdir_umask=$umask;;
	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;

	  *[0-7])
	    mkdir_umask=`expr $umask + 22 \
	      - $umask % 100 % 40 + $umask % 20 \
	      - $umask % 10 % 4 + $umask % 2
	    `;;
	  *) mkdir_umask=$umask,go-w;;
	esac

	# With -d, create the new directory with the user-specified mode.
	# Otherwise, rely on $mkdir_umask.
	if test -n "$dir_arg"; then
	  mkdir_mode=-m$mode
	else
	  mkdir_mode=
	fi

	posix_mkdir=false
	case $umask in
	  *[123567][0-7][0-7])
	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
	    ;;
	  *)
	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0

	    if (umask $mkdir_umask &&
		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
	    then
	      if test -z "$dir_arg" || {
		   # Check for POSIX incompatibilities with -m.
		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
		   # other-writeable bit of parent directory when it shouldn't.
		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
		   case $ls_ld_tmpdir in
		     d????-?r-*) different_mode=700;;
		     d????-?--*) different_mode=755;;
		     *) false;;
		   esac &&
		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
		   }
		 }
	      then posix_mkdir=:
	      fi
	      rmdir "$tmpdir/d" "$tmpdir"
	    else
	      # Remove any dirs left behind by ancient mkdir implementations.
	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
	    fi
	    trap '' 0;;
	esac;;
    esac

    if
      $posix_mkdir && (
	umask $mkdir_umask &&
	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
      )
    then :
    else

      # The umask is ridiculous, or mkdir does not conform to POSIX,
      # or it failed possibly due to a race condition.  Create the
      # directory the slow way, step by step, checking for races as we go.

      case $dstdir in
	/*) prefix='/';;
	-*) prefix='./';;
	*)  prefix='';;
      esac

      eval "$initialize_posix_glob"

      oIFS=$IFS
      IFS=/
      $posix_glob set -f
      set fnord $dstdir
      shift
      $posix_glob set +f
      IFS=$oIFS

      prefixes=

      for d
      do
	test -z "$d" && continue

	prefix=$prefix$d
	if test -d "$prefix"; then
	  prefixes=
	else
	  if $posix_mkdir; then
	    (umask=$mkdir_umask &&
	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
	    # Don't fail if two instances are running concurrently.
	    test -d "$prefix" || exit 1
	  else
	    case $prefix in
	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
	      *) qprefix=$prefix;;
	    esac
	    prefixes="$prefixes '$qprefix'"
	  fi
	fi
	prefix=$prefix/
      done

      if test -n "$prefixes"; then
	# Don't fail if two instances are running concurrently.
	(umask $mkdir_umask &&
	 eval "\$doit_exec \$mkdirprog $prefixes") ||
	  test -d "$dstdir" || exit 1
	obsolete_mkdir_used=true
      fi
    fi
  fi

  if test -n "$dir_arg"; then
    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
  else

    # Make a couple of temp file names in the proper directory.
    dsttmp=$dstdir/_inst.$$_
    rmtmp=$dstdir/_rm.$$_

    # Trap to clean up those temp files at exit.
    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0

    # Copy the file name to the temp name.
    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&

    # and set any options; do chmod last to preserve setuid bits.
    #
    # If any of these fail, we abort the whole thing.  If we want to
    # ignore errors from any of these, just make sure not to ignore
    # errors from the above "$doit $cpprog $src $dsttmp" command.
    #
    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&

    # If -C, don't bother to copy if it wouldn't change the file.
    if $copy_on_change &&
       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&

       eval "$initialize_posix_glob" &&
       $posix_glob set -f &&
       set X $old && old=:$2:$4:$5:$6 &&
       set X $new && new=:$2:$4:$5:$6 &&
       $posix_glob set +f &&

       test "$old" = "$new" &&
       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
    then
      rm -f "$dsttmp"
    else
      # Rename the file to the real destination.
      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||

      # The rename failed, perhaps because mv can't rename something else
      # to itself, or perhaps because mv is so ancient that it does not
      # support -f.
      {
	# Now remove or move aside any old file at destination location.
	# We try this two ways since rm can't unlink itself on some
	# systems and the destination file might be busy for other
	# reasons.  In this case, the final cleanup might fail but the new
	# file should still install successfully.
	{
	  test ! -f "$dst" ||
	  $doit $rmcmd -f "$dst" 2>/dev/null ||
	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
	  } ||
	  { echo "$0: cannot unlink or rename $dst" >&2
	    (exit 1); exit 1
	  }
	} &&

	# Now rename the file to the real destination.
	$doit $mvcmd "$dsttmp" "$dst"
      }
    fi || exit 1

    trap '' 0
  fi
done

# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
Added undroid/tclwmf/tclconfig/tcl.m4.
























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
# tcl.m4 --
#
#	This file provides a set of autoconf macros to help TEA-enable
#	a Tcl extension.
#
# Copyright (c) 1999-2000 Ajuba Solutions.
# Copyright (c) 2002-2005 ActiveState Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.

AC_PREREQ(2.57)

dnl TEA extensions pass us the version of TEA they think they
dnl are compatible with (must be set in TEA_INIT below)
dnl TEA_VERSION="3.9"

# Possible values for key variables defined:
#
# TEA_WINDOWINGSYSTEM - win32 aqua x11 (mirrors 'tk windowingsystem')
# TEA_PLATFORM        - windows unix
#

#------------------------------------------------------------------------
# TEA_PATH_TCLCONFIG --
#
#	Locate the tclConfig.sh file and perform a sanity check on
#	the Tcl compile flags
#
# Arguments:
#	none
#
# Results:
#
#	Adds the following arguments to configure:
#		--with-tcl=...
#
#	Defines the following vars:
#		TCL_BIN_DIR	Full path to the directory containing
#				the tclConfig.sh file
#------------------------------------------------------------------------

AC_DEFUN([TEA_PATH_TCLCONFIG], [
    dnl TEA specific: Make sure we are initialized
    AC_REQUIRE([TEA_INIT])
    #
    # Ok, lets find the tcl configuration
    # First, look for one uninstalled.
    # the alternative search directory is invoked by --with-tcl
    #

    if test x"${no_tcl}" = x ; then
	# we reset no_tcl in case something fails here
	no_tcl=true
	AC_ARG_WITH(tcl,
	    AC_HELP_STRING([--with-tcl],
		[directory containing tcl configuration (tclConfig.sh)]),
	    with_tclconfig="${withval}")
	AC_MSG_CHECKING([for Tcl configuration])
	AC_CACHE_VAL(ac_cv_c_tclconfig,[

	    # First check to see if --with-tcl was specified.
	    if test x"${with_tclconfig}" != x ; then
		case "${with_tclconfig}" in
		    */tclConfig.sh )
			if test -f "${with_tclconfig}"; then
			    AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
			    with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
			fi ;;
		esac
		if test -f "${with_tclconfig}/tclConfig.sh" ; then
		    ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
		else
		    AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
		fi
	    fi

	    # then check for a private Tcl installation
	    if test x"${ac_cv_c_tclconfig}" = x ; then
		for i in \
			../tcl \
			`ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
			`ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
			`ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
			../../tcl \
			`ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
			`ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
			`ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
			../../../tcl \
			`ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
			`ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
			`ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
		    if test "${TEA_PLATFORM}" = "windows" \
			    -a -f "$i/win/tclConfig.sh" ; then
			ac_cv_c_tclconfig="`(cd $i/win; pwd)`"
			break
		    fi
		    if test -f "$i/unix/tclConfig.sh" ; then
			ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
			break
		    fi
		done
	    fi

	    # on Darwin, check in Framework installation locations
	    if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
		for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
			`ls -d /Library/Frameworks 2>/dev/null` \
			`ls -d /Network/Library/Frameworks 2>/dev/null` \
			`ls -d /System/Library/Frameworks 2>/dev/null` \
			; do
		    if test -f "$i/Tcl.framework/tclConfig.sh" ; then
			ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`"
			break
		    fi
		done
	    fi

	    # TEA specific: on Windows, check in common installation locations
	    if test "${TEA_PLATFORM}" = "windows" \
		-a x"${ac_cv_c_tclconfig}" = x ; then
		for i in `ls -d C:/Tcl/lib 2>/dev/null` \
			`ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
			; do
		    if test -f "$i/tclConfig.sh" ; then
			ac_cv_c_tclconfig="`(cd $i; pwd)`"
			break
		    fi
		done
	    fi

	    # check in a few common install locations
	    if test x"${ac_cv_c_tclconfig}" = x ; then
		for i in `ls -d ${libdir} 2>/dev/null` \
			`ls -d ${exec_prefix}/lib 2>/dev/null` \
			`ls -d ${prefix}/lib 2>/dev/null` \
			`ls -d /usr/local/lib 2>/dev/null` \
			`ls -d /usr/contrib/lib 2>/dev/null` \
			`ls -d /usr/lib 2>/dev/null` \
			`ls -d /usr/lib64 2>/dev/null` \
			`ls -d /usr/lib/tcl8.6 2>/dev/null` \
			`ls -d /usr/lib/tcl8.5 2>/dev/null` \
			; do
		    if test -f "$i/tclConfig.sh" ; then
			ac_cv_c_tclconfig="`(cd $i; pwd)`"
			break
		    fi
		done
	    fi

	    # check in a few other private locations
	    if test x"${ac_cv_c_tclconfig}" = x ; then
		for i in \
			${srcdir}/../tcl \
			`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
			`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
			`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
		    if test "${TEA_PLATFORM}" = "windows" \
			    -a -f "$i/win/tclConfig.sh" ; then
			ac_cv_c_tclconfig="`(cd $i/win; pwd)`"
			break
		    fi
		    if test -f "$i/unix/tclConfig.sh" ; then
			ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
			break
		    fi
		done
	    fi
	])

	if test x"${ac_cv_c_tclconfig}" = x ; then
	    TCL_BIN_DIR="# no Tcl configs found"
	    AC_MSG_ERROR([Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh])
	else
	    no_tcl=
	    TCL_BIN_DIR="${ac_cv_c_tclconfig}"
	    AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
	fi
    fi
])

#------------------------------------------------------------------------
# TEA_PATH_TKCONFIG --
#
#	Locate the tkConfig.sh file
#
# Arguments:
#	none
#
# Results:
#
#	Adds the following arguments to configure:
#		--with-tk=...
#
#	Defines the following vars:
#		TK_BIN_DIR	Full path to the directory containing
#				the tkConfig.sh file
#------------------------------------------------------------------------

AC_DEFUN([TEA_PATH_TKCONFIG], [
    #
    # Ok, lets find the tk configuration
    # First, look for one uninstalled.
    # the alternative search directory is invoked by --with-tk
    #

    if test x"${no_tk}" = x ; then
	# we reset no_tk in case something fails here
	no_tk=true
	AC_ARG_WITH(tk,
	    AC_HELP_STRING([--with-tk],
		[directory containing tk configuration (tkConfig.sh)]),
	    with_tkconfig="${withval}")
	AC_MSG_CHECKING([for Tk configuration])
	AC_CACHE_VAL(ac_cv_c_tkconfig,[

	    # First check to see if --with-tkconfig was specified.
	    if test x"${with_tkconfig}" != x ; then
		case "${with_tkconfig}" in
		    */tkConfig.sh )
			if test -f "${with_tkconfig}"; then
			    AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself])
			    with_tkconfig="`echo "${with_tkconfig}" | sed 's!/tkConfig\.sh$!!'`"
			fi ;;
		esac
		if test -f "${with_tkconfig}/tkConfig.sh" ; then
		    ac_cv_c_tkconfig="`(cd "${with_tkconfig}"; pwd)`"
		elif test -f "${with_tkconfig}/sdl2tkConfig.sh" ; then
		    ac_cv_c_tkconfig="`(cd "${with_tkconfig}"; pwd)`"
		else
		    AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
		fi
	    fi

	    # then check for a private Tk library
	    if test x"${ac_cv_c_tkconfig}" = x ; then
		for i in \
			../tk \
			`ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
			`ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
			`ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
			../../tk \
			`ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
			`ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
			`ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
			../../../tk \
			`ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
			`ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
			`ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
		    if test "${TEA_PLATFORM}" = "windows" \
			    -a -f "$i/win/tkConfig.sh" ; then
			ac_cv_c_tkconfig="`(cd $i/win; pwd)`"
			break
		    fi
		    if test -f "$i/unix/tkConfig.sh" ; then
			ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
			break
		    fi
		    if test -f "$i/sdl/sdl2tkConfig.sh" ; then
			ac_cv_c_tkconfig="`(cd $i/sdl; pwd)`"
			break
		    fi
		done
	    fi

	    # on Darwin, check in Framework installation locations
	    if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
		for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
			`ls -d /Library/Frameworks 2>/dev/null` \
			`ls -d /Network/Library/Frameworks 2>/dev/null` \
			`ls -d /System/Library/Frameworks 2>/dev/null` \
			; do
		    if test -f "$i/Tk.framework/tkConfig.sh" ; then
			ac_cv_c_tkconfig="`(cd $i/Tk.framework; pwd)`"
			break
		    fi
		done
	    fi

	    # check in a few common install locations
	    if test x"${ac_cv_c_tkconfig}" = x ; then
		for i in `ls -d ${libdir} 2>/dev/null` \
			`ls -d ${exec_prefix}/lib 2>/dev/null` \
			`ls -d ${prefix}/lib 2>/dev/null` \
			`ls -d /usr/local/lib 2>/dev/null` \
			`ls -d /usr/contrib/lib 2>/dev/null` \
			`ls -d /usr/lib 2>/dev/null` \
			`ls -d /usr/lib64 2>/dev/null` \
			; do
		    if test -f "$i/tkConfig.sh" ; then
			ac_cv_c_tkconfig="`(cd $i; pwd)`"
			break
		    fi
		done
	    fi

	    # TEA specific: on Windows, check in common installation locations
	    if test "${TEA_PLATFORM}" = "windows" \
		-a x"${ac_cv_c_tkconfig}" = x ; then
		for i in `ls -d C:/Tcl/lib 2>/dev/null` \
			`ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
			; do
		    if test -f "$i/tkConfig.sh" ; then
			ac_cv_c_tkconfig="`(cd $i; pwd)`"
			break
		    fi
		done
	    fi

	    # check in a few other private locations
	    if test x"${ac_cv_c_tkconfig}" = x ; then
		for i in \
			${srcdir}/../tk \
			`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
			`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
			`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
		    if test "${TEA_PLATFORM}" = "windows" \
			    -a -f "$i/win/tkConfig.sh" ; then
			ac_cv_c_tkconfig="`(cd $i/win; pwd)`"
			break
		    fi
		    if test -f "$i/unix/tkConfig.sh" ; then
			ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
			break
		    fi
		    if test -f "$i/sdl/sdl2tkConfig.sh" ; then
			ac_cv_c_tkconfig="`(cd $i/sdl; pwd)`"
			break
		    fi
		done
	    fi
	])

	if test x"${ac_cv_c_tkconfig}" = x ; then
	    TK_BIN_DIR="# no Tk configs found"
	    AC_MSG_ERROR([Can't find Tk configuration definitions. Use --with-tk to specify a directory containing tkConfig.sh])
	else
	    no_tk=
	    TK_BIN_DIR="${ac_cv_c_tkconfig}"
	    AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
	fi
    fi
])

#------------------------------------------------------------------------
# TEA_LOAD_TCLCONFIG --
#
#	Load the tclConfig.sh file
#
# Arguments:
#
#	Requires the following vars to be set:
#		TCL_BIN_DIR
#
# Results:
#
#	Substitutes the following vars:
#		TCL_BIN_DIR
#		TCL_SRC_DIR
#		TCL_LIB_FILE
#------------------------------------------------------------------------

AC_DEFUN([TEA_LOAD_TCLCONFIG], [
    AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])

    if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
        AC_MSG_RESULT([loading])
	. "${TCL_BIN_DIR}/tclConfig.sh"
    else
        AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
    fi

    # eval is required to do the TCL_DBGX substitution
    eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
    eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""

    # If the TCL_BIN_DIR is the build directory (not the install directory),
    # then set the common variable name to the value of the build variables.
    # For example, the variable TCL_LIB_SPEC will be set to the value
    # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
    # instead of TCL_BUILD_LIB_SPEC since it will work with both an
    # installed and uninstalled version of Tcl.
    if test -f "${TCL_BIN_DIR}/Makefile" ; then
        TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}"
        TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}"
        TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}"
    elif test "`uname -s`" = "Darwin"; then
	# If Tcl was built as a framework, attempt to use the libraries
	# from the framework at the given location so that linking works
	# against Tcl.framework installed in an arbitrary location.
	case ${TCL_DEFS} in
	    *TCL_FRAMEWORK*)
		if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then
		    for i in "`cd "${TCL_BIN_DIR}"; pwd`" \
			     "`cd "${TCL_BIN_DIR}"/../..; pwd`"; do
			if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
			    TCL_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TCL_LIB_FILE}"
			    break
			fi
		    done
		fi
		if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then
		    TCL_STUB_LIB_SPEC="-L`echo "${TCL_BIN_DIR}"  | sed -e 's/ /\\\\ /g'` ${TCL_STUB_LIB_FLAG}"
		    TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
		fi
		;;
	esac
    fi

    # eval is required to do the TCL_DBGX substitution
    eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
    eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
    eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
    eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""

    AC_SUBST(TCL_VERSION)
    AC_SUBST(TCL_PATCH_LEVEL)
    AC_SUBST(TCL_BIN_DIR)
    AC_SUBST(TCL_SRC_DIR)

    AC_SUBST(TCL_LIB_FILE)
    AC_SUBST(TCL_LIB_FLAG)
    AC_SUBST(TCL_LIB_SPEC)

    AC_SUBST(TCL_STUB_LIB_FILE)
    AC_SUBST(TCL_STUB_LIB_FLAG)
    AC_SUBST(TCL_STUB_LIB_SPEC)

    AC_MSG_CHECKING([platform])
    hold_cc=$CC; CC="$TCL_CC"
    AC_TRY_COMPILE(,[
	    #ifdef _WIN32
		#error win32
	    #endif
    ], TEA_PLATFORM="unix",
	    TEA_PLATFORM="windows"
    )
    CC=$hold_cc
    AC_MSG_RESULT($TEA_PLATFORM)

    # The BUILD_$pkg is to define the correct extern storage class
    # handling when making this package
    AC_DEFINE_UNQUOTED(BUILD_${PACKAGE_NAME}, [],
	    [Building extension source?])
    # Do this here as we have fully defined TEA_PLATFORM now
    if test "${TEA_PLATFORM}" = "windows" ; then
	EXEEXT=".exe"
	CLEANFILES="$CLEANFILES *.lib *.dll *.pdb *.exp"
    fi

    # TEA specific:
    AC_SUBST(CLEANFILES)
    AC_SUBST(TCL_LIBS)
    AC_SUBST(TCL_DEFS)
    AC_SUBST(TCL_EXTRA_CFLAGS)
    AC_SUBST(TCL_LD_FLAGS)
    AC_SUBST(TCL_SHLIB_LD_LIBS)
])

#------------------------------------------------------------------------
# TEA_LOAD_TKCONFIG --
#
#	Load the tkConfig.sh file
#
# Arguments:
#
#	Requires the following vars to be set:
#		TK_BIN_DIR
#
# Results:
#
#	Sets the following vars that should be in tkConfig.sh:
#		TK_BIN_DIR
#------------------------------------------------------------------------

AC_DEFUN([TEA_LOAD_TKCONFIG], [
    AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])

    if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
        AC_MSG_RESULT([loading])
	. "${TK_BIN_DIR}/tkConfig.sh"
    elif test -f "${TK_BIN_DIR}/sdl2tkConfig.sh" ; then
        AC_MSG_RESULT([loading])
	. "${TK_BIN_DIR}/sdl2tkConfig.sh"
    else
        AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
    fi

    # eval is required to do the TK_DBGX substitution
    eval "TK_LIB_FILE=\"${TK_LIB_FILE}\""
    eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\""

    # If the TK_BIN_DIR is the build directory (not the install directory),
    # then set the common variable name to the value of the build variables.
    # For example, the variable TK_LIB_SPEC will be set to the value
    # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
    # instead of TK_BUILD_LIB_SPEC since it will work with both an
    # installed and uninstalled version of Tcl.
    if test -f "${TK_BIN_DIR}/Makefile" ; then
        TK_LIB_SPEC="${TK_BUILD_LIB_SPEC}"
        TK_STUB_LIB_SPEC="${TK_BUILD_STUB_LIB_SPEC}"
        TK_STUB_LIB_PATH="${TK_BUILD_STUB_LIB_PATH}"
    elif test "`uname -s`" = "Darwin"; then
	# If Tk was built as a framework, attempt to use the libraries
	# from the framework at the given location so that linking works
	# against Tk.framework installed in an arbitrary location.
	case ${TK_DEFS} in
	    *TK_FRAMEWORK*)
		if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then
		    for i in "`cd "${TK_BIN_DIR}"; pwd`" \
			     "`cd "${TK_BIN_DIR}"/../..; pwd`"; do
			if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
			    TK_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TK_LIB_FILE}"
			    break
			fi
		    done
		fi
		if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then
		    TK_STUB_LIB_SPEC="-L` echo "${TK_BIN_DIR}"  | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}"
		    TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
		fi
		;;
	esac
    fi

    # eval is required to do the TK_DBGX substitution
    eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\""
    eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\""
    eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\""
    eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\""

    # TEA specific: Ensure windowingsystem is defined
    case ${TK_DEFS} in
	*PLATFORM_SDL*)
	    TEA_WINDOWINGSYSTEM="x11"
	    TEA_USE_SDL=yes
	    ;;
    esac
    if test "${TEA_USE_SDL}" = "yes" ; then
	true
    elif test "${TEA_PLATFORM}" = "unix" ; then
	case ${TK_DEFS} in
	    *MAC_OSX_TK*)
		AC_DEFINE(MAC_OSX_TK, 1, [Are we building against Mac OS X TkAqua?])
		TEA_WINDOWINGSYSTEM="aqua"
		;;
	    *)
		TEA_WINDOWINGSYSTEM="x11"
		;;
	esac
    elif test "${TEA_PLATFORM}" = "windows" ; then
	TEA_WINDOWINGSYSTEM="win32"
    fi

    AC_SUBST(TK_VERSION)
    AC_SUBST(TK_BIN_DIR)
    AC_SUBST(TK_SRC_DIR)

    AC_SUBST(TK_LIB_FILE)
    AC_SUBST(TK_LIB_FLAG)
    AC_SUBST(TK_LIB_SPEC)

    AC_SUBST(TK_STUB_LIB_FILE)
    AC_SUBST(TK_STUB_LIB_FLAG)
    AC_SUBST(TK_STUB_LIB_SPEC)

    # TEA specific:
    AC_SUBST(TK_LIBS)
    AC_SUBST(TK_XINCLUDES)
])

#------------------------------------------------------------------------
# TEA_PROG_TCLSH
#	Determine the fully qualified path name of the tclsh executable
#	in the Tcl build directory or the tclsh installed in a bin
#	directory. This macro will correctly determine the name
#	of the tclsh executable even if tclsh has not yet been
#	built in the build directory. The tclsh found is always
#	associated with a tclConfig.sh file. This tclsh should be used
#	only for running extension test cases. It should never be
#	or generation of files (like pkgIndex.tcl) at build time.
#
# Arguments:
#	none
#
# Results:
#	Substitutes the following vars:
#		TCLSH_PROG
#------------------------------------------------------------------------

AC_DEFUN([TEA_PROG_TCLSH], [
    AC_MSG_CHECKING([for tclsh])
    if test -f "${TCL_BIN_DIR}/Makefile" ; then
        # tclConfig.sh is in Tcl build directory
        if test "${TEA_PLATFORM}" = "windows"; then
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
        else
            TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
        fi
    else
        # tclConfig.sh is in install location
        if test "${TEA_PLATFORM}" = "windows"; then
            TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
        else
            TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_DBGX}"
        fi
        list="`ls -d ${TCL_BIN_DIR}/../bin 2>/dev/null` \
              `ls -d ${TCL_BIN_DIR}/..     2>/dev/null` \
              `ls -d ${TCL_PREFIX}/bin     2>/dev/null`"
        for i in $list ; do
            if test -f "$i/${TCLSH_PROG}" ; then
                REAL_TCL_BIN_DIR="`cd "$i"; pwd`/"
                break
            fi
        done
        TCLSH_PROG="${REAL_TCL_BIN_DIR}${TCLSH_PROG}"
    fi
    AC_MSG_RESULT([${TCLSH_PROG}])
    AC_SUBST(TCLSH_PROG)
])

#------------------------------------------------------------------------
# TEA_PROG_WISH
#	Determine the fully qualified path name of the wish executable
#	in the Tk build directory or the wish installed in a bin
#	directory. This macro will correctly determine the name
#	of the wish executable even if wish has not yet been
#	built in the build directory. The wish found is always
#	associated with a tkConfig.sh file. This wish should be used
#	only for running extension test cases. It should never be
#	or generation of files (like pkgIndex.tcl) at build time.
#
# Arguments:
#	none
#
# Results:
#	Substitutes the following vars:
#		WISH_PROG
#------------------------------------------------------------------------

AC_DEFUN([TEA_PROG_WISH], [
    AC_MSG_CHECKING([for wish])
    if test -f "${TK_BIN_DIR}/Makefile" ; then
        # tkConfig.sh is in Tk build directory
        if test "${TEA_PLATFORM}" = "windows"; then
            WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}"
        else
            WISH_PROG="${TK_BIN_DIR}/wish"
        fi
    else
        # tkConfig.sh is in install location
        if test "${TEA_PLATFORM}" = "windows"; then
            WISH_PROG="wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}"
        else
            WISH_PROG="wish${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_DBGX}"
        fi
        list="`ls -d ${TK_BIN_DIR}/../bin 2>/dev/null` \
              `ls -d ${TK_BIN_DIR}/..     2>/dev/null` \
              `ls -d ${TK_PREFIX}/bin     2>/dev/null`"
        for i in $list ; do
            if test -f "$i/${WISH_PROG}" ; then
                REAL_TK_BIN_DIR="`cd "$i"; pwd`/"
                break
            fi
        done
        WISH_PROG="${REAL_TK_BIN_DIR}${WISH_PROG}"
    fi
    AC_MSG_RESULT([${WISH_PROG}])
    AC_SUBST(WISH_PROG)
])

#------------------------------------------------------------------------
# TEA_ENABLE_SHARED --
#
#	Allows the building of shared libraries
#
# Arguments:
#	none
#
# Results:
#
#	Adds the following arguments to configure:
#		--enable-shared=yes|no
#
#	Defines the following vars:
#		STATIC_BUILD	Used for building import/export libraries
#				on Windows.
#
#	Sets the following vars:
#		SHARED_BUILD	Value of 1 or 0
#------------------------------------------------------------------------

AC_DEFUN([TEA_ENABLE_SHARED], [
    AC_MSG_CHECKING([how to build libraries])
    AC_ARG_ENABLE(shared,
	AC_HELP_STRING([--enable-shared],
	    [build and link with shared libraries (default: on)]),
	[tcl_ok=$enableval], [tcl_ok=yes])

    if test "${enable_shared+set}" = set; then
	enableval="$enable_shared"
	tcl_ok=$enableval
    else
	tcl_ok=yes
    fi

    if test "$tcl_ok" = "yes" ; then
	AC_MSG_RESULT([shared])
	SHARED_BUILD=1
    else
	AC_MSG_RESULT([static])
	SHARED_BUILD=0
	AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?])
    fi
    AC_SUBST(SHARED_BUILD)
])

#------------------------------------------------------------------------
# TEA_ENABLE_THREADS --
#
#	Specify if thread support should be enabled.  If "yes" is specified
#	as an arg (optional), threads are enabled by default, "no" means
#	threads are disabled.  "yes" is the default.
#
#	TCL_THREADS is checked so that if you are compiling an extension
#	against a threaded core, your extension must be compiled threaded
#	as well.
#
#	Note that it is legal to have a thread enabled extension run in a
#	threaded or non-threaded Tcl core, but a non-threaded extension may
#	only run in a non-threaded Tcl core.
#
# Arguments:
#	none
#
# Results:
#
#	Adds the following arguments to configure:
#		--enable-threads
#
#	Sets the following vars:
#		THREADS_LIBS	Thread library(s)
#
#	Defines the following vars:
#		TCL_THREADS
#		_REENTRANT
#		_THREAD_SAFE
#------------------------------------------------------------------------

AC_DEFUN([TEA_ENABLE_THREADS], [
    AC_ARG_ENABLE(threads,
	AC_HELP_STRING([--enable-threads],
	    [build with threads]),
	[tcl_ok=$enableval], [tcl_ok=yes])

    if test "${enable_threads+set}" = set; then
	enableval="$enable_threads"
	tcl_ok=$enableval
    else
	tcl_ok=yes
    fi

    if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
	TCL_THREADS=1

	if test "${TEA_PLATFORM}" != "windows" ; then
	    # We are always OK on Windows, so check what this platform wants:

	    # USE_THREAD_ALLOC tells us to try the special thread-based
	    # allocator that significantly reduces lock contention
	    AC_DEFINE(USE_THREAD_ALLOC, 1,
		[Do we want to use the threaded memory allocator?])
	    AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
	    if test "`uname -s`" = "SunOS" ; then
		AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
			[Do we really want to follow the standard? Yes we do!])
	    fi
	    AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
	    AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
	    if test "$tcl_ok" = "no"; then
		# Check a little harder for __pthread_mutex_init in the same
		# library, as some systems hide it there until pthread.h is
		# defined.  We could alternatively do an AC_TRY_COMPILE with
		# pthread.h, but that will work with libpthread really doesn't
		# exist, like AIX 4.2.  [Bug: 4359]
		AC_CHECK_LIB(pthread, __pthread_mutex_init,
		    tcl_ok=yes, tcl_ok=no)
	    fi

	    if test "$tcl_ok" = "yes"; then
		# The space is needed
		THREADS_LIBS=" -lpthread"
	    else
		AC_CHECK_LIB(pthreads, pthread_mutex_init,
		    tcl_ok=yes, tcl_ok=no)
		if test "$tcl_ok" = "yes"; then
		    # The space is needed
		    THREADS_LIBS=" -lpthreads"
		else
		    AC_CHECK_LIB(c, pthread_mutex_init,
			tcl_ok=yes, tcl_ok=no)
		    if test "$tcl_ok" = "no"; then
			AC_CHECK_LIB(c_r, pthread_mutex_init,
			    tcl_ok=yes, tcl_ok=no)
			if test "$tcl_ok" = "yes"; then
			    # The space is needed
			    THREADS_LIBS=" -pthread"
			else
			    TCL_THREADS=0
			    AC_MSG_WARN([Do not know how to find pthread lib on your system - thread support disabled])
			fi
		    fi
		fi
	    fi
	fi
    else
	TCL_THREADS=0
    fi
    # Do checking message here to not mess up interleaved configure output
    AC_MSG_CHECKING([for building with threads])
    if test "${TCL_THREADS}" = 1; then
	AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
	AC_MSG_RESULT([yes (default)])
    else
	AC_MSG_RESULT([no])
    fi
    # TCL_THREADS sanity checking.  See if our request for building with
    # threads is the same as the way Tcl was built.  If not, warn the user.
    case ${TCL_DEFS} in
	*THREADS=1*)
	    if test "${TCL_THREADS}" = "0"; then
		AC_MSG_WARN([
    Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
    that IS thread-enabled.  It is recommended to use --enable-threads.])
	    fi
	    ;;
	*)
	    if test "${TCL_THREADS}" = "1"; then
		AC_MSG_WARN([
    --enable-threads requested, but building against a Tcl that is NOT
    thread-enabled.  This is an OK configuration that will also run in
    a thread-enabled core.])
	    fi
	    ;;
    esac
    AC_SUBST(TCL_THREADS)
])

#------------------------------------------------------------------------
# TEA_ENABLE_SYMBOLS --
#
#	Specify if debugging symbols should be used.
#	Memory (TCL_MEM_DEBUG) debugging can also be enabled.
#
# Arguments:
#	none
#
#	TEA varies from core Tcl in that C|LDFLAGS_DEFAULT receives
#	the value of C|LDFLAGS_OPTIMIZE|DEBUG already substituted.
#	Requires the following vars to be set in the Makefile:
#		CFLAGS_DEFAULT
#		LDFLAGS_DEFAULT
#
# Results:
#
#	Adds the following arguments to configure:
#		--enable-symbols
#
#	Defines the following vars:
#		CFLAGS_DEFAULT	Sets to $(CFLAGS_DEBUG) if true
#				Sets to "$(CFLAGS_OPTIMIZE) -DNDEBUG" if false
#		LDFLAGS_DEFAULT	Sets to $(LDFLAGS_DEBUG) if true
#				Sets to $(LDFLAGS_OPTIMIZE) if false
#		DBGX		Formerly used as debug library extension;
#				always blank now.
#------------------------------------------------------------------------

AC_DEFUN([TEA_ENABLE_SYMBOLS], [
    dnl TEA specific: Make sure we are initialized
    AC_REQUIRE([TEA_CONFIG_CFLAGS])
    AC_MSG_CHECKING([for build with symbols])
    AC_ARG_ENABLE(symbols,
	AC_HELP_STRING([--enable-symbols],
	    [build with debugging symbols (default: off)]),
	[tcl_ok=$enableval], [tcl_ok=no])
    DBGX=""
    if test "$tcl_ok" = "no"; then
	CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE} -DNDEBUG"
	LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
	AC_MSG_RESULT([no])
    else
	CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
	LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
	if test "$tcl_ok" = "yes"; then
	    AC_MSG_RESULT([yes (standard debugging)])
	fi
    fi
    # TEA specific:
    if test "${TEA_PLATFORM}" != "windows" ; then
	LDFLAGS_DEFAULT="${LDFLAGS}"
    fi
    AC_SUBST(CFLAGS_DEFAULT)
    AC_SUBST(LDFLAGS_DEFAULT)
    AC_SUBST(TCL_DBGX)

    if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
	AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
    fi

    if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
	if test "$tcl_ok" = "all"; then
	    AC_MSG_RESULT([enabled symbols mem debugging])
	else
	    AC_MSG_RESULT([enabled $tcl_ok debugging])
	fi
    fi
])

#------------------------------------------------------------------------
# TEA_ENABLE_LANGINFO --
#
#	Allows use of modern nl_langinfo check for better l10n.
#	This is only relevant for Unix.
#
# Arguments:
#	none
#
# Results:
#
#	Adds the following arguments to configure:
#		--enable-langinfo=yes|no (default is yes)
#
#	Defines the following vars:
#		HAVE_LANGINFO	Triggers use of nl_langinfo if defined.
#------------------------------------------------------------------------

AC_DEFUN([TEA_ENABLE_LANGINFO], [
    AC_ARG_ENABLE(langinfo,
	AC_HELP_STRING([--enable-langinfo],
	    [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
	[langinfo_ok=$enableval], [langinfo_ok=yes])

    HAVE_LANGINFO=0
    if test "$langinfo_ok" = "yes"; then
	AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
    fi
    AC_MSG_CHECKING([whether to use nl_langinfo])
    if test "$langinfo_ok" = "yes"; then
	AC_CACHE_VAL(tcl_cv_langinfo_h, [
	    AC_TRY_COMPILE([#include <langinfo.h>], [nl_langinfo(CODESET);],
		    [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])])
	AC_MSG_RESULT([$tcl_cv_langinfo_h])
	if test $tcl_cv_langinfo_h = yes; then
	    AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?])
	fi
    else
	AC_MSG_RESULT([$langinfo_ok])
    fi
])

#--------------------------------------------------------------------
# TEA_CONFIG_SYSTEM
#
#	Determine what the system is (some things cannot be easily checked
#	on a feature-driven basis, alas). This can usually be done via the
#	"uname" command.
#
# Arguments:
#	none
#
# Results:
#	Defines the following var:
#
#	system -	System/platform/version identification code.
#--------------------------------------------------------------------

AC_DEFUN([TEA_CONFIG_SYSTEM], [
    AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
	# TEA specific:
	if test "${TEA_PLATFORM}" = "windows" ; then
	    tcl_cv_sys_version=windows
	else
	    tcl_cv_sys_version=`uname -s`-`uname -r`
	    if test "$?" -ne 0 ; then
		AC_MSG_WARN([can't find uname command])
		tcl_cv_sys_version=unknown
	    else
		if test "`uname -s`" = "AIX" ; then
		    tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
		fi
	    fi
	fi
    ])
    system=$tcl_cv_sys_version
])

#--------------------------------------------------------------------
# TEA_CONFIG_CFLAGS
#
#	Try to determine the proper flags to pass to the compiler
#	for building shared libraries and other such nonsense.
#
# Arguments:
#	none
#
# Results:
#
#	Defines and substitutes the following vars:
#
#	DL_OBJS, DL_LIBS - removed for TEA, only needed by core.
#       LDFLAGS -      Flags to pass to the compiler when linking object
#                       files into an executable application binary such
#                       as tclsh.
#       LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
#                       that tell the run-time dynamic linker where to look
#                       for shared libraries such as libtcl.so.  Depends on
#                       the variable LIB_RUNTIME_DIR in the Makefile. Could
#                       be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
#       CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
#                       that tell the run-time dynamic linker where to look
#                       for shared libraries such as libtcl.so.  Depends on
#                       the variable LIB_RUNTIME_DIR in the Makefile.
#       SHLIB_CFLAGS -  Flags to pass to cc when compiling the components
#                       of a shared library (may request position-independent
#                       code, among other things).
#       SHLIB_LD -      Base command to use for combining object files
#                       into a shared library.
#       SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
#                       creating shared libraries.  This symbol typically
#                       goes at the end of the "ld" commands that build
#                       shared libraries. The value of the symbol defaults to
#                       "${LIBS}" if all of the dependent libraries should
#                       be specified when creating a shared library.  If
#                       dependent libraries should not be specified (as on
#                       SunOS 4.x, where they cause the link to fail, or in
#                       general if Tcl and Tk aren't themselves shared
#                       libraries), then this symbol has an empty string
#                       as its value.
#       SHLIB_SUFFIX -  Suffix to use for the names of dynamically loadable
#                       extensions.  An empty string means we don't know how
#                       to use shared libraries on this platform.
#       LIB_SUFFIX -    Specifies everything that comes after the "libfoo"
#                       in a static or shared library name, using the $PACKAGE_VERSION variable
#                       to put the version in the right place.  This is used
#                       by platforms that need non-standard library names.
#                       Examples:  ${PACKAGE_VERSION}.so.1.1 on NetBSD, since it needs
#                       to have a version after the .so, and ${PACKAGE_VERSION}.a
#                       on AIX, since a shared library needs to have
#                       a .a extension whereas shared objects for loadable
#                       extensions have a .so extension.  Defaults to
#                       ${PACKAGE_VERSION}${SHLIB_SUFFIX}.
#	CFLAGS_DEBUG -
#			Flags used when running the compiler in debug mode
#	CFLAGS_OPTIMIZE -
#			Flags used when running the compiler in optimize mode
#	CFLAGS -	Additional CFLAGS added as necessary (usually 64-bit)
#--------------------------------------------------------------------

AC_DEFUN([TEA_CONFIG_CFLAGS], [
    dnl TEA specific: Make sure we are initialized
    AC_REQUIRE([TEA_INIT])

    # Step 0.a: Enable 64 bit support?

    AC_MSG_CHECKING([if 64bit support is requested])
    AC_ARG_ENABLE(64bit,
	AC_HELP_STRING([--enable-64bit],
	    [enable 64bit support (default: off)]),
	[do64bit=$enableval], [do64bit=no])
    AC_MSG_RESULT([$do64bit])

    # Step 0.b: Enable Solaris 64 bit VIS support?

    AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
    AC_ARG_ENABLE(64bit-vis,
	AC_HELP_STRING([--enable-64bit-vis],
	    [enable 64bit Sparc VIS support (default: off)]),
	[do64bitVIS=$enableval], [do64bitVIS=no])
    AC_MSG_RESULT([$do64bitVIS])
    # Force 64bit on with VIS
    AS_IF([test "$do64bitVIS" = "yes"], [do64bit=yes])

    # Step 0.c: Check if visibility support is available. Do this here so
    # that platform specific alternatives can be used below if this fails.

    AC_CACHE_CHECK([if compiler supports visibility "hidden"],
	tcl_cv_cc_visibility_hidden, [
	hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
	AC_TRY_LINK([
	    extern __attribute__((__visibility__("hidden"))) void f(void);
	    void f(void) {}], [f();], tcl_cv_cc_visibility_hidden=yes,
	    tcl_cv_cc_visibility_hidden=no)
	CFLAGS=$hold_cflags])
    AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [
	AC_DEFINE(MODULE_SCOPE,
	    [extern __attribute__((__visibility__("hidden")))],
	    [Compiler support for module scope symbols])
	AC_DEFINE(HAVE_HIDDEN, [1], [Compiler support for module scope symbols])
    ])

    # Step 0.d: Disable -rpath support?

    AC_MSG_CHECKING([if rpath support is requested])
    AC_ARG_ENABLE(rpath,
	AC_HELP_STRING([--disable-rpath],
	    [disable rpath support (default: on)]),
	[doRpath=$enableval], [doRpath=yes])
    AC_MSG_RESULT([$doRpath])

    # TEA specific: Cross-compiling options for Windows/CE builds?

    AS_IF([test "${TEA_PLATFORM}" = windows], [
	AC_MSG_CHECKING([if Windows/CE build is requested])
	AC_ARG_ENABLE(wince,
	    AC_HELP_STRING([--enable-wince],
		[enable Win/CE support (where applicable)]),
	    [doWince=$enableval], [doWince=no])
	AC_MSG_RESULT([$doWince])
    ])

    # Set the variable "system" to hold the name and version number
    # for the system.

    TEA_CONFIG_SYSTEM

    # Require ranlib early so we can override it in special cases below.

    AC_REQUIRE([AC_PROG_RANLIB])

    # Set configuration options based on system name and version.
    # This is similar to Tcl's unix/tcl.m4 except that we've added a
    # "windows" case and removed some core-only vars.

    do64bit_ok=no
    # default to '{$LIBS}' and set to "" on per-platform necessary basis
    SHLIB_LD_LIBS='${LIBS}'
    # When ld needs options to work in 64-bit mode, put them in
    # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
    # is disabled by the user. [Bug 1016796]
    LDFLAGS_ARCH=""
    UNSHARED_LIB_SUFFIX=""
    # TEA specific: use PACKAGE_VERSION instead of VERSION
    TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`'
    ECHO_VERSION='`echo ${PACKAGE_VERSION}`'
    TCL_LIB_VERSIONS_OK=ok
    CFLAGS_DEBUG=-g
    AS_IF([test "$GCC" = yes], [
	CFLAGS_OPTIMIZE=-O2
	CFLAGS_WARNING="-Wall"
    ], [
	CFLAGS_OPTIMIZE=-O
	CFLAGS_WARNING=""
    ])
    CC_OBJNAME="-o \[$]@"
    AC_CHECK_TOOL(AR, ar)
    STLIB_LD='${AR} cr'
    LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
    AS_IF([test "x$SHLIB_VERSION" = x],[SHLIB_VERSION="1.0"])
    case $system in
	# TEA specific:
	windows)
	    # This is a 2-stage check to make sure we have the 64-bit SDK
	    # We have to know where the SDK is installed.
	    # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs
	    # MACHINE is IX86 for LINK, but this is used by the manifest,
	    # which requires x86|amd64|ia64.
	    MACHINE="X86"
	    if test "$do64bit" != "no" ; then
		if test "x${MSSDK}x" = "xx" ; then
		    MSSDK="C:/Progra~1/Microsoft Platform SDK"
		fi
		MSSDK=`echo "$MSSDK" | sed -e  's!\\\!/!g'`
		PATH64=""
		case "$do64bit" in
		    amd64|x64|yes)
			MACHINE="AMD64" ; # default to AMD64 64-bit build
			PATH64="${MSSDK}/Bin/Win64/x86/AMD64"
			;;
		    ia64)
			MACHINE="IA64"
			PATH64="${MSSDK}/Bin/Win64"
			;;
		esac
		if test "$GCC" != "yes" -a ! -d "${PATH64}" ; then
		    AC_MSG_WARN([Could not find 64-bit $MACHINE SDK to enable 64bit mode])
		    AC_MSG_WARN([Ensure latest Platform SDK is installed])
		    do64bit="no"
		else
		    AC_MSG_RESULT([   Using 64-bit $MACHINE mode])
		    do64bit_ok="yes"
		fi
	    fi

	    if test "$doWince" != "no" ; then
		if test "$do64bit" != "no" ; then
		    AC_MSG_ERROR([Windows/CE and 64-bit builds incompatible])
		fi
		if test "$GCC" = "yes" ; then
		    AC_MSG_ERROR([Windows/CE and GCC builds incompatible])
		fi
		TEA_PATH_CELIB
		# Set defaults for common evc4/PPC2003 setup
		# Currently Tcl requires 300+, possibly 420+ for sockets
		CEVERSION=420; 		# could be 211 300 301 400 420 ...
		TARGETCPU=ARMV4;	# could be ARMV4 ARM MIPS SH3 X86 ...
		ARCH=ARM;		# could be ARM MIPS X86EM ...
		PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002"
		if test "$doWince" != "yes"; then
		    # If !yes then the user specified something
		    # Reset ARCH to allow user to skip specifying it
		    ARCH=
		    eval `echo $doWince | awk -F, '{ \
	    if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \
	    if ([$]1 < 400)   { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \
	    if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \
	    if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \
	    if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \
		    }'`
		    if test "x${ARCH}" = "x" ; then
			ARCH=$TARGETCPU;
		    fi
		fi
		OSVERSION=WCE$CEVERSION;
	    	if test "x${WCEROOT}" = "x" ; then
			WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0"
		    if test ! -d "${WCEROOT}" ; then
			WCEROOT="C:/Program Files/Microsoft eMbedded Tools"
		    fi
		fi
		if test "x${SDKROOT}" = "x" ; then
		    SDKROOT="C:/Program Files/Windows CE Tools"
		    if test ! -d "${SDKROOT}" ; then
			SDKROOT="C:/Windows CE Tools"
		    fi
		fi
		WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'`
		SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'`
		if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \
		    -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
		    AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]])
		    doWince="no"
		else
		    # We could PATH_NOSPACE these, but that's not important,
		    # as long as we quote them when used.
		    CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include"
		    if test -d "${CEINCLUDE}/${TARGETCPU}" ; then
			CEINCLUDE="${CEINCLUDE}/${TARGETCPU}"
		    fi
		    CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"
    		fi
	    fi

	    if test "$GCC" != "yes" ; then
	        if test "${SHARED_BUILD}" = "0" ; then
		    runtime=-MT
	        else
		    runtime=-MD
	        fi

                if test "$do64bit" != "no" ; then
		    # All this magic is necessary for the Win64 SDK RC1 - hobbs
		    CC="\"${PATH64}/cl.exe\""
		    CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
		    RC="\"${MSSDK}/bin/rc.exe\""
		    lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
		    LINKBIN="\"${PATH64}/link.exe\""
		    CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
		    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
		    # Avoid 'unresolved external symbol __security_cookie'
		    # errors, c.f. http://support.microsoft.com/?id=894573
		    TEA_ADD_LIBS([bufferoverflowU.lib])
		elif test "$doWince" != "no" ; then
		    CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"
		    if test "${TARGETCPU}" = "X86"; then
			CC="\"${CEBINROOT}/cl.exe\""
		    else
			CC="\"${CEBINROOT}/cl${ARCH}.exe\""
		    fi
		    CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
		    RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\""
		    arch=`echo ${ARCH} | awk '{print tolower([$]0)}'`
		    defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS"
		    if test "${SHARED_BUILD}" = "1" ; then
			# Static CE builds require static celib as well
		    	defs="${defs} _DLL"
		    fi
		    for i in $defs ; do
			AC_DEFINE_UNQUOTED($i, 1, [WinCE def ]$i)
		    done
		    AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION, [_WIN32_WCE version])
		    AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION, [UNDER_CE version])
		    CFLAGS_DEBUG="-nologo -Zi -Od"
		    CFLAGS_OPTIMIZE="-nologo -Ox"
		    lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
		    lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
		    LINKBIN="\"${CEBINROOT}/link.exe\""
		    AC_SUBST(CELIB_DIR)
		else
		    RC="rc"
		    lflags="-nologo"
		    LINKBIN="link"
		    CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
		    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
		fi
	    fi

	    if test "$GCC" = "yes"; then
		# mingw gcc mode
		AC_CHECK_TOOL(RC, windres)
		CFLAGS_DEBUG="-g"
		CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
		SHLIB_LD='${CC} -shared'
		UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
		LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
		LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"

		AC_CACHE_CHECK(for cross-compile version of gcc,
			ac_cv_cross,
			AC_TRY_COMPILE([
			    #ifdef _WIN32
				#error cross-compiler
			    #endif
			], [],
			ac_cv_cross=yes,
			ac_cv_cross=no)
		      )
		      if test "$ac_cv_cross" = "yes"; then
			case "$do64bit" in
			    amd64|x64|yes)
				CC="x86_64-w64-mingw32-gcc"
				LD="x86_64-w64-mingw32-ld"
				AR="x86_64-w64-mingw32-ar"
				RANLIB="x86_64-w64-mingw32-ranlib"
				RC="x86_64-w64-mingw32-windres"
			    ;;
			    *)
				CC="i686-w64-mingw32-gcc"
				LD="i686-w64-mingw32-ld"
				AR="i686-w64-mingw32-ar"
				RANLIB="i686-w64-mingw32-ranlib"
				RC="i686-w64-mingw32-windres"
			    ;;
			esac
		fi

	    else
		SHLIB_LD="${LINKBIN} -dll ${lflags}"
		# link -lib only works when -lib is the first arg
		STLIB_LD="${LINKBIN} -lib ${lflags}"
		UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib'
		PATHTYPE=-w
		# For information on what debugtype is most useful, see:
		# http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp
		# and also
		# http://msdn2.microsoft.com/en-us/library/y0zzbyt4%28VS.80%29.aspx
		# This essentially turns it all on.
		LDFLAGS_DEBUG="-debug -debugtype:cv"
		LDFLAGS_OPTIMIZE="-release"
		CFLAGS_DEBUG="${CFLAGS_DEBUG} -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE"
		CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE"
		CC_OBJNAME="-Fo\[$]@"
		if test "$doWince" != "no" ; then
		    LDFLAGS_CONSOLE="-link ${lflags}"
		    LDFLAGS_WINDOW=${LDFLAGS_CONSOLE}
		else
		    LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}"
		    LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}"
		fi
	    fi

	    SHLIB_SUFFIX=".dll"
	    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll'

	    TCL_LIB_VERSIONS_OK=nodots
    	    ;;
	AIX-*)
	    AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [
		# AIX requires the _r compiler when gcc isn't being used
		case "${CC}" in
		    *_r|*_r\ *)
			# ok ...
			;;
		    *)
			# Make sure only first arg gets _r
		    	CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'`
			;;
		esac
		AC_MSG_RESULT([Using $CC for compiling with threads])
	    ])
	    LIBS="$LIBS -lc"
	    SHLIB_CFLAGS=""
	    SHLIB_SUFFIX=".so"

	    LD_LIBRARY_PATH_VAR="LIBPATH"

	    # Check to enable 64-bit flags for compiler/linker
	    AS_IF([test "$do64bit" = yes], [
		AS_IF([test "$GCC" = yes], [
		    AC_MSG_WARN([64bit mode not supported with GCC on $system])
		], [
		    do64bit_ok=yes
		    CFLAGS="$CFLAGS -q64"
		    LDFLAGS_ARCH="-q64"
		    RANLIB="${RANLIB} -X64"
		    AR="${AR} -X64"
		    SHLIB_LD_FLAGS="-b64"
		])
	    ])

	    AS_IF([test "`uname -m`" = ia64], [
		# AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
		SHLIB_LD="/usr/ccs/bin/ld -G -z text"
		AS_IF([test "$GCC" = yes], [
		    CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
		], [
		    CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
		])
		LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
	    ], [
		AS_IF([test "$GCC" = yes], [
		    SHLIB_LD='${CC} -shared -Wl,-bexpall'
		], [
		    SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry"
		    LDFLAGS="$LDFLAGS -brtl"
		])
		SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}"
		CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
	    ])
	    ;;
	BeOS*)
	    SHLIB_CFLAGS="-fPIC"
	    SHLIB_LD='${CC} -nostart'
	    SHLIB_SUFFIX=".so"

	    #-----------------------------------------------------------
	    # Check for inet_ntoa in -lbind, for BeOS (which also needs
	    # -lsocket, even if the network functions are in -lnet which
	    # is always linked to, for compatibility.
	    #-----------------------------------------------------------
	    AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
	    ;;
	BSD/OS-4.*)
	    SHLIB_CFLAGS="-export-dynamic -fPIC"
	    SHLIB_LD='${CC} -shared'
	    SHLIB_SUFFIX=".so"
	    LDFLAGS="$LDFLAGS -export-dynamic"
	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
	    ;;
	CYGWIN_*)
	    SHLIB_CFLAGS=""
	    SHLIB_LD='${CC} -shared'
	    SHLIB_SUFFIX=".dll"
	    EXEEXT=".exe"
	    do64bit_ok=yes
	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
	    ;;
	Haiku*)
	    LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
	    SHLIB_CFLAGS="-fPIC"
	    SHLIB_SUFFIX=".so"
	    SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
	    AC_CHECK_LIB(network, inet_ntoa, [LIBS="$LIBS -lnetwork"])
	    ;;
	HP-UX-*.11.*)
	    # Use updated header definitions where possible
	    AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?])
	    # TEA specific: Needed by Tcl, but not most extensions
	    #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
	    #LIBS="$LIBS -lxnet"               # Use the XOPEN network library

	    AS_IF([test "`uname -m`" = ia64], [
		SHLIB_SUFFIX=".so"
		# Use newer C++ library for C++ extensions
		#if test "$GCC" != "yes" ; then
		#   CPPFLAGS="-AA"
		#fi
	    ], [
		SHLIB_SUFFIX=".sl"
	    ])
	    AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
	    AS_IF([test "$tcl_ok" = yes], [
		LDFLAGS="$LDFLAGS -Wl,-E"
		CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
		LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
		LD_LIBRARY_PATH_VAR="SHLIB_PATH"
	    ])
	    AS_IF([test "$GCC" = yes], [
		SHLIB_LD='${CC} -shared'
		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
	    ], [
		CFLAGS="$CFLAGS -z"
		# Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
		#CFLAGS="$CFLAGS +DAportable"
		SHLIB_CFLAGS="+z"
		SHLIB_LD="ld -b"
	    ])

	    # Check to enable 64-bit flags for compiler/linker
	    AS_IF([test "$do64bit" = "yes"], [
		AS_IF([test "$GCC" = yes], [
		    case `${CC} -dumpmachine` in
			hppa64*)
			    # 64-bit gcc in use.  Fix flags for GNU ld.
			    do64bit_ok=yes
			    SHLIB_LD='${CC} -shared'
			    AS_IF([test $doRpath = yes], [
				CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
			    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
			    ;;
			*)
			    AC_MSG_WARN([64bit mode not supported with GCC on $system])
			    ;;
		    esac
		], [
		    do64bit_ok=yes
		    CFLAGS="$CFLAGS +DD64"
		    LDFLAGS_ARCH="+DD64"
		])
	    ]) ;;
	IRIX-6.*)
	    SHLIB_CFLAGS=""
	    SHLIB_LD="ld -n32 -shared -rdata_shared"
	    SHLIB_SUFFIX=".so"
	    AS_IF([test $doRpath = yes], [
		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
	    AS_IF([test "$GCC" = yes], [
		CFLAGS="$CFLAGS -mabi=n32"
		LDFLAGS="$LDFLAGS -mabi=n32"
	    ], [
		case $system in
		    IRIX-6.3)
			# Use to build 6.2 compatible binaries on 6.3.
			CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
			;;
		    *)
			CFLAGS="$CFLAGS -n32"
			;;
		esac
		LDFLAGS="$LDFLAGS -n32"
	    ])
	    ;;
	IRIX64-6.*)
	    SHLIB_CFLAGS=""
	    SHLIB_LD="ld -n32 -shared -rdata_shared"
	    SHLIB_SUFFIX=".so"
	    AS_IF([test $doRpath = yes], [
		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])

	    # Check to enable 64-bit flags for compiler/linker

	    AS_IF([test "$do64bit" = yes], [
	        AS_IF([test "$GCC" = yes], [
	            AC_MSG_WARN([64bit mode not supported by gcc])
	        ], [
	            do64bit_ok=yes
	            SHLIB_LD="ld -64 -shared -rdata_shared"
	            CFLAGS="$CFLAGS -64"
	            LDFLAGS_ARCH="-64"
	        ])
	    ])
	    ;;
	Linux*|GNU*|NetBSD-Debian)
	    SHLIB_CFLAGS="-fPIC"
	    SHLIB_SUFFIX=".so"

	    # TEA specific:
	    CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"

	    # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
	    SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS_DEFAULT}'
	    # workaround when cross-compiling for Win32: no -fPIC and -Wl,...
	    if test "${TCL_SHLIB_SUFFIX}" = ".dll" ; then
		SHLIB_CFLAGS=""
		SHLIB_SUFFIX=".dll"
		DL_OBJS=""
		DL_LIBS=""
		TCL_LIB_VERSIONS_OK=nodots
		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll'
		UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
	    else	
		LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
	    fi
	    AS_IF([test $doRpath = yes], [
		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
	    AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
	    AS_IF([test $do64bit = yes], [
		AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
		    hold_cflags=$CFLAGS
		    CFLAGS="$CFLAGS -m64"
		    AC_TRY_LINK(,, tcl_cv_cc_m64=yes, tcl_cv_cc_m64=no)
		    CFLAGS=$hold_cflags])
		AS_IF([test $tcl_cv_cc_m64 = yes], [
		    CFLAGS="$CFLAGS -m64"
		    do64bit_ok=yes
		])
	   ])

	    # The combo of gcc + glibc has a bug related to inlining of
	    # functions like strtod(). The -fno-builtin flag should address
	    # this problem but it does not work. The -fno-inline flag is kind
	    # of overkill but it works. Disable inlining only when one of the
	    # files in compat/*.c is being linked in.

	    AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"])
	    ;;
	Lynx*)
	    SHLIB_CFLAGS="-fPIC"
	    SHLIB_SUFFIX=".so"
	    CFLAGS_OPTIMIZE=-02
	    SHLIB_LD='${CC} -shared'
	    LD_FLAGS="-Wl,--export-dynamic"
	    AS_IF([test $doRpath = yes], [
		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
	    ;;
	OpenBSD-*)
	    arch=`arch -s`
	    case "$arch" in
	    vax)
		SHLIB_SUFFIX=""
		SHARED_LIB_SUFFIX=""
		LDFLAGS=""
		;;
	    *)
		SHLIB_CFLAGS="-fPIC"
		SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
		SHLIB_SUFFIX=".so"
		AS_IF([test $doRpath = yes], [
		    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
		LDFLAGS="-Wl,-export-dynamic"
		;;
	    esac
	    case "$arch" in
	    vax)
		CFLAGS_OPTIMIZE="-O1"
		;;
	    *)
		CFLAGS_OPTIMIZE="-O2"
		;;
	    esac
	    AS_IF([test "${TCL_THREADS}" = "1"], [
		# On OpenBSD:	Compile with -pthread
		#		Don't link with -lpthread
		LIBS=`echo $LIBS | sed s/-lpthread//`
		CFLAGS="$CFLAGS -pthread"
	    ])
	    # OpenBSD doesn't do version numbers with dots.
	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
	    TCL_LIB_VERSIONS_OK=nodots
	    ;;
	NetBSD-*)
	    # NetBSD has ELF and can use 'cc -shared' to build shared libs
	    SHLIB_CFLAGS="-fPIC"
	    SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}'
	    SHLIB_SUFFIX=".so"
	    LDFLAGS="$LDFLAGS -export-dynamic"
	    AS_IF([test $doRpath = yes], [
		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
	    AS_IF([test "${TCL_THREADS}" = "1"], [
		# The -pthread needs to go in the CFLAGS, not LIBS
		LIBS=`echo $LIBS | sed s/-pthread//`
		CFLAGS="$CFLAGS -pthread"
	    	LDFLAGS="$LDFLAGS -pthread"
	    ])
	    ;;
	FreeBSD-*)
	    # This configuration from FreeBSD Ports.
	    SHLIB_CFLAGS="-fPIC"
	    SHLIB_LD="${CC} -shared"
	    TCL_SHLIB_LD_EXTRAS="-Wl,-soname=\$[@]"
	    TK_SHLIB_LD_EXTRAS="-Wl,-soname,\$[@]"
	    SHLIB_SUFFIX=".so"
	    LDFLAGS=""
	    AS_IF([test $doRpath = yes], [
		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
	    AS_IF([test "${TCL_THREADS}" = "1"], [
		# The -pthread needs to go in the LDFLAGS, not LIBS
		LIBS=`echo $LIBS | sed s/-pthread//`
		CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
		LDFLAGS="$LDFLAGS $PTHREAD_LIBS"])
	    case $system in
	    FreeBSD-3.*)
		# Version numbers are dot-stripped by system policy.
		TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .`
		UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
		TCL_LIB_VERSIONS_OK=nodots
		;;
	    esac
	    ;;
	Darwin-*)
	    CFLAGS_OPTIMIZE="-Os"
	    SHLIB_CFLAGS="-fno-common"
	    # To avoid discrepancies between what headers configure sees during
	    # preprocessing tests and compiling tests, move any -isysroot and
	    # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
	    CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
		awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
		if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
	    CFLAGS="`echo " ${CFLAGS}" | \
		awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
		if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
	    AS_IF([test $do64bit = yes], [
		case `arch` in
		    ppc)
			AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
				tcl_cv_cc_arch_ppc64, [
			    hold_cflags=$CFLAGS
			    CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
			    AC_TRY_LINK(,, tcl_cv_cc_arch_ppc64=yes,
				    tcl_cv_cc_arch_ppc64=no)
			    CFLAGS=$hold_cflags])
			AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [
			    CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
			    do64bit_ok=yes
			]);;
		    i386)
			AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
				tcl_cv_cc_arch_x86_64, [
			    hold_cflags=$CFLAGS
			    CFLAGS="$CFLAGS -arch x86_64"
			    AC_TRY_LINK(,, tcl_cv_cc_arch_x86_64=yes,
				    tcl_cv_cc_arch_x86_64=no)
			    CFLAGS=$hold_cflags])
			AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [
			    CFLAGS="$CFLAGS -arch x86_64"
			    do64bit_ok=yes
			]);;
		    *)
			AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
		esac
	    ], [
		# Check for combined 32-bit and 64-bit fat build
		AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \
		    && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [
		    fat_32_64=yes])
	    ])
	    # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
	    SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}'
	    AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
		hold_ldflags=$LDFLAGS
		LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
		AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
		LDFLAGS=$hold_ldflags])
	    AS_IF([test $tcl_cv_ld_single_module = yes], [
		SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
	    ])
	    # TEA specific: link shlib with current and compatibility version flags
	    vers=`echo ${PACKAGE_VERSION} | sed -e 's/^\([[0-9]]\{1,5\}\)\(\(\.[[0-9]]\{1,3\}\)\{0,2\}\).*$/\1\2/p' -e d`
	    SHLIB_LD="${SHLIB_LD} -current_version ${vers:-0} -compatibility_version ${vers:-0}"
	    SHLIB_SUFFIX=".dylib"
	    # Don't use -prebind when building for Mac OS X 10.4 or later only:
	    AS_IF([test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
		"`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4], [
		LDFLAGS="$LDFLAGS -prebind"])
	    LDFLAGS="$LDFLAGS -headerpad_max_install_names"
	    AC_CACHE_CHECK([if ld accepts -search_paths_first flag],
		    tcl_cv_ld_search_paths_first, [
		hold_ldflags=$LDFLAGS
		LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
		AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes,
			tcl_cv_ld_search_paths_first=no)
		LDFLAGS=$hold_ldflags])
	    AS_IF([test $tcl_cv_ld_search_paths_first = yes], [
		LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
	    ])
	    AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
		AC_DEFINE(MODULE_SCOPE, [__private_extern__],
		    [Compiler support for module scope symbols])
		tcl_cv_cc_visibility_hidden=yes
	    ])
	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
	    LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
	    # TEA specific: for combined 32 & 64 bit fat builds of Tk
	    # extensions, verify that 64-bit build is possible.
	    AS_IF([test "$fat_32_64" = yes && test -n "${TK_BIN_DIR}"], [
		AS_IF([test "${TEA_WINDOWINGSYSTEM}" = x11], [
		    AC_CACHE_CHECK([for 64-bit X11], tcl_cv_lib_x11_64, [
			for v in CFLAGS CPPFLAGS LDFLAGS; do
			    eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
			done
			CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include"
			LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
			AC_TRY_LINK([#include <X11/Xlib.h>], [XrmInitialize();],
			    tcl_cv_lib_x11_64=yes, tcl_cv_lib_x11_64=no)
			for v in CFLAGS CPPFLAGS LDFLAGS; do
			    eval $v'="$hold_'$v'"'
			done])
		])
		AS_IF([test "${TEA_WINDOWINGSYSTEM}" = aqua], [
		    AC_CACHE_CHECK([for 64-bit Tk], tcl_cv_lib_tk_64, [
			for v in CFLAGS CPPFLAGS LDFLAGS; do
			    eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
			done
			CPPFLAGS="$CPPFLAGS -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 ${TCL_INCLUDES} ${TK_INCLUDES}"
			LDFLAGS="$LDFLAGS ${TCL_STUB_LIB_SPEC} ${TK_STUB_LIB_SPEC}"
			AC_TRY_LINK([#include <tk.h>], [Tk_InitStubs(NULL, "", 0);],
			    tcl_cv_lib_tk_64=yes, tcl_cv_lib_tk_64=no)
			for v in CFLAGS CPPFLAGS LDFLAGS; do
			    eval $v'="$hold_'$v'"'
			done])
		])
		# remove 64-bit arch flags from CFLAGS et al. if configuration
		# does not support 64-bit.
		AS_IF([test "$tcl_cv_lib_tk_64" = no -o "$tcl_cv_lib_x11_64" = no], [
		    AC_MSG_NOTICE([Removing 64-bit architectures from compiler & linker flags])
		    for v in CFLAGS CPPFLAGS LDFLAGS; do
			eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
		    done])
	    ])
	    ;;
	OS/390-*)
	    CFLAGS_OPTIMIZE=""		# Optimizer is buggy
	    AC_DEFINE(_OE_SOCKETS, 1,	# needed in sys/socket.h
		[Should OS/390 do the right thing with sockets?])
	    ;;
	OSF1-V*)
	    # Digital OSF/1
	    SHLIB_CFLAGS=""
	    AS_IF([test "$SHARED_BUILD" = 1], [
	        SHLIB_LD='ld -shared -expect_unresolved "*"'
	    ], [
	        SHLIB_LD='ld -non_shared -expect_unresolved "*"'
	    ])
	    SHLIB_SUFFIX=".so"
	    AS_IF([test $doRpath = yes], [
		CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
	    AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [
		CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"])
	    # see pthread_intro(3) for pthread support on osf1, k.furukawa
	    AS_IF([test "${TCL_THREADS}" = 1], [
		CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
		CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
		LIBS=`echo $LIBS | sed s/-lpthreads//`
		AS_IF([test "$GCC" = yes], [
		    LIBS="$LIBS -lpthread -lmach -lexc"
		], [
		    CFLAGS="$CFLAGS -pthread"
		    LDFLAGS="$LDFLAGS -pthread"
		])
	    ])
	    ;;
	QNX-6*)
	    # QNX RTP
	    # This may work for all QNX, but it was only reported for v6.
	    SHLIB_CFLAGS="-fPIC"
	    SHLIB_LD="ld -Bshareable -x"
	    SHLIB_LD_LIBS=""
	    SHLIB_SUFFIX=".so"
	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
	    ;;
	SCO_SV-3.2*)
	    AS_IF([test "$GCC" = yes], [
		SHLIB_CFLAGS="-fPIC -melf"
		LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
	    ], [
		SHLIB_CFLAGS="-Kpic -belf"
		LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
	    ])
	    SHLIB_LD="ld -G"
	    SHLIB_LD_LIBS=""
	    SHLIB_SUFFIX=".so"
	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
	    ;;
	SunOS-5.[[0-6]])
	    # Careful to not let 5.10+ fall into this case

	    # Note: If _REENTRANT isn't defined, then Solaris
	    # won't define thread-safe library routines.

	    AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
	    AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
		[Do we really want to follow the standard? Yes we do!])

	    SHLIB_CFLAGS="-KPIC"
	    SHLIB_SUFFIX=".so"
	    AS_IF([test "$GCC" = yes], [
		SHLIB_LD='${CC} -shared'
		CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
	    ], [
		SHLIB_LD="/usr/ccs/bin/ld -G -z text"
		CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
	    ])
	    ;;
	SunOS-5*)
	    # Note: If _REENTRANT isn't defined, then Solaris
	    # won't define thread-safe library routines.

	    AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
	    AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
		[Do we really want to follow the standard? Yes we do!])

	    SHLIB_CFLAGS="-KPIC"

	    # Check to enable 64-bit flags for compiler/linker
	    AS_IF([test "$do64bit" = yes], [
		arch=`isainfo`
		AS_IF([test "$arch" = "sparcv9 sparc"], [
		    AS_IF([test "$GCC" = yes], [
			AS_IF([test "`${CC} -dumpversion | awk -F. '{print [$]1}'`" -lt 3], [
			    AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
			], [
			    do64bit_ok=yes
			    CFLAGS="$CFLAGS -m64 -mcpu=v9"
			    LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
			    SHLIB_CFLAGS="-fPIC"
			])
		    ], [
			do64bit_ok=yes
			AS_IF([test "$do64bitVIS" = yes], [
			    CFLAGS="$CFLAGS -xarch=v9a"
			    LDFLAGS_ARCH="-xarch=v9a"
			], [
			    CFLAGS="$CFLAGS -xarch=v9"
			    LDFLAGS_ARCH="-xarch=v9"
			])
			# Solaris 64 uses this as well
			#LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
		    ])
		], [AS_IF([test "$arch" = "amd64 i386"], [
		    AS_IF([test "$GCC" = yes], [
			case $system in
			    SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
				do64bit_ok=yes
				CFLAGS="$CFLAGS -m64"
				LDFLAGS="$LDFLAGS -m64";;
			    *)
				AC_MSG_WARN([64bit mode not supported with GCC on $system]);;
			esac
		    ], [
			do64bit_ok=yes
			case $system in
			    SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
				CFLAGS="$CFLAGS -m64"
				LDFLAGS="$LDFLAGS -m64";;
			    *)
				CFLAGS="$CFLAGS -xarch=amd64"
				LDFLAGS="$LDFLAGS -xarch=amd64";;
			esac
		    ])
		], [AC_MSG_WARN([64bit mode not supported for $arch])])])
	    ])

	    SHLIB_SUFFIX=".so"
	    AS_IF([test "$GCC" = yes], [
		SHLIB_LD='${CC} -shared'
		CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
		AS_IF([test "$do64bit_ok" = yes], [
		    AS_IF([test "$arch" = "sparcv9 sparc"], [
			# We need to specify -static-libgcc or we need to
			# add the path to the sparv9 libgcc.
			# JH: static-libgcc is necessary for core Tcl, but may
			# not be necessary for extensions.
			SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
			# for finding sparcv9 libgcc, get the regular libgcc
			# path, remove so name and append 'sparcv9'
			#v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
			#CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
		    ], [AS_IF([test "$arch" = "amd64 i386"], [
			# JH: static-libgcc is necessary for core Tcl, but may
			# not be necessary for extensions.
			SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
		    ])])
		])
	    ], [
		case $system in
		    SunOS-5.[[1-9]][[0-9]]*)
			# TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS
			SHLIB_LD='${CC} -G -z text ${LDFLAGS_DEFAULT}';;
		    *)
			SHLIB_LD='/usr/ccs/bin/ld -G -z text';;
		esac
		CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
		LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
	    ])
	    ;;
	UNIX_SV* | UnixWare-5*)
	    SHLIB_CFLAGS="-KPIC"
	    SHLIB_LD='${CC} -G'
	    SHLIB_LD_LIBS=""
	    SHLIB_SUFFIX=".so"
	    # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
	    # that don't grok the -Bexport option.  Test that it does.
	    AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
		hold_ldflags=$LDFLAGS
		LDFLAGS="$LDFLAGS -Wl,-Bexport"
		AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no)
	        LDFLAGS=$hold_ldflags])
	    AS_IF([test $tcl_cv_ld_Bexport = yes], [
		LDFLAGS="$LDFLAGS -Wl,-Bexport"
	    ])
	    CC_SEARCH_FLAGS=""
	    LD_SEARCH_FLAGS=""
	    ;;
    esac

    AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = no], [
	AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
    ])

dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
dnl # until the end of configure, as configure's compile and link tests use
dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
dnl # preprocessing tests use only CPPFLAGS.
    AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])

    # Add in the arch flags late to ensure it wasn't removed.
    # Not necessary in TEA, but this is aligned with core
    LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"

    # If we're running gcc, then change the C flags for compiling shared
    # libraries to the right flags for gcc, instead of those for the
    # standard manufacturer compiler.

    AS_IF([test "$GCC" = yes], [
	case $system in
	    AIX-*) ;;
	    BSD/OS*) ;;
	    CYGWIN_*|MINGW32_*) ;;
	    IRIX*) ;;
	    NetBSD-*|FreeBSD-*|OpenBSD-*) ;;
	    Darwin-*) ;;
	    SCO_SV-3.2*) ;;
	    windows) ;;
	    *) SHLIB_CFLAGS="-fPIC" ;;
	esac])

    AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
	AC_DEFINE(MODULE_SCOPE, [extern],
	    [No Compiler support for module scope symbols])
    ])

    AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [
    # TEA specific: use PACKAGE_VERSION instead of VERSION
    SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'])
    AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [
    # TEA specific: use PACKAGE_VERSION instead of VERSION
    UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'])

    if test "${GCC}" = "yes" -a ${SHLIB_SUFFIX} = ".dll"; then
	AC_CACHE_CHECK(for SEH support in compiler,
	    tcl_cv_seh,
	AC_TRY_RUN([
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN

	    int main(int argc, char** argv) {
		int a, b = 0;
		__try {
		    a = 666 / b;
		}
		__except (EXCEPTION_EXECUTE_HANDLER) {
		    return 0;
		}
		return 1;
	    }
	],
	    tcl_cv_seh=yes,
	    tcl_cv_seh=no,
	    tcl_cv_seh=no)
	)
	if test "$tcl_cv_seh" = "no" ; then
	    AC_DEFINE(HAVE_NO_SEH, 1,
		    [Defined when mingw does not support SEH])
	fi

	#
	# Check to see if the excpt.h include file provided contains the
	# definition for EXCEPTION_DISPOSITION; if not, which is the case
	# with Cygwin's version as of 2002-04-10, define it to be int,
	# sufficient for getting the current code to work.
	#
	AC_CACHE_CHECK(for EXCEPTION_DISPOSITION support in include files,
	    tcl_cv_eh_disposition,
	    AC_TRY_COMPILE([
#	    define WIN32_LEAN_AND_MEAN
#	    include <windows.h>
#	    undef WIN32_LEAN_AND_MEAN
	    ],[
		EXCEPTION_DISPOSITION x;
	    ],
		tcl_cv_eh_disposition=yes,
		tcl_cv_eh_disposition=no)
	)
	if test "$tcl_cv_eh_disposition" = "no" ; then
	AC_DEFINE(EXCEPTION_DISPOSITION, int,
		[Defined when cygwin/mingw does not support EXCEPTION DISPOSITION])
	fi

	# Check to see if winnt.h defines CHAR, SHORT, and LONG
	# even if VOID has already been #defined. The win32api
	# used by mingw and cygwin is known to do this.

	AC_CACHE_CHECK(for winnt.h that ignores VOID define,
	    tcl_cv_winnt_ignore_void,
	    AC_TRY_COMPILE([
#define VOID void
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
	    ], [
		CHAR c;
		SHORT s;
		LONG l;
	    ],
        tcl_cv_winnt_ignore_void=yes,
        tcl_cv_winnt_ignore_void=no)
	)
	if test "$tcl_cv_winnt_ignore_void" = "yes" ; then
	    AC_DEFINE(HAVE_WINNT_IGNORE_VOID, 1,
		    [Defined when cygwin/mingw ignores VOID define in winnt.h])
	fi
    fi

	# See if the compiler supports casting to a union type.
	# This is used to stop gcc from printing a compiler
	# warning when initializing a union member.

	AC_CACHE_CHECK(for cast to union support,
	    tcl_cv_cast_to_union,
	    AC_TRY_COMPILE([],
	    [
		  union foo { int i; double d; };
		  union foo f = (union foo) (int) 0;
	    ],
	    tcl_cv_cast_to_union=yes,
	    tcl_cv_cast_to_union=no)
	)
	if test "$tcl_cv_cast_to_union" = "yes"; then
	    AC_DEFINE(HAVE_CAST_TO_UNION, 1,
		    [Defined when compiler supports casting to union type.])
	fi

    AC_SUBST(CFLAGS_DEBUG)
    AC_SUBST(CFLAGS_OPTIMIZE)
    AC_SUBST(CFLAGS_WARNING)
    AC_SUBST(CC_OBJNAME)

    AC_SUBST(STLIB_LD)
    AC_SUBST(SHLIB_LD)

    AC_SUBST(SHLIB_LD_LIBS)
    AC_SUBST(SHLIB_CFLAGS)

    AC_SUBST(LD_LIBRARY_PATH_VAR)

    # These must be called after we do the basic CFLAGS checks and
    # verify any possible 64-bit or similar switches are necessary
    TEA_TCL_EARLY_FLAGS
    TEA_TCL_64BIT_FLAGS
])

#--------------------------------------------------------------------
# TEA_SERIAL_PORT
#
#	Determine which interface to use to talk to the serial port.
#	Note that #include lines must begin in leftmost column for
#	some compilers to recognize them as preprocessor directives,
#	and some build environments have stdin not pointing at a
#	pseudo-terminal (usually /dev/null instead.)
#
# Arguments:
#	none
#
# Results:
#
#	Defines only one of the following vars:
#		HAVE_SYS_MODEM_H
#		USE_TERMIOS
#		USE_TERMIO
#		USE_SGTTY
#--------------------------------------------------------------------

AC_DEFUN([TEA_SERIAL_PORT], [
    AC_CHECK_HEADERS(sys/modem.h)
    AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
    AC_TRY_RUN([
#include <termios.h>

int main() {
    struct termios t;
    if (tcgetattr(0, &t) == 0) {
	cfsetospeed(&t, 0);
	t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
	return 0;
    }
    return 1;
}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
    if test $tcl_cv_api_serial = no ; then
	AC_TRY_RUN([
#include <termio.h>

int main() {
    struct termio t;
    if (ioctl(0, TCGETA, &t) == 0) {
	t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
	return 0;
    }
    return 1;
}], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
    fi
    if test $tcl_cv_api_serial = no ; then
	AC_TRY_RUN([
#include <sgtty.h>

int main() {
    struct sgttyb t;
    if (ioctl(0, TIOCGETP, &t) == 0) {
	t.sg_ospeed = 0;
	t.sg_flags |= ODDP | EVENP | RAW;
	return 0;
    }
    return 1;
}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
    fi
    if test $tcl_cv_api_serial = no ; then
	AC_TRY_RUN([
#include <termios.h>
#include <errno.h>

int main() {
    struct termios t;
    if (tcgetattr(0, &t) == 0
	|| errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
	cfsetospeed(&t, 0);
	t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
	return 0;
    }
    return 1;
}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
    fi
    if test $tcl_cv_api_serial = no; then
	AC_TRY_RUN([
#include <termio.h>
#include <errno.h>

int main() {
    struct termio t;
    if (ioctl(0, TCGETA, &t) == 0
	|| errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
	t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
	return 0;
    }
    return 1;
    }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
    fi
    if test $tcl_cv_api_serial = no; then
	AC_TRY_RUN([
#include <sgtty.h>
#include <errno.h>

int main() {
    struct sgttyb t;
    if (ioctl(0, TIOCGETP, &t) == 0
	|| errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
	t.sg_ospeed = 0;
	t.sg_flags |= ODDP | EVENP | RAW;
	return 0;
    }
    return 1;
}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
    fi])
    case $tcl_cv_api_serial in
	termios) AC_DEFINE(USE_TERMIOS, 1, [Use the termios API for serial lines]);;
	termio)  AC_DEFINE(USE_TERMIO, 1, [Use the termio API for serial lines]);;
	sgtty)   AC_DEFINE(USE_SGTTY, 1, [Use the sgtty API for serial lines]);;
    esac
])

#--------------------------------------------------------------------
# TEA_MISSING_POSIX_HEADERS
#
#	Supply substitutes for missing POSIX header files.  Special
#	notes:
#	    - stdlib.h doesn't define strtol, strtoul, or
#	      strtod in some versions of SunOS
#	    - some versions of string.h don't declare procedures such
#	      as strstr
#
# Arguments:
#	none
#
# Results:
#
#	Defines some of the following vars:
#		NO_DIRENT_H
#		NO_ERRNO_H
#		NO_VALUES_H
#		HAVE_LIMITS_H or NO_LIMITS_H
#		NO_STDLIB_H
#		NO_STRING_H
#		NO_SYS_WAIT_H
#		NO_DLFCN_H
#		HAVE_SYS_PARAM_H
#
#		HAVE_STRING_H ?
#
# tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and
# CHECK on limits.h
#--------------------------------------------------------------------

AC_DEFUN([TEA_MISSING_POSIX_HEADERS], [
    AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [
    AC_TRY_LINK([#include <sys/types.h>
#include <dirent.h>], [
#ifndef _POSIX_SOURCE
#   ifdef __Lynx__
	/*
	 * Generate compilation error to make the test fail:  Lynx headers
	 * are only valid if really in the POSIX environment.
	 */

	missing_procedure();
#   endif
#endif
DIR *d;
struct dirent *entryPtr;
char *p;
d = opendir("foobar");
entryPtr = readdir(d);
p = entryPtr->d_name;
closedir(d);
], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)])

    if test $tcl_cv_dirent_h = no; then
	AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?])
    fi

    # TEA specific:
    AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H, 1, [Do we have <errno.h>?])])
    AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have <float.h>?])])
    AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have <values.h>?])])
    AC_CHECK_HEADER(limits.h,
	[AC_DEFINE(HAVE_LIMITS_H, 1, [Do we have <limits.h>?])],
	[AC_DEFINE(NO_LIMITS_H, 1, [Do we have <limits.h>?])])
    AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
    AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
    AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
    AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
    if test $tcl_ok = 0; then
	AC_DEFINE(NO_STDLIB_H, 1, [Do we have <stdlib.h>?])
    fi
    AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
    AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
    AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)

    # See also memmove check below for a place where NO_STRING_H can be
    # set and why.

    if test $tcl_ok = 0; then
	AC_DEFINE(NO_STRING_H, 1, [Do we have <string.h>?])
    fi

    AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H, 1, [Do we have <sys/wait.h>?])])
    AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have <dlfcn.h>?])])

    # OS/390 lacks sys/param.h (and doesn't need it, by chance).
    AC_HAVE_HEADERS(sys/param.h)
])

#--------------------------------------------------------------------
# TEA_PATH_X
#
#	Locate the X11 header files and the X11 library archive.  Try
#	the ac_path_x macro first, but if it doesn't find the X stuff
#	(e.g. because there's no xmkmf program) then check through
#	a list of possible directories.  Under some conditions the
#	autoconf macro will return an include directory that contains
#	no include files, so double-check its result just to be safe.
#
#	This should be called after TEA_CONFIG_CFLAGS as setting the
#	LIBS line can confuse some configure macro magic.
#
# Arguments:
#	none
#
# Results:
#
#	Sets the following vars:
#		XINCLUDES
#		XLIBSW
#		PKG_LIBS (appends to)
#--------------------------------------------------------------------

AC_DEFUN([TEA_PATH_X], [
    if test "${TEA_WINDOWINGSYSTEM}" = "x11" -a "${TEA_USE_SDL}" != "yes" ; then
	TEA_PATH_UNIX_X
    fi
])

AC_DEFUN([TEA_PATH_UNIX_X], [
    AC_PATH_X
    not_really_there=""
    if test "$no_x" = ""; then
	if test "$x_includes" = ""; then
	    AC_TRY_CPP([#include <X11/Xlib.h>], , not_really_there="yes")
	else
	    if test ! -r $x_includes/X11/Xlib.h; then
		not_really_there="yes"
	    fi
	fi
    fi
    if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
	AC_MSG_CHECKING([for X11 header files])
	found_xincludes="no"
	AC_TRY_CPP([#include <X11/Xlib.h>], found_xincludes="yes", found_xincludes="no")
	if test "$found_xincludes" = "no"; then
	    dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
	    for i in $dirs ; do
		if test -r $i/X11/Xlib.h; then
		    AC_MSG_RESULT([$i])
		    XINCLUDES=" -I$i"
		    found_xincludes="yes"
		    break
		fi
	    done
	fi
    else
	if test "$x_includes" != ""; then
	    XINCLUDES="-I$x_includes"
	    found_xincludes="yes"
	fi
    fi
    if test "$found_xincludes" = "no"; then
	AC_MSG_RESULT([couldn't find any!])
    fi

    if test "$no_x" = yes; then
	AC_MSG_CHECKING([for X11 libraries])
	XLIBSW=nope
	dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
	for i in $dirs ; do
	    if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl -o -r $i/libX11.dylib; then
		AC_MSG_RESULT([$i])
		XLIBSW="-L$i -lX11"
		x_libraries="$i"
		break
	    fi
	done
    else
	if test "$x_libraries" = ""; then
	    XLIBSW=-lX11
	else
	    XLIBSW="-L$x_libraries -lX11"
	fi
    fi
    if test "$XLIBSW" = nope ; then
	AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
    fi
    if test "$XLIBSW" = nope ; then
	AC_MSG_RESULT([could not find any!  Using -lX11.])
	XLIBSW=-lX11
    fi
    # TEA specific:
    if test x"${XLIBSW}" != x ; then
	PKG_LIBS="${PKG_LIBS} ${XLIBSW}"
    fi
])

#--------------------------------------------------------------------
# TEA_BLOCKING_STYLE
#
#	The statements below check for systems where POSIX-style
#	non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
#	On these systems (mostly older ones), use the old BSD-style
#	FIONBIO approach instead.
#
# Arguments:
#	none
#
# Results:
#
#	Defines some of the following vars:
#		HAVE_SYS_IOCTL_H
#		HAVE_SYS_FILIO_H
#		USE_FIONBIO
#		O_NONBLOCK
#--------------------------------------------------------------------

AC_DEFUN([TEA_BLOCKING_STYLE], [
    AC_CHECK_HEADERS(sys/ioctl.h)
    AC_CHECK_HEADERS(sys/filio.h)
    TEA_CONFIG_SYSTEM
    AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
    case $system in
	OSF*)
	    AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
	    AC_MSG_RESULT([FIONBIO])
	    ;;
	*)
	    AC_MSG_RESULT([O_NONBLOCK])
	    ;;
    esac
])

#--------------------------------------------------------------------
# TEA_TIME_HANDLER
#
#	Checks how the system deals with time.h, what time structures
#	are used on the system, and what fields the structures have.
#
# Arguments:
#	none
#
# Results:
#
#	Defines some of the following vars:
#		USE_DELTA_FOR_TZ
#		HAVE_TM_GMTOFF
#		HAVE_TM_TZADJ
#		HAVE_TIMEZONE_VAR
#--------------------------------------------------------------------

AC_DEFUN([TEA_TIME_HANDLER], [
    AC_CHECK_HEADERS(sys/time.h)
    AC_HEADER_TIME
    AC_STRUCT_TIMEZONE

    AC_CHECK_FUNCS(gmtime_r localtime_r)

    AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
	AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
	    tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)])
    if test $tcl_cv_member_tm_tzadj = yes ; then
	AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?])
    fi

    AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
	AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
	    tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)])
    if test $tcl_cv_member_tm_gmtoff = yes ; then
	AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
    fi

    #
    # Its important to include time.h in this check, as some systems
    # (like convex) have timezone functions, etc.
    #
    AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
	AC_TRY_COMPILE([#include <time.h>],
	    [extern long timezone;
	    timezone += 1;
	    exit (0);],
	    tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)])
    if test $tcl_cv_timezone_long = yes ; then
	AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
    else
	#
	# On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
	#
	AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
	    AC_TRY_COMPILE([#include <time.h>],
		[extern time_t timezone;
		timezone += 1;
		exit (0);],
		tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)])
	if test $tcl_cv_timezone_time = yes ; then
	    AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
	fi
    fi
])

#--------------------------------------------------------------------
# TEA_BUGGY_STRTOD
#
#	Under Solaris 2.4, strtod returns the wrong value for the
#	terminating character under some conditions.  Check for this
#	and if the problem exists use a substitute procedure
#	"fixstrtod" (provided by Tcl) that corrects the error.
#	Also, on Compaq's Tru64 Unix 5.0,
#	strtod(" ") returns 0.0 instead of a failure to convert.
#
# Arguments:
#	none
#
# Results:
#
#	Might defines some of the following vars:
#		strtod (=fixstrtod)
#--------------------------------------------------------------------

AC_DEFUN([TEA_BUGGY_STRTOD], [
    AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
    if test "$tcl_strtod" = 1; then
	AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
	    AC_TRY_RUN([
		extern double strtod();
		int main() {
		    char *infString="Inf", *nanString="NaN", *spaceString=" ";
		    char *term;
		    double value;
		    value = strtod(infString, &term);
		    if ((term != infString) && (term[-1] == 0)) {
			exit(1);
		    }
		    value = strtod(nanString, &term);
		    if ((term != nanString) && (term[-1] == 0)) {
			exit(1);
		    }
		    value = strtod(spaceString, &term);
		    if (term == (spaceString+1)) {
			exit(1);
		    }
		    exit(0);
		}], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
		    tcl_cv_strtod_buggy=buggy)])
	if test "$tcl_cv_strtod_buggy" = buggy; then
	    AC_LIBOBJ([fixstrtod])
	    USE_COMPAT=1
	    AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?])
	fi
    fi
])

#--------------------------------------------------------------------
# TEA_TCL_LINK_LIBS
#
#	Search for the libraries needed to link the Tcl shell.
#	Things like the math library (-lm) and socket stuff (-lsocket vs.
#	-lnsl) are dealt with here.
#
# Arguments:
#	Requires the following vars to be set in the Makefile:
#		DL_LIBS (not in TEA, only needed in core)
#		LIBS
#		MATH_LIBS
#
# Results:
#
#	Substitutes the following vars:
#		TCL_LIBS
#		MATH_LIBS
#
#	Might append to the following vars:
#		LIBS
#
#	Might define the following vars:
#		HAVE_NET_ERRNO_H
#--------------------------------------------------------------------

AC_DEFUN([TEA_TCL_LINK_LIBS], [
    #--------------------------------------------------------------------
    # On a few very rare systems, all of the libm.a stuff is
    # already in libc.a.  Set compiler flags accordingly.
    # Also, Linux requires the "ieee" library for math to work
    # right (and it must appear before "-lm").
    #--------------------------------------------------------------------

    AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
    AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])

    #--------------------------------------------------------------------
    # Interactive UNIX requires -linet instead of -lsocket, plus it
    # needs net/errno.h to define the socket-related error codes.
    #--------------------------------------------------------------------

    AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
    AC_CHECK_HEADER(net/errno.h, [
	AC_DEFINE(HAVE_NET_ERRNO_H, 1, [Do we have <net/errno.h>?])])

    #--------------------------------------------------------------------
    #	Check for the existence of the -lsocket and -lnsl libraries.
    #	The order here is important, so that they end up in the right
    #	order in the command line generated by make.  Here are some
    #	special considerations:
    #	1. Use "connect" and "accept" to check for -lsocket, and
    #	   "gethostbyname" to check for -lnsl.
    #	2. Use each function name only once:  can't redo a check because
    #	   autoconf caches the results of the last check and won't redo it.
    #	3. Use -lnsl and -lsocket only if they supply procedures that
    #	   aren't already present in the normal libraries.  This is because
    #	   IRIX 5.2 has libraries, but they aren't needed and they're
    #	   bogus:  they goof up name resolution if used.
    #	4. On some SVR4 systems, can't use -lsocket without -lnsl too.
    #	   To get around this problem, check for both libraries together
    #	   if -lsocket doesn't work by itself.
    #--------------------------------------------------------------------

    tcl_checkBoth=0
    AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
    if test "$tcl_checkSocket" = 1; then
	AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
	    LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
    fi
    if test "$tcl_checkBoth" = 1; then
	tk_oldLibs=$LIBS
	LIBS="$LIBS -lsocket -lnsl"
	AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
    fi
    AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
	    [LIBS="$LIBS -lnsl"])])

    # TEA specific: Don't perform the eval of the libraries here because
    # DL_LIBS won't be set until we call TEA_CONFIG_CFLAGS

    TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
    AC_SUBST(TCL_LIBS)
    AC_SUBST(MATH_LIBS)
])

#--------------------------------------------------------------------
# TEA_TCL_EARLY_FLAGS
#
#	Check for what flags are needed to be passed so the correct OS
#	features are available.
#
# Arguments:
#	None
#
# Results:
#
#	Might define the following vars:
#		_ISOC99_SOURCE
#		_LARGEFILE64_SOURCE
#		_LARGEFILE_SOURCE64
#--------------------------------------------------------------------

AC_DEFUN([TEA_TCL_EARLY_FLAG],[
    AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
	AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
	    AC_TRY_COMPILE([[#define ]$1[ 1
]$2], $3,
		[tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
		[tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
    if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
	AC_DEFINE($1, 1, [Add the ]$1[ flag when building])
	tcl_flags="$tcl_flags $1"
    fi
])

AC_DEFUN([TEA_TCL_EARLY_FLAGS],[
    AC_MSG_CHECKING([for required early compiler flags])
    tcl_flags=""
    TEA_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
	[char *p = (char *)strtoll; char *q = (char *)strtoull;])
    TEA_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
	[struct stat64 buf; int i = stat64("/", &buf);])
    TEA_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
	[char *p = (char *)open64;])
    if test "x${tcl_flags}" = "x" ; then
	AC_MSG_RESULT([none])
    else
	AC_MSG_RESULT([${tcl_flags}])
    fi
])

#--------------------------------------------------------------------
# TEA_TCL_64BIT_FLAGS
#
#	Check for what is defined in the way of 64-bit features.
#
# Arguments:
#	None
#
# Results:
#
#	Might define the following vars:
#		TCL_WIDE_INT_IS_LONG
#		TCL_WIDE_INT_TYPE
#		HAVE_STRUCT_DIRENT64
#		HAVE_STRUCT_STAT64
#		HAVE_TYPE_OFF64_T
#--------------------------------------------------------------------

AC_DEFUN([TEA_TCL_64BIT_FLAGS], [
    AC_MSG_CHECKING([for 64-bit integer type])
    AC_CACHE_VAL(tcl_cv_type_64bit,[
	tcl_cv_type_64bit=none
	# See if the compiler knows natively about __int64
	AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
	    tcl_type_64bit=__int64, tcl_type_64bit="long long")
	# See if we should use long anyway  Note that we substitute in the
	# type that is our current guess for a 64-bit type inside this check
	# program, so it should be modified only carefully...
        AC_TRY_COMPILE(,[switch (0) {
            case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ;
        }],tcl_cv_type_64bit=${tcl_type_64bit})])
    if test "${tcl_cv_type_64bit}" = none ; then
	AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Are wide integers to be implemented with C 'long's?])
	AC_MSG_RESULT([using long])
    elif test "${tcl_cv_type_64bit}" = "__int64" \
		-a "${TEA_PLATFORM}" = "windows" ; then
	# TEA specific: We actually want to use the default tcl.h checks in
	# this case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER*
	AC_MSG_RESULT([using Tcl header defaults])
    else
	AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
	    [What type should be used to define wide integers?])
	AC_MSG_RESULT([${tcl_cv_type_64bit}])

	# Now check for auxiliary declarations
	AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
	    AC_TRY_COMPILE([#include <sys/types.h>
#include <dirent.h>],[struct dirent64 p;],
		tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
	if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
	    AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?])
	fi

	AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
	    AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
],
		tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
	if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
	    AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?])
	fi

	AC_CHECK_FUNCS(open64 lseek64)
	AC_MSG_CHECKING([for off64_t])
	AC_CACHE_VAL(tcl_cv_type_off64_t,[
	    AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
],
		tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
	dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
	dnl functions lseek64 and open64 are defined.
	if test "x${tcl_cv_type_off64_t}" = "xyes" && \
	        test "x${ac_cv_func_lseek64}" = "xyes" && \
	        test "x${ac_cv_func_open64}" = "xyes" ; then
	    AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?])
	    AC_MSG_RESULT([yes])
	else
	    AC_MSG_RESULT([no])
	fi
    fi
])

##
## Here ends the standard Tcl configuration bits and starts the
## TEA specific functions
##

#------------------------------------------------------------------------
# TEA_INIT --
#
#	Init various Tcl Extension Architecture (TEA) variables.
#	This should be the first called TEA_* macro.
#
# Arguments:
#	none
#
# Results:
#
#	Defines and substs the following vars:
#		CYGPATH
#		EXEEXT
#	Defines only:
#		TEA_VERSION
#		TEA_INITED
#		TEA_PLATFORM (windows or unix)
#
# "cygpath" is used on windows to generate native path names for include
# files. These variables should only be used with the compiler and linker
# since they generate native path names.
#
# EXEEXT
#	Select the executable extension based on the host type.  This
#	is a lightweight replacement for AC_EXEEXT that doesn't require
#	a compiler.
#------------------------------------------------------------------------

AC_DEFUN([TEA_INIT], [
    # TEA extensions pass this us the version of TEA they think they
    # are compatible with.
    TEA_VERSION="3.9"

    AC_MSG_CHECKING([for correct TEA configuration])
    if test x"${PACKAGE_NAME}" = x ; then
	AC_MSG_ERROR([
The PACKAGE_NAME variable must be defined by your TEA configure.in])
    fi
    if test x"$1" = x ; then
	AC_MSG_ERROR([
TEA version not specified.])
    elif test "$1" != "${TEA_VERSION}" ; then
	AC_MSG_RESULT([warning: requested TEA version "$1", have "${TEA_VERSION}"])
    else
	AC_MSG_RESULT([ok (TEA ${TEA_VERSION})])
    fi

    # If the user did not set CFLAGS, set it now to keep macros
    # like AC_PROG_CC and AC_TRY_COMPILE from adding "-g -O2".
    if test "${CFLAGS+set}" != "set" ; then
	CFLAGS=""
    fi

    case "`uname -s`" in
	*win32*|*WIN32*|*MINGW32_*)
	    AC_CHECK_PROG(CYGPATH, cygpath, cygpath -w, echo)
	    EXEEXT=".exe"
	    TEA_PLATFORM="windows"
	    ;;
	*CYGWIN_*)
	    CYGPATH=echo
	    EXEEXT=".exe"
	    # TEA_PLATFORM is determined later in LOAD_TCLCONFIG
	    ;;
	*)
	    CYGPATH=echo
	    # Maybe we are cross-compiling....
	    case ${host_alias} in
		*mingw32*)
		EXEEXT=".exe"
		TEA_PLATFORM="windows"
		;;
	    *)
		EXEEXT=""
		TEA_PLATFORM="unix"
		;;
	    esac
	    ;;
    esac

    # Check if exec_prefix is set. If not use fall back to prefix.
    # Note when adjusted, so that TEA_PREFIX can correct for this.
    # This is needed for recursive configures, since autoconf propagates
    # $prefix, but not $exec_prefix (doh!).
    if test x$exec_prefix = xNONE ; then
	exec_prefix_default=yes
	exec_prefix=$prefix
    fi

    AC_MSG_NOTICE([configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}])

    AC_SUBST(EXEEXT)
    AC_SUBST(CYGPATH)

    # This package name must be replaced statically for AC_SUBST to work
    AC_SUBST(PKG_LIB_FILE)
    # Substitute STUB_LIB_FILE in case package creates a stub library too.
    AC_SUBST(PKG_STUB_LIB_FILE)

    # We AC_SUBST these here to ensure they are subst'ed,
    # in case the user doesn't call TEA_ADD_...
    AC_SUBST(PKG_STUB_SOURCES)
    AC_SUBST(PKG_STUB_OBJECTS)
    AC_SUBST(PKG_TCL_SOURCES)
    AC_SUBST(PKG_HEADERS)
    AC_SUBST(PKG_INCLUDES)
    AC_SUBST(PKG_LIBS)
    AC_SUBST(PKG_CFLAGS)
])

#------------------------------------------------------------------------
# TEA_ADD_SOURCES --
#
#	Specify one or more source files.  Users should check for
#	the right platform before adding to their list.
#	It is not important to specify the directory, as long as it is
#	in the generic, win or unix subdirectory of $(srcdir).
#
# Arguments:
#	one or more file names
#
# Results:
#
#	Defines and substs the following vars:
#		PKG_SOURCES
#		PKG_OBJECTS
#------------------------------------------------------------------------
AC_DEFUN([TEA_ADD_SOURCES], [
    vars="$@"
    for i in $vars; do
	case $i in
	    [\$]*)
		# allow $-var names
		PKG_SOURCES="$PKG_SOURCES $i"
		PKG_OBJECTS="$PKG_OBJECTS $i"
		;;
	    *)
		# check for existence - allows for generic/win/unix VPATH
		# To add more dirs here (like 'src'), you have to update VPATH
		# in Makefile.in as well
		if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
		    -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
		    -a ! -f "${srcdir}/macosx/$i" -a ! -f "${srcdir}/sdl/$i" \
		    ; then
		    AC_MSG_ERROR([could not find source file '$i'])
		fi
		PKG_SOURCES="$PKG_SOURCES $i"
		# this assumes it is in a VPATH dir
		i=`basename $i`
		# handle user calling this before or after TEA_SETUP_COMPILER
		if test x"${OBJEXT}" != x ; then
		    j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
		else
		    j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
		fi
		PKG_OBJECTS="$PKG_OBJECTS $j"
		;;
	esac
    done
    AC_SUBST(PKG_SOURCES)
    AC_SUBST(PKG_OBJECTS)
])

#------------------------------------------------------------------------
# TEA_ADD_STUB_SOURCES --
#
#	Specify one or more source files.  Users should check for
#	the right platform before adding to their list.
#	It is not important to specify the directory, as long as it is
#	in the generic, win or unix subdirectory of $(srcdir).
#
# Arguments:
#	one or more file names
#
# Results:
#
#	Defines and substs the following vars:
#		PKG_STUB_SOURCES
#		PKG_STUB_OBJECTS
#------------------------------------------------------------------------
AC_DEFUN([TEA_ADD_STUB_SOURCES], [
    vars="$@"
    for i in $vars; do
	# check for existence - allows for generic/win/unix VPATH
	if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
	    -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
	    -a ! -f "${srcdir}/macosx/$i" -a ! -f "${srcdir}/sdl/$i" \
	    ; then
	    AC_MSG_ERROR([could not find stub source file '$i'])
	fi
	PKG_STUB_SOURCES="$PKG_STUB_SOURCES $i"
	# this assumes it is in a VPATH dir
	i=`basename $i`
	# handle user calling this before or after TEA_SETUP_COMPILER
	if test x"${OBJEXT}" != x ; then
	    j="`echo $i | sed -e 's/\.[[^.]]*$//'`.${OBJEXT}"
	else
	    j="`echo $i | sed -e 's/\.[[^.]]*$//'`.\${OBJEXT}"
	fi
	PKG_STUB_OBJECTS="$PKG_STUB_OBJECTS $j"
    done
    AC_SUBST(PKG_STUB_SOURCES)
    AC_SUBST(PKG_STUB_OBJECTS)
])

#------------------------------------------------------------------------
# TEA_ADD_TCL_SOURCES --
#
#	Specify one or more Tcl source files.  These should be platform
#	independent runtime files.
#
# Arguments:
#	one or more file names
#
# Results:
#
#	Defines and substs the following vars:
#		PKG_TCL_SOURCES
#------------------------------------------------------------------------
AC_DEFUN([TEA_ADD_TCL_SOURCES], [
    vars="$@"
    for i in $vars; do
	# check for existence, be strict because it is installed
	if test ! -f "${srcdir}/$i" ; then
	    AC_MSG_ERROR([could not find tcl source file '${srcdir}/$i'])
	fi
	PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i"
    done
    AC_SUBST(PKG_TCL_SOURCES)
])

#------------------------------------------------------------------------
# TEA_ADD_HEADERS --
#
#	Specify one or more source headers.  Users should check for
#	the right platform before adding to their list.
#
# Arguments:
#	one or more file names
#
# Results:
#
#	Defines and substs the following vars:
#		PKG_HEADERS
#------------------------------------------------------------------------
AC_DEFUN([TEA_ADD_HEADERS], [
    vars="$@"
    for i in $vars; do
	# check for existence, be strict because it is installed
	if test ! -f "${srcdir}/$i" ; then
	    AC_MSG_ERROR([could not find header file '${srcdir}/$i'])
	fi
	PKG_HEADERS="$PKG_HEADERS $i"
    done
    AC_SUBST(PKG_HEADERS)
])

#------------------------------------------------------------------------
# TEA_ADD_INCLUDES --
#
#	Specify one or more include dirs.  Users should check for
#	the right platform before adding to their list.
#
# Arguments:
#	one or more file names
#
# Results:
#
#	Defines and substs the following vars:
#		PKG_INCLUDES
#------------------------------------------------------------------------
AC_DEFUN([TEA_ADD_INCLUDES], [
    vars="$@"
    for i in $vars; do
	PKG_INCLUDES="$PKG_INCLUDES $i"
    done
    AC_SUBST(PKG_INCLUDES)
])

#------------------------------------------------------------------------
# TEA_ADD_LIBS --
#
#	Specify one or more libraries.  Users should check for
#	the right platform before adding to their list.  For Windows,
#	libraries provided in "foo.lib" format will be converted to
#	"-lfoo" when using GCC (mingw).
#
# Arguments:
#	one or more file names
#
# Results:
#
#	Defines and substs the following vars:
#		PKG_LIBS
#------------------------------------------------------------------------
AC_DEFUN([TEA_ADD_LIBS], [
    vars="$@"
    for i in $vars; do
	if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
	    # Convert foo.lib to -lfoo for GCC.  No-op if not *.lib
	    i=`echo "$i" | sed -e 's/^\([[^-]].*\)\.lib[$]/-l\1/i'`
	fi
	PKG_LIBS="$PKG_LIBS $i"
    done
    AC_SUBST(PKG_LIBS)
])

#------------------------------------------------------------------------
# TEA_ADD_CFLAGS --
#
#	Specify one or more CFLAGS.  Users should check for
#	the right platform before adding to their list.
#
# Arguments:
#	one or more file names
#
# Results:
#
#	Defines and substs the following vars:
#		PKG_CFLAGS
#------------------------------------------------------------------------
AC_DEFUN([TEA_ADD_CFLAGS], [
    PKG_CFLAGS="$PKG_CFLAGS $@"
    AC_SUBST(PKG_CFLAGS)
])

#------------------------------------------------------------------------
# TEA_ADD_CLEANFILES --
#
#	Specify one or more CLEANFILES.
#
# Arguments:
#	one or more file names to clean target
#
# Results:
#
#	Appends to CLEANFILES, already defined for subst in LOAD_TCLCONFIG
#------------------------------------------------------------------------
AC_DEFUN([TEA_ADD_CLEANFILES], [
    CLEANFILES="$CLEANFILES $@"
])

#------------------------------------------------------------------------
# TEA_PREFIX --
#
#	Handle the --prefix=... option by defaulting to what Tcl gave
#
# Arguments:
#	none
#
# Results:
#
#	If --prefix or --exec-prefix was not specified, $prefix and
#	$exec_prefix will be set to the values given to Tcl when it was
#	configured.
#------------------------------------------------------------------------
AC_DEFUN([TEA_PREFIX], [
    if test "${prefix}" = "NONE"; then
	prefix_default=yes
	if test x"${TCL_PREFIX}" != x; then
	    AC_MSG_NOTICE([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}])
	    prefix=${TCL_PREFIX}
	else
	    AC_MSG_NOTICE([--prefix defaulting to /usr/local])
	    prefix=/usr/local
	fi
    fi
    if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \
	-o x"${exec_prefix_default}" = x"yes" ; then
	if test x"${TCL_EXEC_PREFIX}" != x; then
	    AC_MSG_NOTICE([--exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}])
	    exec_prefix=${TCL_EXEC_PREFIX}
	else
	    AC_MSG_NOTICE([--exec-prefix defaulting to ${prefix}])
	    exec_prefix=$prefix
	fi
    fi
])

#------------------------------------------------------------------------
# TEA_SETUP_COMPILER_CC --
#
#	Do compiler checks the way we want.  This is just a replacement
#	for AC_PROG_CC in TEA configure.in files to make them cleaner.
#
# Arguments:
#	none
#
# Results:
#
#	Sets up CC var and other standard bits we need to make executables.
#------------------------------------------------------------------------
AC_DEFUN([TEA_SETUP_COMPILER_CC], [
    # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE)
    # in this macro, they need to go into TEA_SETUP_COMPILER instead.

    AC_PROG_CC
    AC_PROG_CPP

    INSTALL="\$(SHELL) \$(srcdir)/tclconfig/install-sh -c"
    AC_SUBST(INSTALL)
    INSTALL_DATA="\${INSTALL} -m 644"
    AC_SUBST(INSTALL_DATA)
    INSTALL_PROGRAM="\${INSTALL}"
    AC_SUBST(INSTALL_PROGRAM)
    INSTALL_SCRIPT="\${INSTALL}"
    AC_SUBST(INSTALL_SCRIPT)

    #--------------------------------------------------------------------
    # Checks to see if the make program sets the $MAKE variable.
    #--------------------------------------------------------------------

    AC_PROG_MAKE_SET

    #--------------------------------------------------------------------
    # Find ranlib
    #--------------------------------------------------------------------

    AC_CHECK_TOOL(RANLIB, ranlib)

    #--------------------------------------------------------------------
    # Determines the correct binary file extension (.o, .obj, .exe etc.)
    #--------------------------------------------------------------------

    AC_OBJEXT
    AC_EXEEXT
])

#------------------------------------------------------------------------
# TEA_SETUP_COMPILER --
#
#	Do compiler checks that use the compiler.  This must go after
#	TEA_SETUP_COMPILER_CC, which does the actual compiler check.
#
# Arguments:
#	none
#
# Results:
#
#	Sets up CC var and other standard bits we need to make executables.
#------------------------------------------------------------------------
AC_DEFUN([TEA_SETUP_COMPILER], [
    # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here.
    AC_REQUIRE([TEA_SETUP_COMPILER_CC])

    #------------------------------------------------------------------------
    # If we're using GCC, see if the compiler understands -pipe. If so, use it.
    # It makes compiling go faster.  (This is only a performance feature.)
    #------------------------------------------------------------------------

    if test -z "$no_pipe" -a -n "$GCC"; then
	AC_CACHE_CHECK([if the compiler understands -pipe],
	    tcl_cv_cc_pipe, [
	    hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
	    AC_TRY_COMPILE(,, tcl_cv_cc_pipe=yes, tcl_cv_cc_pipe=no)
	    CFLAGS=$hold_cflags])
	if test $tcl_cv_cc_pipe = yes; then
	    CFLAGS="$CFLAGS -pipe"
	fi
    fi

    #--------------------------------------------------------------------
    # Common compiler flag setup
    #--------------------------------------------------------------------

    AC_C_BIGENDIAN
    if test "${TEA_PLATFORM}" = "unix" ; then
	TEA_TCL_LINK_LIBS
	TEA_MISSING_POSIX_HEADERS
	# Let the user call this, because if it triggers, they will
	# need a compat/strtod.c that is correct.  Users can also
	# use Tcl_GetDouble(FromObj) instead.
	#TEA_BUGGY_STRTOD
    fi
])

#------------------------------------------------------------------------
# TEA_MAKE_LIB --
#
#	Generate a line that can be used to build a shared/unshared library
#	in a platform independent manner.
#
# Arguments:
#	none
#
#	Requires:
#
# Results:
#
#	Defines the following vars:
#	CFLAGS -	Done late here to note disturb other AC macros
#       MAKE_LIB -      Command to execute to build the Tcl library;
#                       differs depending on whether or not Tcl is being
#                       compiled as a shared library.
#	MAKE_SHARED_LIB	Makefile rule for building a shared library
#	MAKE_STATIC_LIB	Makefile rule for building a static library
#	MAKE_STUB_LIB	Makefile rule for building a stub library
#	VC_MANIFEST_EMBED_DLL Makefile rule for embedded VC manifest in DLL
#	VC_MANIFEST_EMBED_EXE Makefile rule for embedded VC manifest in EXE
#------------------------------------------------------------------------

AC_DEFUN([TEA_MAKE_LIB], [
    if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then
	MAKE_STATIC_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)"
	MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS)"
	AC_EGREP_CPP([manifest needed], [
#if defined(_MSC_VER) && _MSC_VER >= 1400
print("manifest needed")
#endif
	], [
	# Could do a CHECK_PROG for mt, but should always be with MSVC8+
	VC_MANIFEST_EMBED_DLL="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;2 ; fi"
	VC_MANIFEST_EMBED_EXE="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;1 ; fi"
	MAKE_SHARED_LIB="${MAKE_SHARED_LIB} ; ${VC_MANIFEST_EMBED_DLL}"

	# Don't clean .manifest provided by the package (see TEA_ADD_MANIFEST)
	# or one created by Makefile or configure.  Could use the /manifest:filename
	# linker option to explicitly set the linker-generated filename.
	eval eval "manifest=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}.manifest"
	TEA_ADD_CLEANFILES([$manifest])
	])
	MAKE_STUB_LIB="\${STLIB_LD} -nodefaultlib -out:\[$]@ \$(PKG_STUB_OBJECTS)"
    else
	MAKE_STATIC_LIB="\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)"
	MAKE_SHARED_LIB="\${SHLIB_LD} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
	MAKE_STUB_LIB="\${STLIB_LD} \[$]@ \$(PKG_STUB_OBJECTS)"
    fi

    if test "${SHARED_BUILD}" = "1" ; then
	MAKE_LIB="${MAKE_SHARED_LIB} "
    else
	MAKE_LIB="${MAKE_STATIC_LIB} "
    fi

    #--------------------------------------------------------------------
    # Shared libraries and static libraries have different names.
    # Use the double eval to make sure any variables in the suffix is
    # substituted. (@@@ Might not be necessary anymore)
    #--------------------------------------------------------------------

    if test "${TEA_PLATFORM}" = "windows" ; then
	if test "${SHARED_BUILD}" = "1" ; then
	    # We force the unresolved linking of symbols that are really in
	    # the private libraries of Tcl and Tk.
	    if test x"${TK_BIN_DIR}" != x ; then
		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
	    fi
	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
	    if test "$GCC" = "yes"; then
		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -static-libgcc"
	    fi
	    eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
	else
	    eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
	    if test "$GCC" = "yes"; then
		PKG_LIB_FILE=lib${PKG_LIB_FILE}
	    fi
	fi
	# Some packages build their own stubs libraries
	eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
	if test "$GCC" = "yes"; then
	    PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
	fi
	# These aren't needed on Windows (either MSVC or gcc)
	RANLIB=:
	RANLIB_STUB=:
    else
	RANLIB_STUB="${RANLIB}"
	if test "${SHARED_BUILD}" = "1" ; then
	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
	    if test x"${TK_BIN_DIR}" != x ; then
		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
	    fi
	    eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
	    RANLIB=:
	else
	    eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
	fi
	# Some packages build their own stubs libraries
	eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
    fi

    # These are escaped so that only CFLAGS is picked up at configure time.
    # The other values will be substituted at make time.
    CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
    if test "${SHARED_BUILD}" = "1" ; then
	CFLAGS="${CFLAGS} \${SHLIB_CFLAGS}"
    fi

    AC_SUBST(MAKE_LIB)
    AC_SUBST(MAKE_SHARED_LIB)
    AC_SUBST(MAKE_STATIC_LIB)
    AC_SUBST(MAKE_STUB_LIB)
    AC_SUBST(RANLIB_STUB)
    AC_SUBST(VC_MANIFEST_EMBED_DLL)
    AC_SUBST(VC_MANIFEST_EMBED_EXE)
])

#------------------------------------------------------------------------
# TEA_LIB_SPEC --
#
#	Compute the name of an existing object library located in libdir
#	from the given base name and produce the appropriate linker flags.
#
# Arguments:
#	basename	The base name of the library without version
#			numbers, extensions, or "lib" prefixes.
#	extra_dir	Extra directory in which to search for the
#			library.  This location is used first, then
#			$prefix/$exec-prefix, then some defaults.
#
# Requires:
#	TEA_INIT and TEA_PREFIX must be called first.
#
# Results:
#
#	Defines the following vars:
#		${basename}_LIB_NAME	The computed library name.
#		${basename}_LIB_SPEC	The computed linker flags.
#------------------------------------------------------------------------

AC_DEFUN([TEA_LIB_SPEC], [
    AC_MSG_CHECKING([for $1 library])

    # Look in exec-prefix for the library (defined by TEA_PREFIX).

    tea_lib_name_dir="${exec_prefix}/lib"

    # Or in a user-specified location.

    if test x"$2" != x ; then
	tea_extra_lib_dir=$2
    else
	tea_extra_lib_dir=NONE
    fi

    for i in \
	    `ls -dr ${tea_extra_lib_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
	    `ls -dr ${tea_extra_lib_dir}/lib$1[[0-9]]* 2>/dev/null ` \
	    `ls -dr ${tea_lib_name_dir}/$1[[0-9]]*.lib 2>/dev/null ` \
	    `ls -dr ${tea_lib_name_dir}/lib$1[[0-9]]* 2>/dev/null ` \
	    `ls -dr /usr/lib/$1[[0-9]]*.lib 2>/dev/null ` \
	    `ls -dr /usr/lib/lib$1[[0-9]]* 2>/dev/null ` \
	    `ls -dr /usr/lib64/$1[[0-9]]*.lib 2>/dev/null ` \
	    `ls -dr /usr/lib64/lib$1[[0-9]]* 2>/dev/null ` \
	    `ls -dr /usr/local/lib/$1[[0-9]]*.lib 2>/dev/null ` \
	    `ls -dr /usr/local/lib/lib$1[[0-9]]* 2>/dev/null ` ; do
	if test -f "$i" ; then
	    tea_lib_name_dir=`dirname $i`
	    $1_LIB_NAME=`basename $i`
	    $1_LIB_PATH_NAME=$i
	    break
	fi
    done

    if test "${TEA_PLATFORM}" = "windows"; then
	$1_LIB_SPEC=\"`${CYGPATH} ${$1_LIB_PATH_NAME} 2>/dev/null`\"
    else
	# Strip off the leading "lib" and trailing ".a" or ".so"

	tea_lib_name_lib=`echo ${$1_LIB_NAME}|sed -e 's/^lib//' -e 's/\.[[^.]]*$//' -e 's/\.so.*//'`
	$1_LIB_SPEC="-L${tea_lib_name_dir} -l${tea_lib_name_lib}"
    fi

    if test "x${$1_LIB_NAME}" = x ; then
	AC_MSG_ERROR([not found])
    else
	AC_MSG_RESULT([${$1_LIB_SPEC}])
    fi
])

#------------------------------------------------------------------------
# TEA_PRIVATE_TCL_HEADERS --
#
#	Locate the private Tcl include files
#
# Arguments:
#
#	Requires:
#		TCL_SRC_DIR	Assumes that TEA_LOAD_TCLCONFIG has
#				already been called.
#
# Results:
#
#	Substitutes the following vars:
#		TCL_TOP_DIR_NATIVE
#		TCL_INCLUDES
#------------------------------------------------------------------------

AC_DEFUN([TEA_PRIVATE_TCL_HEADERS], [
    # Allow for --with-tclinclude to take effect and define ${ac_cv_c_tclh}
    AC_REQUIRE([TEA_PUBLIC_TCL_HEADERS])
    AC_MSG_CHECKING([for Tcl private include files])

    TCL_SRC_DIR_NATIVE=`${CYGPATH} ${TCL_SRC_DIR}`
    TCL_TOP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}\"

    # Check to see if tcl<Plat>Port.h isn't already with the public headers
    # Don't look for tclInt.h because that resides with tcl.h in the core
    # sources, but the <plat>Port headers are in a different directory
    if test "${TEA_PLATFORM}" = "windows" -a \
	-f "${ac_cv_c_tclh}/tclWinPort.h"; then
	result="private headers found with public headers"
    elif test "${TEA_PLATFORM}" = "unix" -a \
	-f "${ac_cv_c_tclh}/tclUnixPort.h"; then
	result="private headers found with public headers"
    else
	TCL_GENERIC_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/generic\"
	if test "${TEA_PLATFORM}" = "windows"; then
	    TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/win\"
	else
	    TCL_PLATFORM_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/unix\"
	fi
	# Overwrite the previous TCL_INCLUDES as this should capture both
	# public and private headers in the same set.
	# We want to ensure these are substituted so as not to require
	# any *_NATIVE vars be defined in the Makefile
	TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}"
	if test "`uname -s`" = "Darwin"; then
            # If Tcl was built as a framework, attempt to use
            # the framework's Headers and PrivateHeaders directories
            case ${TCL_DEFS} in
	    	*TCL_FRAMEWORK*)
		    if test -d "${TCL_BIN_DIR}/Headers" -a \
			    -d "${TCL_BIN_DIR}/PrivateHeaders"; then
			TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"
		    else
			TCL_INCLUDES="${TCL_INCLUDES} ${TCL_INCLUDE_SPEC} `echo "${TCL_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
		    fi
	            ;;
	    esac
	    result="Using ${TCL_INCLUDES}"
	else
	    if test ! -f "${TCL_SRC_DIR}/generic/tclInt.h" ; then
		AC_MSG_ERROR([Cannot find private header tclInt.h in ${TCL_SRC_DIR}])
	    fi
	    result="Using srcdir found in tclConfig.sh: ${TCL_SRC_DIR}"
	fi
    fi

    AC_SUBST(TCL_TOP_DIR_NATIVE)

    AC_SUBST(TCL_INCLUDES)
    AC_MSG_RESULT([${result}])
])

#------------------------------------------------------------------------
# TEA_PUBLIC_TCL_HEADERS --
#
#	Locate the installed public Tcl header files
#
# Arguments:
#	None.
#
# Requires:
#	CYGPATH must be set
#
# Results:
#
#	Adds a --with-tclinclude switch to configure.
#	Result is cached.
#
#	Substitutes the following vars:
#		TCL_INCLUDES
#------------------------------------------------------------------------

AC_DEFUN([TEA_PUBLIC_TCL_HEADERS], [
    AC_MSG_CHECKING([for Tcl public headers])

    AC_ARG_WITH(tclinclude, [  --with-tclinclude       directory containing the public Tcl header files], with_tclinclude=${withval})

    AC_CACHE_VAL(ac_cv_c_tclh, [
	# Use the value from --with-tclinclude, if it was given

	if test x"${with_tclinclude}" != x ; then
	    if test -f "${with_tclinclude}/tcl.h" ; then
		ac_cv_c_tclh=${with_tclinclude}
	    else
		AC_MSG_ERROR([${with_tclinclude} directory does not contain tcl.h])
	    fi
	else
	    list=""
	    if test "`uname -s`" = "Darwin"; then
		# If Tcl was built as a framework, attempt to use
		# the framework's Headers directory
		case ${TCL_DEFS} in
		    *TCL_FRAMEWORK*)
			list="`ls -d ${TCL_BIN_DIR}/Headers 2>/dev/null`"
			;;
		esac
	    fi

	    # Look in the source dir only if Tcl is not installed,
	    # and in that situation, look there before installed locations.
	    if test -f "${TCL_BIN_DIR}/Makefile" ; then
		list="$list `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`"
	    fi

	    # Check order: pkg --prefix location, Tcl's --prefix location,
	    # relative to directory of tclConfig.sh.

	    eval "temp_includedir=${includedir}"
	    list="$list \
		`ls -d ${temp_includedir}        2>/dev/null` \
		`ls -d ${TCL_PREFIX}/include     2>/dev/null` \
		`ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
	    if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
		list="$list /usr/local/include /usr/include"
		if test x"${TCL_INCLUDE_SPEC}" != x ; then
		    d=`echo "${TCL_INCLUDE_SPEC}" | sed -e 's/^-I//'`
		    list="$list `ls -d ${d} 2>/dev/null`"
		fi
	    fi
	    for i in $list ; do
		if test -f "$i/tcl.h" ; then
		    ac_cv_c_tclh=$i
		    break
		fi
	    done
	fi
    ])

    # Print a message based on how we determined the include path

    if test x"${ac_cv_c_tclh}" = x ; then
	AC_MSG_ERROR([tcl.h not found.  Please specify its location with --with-tclinclude])
    else
	AC_MSG_RESULT([${ac_cv_c_tclh}])
    fi

    # Convert to a native path and substitute into the output files.

    INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclh}`

    TCL_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"

    AC_SUBST(TCL_INCLUDES)
])

#------------------------------------------------------------------------
# TEA_PRIVATE_TK_HEADERS --
#
#	Locate the private Tk include files
#
# Arguments:
#
#	Requires:
#		TK_SRC_DIR	Assumes that TEA_LOAD_TKCONFIG has
#				 already been called.
#
# Results:
#
#	Substitutes the following vars:
#		TK_INCLUDES
#------------------------------------------------------------------------

AC_DEFUN([TEA_PRIVATE_TK_HEADERS], [
    # Allow for --with-tkinclude to take effect and define ${ac_cv_c_tkh}
    AC_REQUIRE([TEA_PUBLIC_TK_HEADERS])
    AC_MSG_CHECKING([for Tk private include files])

    TK_SRC_DIR_NATIVE=`${CYGPATH} ${TK_SRC_DIR}`
    TK_TOP_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}\"

    # Check to see if tk<Plat>Port.h isn't already with the public headers
    # Don't look for tkInt.h because that resides with tk.h in the core
    # sources, but the <plat>Port headers are in a different directory
    if test -f "${ac_cv_c_tkh}/tkSDLPort.h"; then
	result="private headers found with public headers"
    elif test "${TEA_PLATFORM}" = "windows" -a \
	-f "${ac_cv_c_tkh}/tkWinPort.h"; then
	result="private headers found with public headers"
    elif test "${TEA_PLATFORM}" = "unix" -a \
	-f "${ac_cv_c_tkh}/tkUnixPort.h"; then
	result="private headers found with public headers"
    else
	TK_GENERIC_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/generic\"
	TK_XLIB_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/xlib\"
	if test "${TEA_PLATFORM}" = "windows"; then
	    TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/win\"
	else
	    TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/unix\"
	fi
	case ${TK_DEFS} in
	    *PLATFORM_SDL*)
		TK_PLATFORM_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/sdl\"
		;;
	esac
	# Overwrite the previous TK_INCLUDES as this should capture both
	# public and private headers in the same set.
	# We want to ensure these are substituted so as not to require
	# any *_NATIVE vars be defined in the Makefile
	TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}"
	# Detect and add ttk subdir
	if test -d "${TK_SRC_DIR}/generic/ttk"; then
	   TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/generic/ttk\""
	fi
	if test "${TEA_WINDOWINGSYSTEM}" != "x11" -o "${TEA_USE_SDL}" = "yes" ; then
	   TK_INCLUDES="${TK_INCLUDES} -I${TK_XLIB_DIR_NATIVE}"
	fi
	if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
	   TK_INCLUDES="${TK_INCLUDES} -I\"${TK_SRC_DIR_NATIVE}/macosx\""
	fi
	if test "`uname -s`" = "Darwin"; then
	    # If Tk was built as a framework, attempt to use
	    # the framework's Headers and PrivateHeaders directories
	    case ${TK_DEFS} in
		*TK_FRAMEWORK*)
			if test -d "${TK_BIN_DIR}/Headers" -a \
				-d "${TK_BIN_DIR}/PrivateHeaders"; then
			    TK_INCLUDES="-I\"${TK_BIN_DIR}/Headers\" -I\"${TK_BIN_DIR}/PrivateHeaders\" ${TK_INCLUDES}"
			else
			    TK_INCLUDES="${TK_INCLUDES} ${TK_INCLUDE_SPEC} `echo "${TK_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"
			fi
			;;
	    esac
	    result="Using ${TK_INCLUDES}"
	else
	    if test ! -f "${TK_SRC_DIR}/generic/tkInt.h" ; then
	       AC_MSG_ERROR([Cannot find private header tkInt.h in ${TK_SRC_DIR}])
	    fi
	    result="Using srcdir found in tkConfig.sh: ${TK_SRC_DIR}"
	fi
    fi

    AC_SUBST(TK_TOP_DIR_NATIVE)
    AC_SUBST(TK_XLIB_DIR_NATIVE)

    AC_SUBST(TK_INCLUDES)
    AC_MSG_RESULT([${result}])
])

#------------------------------------------------------------------------
# TEA_PUBLIC_TK_HEADERS --
#
#	Locate the installed public Tk header files
#
# Arguments:
#	None.
#
# Requires:
#	CYGPATH must be set
#
# Results:
#
#	Adds a --with-tkinclude switch to configure.
#	Result is cached.
#
#	Substitutes the following vars:
#		TK_INCLUDES
#------------------------------------------------------------------------

AC_DEFUN([TEA_PUBLIC_TK_HEADERS], [
    AC_MSG_CHECKING([for Tk public headers])

    AC_ARG_WITH(tkinclude, [  --with-tkinclude        directory containing the public Tk header files], with_tkinclude=${withval})

    AC_CACHE_VAL(ac_cv_c_tkh, [
	# Use the value from --with-tkinclude, if it was given

	if test x"${with_tkinclude}" != x ; then
	    if test -f "${with_tkinclude}/tk.h" ; then
		ac_cv_c_tkh=${with_tkinclude}
	    else
		AC_MSG_ERROR([${with_tkinclude} directory does not contain tk.h])
	    fi
	else
	    list=""
	    if test "`uname -s`" = "Darwin"; then
		# If Tk was built as a framework, attempt to use
		# the framework's Headers directory.
		case ${TK_DEFS} in
		    *TK_FRAMEWORK*)
			list="`ls -d ${TK_BIN_DIR}/Headers 2>/dev/null`"
			;;
		esac
	    fi

	    # Look in the source dir only if Tk is not installed,
	    # and in that situation, look there before installed locations.
	    if test -f "${TK_BIN_DIR}/Makefile" ; then
		list="$list `ls -d ${TK_SRC_DIR}/generic 2>/dev/null`"
	    fi

	    # Check order: pkg --prefix location, Tk's --prefix location,
	    # relative to directory of tkConfig.sh, Tcl's --prefix location,
	    # relative to directory of tclConfig.sh.

	    eval "temp_includedir=${includedir}"
	    list="$list \
		`ls -d ${temp_includedir}        2>/dev/null` \
		`ls -d ${TK_PREFIX}/include      2>/dev/null` \
		`ls -d ${TK_BIN_DIR}/../include  2>/dev/null` \
		`ls -d ${TCL_PREFIX}/include     2>/dev/null` \
		`ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
	    if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
		list="$list /usr/local/include /usr/include"
		if test x"${TK_INCLUDE_SPEC}" != x ; then
		    d=`echo "${TK_INCLUDE_SPEC}" | sed -e 's/^-I//'`
		    list="$list `ls -d ${d} 2>/dev/null`"
		fi
	    fi
	    for i in $list ; do
		if test -f "$i/tk.h" ; then
		    ac_cv_c_tkh=$i
		    break
		fi
	    done
	fi
    ])

    # Print a message based on how we determined the include path

    if test x"${ac_cv_c_tkh}" = x ; then
	AC_MSG_ERROR([tk.h not found.  Please specify its location with --with-tkinclude])
    else
	AC_MSG_RESULT([${ac_cv_c_tkh}])
    fi

    # Convert to a native path and substitute into the output files.

    INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tkh}`

    TK_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"

    AC_SUBST(TK_INCLUDES)

    if test "${TEA_WINDOWINGSYSTEM}" != "x11" -o "${TEA_USE_SDL}" = "yes" ; then
	# On Windows and Aqua, we need the X compat headers
	AC_MSG_CHECKING([for X11 header files])
	if test ! -r "${INCLUDE_DIR_NATIVE}/X11/Xlib.h"; then
	    INCLUDE_DIR_NATIVE="`${CYGPATH} ${TK_SRC_DIR}/xlib`"
	    TK_XINCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
	    AC_SUBST(TK_XINCLUDES)
	fi
	AC_MSG_RESULT([${INCLUDE_DIR_NATIVE}])
    fi
])

#------------------------------------------------------------------------
# TEA_PATH_CONFIG --
#
#	Locate the ${1}Config.sh file and perform a sanity check on
#	the ${1} compile flags.  These are used by packages like
#	[incr Tk] that load *Config.sh files from more than Tcl and Tk.
#
# Arguments:
#	none
#
# Results:
#
#	Adds the following arguments to configure:
#		--with-$1=...
#
#	Defines the following vars:
#		$1_BIN_DIR	Full path to the directory containing
#				the $1Config.sh file
#------------------------------------------------------------------------

AC_DEFUN([TEA_PATH_CONFIG], [
    #
    # Ok, lets find the $1 configuration
    # First, look for one uninstalled.
    # the alternative search directory is invoked by --with-$1
    #

    if test x"${no_$1}" = x ; then
	# we reset no_$1 in case something fails here
	no_$1=true
	AC_ARG_WITH($1, [  --with-$1              directory containing $1 configuration ($1Config.sh)], with_$1config=${withval})
	AC_MSG_CHECKING([for $1 configuration])
	AC_CACHE_VAL(ac_cv_c_$1config,[

	    # First check to see if --with-$1 was specified.
	    if test x"${with_$1config}" != x ; then
		case ${with_$1config} in
		    */$1Config.sh )
			if test -f ${with_$1config}; then
			    AC_MSG_WARN([--with-$1 argument should refer to directory containing $1Config.sh, not to $1Config.sh itself])
			    with_$1config=`echo ${with_$1config} | sed 's!/$1Config\.sh$!!'`
			fi;;
		esac
		if test -f "${with_$1config}/$1Config.sh" ; then
		    ac_cv_c_$1config=`(cd ${with_$1config}; pwd)`
		else
		    AC_MSG_ERROR([${with_$1config} directory doesn't contain $1Config.sh])
		fi
	    fi

	    # then check for a private $1 installation
	    if test x"${ac_cv_c_$1config}" = x ; then
		for i in \
			../$1 \
			`ls -dr ../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
			`ls -dr ../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
			`ls -dr ../$1*[[0-9]].[[0-9]] 2>/dev/null` \
			`ls -dr ../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
			../../$1 \
			`ls -dr ../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
			`ls -dr ../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
			`ls -dr ../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
			`ls -dr ../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
			../../../$1 \
			`ls -dr ../../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
			`ls -dr ../../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
			`ls -dr ../../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
			`ls -dr ../../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
			${srcdir}/../$1 \
			`ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
			`ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
			`ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]] 2>/dev/null` \
			`ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
			; do
		    if test -f "$i/$1Config.sh" ; then
			ac_cv_c_$1config=`(cd $i; pwd)`
			break
		    fi
		    if test -f "$i/unix/$1Config.sh" ; then
			ac_cv_c_$1config=`(cd $i/unix; pwd)`
			break
		    fi
		done
	    fi

	    # check in a few common install locations
	    if test x"${ac_cv_c_$1config}" = x ; then
		for i in `ls -d ${libdir} 2>/dev/null` \
			`ls -d ${exec_prefix}/lib 2>/dev/null` \
			`ls -d ${prefix}/lib 2>/dev/null` \
			`ls -d /usr/local/lib 2>/dev/null` \
			`ls -d /usr/contrib/lib 2>/dev/null` \
			`ls -d /usr/lib 2>/dev/null` \
			`ls -d /usr/lib64 2>/dev/null` \
			; do
		    if test -f "$i/$1Config.sh" ; then
			ac_cv_c_$1config=`(cd $i; pwd)`
			break
		    fi
		done
	    fi
	])

	if test x"${ac_cv_c_$1config}" = x ; then
	    $1_BIN_DIR="# no $1 configs found"
	    AC_MSG_WARN([Cannot find $1 configuration definitions])
	    exit 0
	else
	    no_$1=
	    $1_BIN_DIR=${ac_cv_c_$1config}
	    AC_MSG_RESULT([found $$1_BIN_DIR/$1Config.sh])
	fi
    fi
])

#------------------------------------------------------------------------
# TEA_LOAD_CONFIG --
#
#	Load the $1Config.sh file
#
# Arguments:
#
#	Requires the following vars to be set:
#		$1_BIN_DIR
#
# Results:
#
#	Substitutes the following vars:
#		$1_SRC_DIR
#		$1_LIB_FILE
#		$1_LIB_SPEC
#------------------------------------------------------------------------

AC_DEFUN([TEA_LOAD_CONFIG], [
    AC_MSG_CHECKING([for existence of ${$1_BIN_DIR}/$1Config.sh])

    if test -f "${$1_BIN_DIR}/$1Config.sh" ; then
        AC_MSG_RESULT([loading])
	. "${$1_BIN_DIR}/$1Config.sh"
    else
        AC_MSG_RESULT([file not found])
    fi

    #
    # If the $1_BIN_DIR is the build directory (not the install directory),
    # then set the common variable name to the value of the build variables.
    # For example, the variable $1_LIB_SPEC will be set to the value
    # of $1_BUILD_LIB_SPEC. An extension should make use of $1_LIB_SPEC
    # instead of $1_BUILD_LIB_SPEC since it will work with both an
    # installed and uninstalled version of Tcl.
    #

    if test -f "${$1_BIN_DIR}/Makefile" ; then
	AC_MSG_WARN([Found Makefile - using build library specs for $1])
        $1_LIB_SPEC=${$1_BUILD_LIB_SPEC}
        $1_STUB_LIB_SPEC=${$1_BUILD_STUB_LIB_SPEC}
        $1_STUB_LIB_PATH=${$1_BUILD_STUB_LIB_PATH}
        $1_INCLUDE_SPEC=${$1_BUILD_INCLUDE_SPEC}
        $1_LIBRARY_PATH=${$1_LIBRARY_PATH}
    fi

    AC_SUBST($1_VERSION)
    AC_SUBST($1_BIN_DIR)
    AC_SUBST($1_SRC_DIR)

    AC_SUBST($1_LIB_FILE)
    AC_SUBST($1_LIB_SPEC)

    AC_SUBST($1_STUB_LIB_FILE)
    AC_SUBST($1_STUB_LIB_SPEC)
    AC_SUBST($1_STUB_LIB_PATH)

    # Allow the caller to prevent this auto-check by specifying any 2nd arg
    AS_IF([test "x$2" = x], [
	# Check both upper and lower-case variants
	# If a dev wanted non-stubs libs, this function could take an option
	# to not use _STUB in the paths below
	AS_IF([test "x${$1_STUB_LIB_SPEC}" = x],
	    [TEA_LOAD_CONFIG_LIB(translit($1,[a-z],[A-Z])_STUB)],
	    [TEA_LOAD_CONFIG_LIB($1_STUB)])
    ])
])

#------------------------------------------------------------------------
# TEA_LOAD_CONFIG_LIB --
#
#	Helper function to load correct library from another extension's
#	${PACKAGE}Config.sh.
#
# Results:
#	Adds to LIBS the appropriate extension library
#------------------------------------------------------------------------
AC_DEFUN([TEA_LOAD_CONFIG_LIB], [
    AC_MSG_CHECKING([For $1 library for LIBS])
    # This simplifies the use of stub libraries by automatically adding
    # the stub lib to your path.  Normally this would add to SHLIB_LD_LIBS,
    # but this is called before CONFIG_CFLAGS.  More importantly, this adds
    # to PKG_LIBS, which becomes LIBS, and that is only used by SHLIB_LD.
    if test "x${$1_LIB_SPEC}" != "x" ; then
	if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes" ; then
	    TEA_ADD_LIBS([\"`${CYGPATH} ${$1_LIB_PATH}`\"])
	    AC_MSG_RESULT([using $1_LIB_PATH ${$1_LIB_PATH}])
	else
	    TEA_ADD_LIBS([${$1_LIB_SPEC}])
	    AC_MSG_RESULT([using $1_LIB_SPEC ${$1_LIB_SPEC}])
	fi
    else
	AC_MSG_RESULT([file not found])
    fi
])

#------------------------------------------------------------------------
# TEA_EXPORT_CONFIG --
#
#	Define the data to insert into the ${PACKAGE}Config.sh file
#
# Arguments:
#
#	Requires the following vars to be set:
#		$1
#
# Results:
#	Substitutes the following vars:
#------------------------------------------------------------------------

AC_DEFUN([TEA_EXPORT_CONFIG], [
    #--------------------------------------------------------------------
    # These are for $1Config.sh
    #--------------------------------------------------------------------

    # pkglibdir must be a fully qualified path and (not ${exec_prefix}/lib)
    eval pkglibdir="[$]{libdir}/$1${PACKAGE_VERSION}"
    if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
	eval $1_LIB_FLAG="-l$1${PACKAGE_VERSION}${DBGX}"
	eval $1_STUB_LIB_FLAG="-l$1stub${PACKAGE_VERSION}${DBGX}"
    else
	eval $1_LIB_FLAG="-l$1`echo ${PACKAGE_VERSION} | tr -d .`${DBGX}"
	eval $1_STUB_LIB_FLAG="-l$1stub`echo ${PACKAGE_VERSION} | tr -d .`${DBGX}"
    fi
    $1_BUILD_LIB_SPEC="-L`pwd` ${$1_LIB_FLAG}"
    $1_LIB_SPEC="-L${pkglibdir} ${$1_LIB_FLAG}"
    $1_BUILD_STUB_LIB_SPEC="-L`pwd` [$]{$1_STUB_LIB_FLAG}"
    $1_STUB_LIB_SPEC="-L${pkglibdir} [$]{$1_STUB_LIB_FLAG}"
    $1_BUILD_STUB_LIB_PATH="`pwd`/[$]{PKG_STUB_LIB_FILE}"
    $1_STUB_LIB_PATH="${pkglibdir}/[$]{PKG_STUB_LIB_FILE}"

    AC_SUBST($1_BUILD_LIB_SPEC)
    AC_SUBST($1_LIB_SPEC)
    AC_SUBST($1_BUILD_STUB_LIB_SPEC)
    AC_SUBST($1_STUB_LIB_SPEC)
    AC_SUBST($1_BUILD_STUB_LIB_PATH)
    AC_SUBST($1_STUB_LIB_PATH)

    AC_SUBST(MAJOR_VERSION)
    AC_SUBST(MINOR_VERSION)
    AC_SUBST(PATCHLEVEL)
])


#------------------------------------------------------------------------
# TEA_PATH_CELIB --
#
#	Locate Keuchel's celib emulation layer for targeting Win/CE
#
# Arguments:
#	none
#
# Results:
#
#	Adds the following arguments to configure:
#		--with-celib=...
#
#	Defines the following vars:
#		CELIB_DIR	Full path to the directory containing
#				the include and platform lib files
#------------------------------------------------------------------------

AC_DEFUN([TEA_PATH_CELIB], [
    # First, look for one uninstalled.
    # the alternative search directory is invoked by --with-celib

    if test x"${no_celib}" = x ; then
	# we reset no_celib in case something fails here
	no_celib=true
	AC_ARG_WITH(celib,[  --with-celib=DIR        use Windows/CE support library from DIR], with_celibconfig=${withval})
	AC_MSG_CHECKING([for Windows/CE celib directory])
	AC_CACHE_VAL(ac_cv_c_celibconfig,[
	    # First check to see if --with-celibconfig was specified.
	    if test x"${with_celibconfig}" != x ; then
		if test -d "${with_celibconfig}/inc" ; then
		    ac_cv_c_celibconfig=`(cd ${with_celibconfig}; pwd)`
		else
		    AC_MSG_ERROR([${with_celibconfig} directory doesn't contain inc directory])
		fi
	    fi

	    # then check for a celib library
	    if test x"${ac_cv_c_celibconfig}" = x ; then
		for i in \
			../celib-palm-3.0 \
			../celib \
			../../celib-palm-3.0 \
			../../celib \
			`ls -dr ../celib-*3.[[0-9]]* 2>/dev/null` \
			${srcdir}/../celib-palm-3.0 \
			${srcdir}/../celib \
			`ls -dr ${srcdir}/../celib-*3.[[0-9]]* 2>/dev/null` \
			; do
		    if test -d "$i/inc" ; then
			ac_cv_c_celibconfig=`(cd $i; pwd)`
			break
		    fi
		done
	    fi
	])
	if test x"${ac_cv_c_celibconfig}" = x ; then
	    AC_MSG_ERROR([Cannot find celib support library directory])
	else
	    no_celib=
	    CELIB_DIR=${ac_cv_c_celibconfig}
	    CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'`
	    AC_MSG_RESULT([found $CELIB_DIR])
	fi
    fi
])

#--------------------------------------------------------------------
# TEA_EMBED_MANIFEST
#
#	Figure out if we can embed the manifest where necessary
#
# Arguments:
#	An optional manifest to merge into DLL/EXE.
#
# Results:
#	Will define the following vars:
#		VC_MANIFEST_EMBED_DLL
#		VC_MANIFEST_EMBED_EXE
#
#--------------------------------------------------------------------

AC_DEFUN([TEA_EMBED_MANIFEST], [
    AC_MSG_CHECKING(whether to embed manifest)
    AC_ARG_ENABLE(embedded-manifest,
	AC_HELP_STRING([--enable-embedded-manifest],
		[embed manifest if possible (default: yes)]),
	[embed_ok=$enableval], [embed_ok=yes])

    VC_MANIFEST_EMBED_DLL=
    VC_MANIFEST_EMBED_EXE=
    result=no
    if test "$embed_ok" = "yes" -a "${SHARED_BUILD}" = "1" \
       -a "$GCC" != "yes" ; then
	# Add the magic to embed the manifest into the dll/exe
	AC_EGREP_CPP([manifest needed], [
#if defined(_MSC_VER) && _MSC_VER >= 1400
print("manifest needed")
#endif
	], [
	# Could do a CHECK_PROG for mt, but should always be with MSVC8+
	# Could add 'if test -f' check, but manifest should be created
	# in this compiler case
	# Add in a manifest argument that may be specified
	VC_MANIFEST_EMBED_DLL="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest $1 -outputresource:\[$]@\;2 ; fi"
	VC_MANIFEST_EMBED_EXE="if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest $1 -outputresource:\[$]@\;1 ; fi"
	result=yes
	if test "x$1" != x ; then
	    result="yes ($1)"
	fi
	])
    fi
    AC_MSG_RESULT([$result])
    AC_SUBST(VC_MANIFEST_EMBED_DLL)
    AC_SUBST(VC_MANIFEST_EMBED_EXE)
])

# Local Variables:
# mode: autoconf
# End:
Added undroid/tclwmf/tclwmf.c.




















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
/*
 * tclwmf.c --
 *
 *      This file contains the implementation of the "wmf" Tcl
 *      built-in command which allows to operate cameras using
 *      the Windows Media Foundation.
 *
 * Copyright (c) 2016 Christian Werner <chw at ch minus werner dot de>
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#ifndef _WIN32
#error "unsupported platform"
#endif

#undef  WINVER
#define WINVER 0x0601

#include <windows.h>
#include <tk.h>
#include <string.h>

#include <shlwapi.h>

#include <initguid.h>
#undef  EXTERN_GUID
#define EXTERN_GUID DEFINE_GUID

#include <mferror.h>
#include <mfidl.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmultichar"
#include <mfapi.h>
#pragma GCC diagnostic pop
#include <mfreadwrite.h>

#if defined(__GNUC__)

/* These are missing in current mingw64 header files */

DEFINE_GUID(MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE,
	    0xc60ac5fe, 0x252a, 0x478f,
	    0xa0, 0xef, 0xbc, 0x8f, 0xa5, 0xf7, 0xca, 0xd3);
DEFINE_GUID(MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID,
	    0x8ac3587a, 0x4ae7, 0x42d8,
	    0x99, 0xe0, 0x0a, 0x60, 0x13, 0xee, 0xf9, 0x0f);
DEFINE_GUID(MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME,
	    0x60d0e559, 0x52f8, 0x4fa2,
	    0xbb, 0xce, 0xac, 0xdb, 0x34, 0xa8, 0xec, 0x1);
DEFINE_GUID(MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK,
	    0x58f0aad8, 0x22bf, 0x4f8a,
	    0xbb, 0x3d, 0xd2, 0xc4, 0x97, 0x8c, 0x6e, 0x2f);

#endif

/*
 * Per process info for dynamically linked WMF DLLs.
 */

static struct {
    int initialized;
    HMODULE mfplat;
    HMODULE mf;
    HMODULE mfreadwrite;
    HRESULT WINAPI (*startup)(ULONG, DWORD);
    HRESULT WINAPI (*shutdown)(void);
    HRESULT WINAPI (*createattributes)(IMFAttributes **, UINT32);
    HRESULT WINAPI (*enumdevicesources)(IMFAttributes *, IMFActivate ***,
					UINT32 *);
    HRESULT WINAPI (*createsourcereaderfrommediasource)(IMFMediaSource *,
							IMFAttributes *,
							IMFSourceReader **);
    HRESULT WINAPI (*getstrideforbitmapinfoheader)(DWORD, DWORD, LONG *);
} WMFM = { 0, 0, NULL, NULL, NULL };

#define MFStartup           WMFM.startup
#define MFShutdown          WMFM.shutdown
#define MFCreateAttributes  WMFM.createattributes
#define MFEnumDeviceSources WMFM.enumdevicesources
#define MFCreateSourceReaderFromMediaSource \
    WMFM.createsourcereaderfrommediasource
#define MFGetStrideForBitmapInfoHeader \
    WMFM.getstrideforbitmapinfoheader

TCL_DECLARE_MUTEX(wmfMutex)

/*
 * IMFSourceReaderCallback implementation.
 */

typedef struct {
    interface IMFSourceReaderCallback isrcb;	/* Interface, methods. */
    CRITICAL_SECTION lock;			/* Mutex. */
    int refCount;				/* Reference count. */
    struct WMFC *wmfc;				/* Pointer to WMF struct. */
} SourceReaderCB;

/*
 * Frame buffer.
 */

typedef struct {
    unsigned char *data;	/* Pixel buffer. */
    int length;			/* Used length of pixel buffer. */
    int maxLength;		/* Max. length of pixel buffer. */
    int ready;			/* Zero when free, positive when filled. */
    int fourcc;			/* Media format code. */
    int width, height;		/* Width and height in pixels. */
    int stride;			/* Line increment in bytes. */
} Frame;

/*
 * Control structure for capture.
 */

typedef struct WMFC {
    IMFMediaSource *mediaSrc;	/* Handle for device. */
    IMFSourceReader *srcReader;	/* Handle for capture. */
    Tcl_Interp *interp;		/* Interpreter for this object. */
    char devId[32];		/* Device id. */
    Tcl_DString devName;	/* Device name. */
    int cbCmdLen;               /* Initial length of callback command. */
    Tcl_DString cbCmd;          /* Callback command prefix. */
    int fourcc, compr;		/* FOURCC and compression. */
    int stride, width, height;	/* Image dimensions. */
    int mirror;			/* Image mirror flags. */
    int rotate;			/* Image rotation in degrees. */
    Tcl_WideInt counters[4];	/* Statistic counters. */
    Tcl_AsyncHandler async;	/* For signalling captured image. */
    SourceReaderCB srcb;	/* Callback interface object. */
    int frameReady;		/* Frame index with data or -1. */
    int frameQueued;		/* Next frame index to be filled. */
    Frame frame[2];		/* Frame buffers. */
} WMFC;

/*
 * Per interpreter control structure.
 */

typedef struct {
    int idCount;
    Tcl_HashTable wmfc;		/* List of active WMFC instances. */
} WMFI;

/*
 * Forward declarations.
 */

static int StopCapture(WMFC *wmfc);


/*
 *-------------------------------------------------------------------------
 *
 * EnumDevices --
 *
 *	Fill in IMFActivate object with info about devices
 *	for video capture. Returns number of devices in
 *	returned array.
 *
 *-------------------------------------------------------------------------
 */

static int
EnumDevices(IMFActivate ***devOut)
{
    IMFAttributes *attr = NULL;
    HRESULT hr;
    UINT32 count = 0;

    *devOut = NULL;
    hr = MFCreateAttributes(&attr, 1);
    if (!SUCCEEDED(hr)) {
	goto done;
    }
    hr = attr->lpVtbl->SetGUID(attr,
		       &MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE,
		       &MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID);
    if (!SUCCEEDED(hr))	{
	goto done;
    }
    hr = MFEnumDeviceSources(attr, devOut, &count);
    if (!SUCCEEDED(hr))	{
	count = 0;
	goto done;
    }
done:
    if (attr != NULL) {
	attr->lpVtbl->Release(attr);
    }
    return count;
}

/*
 *-------------------------------------------------------------------------
 *
 * ListDevices --
 *
 *	Fill in list of devices in interp's result.
 *
 *-------------------------------------------------------------------------
 */

static int
ListDevices(Tcl_Interp *interp)
{
    IMFActivate **devList = NULL, *dev;
    int i, count;
    HRESULT hr;
    Tcl_DString ds;
    Tcl_Obj *list = Tcl_NewListObj(0, NULL);

    Tcl_DStringInit(&ds);
    count = EnumDevices(&devList);
    for (i = 0; i < count; i++) {
	WCHAR *link = NULL, *name = NULL;

	dev = devList[i];
	hr = dev->lpVtbl->GetAllocatedString(dev,
		&MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK,
		&link, NULL);
	if (!SUCCEEDED(hr)) {
	    CoTaskMemFree(link);
	    continue;
	}
	hr = dev->lpVtbl->GetAllocatedString(dev,
		&MF_DEVSOURCE_ATTRIBUTE_FRIENDLY_NAME,
		&name, NULL);
	if (SUCCEEDED(hr)) {
	    Tcl_WinTCharToUtf((TCHAR *) link, -1, &ds);
	    Tcl_ListObjAppendElement(NULL, list,
				     Tcl_NewStringObj(Tcl_DStringValue(&ds),
						      Tcl_DStringLength(&ds)));
	    Tcl_DStringFree(&ds);
	    Tcl_WinTCharToUtf((TCHAR *) name, -1, &ds);
	    Tcl_ListObjAppendElement(NULL, list,
				     Tcl_NewStringObj(Tcl_DStringValue(&ds),
						      Tcl_DStringLength(&ds)));
	    Tcl_DStringFree(&ds);
	}
	CoTaskMemFree(link);
	CoTaskMemFree(name);
    }
    for (i = 0; i < count; i++) {
	dev = devList[i];
	dev->lpVtbl->Release(dev);
    }
    CoTaskMemFree(devList);
    Tcl_SetObjResult(interp, list);
    return TCL_OK;
}

/*
 *-------------------------------------------------------------------------
 *
 * GetSource --
 *
 *	Obtain IMFMediaSource for given symbolic link name.
 *
 *-------------------------------------------------------------------------
 */

static IMFMediaSource *
GetSource(char *devName)
{
    IMFActivate **devList = NULL, *dev = NULL;
    IMFMediaSource *mediaSrc = NULL;
    int i, count;
    HRESULT hr;

    count = EnumDevices(&devList);
    for (i = 0; i < count; i++) {
	WCHAR *link = NULL;
	Tcl_DString ds;
	int rc;

	dev = devList[i];
	hr = dev->lpVtbl->GetAllocatedString(dev,
		&MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK,
		&link, NULL);
	if (!SUCCEEDED(hr)) {
	    CoTaskMemFree(link);
	    continue;
	}
	Tcl_DStringInit(&ds);
	Tcl_WinTCharToUtf((TCHAR *) link, -1, &ds);
	rc = strcmp(Tcl_DStringValue(&ds), devName);
	Tcl_DStringFree(&ds);
	CoTaskMemFree(link);
	if (rc == 0) {
	    break;
	}
	dev = NULL;
    }
    if (dev != NULL) {
	hr = dev->lpVtbl->ActivateObject(dev, &IID_IMFMediaSource,
					 (void **) &mediaSrc);
	if (!SUCCEEDED(hr)) {
	    mediaSrc = NULL;
	}
    }
    for (i = 0; i < count; i++) {
	dev = devList[i];
	dev->lpVtbl->Release(dev);
    }
    CoTaskMemFree(devList);
    return mediaSrc;
}

/*
 *-------------------------------------------------------------------------
 *
 * IMFSourceReader implementation and its VTBL
 *
 *-------------------------------------------------------------------------
 */

static HRESULT STDMETHODCALLTYPE
SR_QueryInterface(IMFSourceReaderCallback *This, REFIID riid, void **ppvObj)
{
    if (IsEqualIID(riid, &IID_IMFSourceReaderCallback)) {
	This->lpVtbl->AddRef(This);
	*ppvObj = This;
	return S_OK;
    }
    *ppvObj = NULL;
    return E_NOINTERFACE;
}

static ULONG STDMETHODCALLTYPE
SR_AddRef(IMFSourceReaderCallback *This)
{
    SourceReaderCB *srcb = (SourceReaderCB *) This;

    srcb->refCount += 1;
    return srcb->refCount;
}

static ULONG STDMETHODCALLTYPE
SR_Release(IMFSourceReaderCallback *This)
{
    SourceReaderCB *srcb = (SourceReaderCB *) This;

    if (srcb->refCount == 0) {
	return 0;
    }
    srcb->refCount -= 1;
    return srcb->refCount;
}

static HRESULT STDMETHODCALLTYPE
SR_OnReadSample(IMFSourceReaderCallback *This, HRESULT hrStatus,
		DWORD streamIndex, DWORD streamFlags, LONGLONG ts,
		IMFSample *sample)
{
    SourceReaderCB *srcb = (SourceReaderCB *) This;
    WMFC *wmfc;
    IMFMediaBuffer *mbuf = NULL;
    int index;
    HRESULT hr = S_OK;

    if (!SUCCEEDED(hrStatus)) {
	hr = hrStatus;
    }
    EnterCriticalSection(&srcb->lock);
    wmfc = srcb->wmfc;
    if ((wmfc->frameQueued < 0) || !SUCCEEDED(hr)) {
	LeaveCriticalSection(&srcb->lock);
	return hr;
    }
    if (sample == NULL) {
	goto done;
    }
    wmfc->counters[0] += 1;
    index = wmfc->frameQueued;
    hr = sample->lpVtbl->ConvertToContiguousBuffer(sample, &mbuf);
    if (SUCCEEDED(hr)) {
	DWORD length = 0, maxLength = 0;
	BYTE *data = NULL;
	int bufok = 0;

	mbuf->lpVtbl->Lock(mbuf, &data, &maxLength, &length);
	if (wmfc->frame[index].data == NULL) {
	    wmfc->frame[index].data =
		(unsigned char *) attemptckalloc(length);
	    if (wmfc->frame[index].data != NULL) {
		wmfc->frame[index].maxLength = length;
		bufok = 1;
	    } else {
		wmfc->frame[index].maxLength = 0;
	    }
	} else if (wmfc->frame[index].maxLength >= length) {
	    bufok = 1;
	} else {
	    unsigned char *newData = (unsigned char *)
		attemptckrealloc(wmfc->frame[index].data, length);

	    if (newData != NULL) {
		wmfc->frame[index].data = newData;
		wmfc->frame[index].maxLength = length;
		bufok = 1;
	    }
	}
	if (bufok) {
	    memcpy(wmfc->frame[index].data, data, length);
	    wmfc->frame[index].length = length;
	    wmfc->frame[index].ready = 1;
	    wmfc->frame[index].fourcc = wmfc->fourcc;
	    wmfc->frame[index].width = wmfc->width;
	    wmfc->frame[index].height = wmfc->height;
	    wmfc->frame[index].stride = wmfc->stride;
	} else {
	    wmfc->frame[index].length = 0;
	    wmfc->frame[index].ready = -1;
	    wmfc->counters[2] += 1;
	    wmfc->counters[3] += 1;
	}
	mbuf->lpVtbl->Unlock(mbuf);
    }
    if (mbuf != NULL) {
	mbuf->lpVtbl->Release(mbuf);
    }
done:
    LeaveCriticalSection(&srcb->lock);
    Tcl_AsyncMark(wmfc->async);
    return hr;
}

static HRESULT STDMETHODCALLTYPE
SR_OnFlush(IMFSourceReaderCallback *This, DWORD streamIndex)
{
    return S_OK;
}

static HRESULT STDMETHODCALLTYPE
SR_OnEvent(IMFSourceReaderCallback *This, DWORD streamIndex,
	   IMFMediaEvent *pEvent)
{
    return S_OK;
}

static IMFSourceReaderCallbackVtbl SourceReaderVtbl = {
    SR_QueryInterface,
    SR_AddRef,
    SR_Release,
    SR_OnReadSample,
    SR_OnFlush,
    SR_OnEvent
};

/*
 *-------------------------------------------------------------------------
 *
 * ImageCallback --
 *
 *	Call as do-when-idle handler from the async event handler
 *	when a new image is available or image capture was stopped
 *	due to an error.
 *
 *-------------------------------------------------------------------------
 */

static void
ImageCallback(ClientData clientData)
{
    WMFC *wmfc = (WMFC *) clientData;
    Tcl_Interp *interp = wmfc->interp;
    int ret;

    Tcl_DStringSetLength(&wmfc->cbCmd, wmfc->cbCmdLen);
    Tcl_DStringAppendElement(&wmfc->cbCmd, wmfc->devId);
    Tcl_DStringAppendElement(&wmfc->cbCmd, (wmfc->async != NULL) ?
			     "capture" : "stop");
    Tcl_Preserve((ClientData) interp);
    ret = Tcl_EvalEx(interp, Tcl_DStringValue(&wmfc->cbCmd),
		     Tcl_DStringLength(&wmfc->cbCmd), TCL_EVAL_GLOBAL);
    if (ret != TCL_OK) {
	StopCapture(wmfc);
	Tcl_AddErrorInfo(interp, "\n    (wmf event handler)");
 	Tcl_BackgroundError(interp);
    }
    Tcl_Release((ClientData) interp);
}

/*
 *-------------------------------------------------------------------------
 *
 * SignalBuffer --
 *
 *	Async event handler called when an image became ready.
 *	Requests next frame and schedules do-when-idle handler
 *	for performing the callback in Tcl.
 *
 *-------------------------------------------------------------------------
 */

static int
SignalBuffer(ClientData clientData, Tcl_Interp *interp, int code)
{
    WMFC *wmfc = (WMFC *) clientData;
    HRESULT hr;
    int bufok = 0, dostop = 0, doread = 0;

    if (wmfc->srcReader == NULL) {
	return code;
    }
    EnterCriticalSection(&wmfc->srcb.lock);
    if (wmfc->counters[3] > 25) {
	/* stop after consecutive memory errors */
	dostop = 1;
    } else if (wmfc->frameQueued >= 0) {
	bufok = wmfc->frame[wmfc->frameQueued].ready > 0;
	if (bufok) {
	    if ((wmfc->frameReady >= 0) &&
		(wmfc->frame[wmfc->frameReady].ready < 2)) {
		wmfc->counters[1] += 1;	/* dropped */
	    }
	    wmfc->frameReady = wmfc->frameQueued;
	    wmfc->frameQueued = wmfc->frameQueued ? 0 : 1;
	    wmfc->counters[3] = 0;	/* reset memory error counter */
	}
	wmfc->frame[wmfc->frameQueued].ready = 0;
	doread = 1;
    }
    LeaveCriticalSection(&wmfc->srcb.lock);
    if (doread) {
	hr = wmfc->srcReader->lpVtbl->ReadSample(wmfc->srcReader,
		MF_SOURCE_READER_ANY_STREAM, 0, NULL, NULL, NULL, NULL);
	if (!SUCCEEDED(hr)) {
	    dostop = 1;
	}
    }
    if (dostop) {
	wmfc->frameQueued = -1;
	Tcl_AsyncDelete(wmfc->async);
	wmfc->async = NULL;
    }
    if (bufok || dostop) {
	Tcl_CancelIdleCall(ImageCallback, clientData);
	Tcl_DoWhenIdle(ImageCallback, clientData);
    }
    return code;
}

/*
 *-------------------------------------------------------------------------
 *
 * SetFormat --
 *
 *	Set media source and source reader format given index.
 *
 *-------------------------------------------------------------------------
 */

static HRESULT
SetFormat(IMFMediaSource *mediaSrc, IMFSourceReader *srcReader, int index)
{
    IMFPresentationDescriptor *pd = NULL;
    IMFStreamDescriptor *sd = NULL;
    IMFMediaTypeHandler *handler = NULL;
    IMFMediaType *mediaType = NULL;
    BOOL selected;
    HRESULT hr;

    hr = mediaSrc->lpVtbl->CreatePresentationDescriptor(mediaSrc, &pd);
    if (!SUCCEEDED(hr)) {
        goto done;
    }
    hr = pd->lpVtbl->GetStreamDescriptorByIndex(pd, 0, &selected, &sd);
    if (!SUCCEEDED(hr)) {
        goto done;
    }
    hr = sd->lpVtbl->GetMediaTypeHandler(sd, &handler);
    if (!SUCCEEDED(hr)) {
        goto done;
    }
    hr = handler->lpVtbl->GetMediaTypeByIndex(handler, index, &mediaType);
    if (!SUCCEEDED(hr)) {
        goto done;
    }
    hr = handler->lpVtbl->SetCurrentMediaType(handler, mediaType);
    if (!SUCCEEDED(hr)) {
        goto done;
    }
    hr = srcReader->lpVtbl->SetCurrentMediaType(srcReader,
		MF_SOURCE_READER_FIRST_VIDEO_STREAM, NULL, mediaType);
done:
    if (mediaType != NULL) {
	mediaType->lpVtbl->Release(mediaType);
    }
    if (handler != NULL) {
	handler->lpVtbl->Release(handler);
    }
    if (sd != NULL) {
	sd->lpVtbl->Release(sd);
    }
    if (pd != NULL) {
	pd->lpVtbl->Release(pd);
    }
    return hr;
}

/*
 *-------------------------------------------------------------------------
 *
 * FindYUVMediaType --
 *
 *	Find the first YUY2 or NV12 media type given media source.
 *	Returns index of the media type or -1 when nothing found.
 *
 *-------------------------------------------------------------------------
 */

static int
FindYUVMediaType(IMFMediaSource *mediaSrc)
{
    IMFPresentationDescriptor *pd = NULL;
    IMFStreamDescriptor *sd = NULL;
    IMFMediaTypeHandler *handler = NULL;
    IMFMediaType *mediaType = NULL;
    BOOL selected;
    DWORD i, count = 0;
    int found = -1;
    HRESULT hr;

    hr = mediaSrc->lpVtbl->CreatePresentationDescriptor(mediaSrc, &pd);
    if (!SUCCEEDED(hr)) {
	goto done;
    }
    hr = pd->lpVtbl->GetStreamDescriptorByIndex(pd, 0, &selected, &sd);
    if (!SUCCEEDED(hr)) {
	goto done;
    }
    hr = sd->lpVtbl->GetMediaTypeHandler(sd, &handler);
    if (!SUCCEEDED(hr)) {
	goto done;
    }
    hr = handler->lpVtbl->GetMediaTypeCount(handler, &count);
    if (!SUCCEEDED(hr)) {
	goto done;
    }
    for (i = 0; i < count; i++) {
	GUID subType = GUID_NULL;

	hr = handler->lpVtbl->GetMediaTypeByIndex(handler, i, &mediaType);
	if (!SUCCEEDED(hr)) {
	    break;
	}
	hr = mediaType->lpVtbl->GetGUID(mediaType, &MF_MT_SUBTYPE, &subType);
	if (mediaType != NULL) {
	    mediaType->lpVtbl->Release(mediaType);
	    mediaType = NULL;
	}
	if (SUCCEEDED(hr)) {
	    if ((subType.Data1 == 0x3231564e) ||
		(subType.Data1 == 0x32595559)) {
		found = i;
		break;
	    }
	}
    }
done:
    if (handler != NULL) {
	handler->lpVtbl->Release(handler);
    }
    if (sd != NULL) {
	sd->lpVtbl->Release(sd);
    }
    if (pd != NULL) {
	pd->lpVtbl->Release(pd);
    }
    return found;
}

/*
 *-------------------------------------------------------------------------
 *
 * GetFormat --
 *
 *	Get information about the media format (width, height etc.)
 *	and try to switch MJPG source to YUY2 or NV12 format.
 *
 *-------------------------------------------------------------------------
 */

static int
GetFormat(Tcl_Interp *interp, IMFMediaSource *mediaSrc,
	  IMFSourceReader *srcReader,
	  int *fourcc, int *compr, int *stride, int *width, int *height)
{
    HRESULT hr;
    IMFMediaType *mediaType = NULL;
    GUID subType = GUID_NULL;
    LONG lval = 0;
    UINT32 uval = 0;
    UINT64 wval = 0;
    UINT32 w = 0, h = 0;
    BOOL isCompressed = FALSE;
    int result = TCL_ERROR;

    hr = srcReader->lpVtbl->GetCurrentMediaType(srcReader,
		MF_SOURCE_READER_FIRST_VIDEO_STREAM, &mediaType);
    if (!SUCCEEDED(hr)) {
	Tcl_SetResult(interp, "cannot get media type from source reader",
		      TCL_STATIC);
	goto done;
    }
    mediaType->lpVtbl->IsCompressedFormat(mediaType, &isCompressed);
    *compr = isCompressed;
    hr = mediaType->lpVtbl->GetGUID(mediaType, &MF_MT_SUBTYPE, &subType);
    if (!SUCCEEDED(hr)) {
	Tcl_SetResult(interp, "cannot get MF_MT_SUBTYPE", TCL_STATIC);
	goto done;
    }
    if (subType.Data1 == 0x47504a4d) {
	/* try to switch from MJPG to YUY2 or NV12 */
	int index = FindYUVMediaType(mediaSrc);

	if (index < 0) {
	    Tcl_SetResult(interp, "no suitable media format found",
			  TCL_STATIC);
	    goto done;
	}
	hr = SetFormat(mediaSrc, srcReader, index);
	if (!SUCCEEDED(hr)) {
	    Tcl_SetResult(interp, "cannot switch to usable media format",
			  TCL_STATIC);
	    goto done;
	}
	mediaType->lpVtbl->Release(mediaType);
	mediaType = NULL;
	hr = srcReader->lpVtbl->GetCurrentMediaType(srcReader,
			MF_SOURCE_READER_FIRST_VIDEO_STREAM, &mediaType);
	if (!SUCCEEDED(hr)) {
	    Tcl_SetResult(interp, "cannot get media type from source reader",
			  TCL_STATIC);
	    goto done;
	}
	mediaType->lpVtbl->IsCompressedFormat(mediaType, &isCompressed);
	*compr = isCompressed;
	hr = mediaType->lpVtbl->GetGUID(mediaType, &MF_MT_SUBTYPE, &subType);
	if (!SUCCEEDED(hr)) {
	    Tcl_SetResult(interp, "cannot get MF_MT_SUBTYPE", TCL_STATIC);
	    goto done;
	}
    }
    if ((subType.Data1 != 0x3231564e) && (subType.Data1 != 0x32595559)) {
	Tcl_SetObjResult(interp,
		Tcl_ObjPrintf("unsupported fourcc 0x%08lX", subType.Data1));
	goto done;
    }
    *fourcc = subType.Data1;
    hr = mediaType->lpVtbl->GetUINT32(mediaType, &MF_MT_DEFAULT_STRIDE, &uval);
    if (!SUCCEEDED(hr)) {
	hr = mediaType->lpVtbl->GetUINT64(mediaType, &MF_MT_FRAME_SIZE, &wval);
	if (SUCCEEDED(hr)) {
	    w = wval >> 32;
	    h = wval;
	}
	if (!SUCCEEDED(hr)) {
	    Tcl_SetResult(interp, "cannot get MF_MT_FRAME_SIZE", TCL_STATIC);
	    goto done;
	}
	hr = MFGetStrideForBitmapInfoHeader(subType.Data1, w, &lval);
	if (!SUCCEEDED(hr)) {
	    Tcl_SetResult(interp, "cannot get stride", TCL_STATIC);
	    goto done;
	}
	mediaType->lpVtbl->SetUINT32(mediaType, &MF_MT_DEFAULT_STRIDE,
				     (UINT32) lval);
	*stride = lval;
	*width = w;
	*height = h;
    } else {
	*stride = uval;
	hr = mediaType->lpVtbl->GetUINT64(mediaType, &MF_MT_FRAME_SIZE, &wval);
	if (!SUCCEEDED(hr)) {
	    Tcl_SetResult(interp, "cannot MF_MT_FRAME_SIZE", TCL_STATIC);
	    goto done;
	}
	w = wval >> 32;
	h = wval;
	*width = w;
	*height = h;
    }
    result = TCL_OK;
done:
    if (mediaType != NULL) {
	mediaType->lpVtbl->Release(mediaType);
    }
    return result;
}

/*
 *-------------------------------------------------------------------------
 *
 * StartCapture --
 *
 *	Start capture of frames. A media source is created if not
 *	already available. The asynchronous event handler is established
 *	and the initial read of a frame is performed.
 *
 *-------------------------------------------------------------------------
 */

static int
StartCapture(WMFC *wmfc)
{
    Tcl_Interp *interp = wmfc->interp;
    IMFAttributes *attr = NULL;
    HRESULT hr;

    if (wmfc->srcReader == NULL) {
	hr = MFCreateAttributes(&attr, 1);
	if (!SUCCEEDED(hr)) {
	    Tcl_SetResult(interp, "cannot create WMF attributes", TCL_STATIC);
	    return TCL_ERROR;
	}
	wmfc->counters[0] = wmfc->counters[1] = 0;
	wmfc->counters[2] = wmfc->counters[3] = 0;
	wmfc->frame[0].ready = wmfc->frame[1].ready = 0;
	wmfc->frameReady = wmfc->frameQueued = -1;
	wmfc->srcb.isrcb.lpVtbl = &SourceReaderVtbl;
	wmfc->srcb.refCount = 1;
	wmfc->srcb.wmfc = wmfc;
	hr = attr->lpVtbl->SetUnknown(attr,
				      &MF_SOURCE_READER_ASYNC_CALLBACK,
				      (struct IUnknown *) &wmfc->srcb);
	hr = MFCreateSourceReaderFromMediaSource(wmfc->mediaSrc, attr,
						 &wmfc->srcReader);
	if (attr != NULL) {
	    attr->lpVtbl->Release(attr);
	}
	if (!SUCCEEDED(hr)) {
	    if (wmfc->srcReader != NULL) {
		wmfc->srcReader->lpVtbl->Release(wmfc->srcReader);
		wmfc->srcReader = NULL;
	    }
	    Tcl_SetResult(interp, "cannot create source reader", TCL_STATIC);
	    return TCL_ERROR;
	}
	if (GetFormat(interp, wmfc->mediaSrc, wmfc->srcReader,
		      &wmfc->fourcc, &wmfc->compr,
		      &wmfc->stride, &wmfc->width, &wmfc->height) != TCL_OK) {
 	    wmfc->srcReader->lpVtbl->Release(wmfc->srcReader);
	    wmfc->srcReader = NULL;
	    return TCL_ERROR;
	}
    }
    EnterCriticalSection(&wmfc->srcb.lock);
    if (wmfc->async == NULL) {
	wmfc->async = Tcl_AsyncCreate(SignalBuffer, (ClientData) wmfc);
	wmfc->counters[0] = wmfc->counters[1] = 0;
	wmfc->counters[2] = wmfc->counters[3] = 0;
	wmfc->frameQueued = wmfc->frameReady ? 0 : 1;
	wmfc->frame[wmfc->frameQueued].ready = 0;
	hr = wmfc->srcReader->lpVtbl->ReadSample(wmfc->srcReader,
						 MF_SOURCE_READER_ANY_STREAM,
						 0, NULL, NULL, NULL, NULL);
	if (!SUCCEEDED(hr)) {
	    wmfc->frameQueued = -1;
	    Tcl_AsyncDelete(wmfc->async);
	    wmfc->async = NULL;
	}
    } else {
	hr = S_OK;
    }
    LeaveCriticalSection(&wmfc->srcb.lock);
    if (!SUCCEEDED(hr)) {
	Tcl_SetResult(interp, "cannot initiate read from source reader",
		      TCL_STATIC);
	return TCL_ERROR;
    }
    return TCL_OK;
}

/*
 *-------------------------------------------------------------------------
 *
 * StopCapture --
 *
 *      Stop capture if running. The async event handler is removed and
 *	a pending idle call to ImageCallback is cancelled, too.
 *
 *-------------------------------------------------------------------------
 */

static int
StopCapture(WMFC *wmfc)
{
    int docancel = 0;

    EnterCriticalSection(&wmfc->srcb.lock);
    if (wmfc->async != NULL) {
        Tcl_AsyncDelete(wmfc->async);
        wmfc->async = NULL;
	docancel = 1;
    }
    wmfc->frameQueued = -1;
    LeaveCriticalSection(&wmfc->srcb.lock);
    if (docancel) {
	Tcl_CancelIdleCall(ImageCallback, (ClientData) wmfc);
    }
    return TCL_OK;
}

/*
 *-------------------------------------------------------------------------
 *
 * GetImage --
 *
 *	Retrieve last captured buffer as photo image or byte array.
 *
 *-------------------------------------------------------------------------
 */

static int
GetImage(WMFC *wmfc, Tcl_Obj *arg)
{
    Tcl_Interp *interp = wmfc->interp;
    Tk_PhotoHandle photo = NULL;
    int fourcc, width, height, result = TCL_OK;
    unsigned char *rawPtr = NULL;

    if (arg != NULL) {
	char *name = Tcl_GetString(arg);

	photo = Tk_FindPhoto(interp, name);
	if (photo == NULL) {
	    Tcl_SetObjResult(interp,
		Tcl_ObjPrintf("can't use \"%s\": not a photo image", name));
	    return TCL_ERROR;
	}
    }

    EnterCriticalSection(&wmfc->srcb.lock);
    if (wmfc->frameReady >= 0) {
	int stride;

	fourcc = wmfc->frame[wmfc->frameReady].fourcc;
	width = wmfc->frame[wmfc->frameReady].width;
	height = wmfc->frame[wmfc->frameReady].height;
	stride = wmfc->frame[wmfc->frameReady].stride;
	if ((width > 0) && (height > 0) && (stride > 0)) {
	    rawPtr = (unsigned char *) attemptckalloc(stride * height * 5);
	}
	if (rawPtr != NULL) {
	    int size = stride * height;

	    if (fourcc == 0x3231564e) {
		/* NV12, stride should be width */
		size += (width * height) / 2;
	    } else {
		/* YUY2, stride should be 2 * width */
	    }
	    memcpy(rawPtr, wmfc->frame[wmfc->frameReady].data, size);
	}
	wmfc->frame[wmfc->frameReady].ready = 2;
    }
    LeaveCriticalSection(&wmfc->srcb.lock);

    if (rawPtr == NULL) {
	/* no image available */
	if (photo != NULL) {
	    Tcl_SetObjResult(interp, Tcl_NewIntObj(0));
	} else {
	    Tcl_SetResult(interp, "no image available", TCL_STATIC);
	    result = TCL_ERROR;
	}
	goto done;
    }
    if ((width <= 0) || (height <= 0)) {
	/* malformed image */
	if (photo != NULL) {
	    Tcl_SetObjResult(interp, Tcl_NewIntObj(-1));
	} else {
	    Tcl_SetResult(interp, "malformed image", TCL_STATIC);
	    result = TCL_ERROR;
	}
	goto done;
    }

    if (photo != NULL) {
	Tk_PhotoImageBlock block;
	unsigned char *yPtr, *uvPtr, *dstPtr;
	int x, y, yVal, yVal2, uVal = 0, vVal = 0, rot = wmfc->rotate;

	block.pixelSize = 3;
	block.offset[0] = 0;
	block.offset[1] = 1;
	block.offset[2] = 2;
	block.offset[3] = block.pixelSize + 1;	/* no alpha */
	block.width = width;
	block.height = height;
	block.pitch = block.pixelSize * block.width;
	block.pixelPtr = rawPtr + 2 * width * height;

	if (fourcc == 0x3231564e) {
	    /* convert NV12 -> RGB */
	    for (y = 0; y < height; y++) {
		yPtr = rawPtr + y * width;
		uvPtr = rawPtr + width * height + (y >> 1) * width;
		dstPtr = block.pixelPtr + block.pixelSize * y * width;
		for (x = 0; x < width; x++) {
		    int red, green, blue;

		    yVal = *yPtr++;
		    yVal -= 16;
		    if (yVal < 0) {
			yVal = 0;
		    }
		    if ((x & 1) == 0) {
			uVal = *uvPtr++ - 128;
			vVal = *uvPtr++ - 128;
		    }
		    yVal *= 1192;
		    red = yVal + 1634 * vVal;
		    green = yVal - 833 * vVal - 400 * uVal;
		    blue = yVal + 2066 * uVal;
		    if (red < 0) {
			red = 0;
		    } else if (red > 0x3ffff) {
			red = 0x3ffff;
		    }
		    *dstPtr++ = red >> 10;
		    if (green < 0) {
			green = 0;
		    } else if (green > 0x3ffff) {
			green = 0x3ffff;
		    }
		    *dstPtr++ = green >> 10;
		    if (blue < 0) {
			blue = 0;
		    } else if (blue > 0x3ffff) {
			blue = 0x3ffff;
		    }
		    *dstPtr++ = blue >> 10;
		}
	    }
	} else {
	    /* convert YUY2 -> RGB */
	    for (y = 0; y < height; y++) {
		yPtr = rawPtr + y * width * 2;
		dstPtr = block.pixelPtr + block.pixelSize * y * width;
		for (x = 0; x < width; x++) {
		    int red, green, blue;

		    yVal = *yPtr++;
		    yVal -= 16;
		    if (yVal < 0) {
			yVal = 0;
		    }
		    uVal = *yPtr++ - 128;
		    yVal2 = *yPtr++;
		    yVal2 -= 16;
		    if (yVal2 < 0) {
			yVal2 = 0;
		    }
		    vVal = *yPtr++ - 128;
		    red = 298 * yVal + 409 * vVal + 128;
		    green = 298 * yVal - 100 * uVal - 208 * vVal + 128;
		    blue = 298 * yVal + 516 * uVal + 128;
		    if (red < 0) {
			red = 0;
		    } else if (red > 0xffff) {
			red = 0xffff;
		    }
		    *dstPtr++ = red >> 8;
		    if (green < 0) {
			green = 0;
		    } else if (green > 0xffff) {
			green = 0xffff;
		    }
		    *dstPtr++ = green >> 8;
		    if (blue < 0) {
			blue = 0;
		    } else if (blue > 0xffff) {
			blue = 0xffff;
		    }
		    *dstPtr++ = blue >> 8;
		    red = 298 * yVal2 + 409 * vVal + 128;
		    green = 298 * yVal2 - 100 * uVal - 208 * vVal + 128;
		    blue = 298 * yVal2 + 516 * uVal + 128;
		    if (red < 0) {
			red = 0;
		    } else if (red > 0xffff) {
			red = 0xffff;
		    }
		    *dstPtr++ = red >> 8;
		    if (green < 0) {
			green = 0;
		    } else if (green > 0xffff) {
			green = 0xffff;
		    }
		    *dstPtr++ = green >> 8;
		    if (blue < 0) {
			blue = 0;
		    } else if (blue > 0xffff) {
			blue = 0xffff;
		    }
		    *dstPtr++ = blue >> 8;
		}
	    }
	}

	if ((wmfc->mirror & 3) == 3) {
	    rot = (rot + 180) % 360;
	}

	switch (rot) {
	case 270:	/* = 90 CW */
	    block.pitch = block.pixelSize;
	    block.pixelPtr += width * block.pixelSize * (height - 1);
	    block.pixelSize *= -width;
	    block.offset[3] = block.pixelSize + 1;	/* no alpha */
	    block.width = height;
	    block.height = width;
	    break;
	case 180:	/* = 180 CW */
	    block.pitch = -block.pitch;
	    block.pixelPtr += (width * height - 1) * block.pixelSize;
	    block.pixelSize = -block.pixelSize;
	    block.offset[3] = block.pixelSize + 1;	/* no alpha */
	    break;
	case 90:	/* = 270 CW */
	    block.pitch = -block.pixelSize;
	    block.pixelPtr += (width - 1) * block.pixelSize;
	    block.pixelSize *= width;
	    block.offset[3] = block.pixelSize + 1;	/* no alpha */
	    block.width = height;
	    block.height = width;
	    break;
	}

	if ((wmfc->mirror & 3) == 2) {
	    /* mirror in X */
	    block.pixelPtr += (block.width - 1) * block.pixelSize;
	    block.pixelSize = -block.pixelSize;
	    block.offset[3] = block.pixelSize + 1;	/* no alpha */
	}
	if ((wmfc->mirror & 1) == 1) {
	    /* mirror in Y */
	    block.pixelPtr += block.pitch * (block.height - 1);
	    block.pitch = -block.pitch;
	}

	if (Tk_PhotoExpand(interp, photo, block.width, block.height)
	    != TCL_OK) {
	    result = TCL_ERROR;
	    goto done;
	}
	if (Tk_PhotoPutBlock(interp, photo, &block, 0, 0,
			     block.width, block.height,
			     TK_PHOTO_COMPOSITE_SET) != TCL_OK) {
	    result = TCL_ERROR;
	} else {
	    Tcl_SetObjResult(interp, Tcl_NewIntObj(1));
	}
    } else {
	unsigned char *pixelPtr;
	Tcl_Obj *list[4];
	unsigned char *yPtr, *uvPtr, *dstPtr;
	int x, y, yVal, yVal2, uVal = 0, vVal = 0;

	pixelPtr = rawPtr + 2 * width * height;

	if (fourcc == 0x3231564e) {
	    /* convert NV12 -> RGB */
	    for (y = 0; y < height; y++) {
		yPtr = rawPtr + y * width;
		uvPtr = rawPtr + width * height + (y >> 1) * width;
		dstPtr = pixelPtr + 3 * y * width;
		for (x = 0; x < width; x++) {
		    int red, green, blue;

		    yVal = *yPtr++;
		    yVal -= 16;
		    if (yVal < 0) {
			yVal = 0;
		    }
		    if ((x & 1) == 0) {
			uVal = *uvPtr++ - 128;
			vVal = *uvPtr++ - 128;
		    }
		    yVal *= 1192;
		    red = yVal + 1634 * vVal;
		    green = yVal - 833 * vVal - 400 * uVal;
		    blue = yVal + 2066 * uVal;
		    if (red < 0) {
			red = 0;
		    } else if (red > 0x3ffff) {
			red = 0x3ffff;
		    }
		    *dstPtr++ = red >> 10;
		    if (green < 0) {
			green = 0;
		    } else if (green > 0x3ffff) {
			green = 0x3ffff;
		    }
		    *dstPtr++ = green >> 10;
		    if (blue < 0) {
			blue = 0;
		    } else if (blue > 0x3ffff) {
			blue = 0x3ffff;
		    }
		    *dstPtr++ = blue >> 10;
		}
	    }
	} else {
	    /* convert YUY2 -> RGB */
	    for (y = 0; y < height; y++) {
		yPtr = rawPtr + y * width * 2;
		dstPtr = pixelPtr + 3 * y * width;
		for (x = 0; x < width / 2; x++) {
		    int red, green, blue;

		    yVal = *yPtr++;
		    yVal -= 16;
		    if (yVal < 0) {
			yVal = 0;
		    }
		    uVal = *yPtr++ - 128;
		    yVal2 = *yPtr++;
		    yVal2 -= 16;
		    if (yVal2 < 0) {
			yVal2 = 0;
		    }
		    vVal = *yPtr++ - 128;
		    red = 298 * yVal + 409 * vVal + 128;
		    green = 298 * yVal - 100 * uVal - 208 * vVal + 128;
		    blue = 298 * yVal + 516 * uVal + 128;
		    if (red < 0) {
			red = 0;
		    } else if (red > 0xffff) {
			red = 0xffff;
		    }
		    *dstPtr++ = red >> 8;
		    if (green < 0) {
			green = 0;
		    } else if (green > 0xffff) {
			green = 0xffff;
		    }
		    *dstPtr++ = green >> 8;
		    if (blue < 0) {
			blue = 0;
		    } else if (blue > 0xffff) {
			blue = 0xffff;
		    }
		    *dstPtr++ = blue >> 8;
		    red = 298 * yVal2 + 409 * vVal + 128;
		    green = 298 * yVal2 - 100 * uVal - 208 * vVal + 128;
		    blue = 298 * yVal2 + 516 * uVal + 128;
		    if (red < 0) {
			red = 0;
		    } else if (red > 0xffff) {
			red = 0xffff;
		    }
		    *dstPtr++ = red >> 8;
		    if (green < 0) {
			green = 0;
		    } else if (green > 0xffff) {
			green = 0xffff;
		    }
		    *dstPtr++ = green >> 8;
		    if (blue < 0) {
			blue = 0;
		    } else if (blue > 0xffff) {
			blue = 0xffff;
		    }
		    *dstPtr++ = blue >> 8;
		}
	    }
	}

	list[0] = Tcl_NewIntObj(width);
	list[1] = Tcl_NewIntObj(height);
	list[2] = Tcl_NewIntObj(3);
	list[3] = Tcl_NewByteArrayObj(pixelPtr, 3 * width * height);
	Tcl_SetObjResult(interp, Tcl_NewListObj(4, list));
    }
done:
    if (rawPtr != NULL) {
	ckfree((char *) rawPtr);
    }
    return result;
}

/*
 *-------------------------------------------------------------------------
 *
 * WmfObjCmdDeleted --
 *
 *	Destructor of "wmf" Tcl command. Closes all device and
 *	releases all resources.
 *
 *-------------------------------------------------------------------------
 */

static void
WmfObjCmdDeleted(ClientData clientData)
{
    WMFI *wmfi = (WMFI *) clientData;
    Tcl_HashEntry *hPtr;
    Tcl_HashSearch search;
    WMFC *wmfc;

    hPtr = Tcl_FirstHashEntry(&wmfi->wmfc, &search);
    while (hPtr != NULL) {
	wmfc = (WMFC *) Tcl_GetHashValue(hPtr);
	StopCapture(wmfc);
	if (wmfc->srcReader != NULL) {
	    wmfc->srcReader->lpVtbl->Release(wmfc->srcReader);
	}
	if (wmfc->mediaSrc != NULL) {
	    wmfc->mediaSrc->lpVtbl->Release(wmfc->mediaSrc);
	}
	if (wmfc->frame[0].data != NULL) {
	    ckfree((char *) wmfc->frame[0].data);
	}
	if (wmfc->frame[1].data != NULL) {
	    ckfree((char *) wmfc->frame[1].data);
	}
	Tcl_DStringFree(&wmfc->devName);
	Tcl_DStringFree(&wmfc->cbCmd);
	DeleteCriticalSection(&wmfc->srcb.lock);
	ckfree((char *) wmfc);
	hPtr = Tcl_NextHashEntry(&search);
    }
    Tcl_DeleteHashTable(&wmfi->wmfc);
    ckfree((char *) wmfi);
}

/*
 *-------------------------------------------------------------------------
 *
 * WmfObjCmd --
 *
 *	"wmf" Tcl command dealing with Windows Media Foundation.
 *
 * Results:
 *	A standard Tcl result.
 *
 * Side effects:
 *	See the user documentation.
 *
 *-------------------------------------------------------------------------
 */

static int
WmfObjCmd(ClientData clientData, Tcl_Interp *interp,
	  int objc, Tcl_Obj * const objv[])
{
    WMFI *wmfi = (WMFI *) clientData;
    WMFC *wmfc;
    Tcl_HashEntry *hPtr;
    int ret = TCL_OK, command;

    static const char *cmdNames[] = {
	"close", "counters", "devices", "image", "info",
	"mirror", "open", "orientation", "parameters",
	"start", "state", "stop", NULL
    };
    enum cmdCode {
	CMD_close, CMD_counters, CMD_devices, CMD_image, CMD_info,
	CMD_mirror, CMD_open, CMD_orientation, CMD_parameters,
	CMD_start, CMD_state, CMD_stop
    };

    if (objc < 2) {
	Tcl_WrongNumArgs(interp, 1, objv, "option ...");
	return TCL_ERROR;
    }
    if (Tcl_GetIndexFromObj(interp, objv[1], cmdNames, "option", 0,
			    &command) != TCL_OK) {
	return TCL_ERROR;
    }

    switch ((enum cmdCode) command) {

    case CMD_close: {
	if (objc != 3) {
	    Tcl_WrongNumArgs(interp, 2, objv, "devid");
	    return TCL_ERROR;
	}
	hPtr = Tcl_FindHashEntry(&wmfi->wmfc, Tcl_GetString(objv[2]));
	if (hPtr == NULL) {
devNotFound:
	    Tcl_SetObjResult(interp, Tcl_ObjPrintf("device \"%s\" not found",
			Tcl_GetString(objv[2])));
	    ret = TCL_ERROR;
	}
	wmfc = (WMFC *) Tcl_GetHashValue(hPtr);
	Tcl_DeleteHashEntry(hPtr);
	StopCapture(wmfc);
	if (wmfc->srcReader != NULL) {
	    wmfc->srcReader->lpVtbl->Release(wmfc->srcReader);
	}
	if (wmfc->mediaSrc != NULL) {
	    wmfc->mediaSrc->lpVtbl->Release(wmfc->mediaSrc);
	}
	if (wmfc->frame[0].data != NULL) {
	    ckfree((char *) wmfc->frame[0].data);
	}
	if (wmfc->frame[1].data != NULL) {
	    ckfree((char *) wmfc->frame[1].data);
	}
	Tcl_DStringFree(&wmfc->devName);
	Tcl_DStringFree(&wmfc->cbCmd);
	DeleteCriticalSection(&wmfc->srcb.lock);
	ckfree((char *) wmfc);
	break;
    }

    case CMD_counters: {
	if (objc != 3) {
	    Tcl_WrongNumArgs(interp, 2, objv, "devid");
	    return TCL_ERROR;
	}
	hPtr = Tcl_FindHashEntry(&wmfi->wmfc, Tcl_GetString(objv[2]));
	if (hPtr != NULL) {
	    Tcl_Obj *r[3];

	    wmfc = (WMFC *) Tcl_GetHashValue(hPtr);
	    EnterCriticalSection(&wmfc->srcb.lock);
	    r[0] = Tcl_NewWideIntObj(wmfc->counters[0]);
	    r[1] = Tcl_NewWideIntObj(wmfc->counters[1]);
	    r[2] = Tcl_NewWideIntObj(wmfc->counters[2]);
	    LeaveCriticalSection(&wmfc->srcb.lock);
	    Tcl_SetObjResult(interp, Tcl_NewListObj(3, r));
	} else {
	    goto devNotFound;
	}
	break;
    }

    case CMD_devices: {
	if (objc != 2) {
	    Tcl_WrongNumArgs(interp, 2, objv, NULL);
	    return TCL_ERROR;
	}
	ret = ListDevices(interp);
	break;
    }

    case CMD_image: {
	if ((objc < 3) || (objc > 4)) {
	    Tcl_WrongNumArgs(interp, 2, objv, "devid ?photoImage?");
	    return TCL_ERROR;
	}
	hPtr = Tcl_FindHashEntry(&wmfi->wmfc, Tcl_GetString(objv[2]));
	if (hPtr == NULL) {
	    goto devNotFound;
	}
	wmfc = (WMFC *) Tcl_GetHashValue(hPtr);
	ret = GetImage(wmfc, (objc > 3) ? objv[3] : NULL);
 	break;
    }

    case CMD_info: {
	if (objc > 3) {
	    Tcl_WrongNumArgs(interp, 2, objv, "?devid?");
	    return TCL_ERROR;
	}
	if (objc == 2) {
	    Tcl_HashSearch search;
	    Tcl_Obj *list = Tcl_NewListObj(0, NULL);

	    hPtr = Tcl_FirstHashEntry(&wmfi->wmfc, &search);
	    while (hPtr != NULL) {
		wmfc = (WMFC *) Tcl_GetHashValue(hPtr);
		Tcl_ListObjAppendElement(NULL, list,
			Tcl_NewStringObj(wmfc->devId, -1));
		hPtr = Tcl_NextHashEntry(&search);
	    }
	    Tcl_SetObjResult(interp, list);
	} else {
	    hPtr = Tcl_FindHashEntry(&wmfi->wmfc, Tcl_GetString(objv[2]));
	    if (hPtr != NULL) {
		Tcl_Obj *r[2];

		wmfc = (WMFC *) Tcl_GetHashValue(hPtr);
		r[0] = Tcl_NewStringObj(Tcl_DStringValue(&wmfc->devName),
					Tcl_DStringLength(&wmfc->devName));
		r[1] = Tcl_NewStringObj(Tcl_DStringValue(&wmfc->cbCmd),
					wmfc->cbCmdLen);
		Tcl_SetObjResult(interp, Tcl_NewListObj(2, r));
	    } else {
		goto devNotFound;
	    }
	}
	break;
    }

    case CMD_mirror: {
	int x, y;

	if ((objc != 3) && (objc != 5)) {
	    Tcl_WrongNumArgs(interp, 3, objv, "?x y?");
	    return TCL_ERROR;
	}
	hPtr = Tcl_FindHashEntry(&wmfi->wmfc, Tcl_GetString(objv[2]));
	if (hPtr == NULL) {
	    goto devNotFound;
	}
	wmfc = (WMFC *) Tcl_GetHashValue(hPtr);
	if ((objc > 3) &&
	    ((Tcl_GetBooleanFromObj(interp, objv[3], &x) != TCL_OK) ||
	     (Tcl_GetBooleanFromObj(interp, objv[4], &y) != TCL_OK))) {
	    return TCL_ERROR;
	}
	if (objc > 3) {
	    wmfc->mirror = (x ? 1 : 0) | (y ? 2 : 0);
	} else {
	    Tcl_Obj *list[2];

	    list[0] = Tcl_NewBooleanObj(wmfc->mirror & 1);
	    list[1] = Tcl_NewBooleanObj(wmfc->mirror & 2);
	    Tcl_SetObjResult(interp, Tcl_NewListObj(2, list));
	}
	break;
    }

    case CMD_open: {
	char *devName;
	int isNew;
	IMFMediaSource *mediaSrc;
	Tcl_HashSearch search;

	if (objc != 4) {
	    Tcl_WrongNumArgs(interp, 2, objv, "device callback");
	    return TCL_ERROR;
	}
	devName = Tcl_GetString(objv[2]);
	hPtr = Tcl_FirstHashEntry(&wmfi->wmfc, &search);
	while (hPtr != NULL) {
	    wmfc = (WMFC *) Tcl_GetHashValue(hPtr);
	    if (strcmp(Tcl_DStringValue(&wmfc->devName), devName) == 0) {
		Tcl_SetObjResult(interp,
			Tcl_ObjPrintf("\"%s\" is already opened", devName));
		return TCL_ERROR;
	    }
	    hPtr = Tcl_NextHashEntry(&search);
	}
	mediaSrc = GetSource(devName);
	if (mediaSrc == NULL) {
	    Tcl_SetObjResult(interp,
		Tcl_ObjPrintf("cannot open \"%s\"", devName));
	    return TCL_ERROR;
	}
	wmfc = (WMFC *) ckalloc(sizeof (WMFC));
	memset(wmfc, 0, sizeof (WMFC));
	wmfc->mediaSrc = mediaSrc;
	wmfc->srcReader = NULL;
	wmfc->frameReady = wmfc->frameQueued = -1;
        wmfc->mirror = 0;
        wmfc->rotate = 0;
        wmfc->interp = interp;
	InitializeCriticalSection(&wmfc->srcb.lock);
 	Tcl_DStringInit(&wmfc->devName);
	Tcl_DStringAppend(&wmfc->devName, devName, -1);
	Tcl_DStringInit(&wmfc->cbCmd);
	Tcl_DStringAppend(&wmfc->cbCmd, Tcl_GetString(objv[3]), -1);
	wmfc->cbCmdLen = Tcl_DStringLength(&wmfc->cbCmd);
	sprintf(wmfc->devId, "wmfdev%d", wmfi->idCount++);
	hPtr = Tcl_CreateHashEntry(&wmfi->wmfc, wmfc->devId, &isNew);
	Tcl_SetHashValue(hPtr, (ClientData) wmfc);
	Tcl_SetObjResult(interp, Tcl_NewStringObj(wmfc->devId, -1));
	break;
    }

    case CMD_orientation: {
	if (objc > 4) {
	    Tcl_WrongNumArgs(interp, 3, objv, "?degrees?");
	    return TCL_ERROR;
	}
	hPtr = Tcl_FindHashEntry(&wmfi->wmfc, Tcl_GetString(objv[2]));
	if (hPtr == NULL) {
	    goto devNotFound;
	}
	wmfc = (WMFC *) Tcl_GetHashValue(hPtr);
	if (objc > 3) {
	    int degrees;

	    if (Tcl_GetIntFromObj(interp, objv[3], &degrees) != TCL_OK) {
		return TCL_ERROR;
	    }
	    degrees = degrees % 360;
	    if (degrees < 45) {
		wmfc->rotate = 0;
	    } else if (degrees < 135) {
		wmfc->rotate = 90;
	    } else if (degrees < 225) {
		wmfc->rotate = 180;
	    } else if (degrees < 315) {
		wmfc->rotate = 270;
	    } else {
		wmfc->rotate = 0;
	    }
	} else {
	    Tcl_SetObjResult(interp, Tcl_NewIntObj(wmfc->rotate));
	}
	break;
    }

    case CMD_parameters: {
	if ((objc < 3) || (objc % 2 == 0)) {
	    Tcl_WrongNumArgs(interp, 2, objv, "devid ?key value ...?");
	    return TCL_ERROR;
	}
 	break;
    }

    case CMD_start: {
	if (objc != 3) {
	    Tcl_WrongNumArgs(interp, 2, objv, "devid");
	    return TCL_ERROR;
	}
	hPtr = Tcl_FindHashEntry(&wmfi->wmfc, Tcl_GetString(objv[2]));
	if (hPtr == NULL) {
	    goto devNotFound;
	}
	wmfc = (WMFC *) Tcl_GetHashValue(hPtr);
	ret = StartCapture(wmfc);
	break;
    }

    case CMD_state: {
	if (objc != 3) {
	    Tcl_WrongNumArgs(interp, 2, objv, "devid");
	    return TCL_ERROR;
	}
	hPtr = Tcl_FindHashEntry(&wmfi->wmfc, Tcl_GetString(objv[2]));
	if (hPtr == NULL) {
	    goto devNotFound;
	}
	wmfc = (WMFC *) Tcl_GetHashValue(hPtr);
	Tcl_SetResult(interp, (wmfc->async != NULL) ?
		      "capture" : "stop", TCL_STATIC);
	break;
    }

    case CMD_stop: {
	if (objc != 3) {
	    Tcl_WrongNumArgs(interp, 2, objv, "devid");
	    return TCL_ERROR;
	}
	hPtr = Tcl_FindHashEntry(&wmfi->wmfc, Tcl_GetString(objv[2]));
	if (hPtr == NULL) {
	    goto devNotFound;
	}
	wmfc = (WMFC *) Tcl_GetHashValue(hPtr);
	StopCapture(wmfc);
	break;
    }

    }

    return ret;
}

/*
 *-------------------------------------------------------------------------
 *
 * WmfSysInit --
 *
 *	Process wide (de)initializer function.
 *
 *-------------------------------------------------------------------------
 */

static void
WmfSysInit(int init)
{
    if (init) {
	HRESULT hr;

	WMFM.mfplat = LoadLibrary("mfplat.dll");
	if (WMFM.mfplat == NULL) {
	    goto initFailed;
	}
	WMFM.mf = LoadLibrary("mf.dll");
	if (WMFM.mf == NULL) {
	    goto initFailed;
	}
	WMFM.mfreadwrite = LoadLibrary("mfreadwrite.dll");
	if (WMFM.mfreadwrite == NULL) {
	    goto initFailed;
	}
	*((FARPROC *) &WMFM.startup) =
	    GetProcAddress(WMFM.mfplat, "MFStartup");
	if (WMFM.startup == NULL) {
	    goto initFailed;
	}
	*((FARPROC *) &WMFM.shutdown) =
	    GetProcAddress(WMFM.mfplat, "MFShutdown");
	if (WMFM.shutdown == NULL) {
	    goto initFailed;
	}
	*((FARPROC *) &WMFM.createattributes) =
	    GetProcAddress(WMFM.mfplat, "MFCreateAttributes");
	if (WMFM.createattributes == NULL) {
	    goto initFailed;
	}
	*((FARPROC *) &WMFM.enumdevicesources) =
	    GetProcAddress(WMFM.mf, "MFEnumDeviceSources");
	if (WMFM.enumdevicesources == NULL) {
	    goto initFailed;
	}
	*((FARPROC *) &WMFM.createsourcereaderfrommediasource) =
	    GetProcAddress(WMFM.mfreadwrite,
			   "MFCreateSourceReaderFromMediaSource");
	if (WMFM.createsourcereaderfrommediasource == NULL) {
	    goto initFailed;
	}
	*((FARPROC *) &WMFM.getstrideforbitmapinfoheader) =
	    GetProcAddress(WMFM.mfplat,
			   "MFGetStrideForBitmapInfoHeader");
	if (WMFM.getstrideforbitmapinfoheader == NULL) {
	    goto initFailed;
	}
	hr = MFStartup(MF_VERSION, MFSTARTUP_FULL);
	if (!SUCCEEDED(hr)) {
initFailed:
	    if (WMFM.mfplat != NULL) {
		FreeLibrary(WMFM.mfplat);
		WMFM.mfplat = NULL;
	    }
	    if (WMFM.mf != NULL) {
		FreeLibrary(WMFM.mfplat);
		WMFM.mfplat = NULL;
	    }
	    if (WMFM.mfreadwrite != NULL) {
		FreeLibrary(WMFM.mfreadwrite);
		WMFM.mfreadwrite = NULL;
	    }
	    return;
	}
	hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
	if ((hr != S_OK) && (hr != S_FALSE)) {
	    MFShutdown();
	    goto initFailed;
	}
	WMFM.initialized = (hr == S_OK) ? 2 : 1;
    } else if (WMFM.initialized) {
	MFShutdown();
	FreeLibrary(WMFM.mfplat);
	WMFM.mfplat = NULL;
	FreeLibrary(WMFM.mf);
	WMFM.mf = NULL;
	FreeLibrary(WMFM.mfreadwrite);
	WMFM.mfreadwrite = NULL;
	if (WMFM.initialized > 1) {
	    CoUninitialize();
	}
	WMFM.initialized = 0;
    }
}

/*
 *-------------------------------------------------------------------------
 *
 * Tclwmf_Init --
 *
 *	Module initializer
 *
 * Results:
 *	A standard Tcl result.
 *
 * Side effects:
 *	See the user documentation.
 *
 *-------------------------------------------------------------------------
 */

int
Tclwmf_Init(Tcl_Interp *interp)
{
    WMFI *wmfi;

#ifdef USE_TCL_STUBS
    if (Tcl_InitStubs(interp, "8.4", 0) == NULL) {
	return TCL_ERROR;
    }
#else
    if (Tcl_PkgRequire(interp, "Tcl", "8.4", 0) == NULL) {
	return TCL_ERROR;
    }
#endif
#ifdef USE_TK_STUBS
    if (Tk_InitStubs(interp, "8.4", 0) == NULL) {
	return TCL_ERROR;
    }
#else
    if (Tcl_PkgRequire(interp, "Tk", "8.4", 0) == NULL) {
	return TCL_ERROR;
    }
#endif
    if (!WMFM.initialized) {
	Tcl_MutexLock(&wmfMutex);
	WmfSysInit(1);
	if (!WMFM.initialized) {
	    Tcl_MutexUnlock(&wmfMutex);
	    Tcl_SetResult(interp, "Windows Media Foundation not available",
			  TCL_STATIC);
	    return TCL_ERROR;
	}
	Tcl_MutexUnlock(&wmfMutex);
    }
    if (Tcl_PkgProvide(interp, PACKAGE_NAME, PACKAGE_VERSION) != TCL_OK) {
	return TCL_ERROR;
    }
    wmfi = (WMFI *) ckalloc(sizeof (WMFI));
    memset(wmfi, 0, sizeof (WMFI));
    wmfi->idCount = 0;
    Tcl_InitHashTable(&wmfi->wmfc, TCL_STRING_KEYS);
    Tcl_CreateObjCommand(interp, "wmf", WmfObjCmd,
			 (ClientData) wmfi, WmfObjCmdDeleted);
    return TCL_OK;
}

/*
 *-------------------------------------------------------------------------
 *
 * DllMain --
 *
 *	Use DLL_PROCESS_DETACH reason code to unload depending
 *	Windows Media Framework libraries.
 *
 *-------------------------------------------------------------------------
 */

BOOL WINAPI
DllMain(HINSTANCE hmod, DWORD reason, PVOID unused)
{
    if (reason == DLL_PROCESS_DETACH) {
	WmfSysInit(0);
    }
    return TRUE;
}

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * tab-width: 8
 * End:
 */