Browse Source

vdpau: add vlc_vdp_video_destroy() and simplify

pull/22/merge
Rémi Denis-Courmont 9 years ago
parent
commit
260fca1295
  1. 10
      modules/hw/vdpau/avcodec.c
  2. 7
      modules/hw/vdpau/chroma.c
  3. 5
      modules/hw/vdpau/vlc_vdpau.h

10
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);

7
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));

5
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).

Loading…
Cancel
Save