[vlc-commits] vdpau: move field copy to a callback (refs #14456)

Rémi Denis-Courmont git at videolan.org
Mon Jun 5 19:58:33 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jun  5 19:38:58 2017 +0300| [f85bd16fe865728fc2cc749d5217b1b59917564f] | committer: Rémi Denis-Courmont

vdpau: move field copy to a callback (refs #14456)

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

 modules/hw/vdpau/picture.c   | 7 +++++--
 modules/hw/vdpau/vlc_vdpau.h | 7 ++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/modules/hw/vdpau/picture.c b/modules/hw/vdpau/picture.c
index 18c6ce97fd..88801167a5 100644
--- a/modules/hw/vdpau/picture.c
+++ b/modules/hw/vdpau/picture.c
@@ -56,21 +56,23 @@ static void SurfaceDestroy(struct picture_context_t *ctx)
     free(frame);
 }
 
-vlc_vdp_video_field_t *vlc_vdp_video_copy(vlc_vdp_video_field_t *fold)
+static picture_context_t *SurfaceCopy(picture_context_t *ctx)
 {
+    vlc_vdp_video_field_t *fold = (vlc_vdp_video_field_t *)ctx;
     vlc_vdp_video_frame_t *frame = fold->frame;
     vlc_vdp_video_field_t *fnew = malloc(sizeof (*fnew));
     if (unlikely(fnew == NULL))
         return NULL;
 
     fnew->context.destroy = SurfaceDestroy;
+    fnew->copy = SurfaceCopy;
     fnew->frame = frame;
     fnew->structure = fold->structure;
     fnew->procamp = fold->procamp;
     fnew->sharpen = fold->sharpen;
 
     atomic_fetch_add(&frame->refs, 1);
-    return fnew;
+    return &fnew->context;
 }
 
 static const VdpProcamp procamp_default =
@@ -96,6 +98,7 @@ vlc_vdp_video_field_t *vlc_vdp_video_create(vdp_t *vdp,
     }
 
     field->context.destroy = SurfaceDestroy;
+    field->copy = SurfaceCopy;
     field->frame = frame;
     field->structure = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME;
     field->procamp = procamp_default;
diff --git a/modules/hw/vdpau/vlc_vdpau.h b/modules/hw/vdpau/vlc_vdpau.h
index a5f95981a8..318425c79b 100644
--- a/modules/hw/vdpau/vlc_vdpau.h
+++ b/modules/hw/vdpau/vlc_vdpau.h
@@ -274,6 +274,7 @@ typedef struct vlc_vdp_video_frame
 typedef struct vlc_vdp_video_field
 {
     picture_context_t context;
+    struct picture_context_t *(*copy)(struct picture_context_t *);
     vlc_vdp_video_frame_t *frame;
     VdpVideoMixerPictureStructure structure;
     VdpProcamp procamp;
@@ -299,5 +300,9 @@ static inline void vlc_vdp_video_destroy(vlc_vdp_video_field_t *f)
  * Performs a shallow copy of a VDPAU video surface context
  * (the underlying VDPAU video surface is shared).
  */
-vlc_vdp_video_field_t *vlc_vdp_video_copy(vlc_vdp_video_field_t *);
+static inline vlc_vdp_video_field_t *vlc_vdp_video_copy(
+    vlc_vdp_video_field_t *fold)
+{
+    return (vlc_vdp_video_field_t *)fold->copy(&fold->context);
+}
 #endif



More information about the vlc-commits mailing list