changeset 36187:09b2e3d9f51b

border_pos support for a few more vos.
author reimar
date Sat, 25 May 2013 07:43:22 +0000
parents 3b15983f5e48
children 34116de1aa96
files DOCS/man/en/mplayer.1 libvo/video_out.c
diffstat 2 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/man/en/mplayer.1	Sat May 25 06:54:41 2013 +0000
+++ b/DOCS/man/en/mplayer.1	Sat May 25 07:43:22 2013 +0000
@@ -3628,14 +3628,14 @@
 This feature is experimental.
 .
 .TP
-.B \-border\-pos\-x <0.0\-1.0> (-vo gl only, default 0.5)
+.B \-border\-pos\-x <0.0\-1.0> (-vo gl,xv,xvmc,vdpau,direct3d only, default 0.5)
 When black borders are added to adjust for aspect, this determines where they are placed.
 0.0 places borders on the right, 1.0 on the left.
 Values outside the range 0.0 \- 1.0 will add extra black borders on one side
 and remove part of the image on the other side.
 .
 .TP
-.B \-border\-pos\-y <0.0\-1.0> (-vo gl only, default 0.5)
+.B \-border\-pos\-y <0.0\-1.0> (-vo gl,xv,xvmc,vdpau,direct3d only, default 0.5)
 As \-border\-pos\-x but for top/bottom borders.
 0.0 places borders on the bottom, 1.0 on the top.
 .
--- a/libvo/video_out.c	Sat May 25 06:54:41 2013 +0000
+++ b/libvo/video_out.c	Sat May 25 07:43:22 2013 +0000
@@ -406,6 +406,7 @@
  *        and destination rectangle like Direct3D and VDPAU
  */
 static void src_dst_split_scaling(int src_size, int dst_size, int scaled_src_size,
+                                  float bpos,
                                   int *src_start, int *src_end, int *dst_start, int *dst_end) {
   if (scaled_src_size > dst_size) {
     int border = src_size * (scaled_src_size - dst_size) / scaled_src_size;
@@ -418,7 +419,7 @@
   } else {
     *src_start = 0;
     *src_end   = src_size;
-    *dst_start = (dst_size - scaled_src_size) / 2;
+    *dst_start = apply_border_pos(dst_size, scaled_src_size, bpos);
     *dst_end   = *dst_start + scaled_src_size;
   }
 }
@@ -455,12 +456,12 @@
     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;
+      borders->left = apply_border_pos(vo_dwidth,  scaled_width,  vo_border_pos_x);
+      borders->top  = apply_border_pos(vo_dheight, scaled_height, vo_border_pos_y);
     }
-    src_dst_split_scaling(src_width, vo_dwidth, scaled_width,
+    src_dst_split_scaling(src_width, vo_dwidth, scaled_width, vo_border_pos_x,
                           &src->left, &src->right, &dst->left, &dst->right);
-    src_dst_split_scaling(src_height, vo_dheight, scaled_height,
+    src_dst_split_scaling(src_height, vo_dheight, scaled_height, vo_border_pos_y,
                           &src->top, &src->bottom, &dst->top, &dst->bottom);
   }
   src->left += crop->left; src->right  += crop->left;