[vlc-commits] dxva: pass the actual video_format_t to create the device
Steve Lhomme
git at videolan.org
Wed Jun 12 12:40:23 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jun 12 09:48:16 2019 +0200| [77df17ab89305d7ff6d77ed7da1273dccb683997] | committer: Steve Lhomme
dxva: pass the actual video_format_t to create the device
In DVXA2 we should check the max decoding resolution.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=77df17ab89305d7ff6d77ed7da1273dccb683997
---
modules/codec/avcodec/d3d11va.c | 6 +++---
modules/codec/avcodec/directx_va.c | 4 ++--
modules/codec/avcodec/directx_va.h | 2 +-
modules/codec/avcodec/dxva2.c | 10 ++++------
modules/codec/avcodec/va_surface.c | 4 ++--
modules/codec/avcodec/va_surface_internal.h | 4 ++--
6 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index b08dd363f5..447de543c7 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -127,7 +127,7 @@ struct vlc_va_sys_t
};
/* */
-static int D3dCreateDevice(vlc_va_t *);
+static int D3dCreateDevice(vlc_va_t *, const video_format_t *);
static void D3dDestroyDevice(vlc_va_t *);
static char *DxDescribe(vlc_va_sys_t *);
@@ -389,7 +389,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
}
}
- err = directx_va_Open(va, &sys->dx_sys);
+ err = directx_va_Open(va, &fmt->video, &sys->dx_sys);
if (err!=VLC_SUCCESS)
goto error;
@@ -418,7 +418,7 @@ error:
/**
* It creates a Direct3D device usable for decoding
*/
-static int D3dCreateDevice(vlc_va_t *va)
+static int D3dCreateDevice(vlc_va_t *va, const video_format_t *fmt)
{
vlc_va_sys_t *sys = va->sys;
HRESULT hr;
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index fd93aeec15..517632eb96 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -339,9 +339,9 @@ void directx_va_Close(vlc_va_t *va, directx_sys_t *dx_sys)
va_pool_Close(va, &dx_sys->va_pool);
}
-int directx_va_Open(vlc_va_t *va, directx_sys_t *dx_sys)
+int directx_va_Open(vlc_va_t *va, const video_format_t *fmt, directx_sys_t *dx_sys)
{
- return va_pool_Open(va, &dx_sys->va_pool);
+ return va_pool_Open(va, fmt, &dx_sys->va_pool);
}
static bool profile_supported(const directx_va_mode_t *mode, const es_format_t *fmt,
diff --git a/modules/codec/avcodec/directx_va.h b/modules/codec/avcodec/directx_va.h
index 88a6af2e1b..ede4c02b75 100644
--- a/modules/codec/avcodec/directx_va.h
+++ b/modules/codec/avcodec/directx_va.h
@@ -77,7 +77,7 @@ typedef struct
} directx_sys_t;
-int directx_va_Open(vlc_va_t *, directx_sys_t *);
+int directx_va_Open(vlc_va_t *, const video_format_t *, directx_sys_t *);
void directx_va_Close(vlc_va_t *, directx_sys_t *);
int directx_va_Setup(vlc_va_t *, directx_sys_t *, const AVCodecContext *avctx, const es_format_t *, int flag_xbox);
char *directx_va_GetDecoderName(const GUID *guid);
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 4e1e4c443a..c26ad2a894 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -136,7 +136,7 @@ struct vlc_va_sys_t
/* */
-static int D3dCreateDevice(vlc_va_t *);
+static int D3dCreateDevice(vlc_va_t *, const video_format_t *);
static void D3dDestroyDevice(vlc_va_t *);
static char *DxDescribe(vlc_va_sys_t *);
@@ -267,7 +267,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
vlc_va_sys_t *sys = calloc(1, sizeof (*sys));
if (unlikely(sys == NULL))
return VLC_ENOMEM;
-
/* Load dll*/
if (p_sys!=NULL && p_sys->surface!=NULL)
{
@@ -320,7 +319,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
va->sys = sys;
- err = directx_va_Open(va, &sys->dx_sys);
+ err = directx_va_Open(va, &fmt->video, &sys->dx_sys);
if (err!=VLC_SUCCESS)
goto error;
@@ -349,7 +348,7 @@ error:
/**
* It creates a Direct3D device usable for DXVA 2
*/
-static int D3dCreateDevice(vlc_va_t *va)
+static int D3dCreateDevice(vlc_va_t *va, const video_format_t *fmt)
{
vlc_va_sys_t *sys = va->sys;
@@ -358,8 +357,7 @@ static int D3dCreateDevice(vlc_va_t *va)
return VLC_SUCCESS;
}
- video_format_t fmt = { 0 };
- HRESULT hr = D3D9_CreateDevice(va, &sys->hd3d, GetDesktopWindow(), &fmt, &sys->d3d_dev);
+ HRESULT hr = D3D9_CreateDevice(va, &sys->hd3d, NULL, fmt, &sys->d3d_dev);
if (FAILED(hr))
{
msg_Err(va, "IDirect3D9_CreateDevice failed");
diff --git a/modules/codec/avcodec/va_surface.c b/modules/codec/avcodec/va_surface.c
index 7ec17da9cc..6e266b6663 100644
--- a/modules/codec/avcodec/va_surface.c
+++ b/modules/codec/avcodec/va_surface.c
@@ -198,10 +198,10 @@ void va_pool_Close(vlc_va_t *va, va_pool_t *va_pool)
va_pool->pf_destroy_device(va);
}
-int va_pool_Open(vlc_va_t *va, va_pool_t *va_pool)
+int va_pool_Open(vlc_va_t *va, const video_format_t *fmt, va_pool_t *va_pool)
{
/* */
- if (va_pool->pf_create_device(va)) {
+ if (va_pool->pf_create_device(va, fmt)) {
msg_Err(va, "Failed to create device");
goto error;
}
diff --git a/modules/codec/avcodec/va_surface_internal.h b/modules/codec/avcodec/va_surface_internal.h
index 2b062c27dc..c11e6ea9fd 100644
--- a/modules/codec/avcodec/va_surface_internal.h
+++ b/modules/codec/avcodec/va_surface_internal.h
@@ -43,7 +43,7 @@ typedef struct
struct va_pic_context *surface[MAX_SURFACE_COUNT];
- int (*pf_create_device)(vlc_va_t *);
+ int (*pf_create_device)(vlc_va_t *, const video_format_t *);
void (*pf_destroy_device)(vlc_va_t *);
int (*pf_create_device_manager)(vlc_va_t *);
@@ -74,7 +74,7 @@ typedef struct
} va_pool_t;
-int va_pool_Open(vlc_va_t *, va_pool_t *);
+int va_pool_Open(vlc_va_t *, const video_format_t *, va_pool_t *);
void va_pool_Close(vlc_va_t *va, va_pool_t *);
int va_pool_SetupDecoder(vlc_va_t *, va_pool_t *, const AVCodecContext *, unsigned count, int alignment);
int va_pool_SetupSurfaces(vlc_va_t *, va_pool_t *, unsigned count);
More information about the vlc-commits
mailing list