mirror of
https://github.com/mpv-player/mpv
synced 2025-01-14 02:51:26 +00:00
video/decode: change fix_image callback
This might make it slightly easier when trying to implement surface read-back for hardware decoding.
This commit is contained in:
parent
be2f2ff033
commit
006c2f66e1
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user