summaryrefslogtreecommitdiffstats
path: root/video/out/vo_xv.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-09-26 14:26:23 -0500
committerDudemanguy <random342@airmail.cc>2023-10-01 14:48:38 +0000
commit0b705983584691c6d7b1ee19c4b6950fa5334326 (patch)
treeff51915e63cb312aaeaab5f7c79ba7dd533d7db8 /video/out/vo_xv.c
parent043189c2298ea6ee9d1d88143946e6b95e907db8 (diff)
downloadmpv-0b705983584691c6d7b1ee19c4b6950fa5334326.tar.bz2
mpv-0b705983584691c6d7b1ee19c4b6950fa5334326.tar.xz
vo: fully replace draw_image with draw_frame
0739cfc20934ac7772ab71dbae7ecba4ba10fda4 added the draw_frame API deprecated draw_image internally. VOs that still used draw_image were around, but really there's no reason to not just "upgrade" them anyway. draw_frame is what the "real" VOs that people care about (gpu/gpu-next) use. So we can just simplfy the code a bit now. VOCTRL_REDRAW_FRAME is also no longer needed so that can be completely deleted as well. Note that several of these VOs are legacy crap anyway (e.g. vaapi) and maybe should just be deleted but whatever. vo_direct3d was also completely untested (not that anyone should ever use it).
Diffstat (limited to 'video/out/vo_xv.c')
-rw-r--r--video/out/vo_xv.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c
index 9445979cd9..22bce03770 100644
--- a/video/out/vo_xv.c
+++ b/video/out/vo_xv.c
@@ -465,8 +465,6 @@ static int reconfig(struct vo *vo, struct mp_image_params *params)
struct xvctx *ctx = vo->priv;
int i;
- mp_image_unrefp(&ctx->original_image);
-
ctx->image_height = params->h;
ctx->image_width = params->w;
ctx->image_format = params->imgfmt;
@@ -702,8 +700,7 @@ static void get_vsync(struct vo *vo, struct vo_vsync_info *info)
present_sync_get_info(x11->present, info);
}
-// Note: REDRAW_FRAME can call this with NULL.
-static void draw_image(struct vo *vo, mp_image_t *mpi)
+static void draw_frame(struct vo *vo, struct vo_frame *frame)
{
struct xvctx *ctx = vo->priv;
@@ -713,19 +710,17 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
return;
struct mp_image xv_buffer = get_xv_buffer(vo, ctx->current_buf);
- if (mpi) {
- mp_image_copy(&xv_buffer, mpi);
+ if (frame->current) {
+ mp_image_copy(&xv_buffer, frame->current);
} else {
mp_image_clear(&xv_buffer, 0, 0, xv_buffer.w, xv_buffer.h);
}
struct mp_osd_res res = osd_res_from_image_params(vo->params);
- osd_draw_on_image(vo->osd, res, mpi ? mpi->pts : 0, 0, &xv_buffer);
+ osd_draw_on_image(vo->osd, res, frame->current ? frame->current->pts : 0, 0, &xv_buffer);
- if (mpi != ctx->original_image) {
- talloc_free(ctx->original_image);
- ctx->original_image = mpi;
- }
+ if (frame->current != ctx->original_image)
+ ctx->original_image = frame->current;
}
static int query_format(struct vo *vo, int format)
@@ -748,8 +743,6 @@ static void uninit(struct vo *vo)
struct xvctx *ctx = vo->priv;
int i;
- talloc_free(ctx->original_image);
-
if (ctx->ai)
XvFreeAdaptorInfo(ctx->ai);
ctx->ai = NULL;
@@ -872,14 +865,10 @@ static int preinit(struct vo *vo)
static int control(struct vo *vo, uint32_t request, void *data)
{
- struct xvctx *ctx = vo->priv;
switch (request) {
case VOCTRL_SET_PANSCAN:
resize(vo);
return VO_TRUE;
- case VOCTRL_REDRAW_FRAME:
- draw_image(vo, ctx->original_image);
- return true;
}
int events = 0;
int r = vo_x11_control(vo, &events, request, data);
@@ -898,7 +887,7 @@ const struct vo_driver video_out_xv = {
.query_format = query_format,
.reconfig = reconfig,
.control = control,
- .draw_image = draw_image,
+ .draw_frame = draw_frame,
.flip_page = flip_page,
.get_vsync = get_vsync,
.wakeup = vo_x11_wakeup,