summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Mitchell <kevmitch@gmail.com>2016-02-15 17:52:56 -0800
committerKevin Mitchell <kevmitch@gmail.com>2016-02-16 12:36:57 -0800
commit3dfb07854b3143d59681fd65f7dd7c3ba65e1d2f (patch)
treeaa88d49a3d1df74662f7e60a4076baf234effbae
parent88c83f450afdf763f88fbc3bab40556e24af1b6d (diff)
downloadmpv-3dfb07854b3143d59681fd65f7dd7c3ba65e1d2f.tar.bz2
mpv-3dfb07854b3143d59681fd65f7dd7c3ba65e1d2f.tar.xz
dxva2: use mp_HESULT_to_str on FAILED(hr)
-rw-r--r--osdep/windows_utils.c35
-rw-r--r--video/decode/dxva2.c31
2 files changed, 55 insertions, 11 deletions
diff --git a/osdep/windows_utils.c b/osdep/windows_utils.c
index ee80a18ef4..21ff40a89d 100644
--- a/osdep/windows_utils.c
+++ b/osdep/windows_utils.c
@@ -21,6 +21,7 @@
#include <windows.h>
#include <errors.h>
#include <audioclient.h>
+#include <d3d9.h>
#include "windows_utils.h"
@@ -83,6 +84,40 @@ static char *hresult_to_str(const HRESULT hr)
E(AUDCLNT_S_BUFFER_EMPTY)
E(AUDCLNT_S_THREAD_ALREADY_REGISTERED)
E(AUDCLNT_S_POSITION_STALLED)
+ E(D3DERR_WRONGTEXTUREFORMAT)
+ E(D3DERR_UNSUPPORTEDCOLOROPERATION)
+ E(D3DERR_UNSUPPORTEDCOLORARG)
+ E(D3DERR_UNSUPPORTEDALPHAOPERATION)
+ E(D3DERR_UNSUPPORTEDALPHAARG)
+ E(D3DERR_TOOMANYOPERATIONS)
+ E(D3DERR_CONFLICTINGTEXTUREFILTER)
+ E(D3DERR_UNSUPPORTEDFACTORVALUE)
+ E(D3DERR_CONFLICTINGRENDERSTATE)
+ E(D3DERR_UNSUPPORTEDTEXTUREFILTER)
+ E(D3DERR_CONFLICTINGTEXTUREPALETTE)
+ E(D3DERR_DRIVERINTERNALERROR)
+ E(D3DERR_NOTFOUND)
+ E(D3DERR_MOREDATA)
+ E(D3DERR_DEVICELOST)
+ E(D3DERR_DEVICENOTRESET)
+ E(D3DERR_NOTAVAILABLE)
+ E(D3DERR_OUTOFVIDEOMEMORY)
+ E(D3DERR_INVALIDDEVICE)
+ E(D3DERR_INVALIDCALL)
+ E(D3DERR_DRIVERINVALIDCALL)
+ E(D3DERR_WASSTILLDRAWING)
+ E(D3DOK_NOAUTOGEN)
+ E(D3DERR_DEVICEREMOVED)
+ E(D3DERR_DEVICEHUNG)
+ E(S_NOT_RESIDENT)
+ E(S_RESIDENT_IN_SHARED_MEMORY)
+ E(S_PRESENT_MODE_CHANGED)
+ E(S_PRESENT_OCCLUDED)
+ E(D3DERR_UNSUPPORTEDOVERLAY)
+ E(D3DERR_UNSUPPORTEDOVERLAYFORMAT)
+ E(D3DERR_CANNOTPROTECTCONTENT)
+ E(D3DERR_UNSUPPORTEDCRYPTO)
+ E(D3DERR_PRESENT_STATISTICS_DISJOINT)
default:
return "<Unknown>";
}
diff --git a/video/decode/dxva2.c b/video/decode/dxva2.c
index 782ae17cfe..220a97d504 100644
--- a/video/decode/dxva2.c
+++ b/video/decode/dxva2.c
@@ -207,7 +207,8 @@ static struct mp_image *dxva2_retrieve_image(struct lavc_ctx *s,
hr = IDirect3DSurface9_LockRect(surface, &LockedRect, NULL, D3DLOCK_READONLY);
if (FAILED(hr)) {
- MP_ERR(ctx, "Unable to lock DXVA2 surface\n");
+ MP_ERR(ctx, "Unable to lock DXVA2 surface: %s\n",
+ mp_HRESULT_to_str(hr));
talloc_free(sw_img);
return img;
}
@@ -271,7 +272,8 @@ static int create_device(struct lavc_ctx *s)
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE,
&d3dpp, &ctx->d3d9device);
if (FAILED(hr)) {
- MP_ERR(ctx, "Failed to create Direct3D device\n");
+ MP_ERR(ctx, "Failed to create Direct3D device: %s\n",
+ mp_HRESULT_to_str(hr));
goto fail;
}
@@ -317,25 +319,29 @@ static int dxva2_init(struct lavc_ctx *s)
hr = createDeviceManager(&resetToken, &ctx->d3d9devmgr);
if (FAILED(hr)) {
- MP_ERR(ctx, "Failed to create Direct3D device manager\n");
+ MP_ERR(ctx, "Failed to create Direct3D device manager: %s\n",
+ mp_HRESULT_to_str(hr));
goto fail;
}
hr = IDirect3DDeviceManager9_ResetDevice(ctx->d3d9devmgr, ctx->d3d9device, resetToken);
if (FAILED(hr)) {
- MP_ERR(ctx, "Failed to bind Direct3D device to device manager\n");
+ MP_ERR(ctx, "Failed to bind Direct3D device to device manager: %s\n",
+ mp_HRESULT_to_str(hr));
goto fail;
}
hr = IDirect3DDeviceManager9_OpenDeviceHandle(ctx->d3d9devmgr, &ctx->deviceHandle);
if (FAILED(hr)) {
- MP_ERR(ctx, "Failed to open device handle\n");
+ MP_ERR(ctx, "Failed to open device handle: %s\n",
+ mp_HRESULT_to_str(hr));
goto fail;
}
hr = IDirect3DDeviceManager9_GetVideoService(ctx->d3d9devmgr, ctx->deviceHandle, &IID_IDirectXVideoDecoderService, (void **)&ctx->decoder_service);
if (FAILED(hr)) {
- MP_ERR(ctx, "Failed to create IDirectXVideoDecoderService\n");
+ MP_ERR(ctx, "Failed to create IDirectXVideoDecoderService: %s\n",
+ mp_HRESULT_to_str(hr));
goto fail;
}
@@ -364,7 +370,8 @@ static int dxva2_get_decoder_configuration(struct lavc_ctx *s,
hr = IDirectXVideoDecoderService_GetDecoderConfigurations(ctx->decoder_service, device_guid, desc, NULL, &cfg_count, &cfg_list);
if (FAILED(hr)) {
- MP_ERR(ctx, "Unable to retrieve decoder configurations\n");
+ MP_ERR(ctx, "Unable to retrieve decoder configurations: %s\n",
+ mp_HRESULT_to_str(hr));
return -1;
}
@@ -426,7 +433,8 @@ static int dxva2_create_decoder(struct lavc_ctx *s, int w, int h,
hr = IDirectXVideoDecoderService_GetDecoderDeviceGuids(ctx->decoder_service, &guid_count, &guid_list);
if (FAILED(hr)) {
- MP_ERR(ctx, "Failed to retrieve decoder device GUIDs\n");
+ MP_ERR(ctx, "Failed to retrieve decoder device GUIDs: %s\n",
+ mp_HRESULT_to_str(hr));
goto fail;
}
@@ -543,8 +551,8 @@ static int dxva2_create_decoder(struct lavc_ctx *s, int w, int h,
decoder->num_surfaces - 1, target_format, D3DPOOL_DEFAULT, 0,
DXVA2_VideoDecoderRenderTarget, decoder->surfaces, NULL);
if (FAILED(hr)) {
- MP_ERR(ctx, "Failed to create %d video surfaces\n",
- decoder->num_surfaces);
+ MP_ERR(ctx, "Failed to create %d video surfaces: %s\n",
+ decoder->num_surfaces, mp_HRESULT_to_str(hr));
goto fail;
}
@@ -552,7 +560,8 @@ static int dxva2_create_decoder(struct lavc_ctx *s, int w, int h,
ctx->decoder_service, &device_guid, &desc, &decoder->config,
decoder->surfaces, decoder->num_surfaces, &decoder->decoder);
if (FAILED(hr)) {
- MP_ERR(ctx, "Failed to create DXVA2 video decoder\n");
+ MP_ERR(ctx, "Failed to create DXVA2 video decoder: %s\n",
+ mp_HRESULT_to_str(hr));
goto fail;
}
decoder->pool = talloc_steal(decoder, mp_image_pool_new(decoder->num_surfaces));