summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-08-27 18:36:51 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-08-27 18:36:51 +0000
commit6765091bfac7782c0ef814f5983f4b92cccc3748 (patch)
treef9bca13607f89086a4a301d3189201ea4a3a0a1c /libvo
parent26d8e6a696bbce015966e7a3c69ebc14aa38f08b (diff)
downloadmpv-6765091bfac7782c0ef814f5983f4b92cccc3748.tar.bz2
mpv-6765091bfac7782c0ef814f5983f4b92cccc3748.tar.xz
Add infrastructure and test code to enable aspect scaling and panscan in windowed mode.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29566 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/aspect.c21
-rw-r--r--libvo/aspect.h1
-rw-r--r--libvo/video_out.h5
-rw-r--r--libvo/vo_gl.c10
4 files changed, 28 insertions, 9 deletions
diff --git a/libvo/aspect.c b/libvo/aspect.c
index f345d6807c..04229231ac 100644
--- a/libvo/aspect.c
+++ b/libvo/aspect.c
@@ -151,15 +151,15 @@ void panscan_init( void )
vo_panscan_amount=0.0f;
}
-void panscan_calc( void )
+static void panscan_calc_internal(int zoom)
{
int fwidth,fheight;
int vo_panscan_area;
int max_w, max_h;
- get_max_dims(&max_w, &max_h, A_ZOOM);
+ get_max_dims(&max_w, &max_h, zoom);
if (vo_panscanrange > 0) {
- aspect(&fwidth,&fheight,A_ZOOM);
+ aspect(&fwidth,&fheight,zoom);
vo_panscan_area = max_h - fheight;
if (!vo_panscan_area)
vo_panscan_area = max_w - fwidth;
@@ -167,8 +167,21 @@ void panscan_calc( void )
} else
vo_panscan_area = -vo_panscanrange * max_h;
- vo_panscan_amount = vo_fs ? vo_panscan : 0;
+ vo_panscan_amount = vo_fs || zoom == A_WINZOOM ? vo_panscan : 0;
vo_panscan_x = vo_panscan_area * vo_panscan_amount * aspdat.asp;
vo_panscan_y = vo_panscan_area * vo_panscan_amount;
}
+void panscan_calc(void)
+{
+ panscan_calc_internal(A_ZOOM);
+}
+
+/**
+ * vos that set vo_dwidth and v_dheight correctly should call this to update
+ * vo_panscan_x and vo_panscan_y
+ */
+void panscan_calc_windowed(void)
+{
+ panscan_calc_internal(A_WINZOOM);
+}
diff --git a/libvo/aspect.h b/libvo/aspect.h
index 268153987c..0654d86c9f 100644
--- a/libvo/aspect.h
+++ b/libvo/aspect.h
@@ -26,6 +26,7 @@ extern float vo_panscan_amount;
void panscan_init(void);
void panscan_calc(void);
+void panscan_calc_windowed(void);
void aspect_save_orig(int orgw, int orgh);
diff --git a/libvo/video_out.h b/libvo/video_out.h
index f90123ddee..ae38970209 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -275,4 +275,9 @@ struct vo_rect {
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 inline int aspect_scaling(void)
+{
+ return vo_fs;
+}
+
#endif /* MPLAYER_VIDEO_OUT_H */
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index 27d5463fc8..a281611c4c 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -163,11 +163,11 @@ static void resize(int x,int y){
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
ass_border_x = ass_border_y = 0;
- if (vo_fs && use_aspect) {
+ if (aspect_scaling() && use_aspect) {
int new_w, new_h;
GLdouble scale_x, scale_y;
- aspect(&new_w, &new_h, A_ZOOM);
- panscan_calc();
+ aspect(&new_w, &new_h, A_WINZOOM);
+ panscan_calc_windowed();
new_w += vo_panscan_x;
new_h += vo_panscan_y;
scale_x = (GLdouble)new_w / (GLdouble)x;
@@ -722,7 +722,7 @@ static void flip_page(void) {
if (vo_doublebuffering) {
if (use_glFinish) glFinish();
swapGlBuffers();
- if (vo_fs && use_aspect)
+ if (aspect_scaling() && use_aspect)
glClear(GL_COLOR_BUFFER_BIT);
} else {
do_render();
@@ -1148,7 +1148,7 @@ static int control(uint32_t request, void *data, ...)
r->w = vo_dwidth; r->h = vo_dheight;
r->mt = r->mb = r->ml = r->mr = 0;
if (scaled_osd) {r->w = image_width; r->h = image_height;}
- else if (vo_fs) {
+ else if (aspect_scaling()) {
r->ml = r->mr = ass_border_x;
r->mt = r->mb = ass_border_y;
}