[FFmpeg-devel,5/5] ffmpeg: use the typedefs more to make comparison between dxva2 and d3d11va

Submitted by Steve Lhomme on Dec. 16, 2016, 10:12 a.m.

Details

Message ID 20161216101205.1360-5-robUx4@gmail.com
State New
Headers show

Commit Message

Steve Lhomme Dec. 16, 2016, 10:12 a.m.
From: Steve Lhomme <robux4@gmail.com>

---
 ffmpeg_d3d11va.c | 20 ++++++++++----------
 ffmpeg_dxva2.c   | 20 ++++++++++----------
 2 files changed, 20 insertions(+), 20 deletions(-)

Patch hide | download patch | download mbox

diff --git a/ffmpeg_d3d11va.c b/ffmpeg_d3d11va.c
index 18c3e53..837c250 100644
--- a/ffmpeg_d3d11va.c
+++ b/ffmpeg_d3d11va.c
@@ -59,15 +59,15 @@  typedef ID3D11VideoDevice          *DXVA_DECODER_SERVICE;
 
 static int d3d11va_get_decoder_configuration(AVCodecContext *s,
                                              const D3D11_VIDEO_DECODER_DESC *desc,
-                                             D3D11_VIDEO_DECODER_CONFIG *config)
+                                             DXVA_DECODER_CONFIG *config)
 {
     InputStream  *ist                    = s->opaque;
     int loglevel                         = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR;
-    D3D11VAContext *ctx                    = ist->hwaccel_ctx;
+    DXVA_CONTEXT *ctx                    = ist->hwaccel_ctx;
     AVHWDeviceContext        *device_ctx = (AVHWDeviceContext*)ctx->hw_device_ctx->data;
     AVD3D11VADeviceContext *device_hwctx = device_ctx->hwctx;
     unsigned cfg_count;
-    D3D11_VIDEO_DECODER_CONFIG *cfg_list;
+    DXVA_DECODER_CONFIG *cfg_list;
     HRESULT hr;
     int i, ret;
 
@@ -77,7 +77,7 @@  static int d3d11va_get_decoder_configuration(AVCodecContext *s,
         return AVERROR(EINVAL);
     }
 
-    cfg_list = av_malloc(cfg_count * sizeof(D3D11_VIDEO_DECODER_CONFIG));
+    cfg_list = av_malloc(cfg_count * sizeof(DXVA_DECODER_CONFIG));
     if (cfg_list == NULL)
         return AVERROR(ENOMEM);
     for (i = 0; i < cfg_count; i++) {
@@ -94,7 +94,7 @@  static int d3d11va_get_decoder_configuration(AVCodecContext *s,
     return ret;
 }
 
-static int d3d11va_validate_output(ID3D11VideoDevice *service, GUID guid, DXGI_FORMAT surface_format)
+static int d3d11va_validate_output(DXVA_DECODER_SERVICE service, GUID guid, DXVA_SURFACE_FORMAT surface_format)
 {
     HRESULT hr;
     BOOL is_supported = FALSE;
@@ -106,15 +106,15 @@  static int d3d11va_create_decoder(AVCodecContext *s)
 {
     InputStream  *ist = s->opaque;
     int loglevel = (ist->hwaccel_id == HWACCEL_AUTO) ? AV_LOG_VERBOSE : AV_LOG_ERROR;
-    D3D11VAContext *ctx = ist->hwaccel_ctx;
-    AVD3D11VAContext *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, i;
     GUID device_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 cfde649..928a86f 100644
--- a/ffmpeg_dxva2.c
+++ b/ffmpeg_dxva2.c
@@ -68,7 +68,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);
@@ -80,7 +80,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;
 
@@ -119,13 +119,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;
 
@@ -164,15 +164,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');
-    D3DFORMAT target_format = 0;
+    const DXVA_SURFACE_FORMAT surface_format = (s->sw_pix_fmt == AV_PIX_FMT_YUV420P10) ? MKTAG('P','0','1','0') : MKTAG('N','V','1','2');
+    DXVA_SURFACE_FORMAT target_format = 0;
     DXVA2_VideoDesc desc = { 0 };
-    DXVA2_ConfigPictureDecode config;
+    DXVA_DECODER_CONFIG config;
     HRESULT hr;
     int ret;