Discussion:
[PATCH] d3d11va: force WINAPI_FAMILY to WINAPI_FAMILY_DESKTOP_APP to be able to use dxva.h
(too old to reply)
Martin Storsjö
2015-07-26 08:36:13 UTC
Permalink
From: Steve Lhomme <***@gmail.com>

The struct definitions in dxva.h, which are necessary in order to
actually use d3d11va, are hidden when WINAPI_FAMILY targets Windows Phone
or WindowsRT.

Since this is only struct definitions, it doesn't affect the runtime
compatibility.

Building with WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP is disallowed
when targeting ARM. ("Compiling Desktop applications for the ARM
platform is not supported.")

Disable this error during the configure test. When actually building
the libavcodec source files, the header that causes the errors
(crtdefs.h or corecrt.h) has already been included before it is
redefined.
---
configure | 2 +-
libavcodec/dxva2_internal.h | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 973edb4..b76f838 100755
--- a/configure
+++ b/configure
@@ -4270,7 +4270,7 @@ check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi

check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss

-check_type "windows.h dxva.h" "DXVA_PicParams_HEVC"
+check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1
check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0600

diff --git a/libavcodec/dxva2_internal.h b/libavcodec/dxva2_internal.h
index 3b651a4..d030ec4 100644
--- a/libavcodec/dxva2_internal.h
+++ b/libavcodec/dxva2_internal.h
@@ -34,6 +34,10 @@
#include "d3d11va.h"
#endif
#if HAVE_DXVA_H
+/* When targeting WINAPI_FAMILY_PHONE_APP or WINAPI_FAMILY_APP, dxva.h
+ * defines nothing. Force the struct definitions to be visible. */
+#undef WINAPI_FAMILY
+#define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP
#include <dxva.h>
#endif
--
1.8.1.2
Jean-Baptiste Kempf
2015-07-26 08:52:22 UTC
Permalink
Post by Martin Storsjö
The struct definitions in dxva.h, which are necessary in order to
actually use d3d11va, are hidden when WINAPI_FAMILY targets Windows Phone
or WindowsRT.
Isn't that a bug in the MSVC Windows SDK, btw?
Was it reported?

With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Steve Lhomme
2015-07-26 09:13:23 UTC
Permalink
Post by Jean-Baptiste Kempf
Post by Martin Storsjö
The struct definitions in dxva.h, which are necessary in order to
actually use d3d11va, are hidden when WINAPI_FAMILY targets Windows Phone
or WindowsRT.
Isn't that a bug in the MSVC Windows SDK, btw?
Was it reported?
Just like API that are available on the phones but do not pass WAC, it
may be unofficially working.
Post by Jean-Baptiste Kempf
With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
_______________________________________________
libav-devel mailing list
https://lists.libav.org/mailman/listinfo/libav-devel
Jean-Baptiste Kempf
2015-07-26 09:43:37 UTC
Permalink
Post by Steve Lhomme
Post by Jean-Baptiste Kempf
Post by Martin Storsjö
The struct definitions in dxva.h, which are necessary in order to
actually use d3d11va, are hidden when WINAPI_FAMILY targets Windows Phone
or WindowsRT.
Isn't that a bug in the MSVC Windows SDK, btw?
Was it reported?
Just like API that are available on the phones but do not pass WAC, it
may be unofficially working.
They must pass WACK, if they are needed for IDirect3D11Decode...

With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Steve Lhomme
2015-07-26 09:54:09 UTC
Permalink
Post by Jean-Baptiste Kempf
Post by Steve Lhomme
Post by Jean-Baptiste Kempf
Post by Martin Storsjö
The struct definitions in dxva.h, which are necessary in order to
actually use d3d11va, are hidden when WINAPI_FAMILY targets Windows Phone
or WindowsRT.
Isn't that a bug in the MSVC Windows SDK, btw?
Was it reported?
Just like API that are available on the phones but do not pass WAC, it
may be unofficially working.
They must pass WACK, if they are needed for IDirect3D11Decode...
But I don't think there is WACK checks on COM interfaces we try to
use. Not sure how it would do that without running the code.
Post by Jean-Baptiste Kempf
With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
_______________________________________________
libav-devel mailing list
https://lists.libav.org/mailman/listinfo/libav-devel
Jean-Baptiste Kempf
2015-07-26 10:54:52 UTC
Permalink
Post by Steve Lhomme
Post by Jean-Baptiste Kempf
Post by Steve Lhomme
Post by Jean-Baptiste Kempf
Post by Martin Storsjö
The struct definitions in dxva.h, which are necessary in order to
actually use d3d11va, are hidden when WINAPI_FAMILY targets Windows Phone
or WindowsRT.
Isn't that a bug in the MSVC Windows SDK, btw?
Was it reported?
Just like API that are available on the phones but do not pass WAC, it
may be unofficially working.
They must pass WACK, if they are needed for IDirect3D11Decode...
But I don't think there is WACK checks on COM interfaces we try to
use. Not sure how it would do that without running the code.
It does run the code.
And check the strings and the calls to COM interface methods. Else the
whole WACK is useless.

With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
Steve Lhomme
2015-07-26 11:02:22 UTC
Permalink
Post by Jean-Baptiste Kempf
Post by Steve Lhomme
Post by Jean-Baptiste Kempf
Post by Steve Lhomme
Post by Jean-Baptiste Kempf
Post by Martin Storsjö
The struct definitions in dxva.h, which are necessary in order to
actually use d3d11va, are hidden when WINAPI_FAMILY targets Windows Phone
or WindowsRT.
Isn't that a bug in the MSVC Windows SDK, btw?
Was it reported?
Just like API that are available on the phones but do not pass WAC, it
may be unofficially working.
They must pass WACK, if they are needed for IDirect3D11Decode...
But I don't think there is WACK checks on COM interfaces we try to
use. Not sure how it would do that without running the code.
It does run the code.
And check the strings and the calls to COM interface methods. Else the
whole WACK is useless.
OK, I'll give it a try then. There are direct API calls that should
not be unhidden like D3DCreateDevice and D3DCompile. In VLC the device
comes the managed layer so we don't call them. In some avconv app, I'm
not sure how this would be done.
Post by Jean-Baptiste Kempf
With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
_______________________________________________
libav-devel mailing list
https://lists.libav.org/mailman/listinfo/libav-devel
Martin Storsjö
2015-07-26 09:23:31 UTC
Permalink
Post by Martin Storsjö
The struct definitions in dxva.h, which are necessary in order to
actually use d3d11va, are hidden when WINAPI_FAMILY targets Windows Phone
or WindowsRT.
Since this is only struct definitions, it doesn't affect the runtime
compatibility.
Building with WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP is disallowed
when targeting ARM. ("Compiling Desktop applications for the ARM
platform is not supported.")
Disable this error during the configure test. When actually building
the libavcodec source files, the header that causes the errors
(crtdefs.h or corecrt.h) has already been included before it is
redefined.
---
configure | 2 +-
libavcodec/dxva2_internal.h | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
Steve, if you're ok with this version (with
-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1), I'll push it soon.

// Martin
Steve Lhomme
2015-07-26 11:30:40 UTC
Permalink
Post by Martin Storsjö
Post by Martin Storsjö
The struct definitions in dxva.h, which are necessary in order to
actually use d3d11va, are hidden when WINAPI_FAMILY targets Windows Phone
or WindowsRT.
Since this is only struct definitions, it doesn't affect the runtime
compatibility.
Building with WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP is disallowed
when targeting ARM. ("Compiling Desktop applications for the ARM
platform is not supported.")
Disable this error during the configure test. When actually building
the libavcodec source files, the header that causes the errors
(crtdefs.h or corecrt.h) has already been included before it is
redefined.
---
configure | 2 +-
libavcodec/dxva2_internal.h | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
Steve, if you're ok with this version (with
-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1), I'll push it soon.
I think using -D_CRT_BUILD_DESKTOP_APP=0 is better, it may even be set
globally on the build and it has the same effect.
If it's not set globally, then we need to set this one or the other in
dxva2_internal.h.

I'll submit a version that compiles here with VS2013 ARM & WP8.1 SDK.
Post by Martin Storsjö
// Martin
_______________________________________________
libav-devel mailing list
https://lists.libav.org/mailman/listinfo/libav-devel
Martin Storsjö
2015-07-26 16:45:55 UTC
Permalink
Post by Steve Lhomme
Post by Martin Storsjö
Post by Martin Storsjö
The struct definitions in dxva.h, which are necessary in order to
actually use d3d11va, are hidden when WINAPI_FAMILY targets Windows Phone
or WindowsRT.
Since this is only struct definitions, it doesn't affect the runtime
compatibility.
Building with WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP is disallowed
when targeting ARM. ("Compiling Desktop applications for the ARM
platform is not supported.")
Disable this error during the configure test. When actually building
the libavcodec source files, the header that causes the errors
(crtdefs.h or corecrt.h) has already been included before it is
redefined.
---
configure | 2 +-
libavcodec/dxva2_internal.h | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
Steve, if you're ok with this version (with
-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1), I'll push it soon.
I think using -D_CRT_BUILD_DESKTOP_APP=0 is better, it may even be set
globally on the build and it has the same effect.
Thanks, that's probably just as good or better.
Post by Steve Lhomme
If it's not set globally, then we need to set this one or the other in
dxva2_internal.h.
At least in my tests, it wasn't necessary, because in each place
dxva2_internal.h is included, enough system headers have already been
included so the check has been performed (and won't be performed again).
But it doesn't hurt to add it there just in case, and that's of course
even better.

// Martin

Continue reading on narkive:
Loading...