[vlc-commits] vdpau: helper to detach a VDPAU context from a picture

Rémi Denis-Courmont git at videolan.org
Tue Jul 9 18:04:45 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jul  8 22:40:50 2013 +0300| [192bf986046de13d40fff5c7ef86265a1b82b487] | committer: Rémi Denis-Courmont

vdpau: helper to detach a VDPAU context from a picture

This enables releasing the VLC picture while keeping the VDPAU surface
for internal usage.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=192bf986046de13d40fff5c7ef86265a1b82b487
---

 modules/hw/vdpau/picture.c   |   11 +++++++++++
 modules/hw/vdpau/vlc_vdpau.h |    6 ++++++
 2 files changed, 17 insertions(+)

diff --git a/modules/hw/vdpau/picture.c b/modules/hw/vdpau/picture.c
index 38281f2..75f1825 100644
--- a/modules/hw/vdpau/picture.c
+++ b/modules/hw/vdpau/picture.c
@@ -119,3 +119,14 @@ VdpStatus vlc_vdp_video_copy(picture_t *restrict dst, picture_t *restrict src)
     atomic_fetch_add(&frame->refs, 1);
     return VDP_STATUS_OK;
 }
+
+vlc_vdp_video_field_t *vlc_vdp_video_detach(picture_t *pic)
+{
+    vlc_vdp_video_field_t *field = pic->context;
+
+    assert(pic->format.i_chroma == VLC_CODEC_VDPAU_VIDEO_420
+        || pic->format.i_chroma == VLC_CODEC_VDPAU_VIDEO_422);
+    //assert(!picture_IsReferenced(pic));
+    pic->context = NULL;
+    return field;
+}
diff --git a/modules/hw/vdpau/vlc_vdpau.h b/modules/hw/vdpau/vlc_vdpau.h
index 29b916b..450bf7c 100644
--- a/modules/hw/vdpau/vlc_vdpau.h
+++ b/modules/hw/vdpau/vlc_vdpau.h
@@ -274,4 +274,10 @@ VdpStatus vlc_vdp_video_attach(vdp_t *, VdpVideoSurface, picture_t *);
  * Copies the VDPAU video surface from a VLC picture into another VLC picture.
  */
 VdpStatus vlc_vdp_video_copy(picture_t *dst, picture_t *src);
+
+/**
+ * Detaches a VDPAU video surface as context from a VLC picture.
+ * @return the detached context, or NULL on error.
+ */
+vlc_vdp_video_field_t *vlc_vdp_video_detach(picture_t *);
 #endif



More information about the vlc-commits mailing list