Commit f85bd16f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

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

parent 63ae28a0
......@@ -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;
......
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment