[vlc-commits] va_surface: add a function to get the surface index in the array
Steve Lhomme
git at videolan.org
Fri Oct 18 14:50:34 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Oct 18 12:01:23 2019 +0200| [fac459a554415f6a7c7afd34cdf25bbd086bba44] | committer: Steve Lhomme
va_surface: add a function to get the surface index in the array
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fac459a554415f6a7c7afd34cdf25bbd086bba44
---
modules/codec/avcodec/va_surface.c | 7 +++++++
modules/codec/avcodec/va_surface_internal.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/modules/codec/avcodec/va_surface.c b/modules/codec/avcodec/va_surface.c
index 9f9c957836..1441340002 100644
--- a/modules/codec/avcodec/va_surface.c
+++ b/modules/codec/avcodec/va_surface.c
@@ -53,6 +53,7 @@ struct va_pool_t
};
struct vlc_va_surface_t {
+ unsigned index;
atomic_uintptr_t refcount; // 1 ref for the surface existance, 1 per surface/clone in-flight
picture_context_t *pic_va_ctx;
};
@@ -114,6 +115,7 @@ static int SetupSurfaces(vlc_va_t *va, va_pool_t *va_pool)
vlc_va_surface_t *p_surface = malloc(sizeof(*p_surface));
if (unlikely(p_surface==NULL))
goto done;
+ p_surface->index = i;
p_surface->pic_va_ctx = va_pool->callbacks.pf_new_surface_context(va, i, p_surface);
if (unlikely(p_surface->pic_va_ctx==NULL))
{
@@ -185,6 +187,11 @@ void va_surface_Release(vlc_va_surface_t *surface)
free(surface);
}
+unsigned va_surface_GetIndex(vlc_va_surface_t *surface)
+{
+ return surface->index;
+}
+
void va_pool_Close(vlc_va_t *va, va_pool_t *va_pool)
{
ReleasePoolSurfaces(va_pool);
diff --git a/modules/codec/avcodec/va_surface_internal.h b/modules/codec/avcodec/va_surface_internal.h
index e9bb532503..deb25125b0 100644
--- a/modules/codec/avcodec/va_surface_internal.h
+++ b/modules/codec/avcodec/va_surface_internal.h
@@ -69,6 +69,7 @@ int va_pool_SetupDecoder(vlc_va_t *, va_pool_t *, const AVCodecContext *, const
vlc_va_surface_t *va_pool_Get(va_pool_t *);
picture_context_t *va_surface_GetContext(vlc_va_surface_t *);
+unsigned va_surface_GetIndex(vlc_va_surface_t *surface);
void va_surface_AddRef(vlc_va_surface_t *surface);
void va_surface_Release(vlc_va_surface_t *surface);
More information about the vlc-commits
mailing list