# HG changeset patch # User reimar # Date 1234871989 0 # Node ID 4172d83194f26f1eb2f88e8fc589ba76d275af9b # Parent 96dfe52d18fffe071359ac29b686fc3ec6eb1ec4 Extend calc_src_dst_rects to also calculate the border values needed for correctly placed dvdnav highlights, and fix direct3d and vdpau accordingly. diff -r 96dfe52d18ff -r 4172d83194f2 libvo/video_out.c --- a/libvo/video_out.c Tue Feb 17 11:52:39 2009 +0000 +++ b/libvo/video_out.c Tue Feb 17 11:59:49 2009 +0000 @@ -387,8 +387,11 @@ * Can be extended to take future cropping support into account. * * \param crop specifies the cropping border size in the left, right, top and bottom members, may be NULL + * \param borders the border values as e.g. EOSD (ASS) and properly placed DVD highlight support requires, + * may be NULL and only left and top are currently valid. */ -void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst, const struct vo_rect *crop) { +void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst, + struct vo_rect *borders, const struct vo_rect *crop) { static const struct vo_rect no_crop = {0, 0, 0, 0, 0, 0}; int scaled_width = 0; int scaled_height = 0; @@ -401,11 +404,18 @@ dst->top = 0; dst->bottom = vo_dheight; src->left = 0; src->right = src_width; src->top = 0; src->bottom = src_height; + if (borders) { + borders->left = 0; borders->top = 0; + } if (vo_fs) { aspect(&scaled_width, &scaled_height, A_ZOOM); panscan_calc(); scaled_width += vo_panscan_x; scaled_height += vo_panscan_y; + if (borders) { + borders->left = (vo_dwidth - scaled_width ) / 2; + borders->top = (vo_dheight - scaled_height) / 2; + } src_dst_split_scaling(src_width, vo_dwidth, scaled_width, &src->left, &src->right, &dst->left, &dst->right); src_dst_split_scaling(src_height, vo_dheight, scaled_height, diff -r 96dfe52d18ff -r 4172d83194f2 libvo/video_out.h --- a/libvo/video_out.h Tue Feb 17 11:52:39 2009 +0000 +++ b/libvo/video_out.h Tue Feb 17 11:59:49 2009 +0000 @@ -272,6 +272,7 @@ struct vo_rect { int left, right, top, bottom, width, height; }; -void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst, const struct vo_rect *crop); +void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst, + struct vo_rect *borders, const struct vo_rect *crop); #endif /* MPLAYER_VIDEO_OUT_H */ diff -r 96dfe52d18ff -r 4172d83194f2 libvo/vo_direct3d.c --- a/libvo/vo_direct3d.c Tue Feb 17 11:52:39 2009 +0000 +++ b/libvo/vo_direct3d.c Tue Feb 17 11:59:49 2009 +0000 @@ -63,6 +63,8 @@ fullscreen */ int src_width; /**< Source (movie) width */ int src_height; /**< Source (movie) heigth */ + int border_x; /**< horizontal border value for OSD */ + int border_y; /**< vertical border value for OSD */ D3DFORMAT movie_src_fmt; /**< Movie colorspace format (depends on the movie's codec) */ @@ -149,7 +151,8 @@ { struct vo_rect src_rect; struct vo_rect dst_rect; - calc_src_dst_rects(priv->src_width, priv->src_height, &src_rect, &dst_rect, NULL); + struct vo_rect borders; + calc_src_dst_rects(priv->src_width, priv->src_height, &src_rect, &dst_rect, &borders, NULL); priv->fs_movie_rect.left = dst_rect.left; priv->fs_movie_rect.right = dst_rect.right; @@ -159,6 +162,8 @@ priv->fs_panscan_rect.right = src_rect.right; priv->fs_panscan_rect.top = src_rect.top; priv->fs_panscan_rect.bottom = src_rect.bottom; + priv->border_x = borders.left; + priv->border_y = borders.top; mp_msg(MSGT_VO, MSGL_V, "Fullscreen movie rectangle: t: %ld, l: %ld, r: %ld, b:%ld\n", @@ -1027,7 +1032,8 @@ /* required for if subs are in the boarder region */ priv->is_clear_needed = 1; - vo_draw_text(priv->osd_width, priv->osd_height, draw_alpha); + vo_draw_text_ext(priv->osd_width, priv->osd_height, priv->border_x, priv->border_y, + priv->border_x, priv->border_y, priv->src_width, priv->src_height, draw_alpha); if (!priv->device_texture_sys) { diff -r 96dfe52d18ff -r 4172d83194f2 libvo/vo_vdpau.c --- a/libvo/vo_vdpau.c Tue Feb 17 11:52:39 2009 +0000 +++ b/libvo/vo_vdpau.c Tue Feb 17 11:59:49 2009 +0000 @@ -138,6 +138,7 @@ static VdpRect src_rect_vid; static VdpRect out_rect_vid; +static int border_x, border_y; static struct vdpau_render_state surface_render[MAX_VIDEO_SURFACES]; static int surface_num; @@ -184,7 +185,8 @@ int i; struct vo_rect src_rect; struct vo_rect dst_rect; - calc_src_dst_rects(vid_width, vid_height, &src_rect, &dst_rect, NULL); + struct vo_rect borders; + calc_src_dst_rects(vid_width, vid_height, &src_rect, &dst_rect, &borders, NULL); out_rect_vid.x0 = dst_rect.left; out_rect_vid.x1 = dst_rect.right; out_rect_vid.y0 = dst_rect.top; @@ -193,6 +195,8 @@ src_rect_vid.x1 = src_rect.right; src_rect_vid.y0 = src_rect.top; src_rect_vid.y1 = src_rect.bottom; + border_x = borders.left; + border_y = borders.top; #ifdef CONFIG_FREETYPE // adjust font size to display size force_load_font = 1; @@ -522,7 +526,8 @@ { mp_msg(MSGT_VO, MSGL_DBG2, "DRAW_OSD\n"); - vo_draw_text(vo_dwidth, vo_dheight, draw_osd_I8A8); + vo_draw_text_ext(vo_dwidth, vo_dheight, border_x, border_y, border_x, border_y, + vid_width, vid_height, draw_osd_I8A8); } static void flip_page(void) diff -r 96dfe52d18ff -r 4172d83194f2 libvo/vo_xv.c --- a/libvo/vo_xv.c Tue Feb 17 11:52:39 2009 +0000 +++ b/libvo/vo_xv.c Tue Feb 17 11:59:49 2009 +0000 @@ -161,7 +161,7 @@ static void resize(void) { - calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL); + calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL, NULL); vo_x11_clearwindow_part(mDisplay, vo_window, dst_rect.width, dst_rect.height, 1); vo_xv_draw_colorkey(dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height); } diff -r 96dfe52d18ff -r 4172d83194f2 libvo/vo_xvmc.c --- a/libvo/vo_xvmc.c Tue Feb 17 11:52:39 2009 +0000 +++ b/libvo/vo_xvmc.c Tue Feb 17 11:59:49 2009 +0000 @@ -943,7 +943,7 @@ if(p_render_surface == NULL) return; - calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL); + calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL, NULL); if(draw_ck) vo_xv_draw_colorkey(dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height);