From 59960baa7f61eaff352043a15eaaf5792d9e8cfd Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 14 Mar 2013 15:53:59 +0100 Subject: vo_xv: minor simplifications The draw_osd change is a bit tricky: I guess originally, there was some intention not to second-guess the generic aspect code, but the result is the same and the code is more confusing. --- video/out/vo_xv.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'video') diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c index 8435b7da85..3d0b95b8eb 100644 --- a/video/out/vo_xv.c +++ b/video/out/vo_xv.c @@ -85,8 +85,6 @@ struct xvctx { int current_buf; int current_ip_buf; int num_buffers; - int total_buffers; - int visible_buf; XvImage *xvimage[2]; struct mp_image *original_image; uint32_t image_width; @@ -511,8 +509,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, return -1; } - ctx->visible_buf = -1; - /* check image formats */ ctx->xv_format = 0; for (i = 0; i < ctx->formats; i++) { @@ -535,13 +531,12 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, ctx->xv_port); // In case config has been called before - for (i = 0; i < ctx->total_buffers; i++) + for (i = 0; i < ctx->num_buffers; i++) deallocate_xvimage(vo, i); ctx->num_buffers = 2; - ctx->total_buffers = ctx->num_buffers; - for (i = 0; i < ctx->total_buffers; i++) + for (i = 0; i < ctx->num_buffers; i++) allocate_xvimage(vo, i); ctx->current_buf = 0; @@ -681,16 +676,10 @@ static void draw_osd(struct vo *vo, struct osd_state *osd) struct mp_image img = get_xv_buffer(vo, ctx->current_buf); - struct mp_rect *src = &ctx->src_rect; - struct mp_rect *dst = &ctx->dst_rect; - int dw = dst->x1 - dst->x0, dh = dst->y1 - dst->y0; - int sw = src->x1 - src->x0, sh = src->y1 - src->y0; - double xvpar = (double)dw / dh * sh / sw; - struct mp_osd_res res = { .w = ctx->image_width, .h = ctx->image_height, - .display_par = vo->monitor_par / xvpar, + .display_par = 1.0 / vo->aspdat.par, .video_par = vo->aspdat.par, }; @@ -722,7 +711,6 @@ static void flip_page(struct vo *vo) put_xvimage(vo, ctx->xvimage[ctx->current_buf]); /* remember the currently visible buffer */ - ctx->visible_buf = ctx->current_buf; ctx->current_buf = (ctx->current_buf + 1) % ctx->num_buffers; if (!ctx->Shmem_Flag) @@ -786,7 +774,6 @@ static void uninit(struct vo *vo) talloc_free(ctx->original_image); - ctx->visible_buf = -1; if (ctx->ai) XvFreeAdaptorInfo(ctx->ai); ctx->ai = NULL; @@ -794,7 +781,7 @@ static void uninit(struct vo *vo) XFree(ctx->fo); ctx->fo = NULL; } - for (i = 0; i < ctx->total_buffers; i++) + for (i = 0; i < ctx->num_buffers; i++) deallocate_xvimage(vo, i); // uninit() shouldn't get called unless initialization went past vo_init() vo_x11_uninit(vo); -- cgit v1.2.3