From 006c2f66e109099d1956594234f54a5f3b5f0ec5 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 15 Aug 2013 18:21:54 +0200 Subject: video/decode: change fix_image callback This might make it slightly easier when trying to implement surface read-back for hardware decoding. --- video/decode/lavc.h | 3 ++- video/decode/vd_lavc.c | 4 ++-- video/decode/vdpau_old.c | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'video') diff --git a/video/decode/lavc.h b/video/decode/lavc.h index f2ac5691d2..769d20b0df 100644 --- a/video/decode/lavc.h +++ b/video/decode/lavc.h @@ -63,7 +63,8 @@ struct vd_lavc_hwdec { void (*uninit)(struct lavc_ctx *ctx); struct mp_image *(*allocate_image)(struct lavc_ctx *ctx, int fmt, int w, int h); - void (*fix_image)(struct lavc_ctx *ctx, struct mp_image *img); + // Process the image returned by the libavcodec decoder. + struct mp_image *(*process_image)(struct lavc_ctx *ctx, struct mp_image *img); }; enum { diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index ba9b81d98e..b77e540168 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -747,8 +747,8 @@ static int decode(struct sh_video *sh, struct demux_packet *packet, struct mp_image *mpi = image_from_decoder(sh); assert(mpi->planes[0]); - if (ctx->hwdec && ctx->hwdec->fix_image) - ctx->hwdec->fix_image(ctx, mpi); + if (ctx->hwdec && ctx->hwdec->process_image) + ctx->hwdec->process_image(ctx, mpi); mpi->colorspace = ctx->image_params.colorspace; mpi->levels = ctx->image_params.colorlevels; diff --git a/video/decode/vdpau_old.c b/video/decode/vdpau_old.c index b5674dcec0..8490caedeb 100644 --- a/video/decode/vdpau_old.c +++ b/video/decode/vdpau_old.c @@ -247,12 +247,13 @@ static int probe(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info, return 0; } -static void fix_image(struct lavc_ctx *ctx, struct mp_image *img) +static struct mp_image *process_image(struct lavc_ctx *ctx, struct mp_image *img) { // Make it follow the convention of the "new" vdpau decoder struct vdpau_render_state *rndr = (void *)img->planes[0]; img->planes[0] = (void *)"dummy"; // must be non-NULL, otherwise arbitrary img->planes[3] = (void *)(intptr_t)rndr->surface; + return img; } const struct vd_lavc_hwdec mp_vd_lavc_vdpau_old = { @@ -275,5 +276,5 @@ const struct vd_lavc_hwdec mp_vd_lavc_vdpau_old = { .init = init, .uninit = uninit, .allocate_image = allocate_image, - .fix_image = fix_image, + .process_image = process_image, }; -- cgit v1.2.3