vlc | branch: master | Steve Lhomme <[email protected]> | Mon Oct 21 09:24:53 2019 +0200| [c0162d6dd7e289ce9006c146dfb3e35de4d8ddff] | committer: Steve Lhomme
va_surface: use size_t for the surface index and read it using a const pointer > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c0162d6dd7e289ce9006c146dfb3e35de4d8ddff --- modules/codec/avcodec/d3d11va.c | 4 ++-- modules/codec/avcodec/dxva2.c | 6 +++--- modules/codec/avcodec/va_surface.c | 10 +++++----- modules/codec/avcodec/va_surface_internal.h | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c index 202cb71a20..c0e419e9b5 100644 --- a/modules/codec/avcodec/d3d11va.c +++ b/modules/codec/avcodec/d3d11va.c @@ -126,7 +126,7 @@ static int DxGetInputList(vlc_va_t *, input_list_t *); static int DxSetupOutput(vlc_va_t *, const directx_va_mode_t *, const video_format_t *); static int DxCreateDecoderSurfaces(vlc_va_t *, int codec_id, - const video_format_t *fmt, unsigned surface_count); + const video_format_t *fmt, size_t surface_count); static void DxDestroySurfaces(void *); static void SetupAVCodecContext(void *opaque) @@ -594,7 +594,7 @@ static bool CanUseDecoderPadding(vlc_va_sys_t *sys) * It creates a Direct3D11 decoder using the given video format */ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id, - const video_format_t *fmt, unsigned surface_count) + const video_format_t *fmt, size_t surface_count) { vlc_va_sys_t *sys = va->sys; HRESULT hr; diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c index e6999604fa..0ca8f74290 100644 --- a/modules/codec/avcodec/dxva2.c +++ b/modules/codec/avcodec/dxva2.c @@ -149,7 +149,7 @@ static int DxGetInputList(vlc_va_t *, input_list_t *); static int DxSetupOutput(vlc_va_t *, const directx_va_mode_t *, const video_format_t *); static int DxCreateVideoDecoder(vlc_va_t *, int codec_id, - const video_format_t *, unsigned surface_count); + const video_format_t *, size_t surface_count); static void DxDestroyVideoDecoder(void *); static void SetupAVCodecContext(void *opaque) @@ -542,7 +542,7 @@ static int DxSetupOutput(vlc_va_t *va, const directx_va_mode_t *mode, const vide * It creates a DXVA2 decoder using the given video format */ static int DxCreateVideoDecoder(vlc_va_t *va, int codec_id, - const video_format_t *fmt, unsigned surface_count) + const video_format_t *fmt, size_t surface_count) { vlc_va_sys_t *sys = va->sys; HRESULT hr; @@ -670,7 +670,7 @@ static int DxCreateVideoDecoder(vlc_va_t *va, int codec_id, msg_Dbg(va, "IDirectXVideoDecoderService_CreateVideoDecoder succeed"); return VLC_SUCCESS; error: - for (unsigned i = 0; i < surface_count; i++) + for (size_t i = 0; i < surface_count; i++) IDirect3DSurface9_Release( sys->hw_surface[i] ); return VLC_EGENERIC; } diff --git a/modules/codec/avcodec/va_surface.c b/modules/codec/avcodec/va_surface.c index 3b0dd98c14..974090ab71 100644 --- a/modules/codec/avcodec/va_surface.c +++ b/modules/codec/avcodec/va_surface.c @@ -41,7 +41,7 @@ #define MAX_GET_RETRIES ((VLC_TICK_FROM_SEC(1) + VOUT_OUTMEM_SLEEP) / VOUT_OUTMEM_SLEEP) struct vlc_va_surface_t { - unsigned index; + size_t index; atomic_uintptr_t refcount; // 1 ref for the surface existance, 1 per surface/clone in-flight va_pool_t *va_pool; }; @@ -49,7 +49,7 @@ struct vlc_va_surface_t { struct va_pool_t { /* */ - unsigned surface_count; + size_t surface_count; unsigned surface_width; unsigned surface_height; @@ -77,7 +77,7 @@ static void va_pool_Release(va_pool_t *va_pool) /* */ int va_pool_SetupDecoder(vlc_va_t *va, va_pool_t *va_pool, const AVCodecContext *avctx, - const video_format_t *fmt, unsigned count) + const video_format_t *fmt, size_t count) { if ( va_pool->surface_count >= count && va_pool->surface_width == fmt->i_width && @@ -101,7 +101,7 @@ int va_pool_SetupDecoder(vlc_va_t *va, va_pool_t *va_pool, const AVCodecContext va_pool->surface_height = fmt->i_height; va_pool->surface_count = count; - for (unsigned i = 0; i < va_pool->surface_count; i++) { + for (size_t i = 0; i < va_pool->surface_count; i++) { vlc_va_surface_t *surface = &va_pool->surface[i]; atomic_init(&surface->refcount, 1); va_pool_AddRef(va_pool); @@ -163,7 +163,7 @@ void va_surface_Release(vlc_va_surface_t *surface) va_pool_Release(surface->va_pool); } -unsigned va_surface_GetIndex(vlc_va_surface_t *surface) +size_t va_surface_GetIndex(const vlc_va_surface_t *surface) { return surface->index; } diff --git a/modules/codec/avcodec/va_surface_internal.h b/modules/codec/avcodec/va_surface_internal.h index 3c6a49b4cd..4ed38af02b 100644 --- a/modules/codec/avcodec/va_surface_internal.h +++ b/modules/codec/avcodec/va_surface_internal.h @@ -48,7 +48,7 @@ struct va_pool_cfg { */ int (*pf_create_decoder_surfaces)(vlc_va_t *, int codec_id, const video_format_t *fmt, - unsigned surface_count); + size_t surface_count); /** * Set the avcodec hw context after the decoder is created */ @@ -59,10 +59,10 @@ struct va_pool_cfg { va_pool_t * va_pool_Create(vlc_va_t *, const struct va_pool_cfg *); void va_pool_Close(va_pool_t *); -int va_pool_SetupDecoder(vlc_va_t *, va_pool_t *, const AVCodecContext *, const video_format_t *, unsigned count); +int va_pool_SetupDecoder(vlc_va_t *, va_pool_t *, const AVCodecContext *, const video_format_t *, size_t count); vlc_va_surface_t *va_pool_Get(va_pool_t *); -unsigned va_surface_GetIndex(vlc_va_surface_t *surface); +size_t va_surface_GetIndex(const vlc_va_surface_t *surface); void va_surface_AddRef(vlc_va_surface_t *surface); void va_surface_Release(vlc_va_surface_t *surface); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
