[MPlayer-cvslog] r28633 - in trunk/libvo: video_out.c video_out.h vo_direct3d.c vo_vdpau.c vo_xv.c vo_xvmc.c

reimar subversion at mplayerhq.hu
Tue Feb 17 12:59:50 CET 2009


Author: reimar
Date: Tue Feb 17 12:59:49 2009
New Revision: 28633

Log:
Extend calc_src_dst_rects to also calculate the border values needed for
correctly placed dvdnav highlights, and fix direct3d and vdpau accordingly.

Modified:
   trunk/libvo/video_out.c
   trunk/libvo/video_out.h
   trunk/libvo/vo_direct3d.c
   trunk/libvo/vo_vdpau.c
   trunk/libvo/vo_xv.c
   trunk/libvo/vo_xvmc.c

Modified: trunk/libvo/video_out.c
==============================================================================
--- trunk/libvo/video_out.c	Tue Feb 17 12:52:39 2009	(r28632)
+++ trunk/libvo/video_out.c	Tue Feb 17 12:59:49 2009	(r28633)
@@ -387,8 +387,11 @@ static void src_dst_split_scaling(int sr
  * 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 @@ void calc_src_dst_rects(int src_width, i
   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,

Modified: trunk/libvo/video_out.h
==============================================================================
--- trunk/libvo/video_out.h	Tue Feb 17 12:52:39 2009	(r28632)
+++ trunk/libvo/video_out.h	Tue Feb 17 12:59:49 2009	(r28633)
@@ -272,6 +272,7 @@ int lookup_keymap_table(const struct key
 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 */

Modified: trunk/libvo/vo_direct3d.c
==============================================================================
--- trunk/libvo/vo_direct3d.c	Tue Feb 17 12:52:39 2009	(r28632)
+++ trunk/libvo/vo_direct3d.c	Tue Feb 17 12:59:49 2009	(r28633)
@@ -63,6 +63,8 @@ static struct global_priv {
                                 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 @@ static void calc_fs_rect(void)
 {
     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 @@ static void calc_fs_rect(void)
     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,
            "<vo_direct3d>Fullscreen movie rectangle: t: %ld, l: %ld, r: %ld, b:%ld\n",
@@ -1027,7 +1032,8 @@ static void draw_osd(void)
         /* 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)
         {

Modified: trunk/libvo/vo_vdpau.c
==============================================================================
--- trunk/libvo/vo_vdpau.c	Tue Feb 17 12:52:39 2009	(r28632)
+++ trunk/libvo/vo_vdpau.c	Tue Feb 17 12:59:49 2009	(r28633)
@@ -138,6 +138,7 @@ static int                              
 
 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 @@ static void resize(void)
     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 @@ static void resize(void)
     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 @@ static void draw_osd(void)
 {
     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)

Modified: trunk/libvo/vo_xv.c
==============================================================================
--- trunk/libvo/vo_xv.c	Tue Feb 17 12:52:39 2009	(r28632)
+++ trunk/libvo/vo_xv.c	Tue Feb 17 12:59:49 2009	(r28633)
@@ -161,7 +161,7 @@ static void deallocate_xvimage(int foo);
 
 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);
 }

Modified: trunk/libvo/vo_xvmc.c
==============================================================================
--- trunk/libvo/vo_xvmc.c	Tue Feb 17 12:52:39 2009	(r28632)
+++ trunk/libvo/vo_xvmc.c	Tue Feb 17 12:59:49 2009	(r28633)
@@ -943,7 +943,7 @@ int i;
    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);



More information about the MPlayer-cvslog mailing list