[MPlayer-cvslog] r36282 - in trunk: DOCS/man/en/mplayer.1 cfg-mplayer.h libvo/video_out.c libvo/video_out.h libvo/vo_gl.c

reimar subversion at mplayerhq.hu
Sat May 25 08:54:41 CEST 2013


Author: reimar
Date: Sat May 25 08:54:41 2013
New Revision: 36282

Log:
Add options to determine where borders will be added when adjusting for aspect.

Modified:
   trunk/cfg-mplayer.h
   trunk/libvo/video_out.c
   trunk/libvo/video_out.h
   trunk/libvo/vo_gl.c

Changes in other areas also in this revision:
Modified:
   trunk/DOCS/man/en/mplayer.1

Modified: trunk/cfg-mplayer.h
==============================================================================
--- trunk/cfg-mplayer.h	Fri May 24 16:20:19 2013	(r36281)
+++ trunk/cfg-mplayer.h	Sat May 25 08:54:41 2013	(r36282)
@@ -173,6 +173,8 @@ const m_option_t mplayer_opts[]={
     {"novsync", &vo_vsync, CONF_TYPE_FLAG, 0, 1, 0, NULL},
     {"panscan", &vo_panscan, CONF_TYPE_FLOAT, CONF_RANGE, -1.0, 1.0, NULL},
     {"panscanrange", &vo_panscanrange, CONF_TYPE_FLOAT, CONF_RANGE, -19.0, 99.0, NULL},
+    {"border-pos-x", &vo_border_pos_x, CONF_TYPE_FLOAT, CONF_RANGE, -1, 2, NULL},
+    {"border-pos-y", &vo_border_pos_y, CONF_TYPE_FLOAT, CONF_RANGE, -1, 2, NULL},
     {"monitor-orientation", &vo_rotate, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL},
 
     {"grabpointer", &vo_grabpointer, CONF_TYPE_FLAG, 0, 0, 1, NULL},

Modified: trunk/libvo/video_out.c
==============================================================================
--- trunk/libvo/video_out.c	Fri May 24 16:20:19 2013	(r36281)
+++ trunk/libvo/video_out.c	Sat May 25 08:54:41 2013	(r36282)
@@ -65,6 +65,8 @@ int vo_vsync = 0;
 int vo_fs = 0;
 int vo_fsmode = 0;
 float vo_panscan = 0.0f;
+float vo_border_pos_x = 0.5;
+float vo_border_pos_y = 0.5;
 int vo_rotate;
 int vo_ontop = 0;
 int vo_adapter_num=0;

Modified: trunk/libvo/video_out.h
==============================================================================
--- trunk/libvo/video_out.h	Fri May 24 16:20:19 2013	(r36281)
+++ trunk/libvo/video_out.h	Sat May 25 08:54:41 2013	(r36282)
@@ -232,6 +232,8 @@ extern int vo_vsync;
 extern int vo_fs;
 extern int vo_fsmode;
 extern float vo_panscan;
+extern float vo_border_pos_x;
+extern float vo_border_pos_y;
 extern int vo_rotate;
 extern int vo_adapter_num;
 extern int vo_refresh_rate;

Modified: trunk/libvo/vo_gl.c
==============================================================================
--- trunk/libvo/vo_gl.c	Fri May 24 16:20:19 2013	(r36281)
+++ trunk/libvo/vo_gl.c	Sat May 25 08:54:41 2013	(r36282)
@@ -179,6 +179,15 @@ static void redraw(void);
 static float video_matrix[16];
 static float osd_matrix[16];
 
+static int apply_border_pos(int full, int part, float pos) {
+  if (pos >= 0.0 && pos <= 1.0) {
+    return pos*(full - part);
+  }
+  if (pos < 0)
+    return pos * part;
+  return full - part + (pos - 1) * part;
+}
+
 static void resize(void) {
   int i;
   draw_width  = (vo_rotate & 1) ? vo_dheight : vo_dwidth;
@@ -225,15 +234,15 @@ static void resize(void) {
     scale_y = (double)new_h / (double)vo_dheight;
     video_matrix[0]  *= scale_x;
     video_matrix[4]  *= scale_x;
-    video_matrix[12] *= scale_x;
+    video_matrix[12] = -1 + apply_border_pos(vo_dwidth, new_w, vo_border_pos_x) * 2.0 / vo_dwidth;
     video_matrix[1]  *= scale_y;
     video_matrix[5]  *= scale_y;
-    video_matrix[13] *= scale_y;
+    video_matrix[13] = 1 - apply_border_pos(vo_dheight, new_h, vo_border_pos_y) * 2.0 / vo_dheight;
     if (vo_rotate & 1) {
       int tmp = new_w; new_w = new_h; new_h = tmp;
     }
-    ass_border_x = (draw_width  - new_w) / 2;
-    ass_border_y = (draw_height - new_h) / 2;
+    ass_border_x = apply_border_pos(draw_width, new_w, vo_border_pos_x);
+    ass_border_y = apply_border_pos(draw_height, new_h, vo_border_pos_y);
   }
   mpglLoadMatrixf(video_matrix);
 


More information about the MPlayer-cvslog mailing list