[vlc-commits] directx_va: make surface_count unsigned
Steve Lhomme
git at videolan.org
Thu Jun 22 17:26:10 CEST 2017
vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Wed Jun 21 10:50:34 2017 +0200| [1b894f8795aee82f3f922071350e808035768d19] | committer: Jean-Baptiste Kempf
directx_va: make surface_count unsigned
This is what libavcodec uses anyway.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1b894f8795aee82f3f922071350e808035768d19
---
modules/codec/avcodec/d3d11va.c | 4 ++--
modules/codec/avcodec/directx_va.c | 8 ++++----
modules/codec/avcodec/directx_va.h | 2 +-
modules/codec/avcodec/dxva2.c | 6 +++---
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index f51b741c4f..4f903bf6f8 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -893,7 +893,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id, const video_forma
return VLC_EGENERIC;
}
- int surface_count = dx_sys->surface_count;
+ unsigned surface_count = dx_sys->surface_count;
for (dx_sys->surface_count = 0; dx_sys->surface_count < surface_count; dx_sys->surface_count++) {
sys->extern_pics[dx_sys->surface_count] = NULL;
viewDesc.Texture2D.ArraySlice = dx_sys->surface_count;
@@ -997,7 +997,7 @@ static void DxDestroySurfaces(vlc_va_t *va)
ID3D11Resource_Release(p_texture);
ID3D11Resource_Release(p_texture);
}
- for (int i = 0; i < dx_sys->surface_count; i++)
+ for (unsigned i = 0; i < dx_sys->surface_count; i++)
{
ID3D11VideoDecoderOutputView_Release( dx_sys->hw_surface[i] );
for (int j = 0; j < D3D11_MAX_SHADER_VIEW; j++)
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index 49112f6bdf..5e4b849899 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -281,7 +281,7 @@ char *directx_va_GetDecoderName(const GUID *guid)
int directx_va_Setup(vlc_va_t *va, directx_sys_t *dx_sys, AVCodecContext *avctx)
{
int surface_alignment = 16;
- int surface_count = 2;
+ unsigned surface_count = 2;
if (dx_sys->width == avctx->coded_width && dx_sys->height == avctx->coded_height
&& dx_sys->decoder != NULL)
@@ -349,7 +349,7 @@ int directx_va_Setup(vlc_va_t *va, directx_sys_t *dx_sys, AVCodecContext *avctx)
dx_sys->surface_width, dx_sys->surface_height,
avctx->coded_width, avctx->coded_height);
- for (int i = 0; i < dx_sys->surface_count; i++) {
+ for (unsigned i = 0; i < dx_sys->surface_count; i++) {
vlc_va_surface_t *surface = malloc(sizeof(*surface));
if (unlikely(surface==NULL))
{
@@ -370,7 +370,7 @@ void DestroyVideoDecoder(vlc_va_t *va, directx_sys_t *dx_sys)
{
dx_sys->pf_destroy_surfaces(va);
- for (int i = 0; i < dx_sys->surface_count; i++)
+ for (unsigned i = 0; i < dx_sys->surface_count; i++)
{
IUnknown_Release( dx_sys->hw_surface[i] );
directx_va_Release(dx_sys->surface[i]);
@@ -381,7 +381,7 @@ void DestroyVideoDecoder(vlc_va_t *va, directx_sys_t *dx_sys)
static vlc_va_surface_t *GetSurface(directx_sys_t *dx_sys)
{
- for (int i = 0; i < dx_sys->surface_count; i++) {
+ for (unsigned i = 0; i < dx_sys->surface_count; i++) {
vlc_va_surface_t *surface = dx_sys->surface[i];
uintptr_t expected = 1;
diff --git a/modules/codec/avcodec/directx_va.h b/modules/codec/avcodec/directx_va.h
index 65e53c78f7..5596864482 100644
--- a/modules/codec/avcodec/directx_va.h
+++ b/modules/codec/avcodec/directx_va.h
@@ -76,7 +76,7 @@ typedef struct
D3D_DecoderType *decoder;
/* */
- int surface_count;
+ unsigned surface_count;
int surface_width;
int surface_height;
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index e59622417a..4632a7b03e 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -677,7 +677,7 @@ static int DxCreateVideoDecoder(vlc_va_t *va, int codec_id, const video_format_t
NULL);
if (FAILED(hr)) {
msg_Err(va, "extra buffer impossible, avoid a crash (hr=0x%0lx)", hr);
- for (int i = 0; i < sys->surface_count; i++)
+ for (unsigned i = 0; i < sys->surface_count; i++)
IDirect3DSurface9_Release( sys->hw_surface[i] );
sys->surface_count = 0;
return VLC_EGENERIC;
@@ -721,7 +721,7 @@ static int DxCreateVideoDecoder(vlc_va_t *va, int codec_id, const video_format_t
&cfg_count,
&cfg_list))) {
msg_Err(va, "IDirectXVideoDecoderService_GetDecoderConfigurations failed");
- for (int i = 0; i < sys->surface_count; i++)
+ for (unsigned i = 0; i < sys->surface_count; i++)
IDirect3DSurface9_Release( sys->hw_surface[i] );
sys->surface_count = 0;
return VLC_EGENERIC;
@@ -769,7 +769,7 @@ static int DxCreateVideoDecoder(vlc_va_t *va, int codec_id, const video_format_t
sys->surface_count,
&decoder))) {
msg_Err(va, "IDirectXVideoDecoderService_CreateVideoDecoder failed");
- for (int i = 0; i < sys->surface_count; i++)
+ for (unsigned i = 0; i < sys->surface_count; i++)
IDirect3DSurface9_Release( sys->hw_surface[i] );
sys->surface_count = 0;
return VLC_EGENERIC;
More information about the vlc-commits
mailing list