[vlc-commits] vdpau: add vlc_vdp_video_destroy() and simplify
Rémi Denis-Courmont
git at videolan.org
Mon Jun 5 18:46:52 CEST 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jun 5 19:44:43 2017 +0300| [260fca1295f23c1c8dbd9649004d6a04877e1f91] | committer: Rémi Denis-Courmont
vdpau: add vlc_vdp_video_destroy() and simplify
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=260fca1295f23c1c8dbd9649004d6a04877e1f91
---
modules/hw/vdpau/avcodec.c | 10 ++--------
modules/hw/vdpau/chroma.c | 7 +++----
modules/hw/vdpau/vlc_vdpau.h | 5 +++++
3 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c
index a73ba53033..7ef934827e 100644
--- a/modules/hw/vdpau/avcodec.c
+++ b/modules/hw/vdpau/avcodec.c
@@ -70,12 +70,6 @@ static vlc_vdp_video_field_t *CreateSurface(vlc_va_t *va)
return field;
}
-static void DestroySurface(vlc_vdp_video_field_t *field)
-{
- assert(field != NULL);
- field->context.destroy(&field->context);
-}
-
static vlc_vdp_video_field_t *GetSurface(vlc_va_t *va)
{
vlc_va_sys_t *sys = va->sys;
@@ -195,7 +189,7 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, enum PixelFormat pix_fmt,
{
msg_Err(va, "not enough video RAM");
while (i > 0)
- DestroySurface(sys->pool[--i]);
+ vlc_vdp_video_destroy(sys->pool[--i]);
goto error;
}
@@ -224,7 +218,7 @@ static void Close(vlc_va_t *va, AVCodecContext *avctx)
vlc_va_sys_t *sys = va->sys;
for (unsigned i = 0; sys->pool[i] != NULL; i++)
- DestroySurface(sys->pool[i]);
+ vlc_vdp_video_destroy(sys->pool[i]);
vdp_release_x11(sys->vdp);
av_freep(&avctx->hwaccel_context);
free(sys);
diff --git a/modules/hw/vdpau/chroma.c b/modules/hw/vdpau/chroma.c
index 115d07fcba..ae51d97446 100644
--- a/modules/hw/vdpau/chroma.c
+++ b/modules/hw/vdpau/chroma.c
@@ -290,8 +290,7 @@ static void Flush(filter_t *filter)
for (unsigned i = 0; i < MAX_PAST + MAX_FUTURE; i++)
if (sys->history[i].field != NULL)
{
- sys->history[i].field->context.destroy(
- &sys->history[i].field->context);
+ vlc_vdp_video_destroy(sys->history[i].field);
sys->history[i].field = NULL;
}
}
@@ -503,7 +502,7 @@ static picture_t *Render(filter_t *filter, picture_t *src, bool import)
{
f = sys->history[0].field;
if (f != NULL)
- f->context.destroy(&f->context);
+ vlc_vdp_video_destroy(f);
memmove(sys->history, sys->history + 1,
sizeof (sys->history[0]) * (MAX_PAST + MAX_FUTURE));
@@ -680,7 +679,7 @@ static picture_t *Render(filter_t *filter, picture_t *src, bool import)
skip:
f = sys->history[0].field;
if (f != NULL)
- f->context.destroy(&f->context); /* Release oldest field */
+ vlc_vdp_video_destroy(f); /* Release oldest field */
memmove(sys->history, sys->history + 1, /* Advance history */
sizeof (sys->history[0]) * (MAX_PAST + MAX_FUTURE));
diff --git a/modules/hw/vdpau/vlc_vdpau.h b/modules/hw/vdpau/vlc_vdpau.h
index 16e776d92c..a5f95981a8 100644
--- a/modules/hw/vdpau/vlc_vdpau.h
+++ b/modules/hw/vdpau/vlc_vdpau.h
@@ -290,6 +290,11 @@ VdpStatus vlc_vdp_video_attach(vdp_t *, VdpVideoSurface, picture_t *);
*/
vlc_vdp_video_field_t *vlc_vdp_video_create(vdp_t *, VdpVideoSurface);
+static inline void vlc_vdp_video_destroy(vlc_vdp_video_field_t *f)
+{
+ return f->context.destroy(&f->context);
+}
+
/**
* Performs a shallow copy of a VDPAU video surface context
* (the underlying VDPAU video surface is shared).
More information about the vlc-commits
mailing list