[FFmpeg-devel] [PATCH 3/6] ffmpeg: dxva2: move the DXVA GUID definitions outside of the template

Steve Lhomme robux4 at gmail.com
Wed Jan 4 15:52:40 EET 2017


---
 Makefile               |  2 +-
 ffmpeg_dxva2.c         |  1 +
 ffmpeg_dxva_template.c |  7 ++++++-
 ffmpeg_guid.c          | 20 ++++++++++++++++++++
 4 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 ffmpeg_guid.c

diff --git a/Makefile b/Makefile
index 8aa72fd..25e1d54 100644
--- a/Makefile
+++ b/Makefile
@@ -37,7 +37,7 @@ ifndef CONFIG_VIDEOTOOLBOX
 OBJS-ffmpeg-$(CONFIG_VDA)     += ffmpeg_videotoolbox.o
 endif
 OBJS-ffmpeg-$(CONFIG_CUVID)   += ffmpeg_cuvid.o
-OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o
+OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o ffmpeg_guid.o
 OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o
 OBJS-ffserver                 += ffserver_config.o
 
diff --git a/ffmpeg_dxva2.c b/ffmpeg_dxva2.c
index e07f2b8..dd19fec 100644
--- a/ffmpeg_dxva2.c
+++ b/ffmpeg_dxva2.c
@@ -63,6 +63,7 @@ typedef struct dxva_context         DXVA_AV_CONTEXT;
 typedef IDirectXVideoDecoderService *DXVA_DECODER_SERVICE;
 #include "ffmpeg_dxva_template.c"
 
+#include <initguid.h>
 DEFINE_GUID(IID_IDirectXVideoDecoderService, 0xfc51a551,0xd5e7,0x11d9,0xaf,0x55,0x00,0x05,0x4e,0x43,0xff,0x02);
 
 static void dxva2_uninit(AVCodecContext *s)
diff --git a/ffmpeg_dxva_template.c b/ffmpeg_dxva_template.c
index 87d33f2..1a7d26e 100644
--- a/ffmpeg_dxva_template.c
+++ b/ffmpeg_dxva_template.c
@@ -16,9 +16,12 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#ifndef INITGUID
+#include <guiddef.h>
+#endif
+
 /* define all the GUIDs used directly here,
  to avoid problems with inconsistent dxva2api.h versions in mingw-w64 and different MSVC version */
-#include <initguid.h>
 DEFINE_GUID(DXVA2_ModeMPEG2_VLD,      0xee27417f, 0x5e28,0x4e65,0xbe,0xea,0x1d,0x26,0xb5,0x08,0xad,0xc9);
 DEFINE_GUID(DXVA2_ModeMPEG2and1_VLD,  0x86695f12, 0x340e,0x4f04,0x9f,0xd3,0x92,0x53,0xdd,0x32,0x74,0x60);
 DEFINE_GUID(DXVA2_ModeH264_E,         0x1b81be68, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
@@ -32,6 +35,7 @@ DEFINE_GUID(DXVA2_NoEncrypt,          0x1b81beD0, 0xa0c7,0x11d3,0xb9,0x84,0x00,0
 DEFINE_GUID(DXVA2_ModeVP9_VLD_Profile0, 0x463707f8, 0xa1d0,0x4585,0x87,0x6d,0x83,0xaa,0x6d,0x60,0xb8,0x9e);
 DEFINE_GUID(GUID_NULL,                0x00000000, 0x0000,0x0000,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00);
 
+#ifndef INITGUID
 typedef struct dxva_mode {
     const GUID     *guid;
     enum AVCodecID codec;
@@ -293,3 +297,4 @@ fail:
     dxva_uninit(s);
     return AVERROR(EINVAL);
 }
+#endif /* INITGUID */
diff --git a/ffmpeg_guid.c b/ffmpeg_guid.c
new file mode 100644
index 0000000..4a12227
--- /dev/null
+++ b/ffmpeg_guid.c
@@ -0,0 +1,20 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <initguid.h>
+#include "ffmpeg_dxva_template.c"
-- 
2.10.1.windows.1



More information about the ffmpeg-devel mailing list