[FFmpeg-devel] [PATCH 6/6] ffmpeg: dxva: use the typedefs more to make comparison between dxva2 and d3d11va

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


---
 ffmpeg_d3d11va.c |  9 +++++----
 ffmpeg_dxva2.c   | 19 ++++++++++---------
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/ffmpeg_d3d11va.c b/ffmpeg_d3d11va.c
index b8ca9d8..3fd12f2 100644
--- a/ffmpeg_d3d11va.c
+++ b/ffmpeg_d3d11va.c
@@ -58,8 +58,8 @@ typedef ID3D11VideoDevice          *DXVA_DECODER_SERVICE;
 #include "ffmpeg_dxva_template.c"
 
 static int d3d11va_get_decoder_configuration(AVCodecContext *s,
-                                           const D3D11_VIDEO_DECODER_DESC *desc,
-                                           D3D11_VIDEO_DECODER_CONFIG *config)
+                                             const D3D11_VIDEO_DECODER_DESC *desc,
+                                             DXVA_DECODER_CONFIG *config)
 {
     InputStream  *ist = s->opaque;
     int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR;
@@ -112,9 +112,10 @@ static int d3d11va_create_decoder(AVCodecContext *s)
     GUID *guid_list;
     unsigned guid_count, i;
     GUID decoder_guid;
-    const DXGI_FORMAT surface_format = (s->sw_pix_fmt == AV_PIX_FMT_YUV420P10) ? DXGI_FORMAT_P010 : DXGI_FORMAT_NV12;
+    const DXVA_SURFACE_FORMAT surface_format = s->sw_pix_fmt == AV_PIX_FMT_YUV420P10 ?
+                                               DXGI_FORMAT_P010 : DXGI_FORMAT_NV12;
     D3D11_VIDEO_DECODER_DESC desc = { 0 };
-    D3D11_VIDEO_DECODER_CONFIG config;
+    DXVA_DECODER_CONFIG config;
     HRESULT hr;
     int ret;
 
diff --git a/ffmpeg_dxva2.c b/ffmpeg_dxva2.c
index 68e0365..1497b76 100644
--- a/ffmpeg_dxva2.c
+++ b/ffmpeg_dxva2.c
@@ -69,7 +69,7 @@ DEFINE_GUID(IID_IDirectXVideoDecoderService, 0xfc51a551,0xd5e7,0x11d9,0xaf,0x55,
 static void dxva2_uninit(AVCodecContext *s)
 {
     InputStream  *ist = s->opaque;
-    DXVA2Context *ctx = ist->hwaccel_ctx;
+    DXVA_CONTEXT *ctx = ist->hwaccel_ctx;
 
     if (ctx->decoder_service)
         IDirectXVideoDecoderService_Release(ctx->decoder_service);
@@ -81,7 +81,7 @@ static int dxva2_alloc(AVCodecContext *s)
 {
     InputStream  *ist = s->opaque;
     int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR;
-    DXVA2Context *ctx;
+    DXVA_CONTEXT *ctx;
     HANDLE device_handle;
     HRESULT hr;
 
@@ -120,13 +120,13 @@ fail:
 
 static int dxva2_get_decoder_configuration(AVCodecContext *s, const GUID *device_guid,
                                            const DXVA2_VideoDesc *desc,
-                                           DXVA2_ConfigPictureDecode *config)
+                                           DXVA_DECODER_CONFIG *config)
 {
     InputStream  *ist = s->opaque;
     int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR;
-    DXVA2Context *ctx = ist->hwaccel_ctx;
+    DXVA_CONTEXT *ctx = ist->hwaccel_ctx;
     unsigned cfg_count;
-    DXVA2_ConfigPictureDecode *cfg_list;
+    DXVA_DECODER_CONFIG *cfg_list;
     HRESULT hr;
     int ret;
 
@@ -165,14 +165,15 @@ static int dxva2_create_decoder(AVCodecContext *s)
 {
     InputStream  *ist = s->opaque;
     int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR;
-    DXVA2Context *ctx = ist->hwaccel_ctx;
-    struct dxva_context *dxva_ctx = s->hwaccel_context;
+    DXVA_CONTEXT *ctx = ist->hwaccel_ctx;
+    DXVA_AV_CONTEXT *dxva_ctx = s->hwaccel_context;
     GUID *guid_list;
     unsigned guid_count;
     GUID device_guid;
-    const D3DFORMAT surface_format = (s->sw_pix_fmt == AV_PIX_FMT_YUV420P10) ? MKTAG('P','0','1','0') : MKTAG('N','V','1','2');
+    const DXVA_SURFACE_FORMAT surface_format = s->sw_pix_fmt == AV_PIX_FMT_YUV420P10 ?
+                                               MKTAG('P', '0', '1', '0') : MKTAG('N', 'V', '1', '2');
     DXVA2_VideoDesc desc = { 0 };
-    DXVA2_ConfigPictureDecode config;
+    DXVA_DECODER_CONFIG config;
     HRESULT hr;
     int ret;
 
-- 
2.10.1.windows.1



More information about the ffmpeg-devel mailing list