summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorpontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-06-05 19:35:54 +0000
committerpontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-06-05 19:35:54 +0000
commitae8906e42cbf6de281e5c90fb05704234f777d67 (patch)
treef09eecbaec15cde716c93c02877c4bb3a4e7bdeb /libvo
parent49d13970550898741af54c3f70f88fc890db3fb2 (diff)
downloadmpv-ae8906e42cbf6de281e5c90fb05704234f777d67.tar.bz2
mpv-ae8906e42cbf6de281e5c90fb05704234f777d67.tar.xz
added panscan support for xmga/xvidix
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6308 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/aspect.c23
-rw-r--r--libvo/aspect.h7
-rw-r--r--libvo/mga_common.c11
-rw-r--r--libvo/video_out.h3
-rw-r--r--libvo/vo_xmga.c29
-rw-r--r--libvo/vo_xv.c38
-rw-r--r--libvo/vo_xvidix.c31
7 files changed, 111 insertions, 31 deletions
diff --git a/libvo/aspect.c b/libvo/aspect.c
index 463f3bfe09..be5d8949c7 100644
--- a/libvo/aspect.c
+++ b/libvo/aspect.c
@@ -10,6 +10,12 @@
#include <stdio.h>
#endif
+int vo_panscan_x = 0;
+int vo_panscan_y = 0;
+float vo_panscan_amount = 0;
+
+#include "video_out.h"
+
float monitor_aspect=4.0/3.0;
static struct {
@@ -19,6 +25,7 @@ static struct {
int preh; // prescaled height
int scrw; // horizontal resolution
int scrh; // vertical resolution
+ float asp;
} aspdat;
void aspect_save_orig(int orgw, int orgh){
@@ -79,8 +86,24 @@ void aspect(int *srcw, int *srch, int zoom){
#endif
}
}
+ aspdat.asp=*srcw / (float)*srch;
#ifdef ASPECT_DEBUG
printf("aspect(3) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat.prew,aspdat.preh);
#endif
}
+void panscan_init( void )
+{
+ vo_panscan_x=0;
+ vo_panscan_y=0;
+ vo_panscan_amount=0.0f;
+}
+
+void panscan_calc( void )
+{
+ int vo_panscan_area = (vo_screenheight-vo_dheight);
+ vo_panscan_amount = vo_fs ? vo_panscan : 0;
+ vo_panscan_x = vo_panscan_area * vo_panscan_amount * aspdat.asp;
+ vo_panscan_y = vo_panscan_area * vo_panscan_amount;
+}
+
diff --git a/libvo/aspect.h b/libvo/aspect.h
index eac6d1cdd0..e23b3445cf 100644
--- a/libvo/aspect.h
+++ b/libvo/aspect.h
@@ -2,6 +2,13 @@
#define __ASPECT_H
/* Stuff for correct aspect scaling. */
+extern int vo_panscan_x;
+extern int vo_panscan_y;
+extern float vo_panscan_amount;
+
+extern void panscan_init( void );
+extern void panscan_calc( void );
+
void aspect_save_orig(int orgw, int orgh);
void aspect_save_prescale(int prew, int preh);
diff --git a/libvo/mga_common.c b/libvo/mga_common.c
index 8ed4a6ca87..bf3b61eb01 100644
--- a/libvo/mga_common.c
+++ b/libvo/mga_common.c
@@ -280,6 +280,17 @@ static uint32_t control(uint32_t request, void *data, ...)
case VOCTRL_GUISUPPORT:
return VO_TRUE;
#endif
+#ifdef VO_XMGA
+ case VOCTRL_GET_PANSCAN:
+ return VO_TRUE;
+ case VOCTRL_SET_PANSCAN:
+ if ( vo_fs && ( vo_panscan != vo_panscan_amount ) )
+ {
+ panscan_calc();
+ set_window( 1 );
+ }
+ return VO_TRUE;
+#endif
}
return VO_NOTIMPL;
}
diff --git a/libvo/video_out.h b/libvo/video_out.h
index d3777d0088..292872dca9 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -45,6 +45,9 @@
#define VOCTRL_GET_FRAME_NUM 11
#define VOCTRL_SET_FRAME_NUM 12
+#define VOCTRL_GET_PANSCAN 13
+#define VOCTRL_SET_PANSCAN 14
+
#define VO_TRUE 1
#define VO_FALSE 0
#define VO_ERROR -1
diff --git a/libvo/vo_xmga.c b/libvo/vo_xmga.c
index 5e5fce7ee6..96e30880f4 100644
--- a/libvo/vo_xmga.c
+++ b/libvo/vo_xmga.c
@@ -103,7 +103,7 @@ static void mDrawColorKey( void )
XFlush( mDisplay );
}
-static void set_window(){
+static void set_window( int ps ){
if ( WinID )
{
@@ -127,8 +127,7 @@ static void set_window(){
drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight);
mp_msg(MSGT_VO,MSGL_V,"[xmga-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
}
-
- mDrawColorKey();
+ vo_dwidth=drwWidth; vo_dheight=drwHeight;
#ifdef HAVE_XINERAMA
if(XineramaIsActive(mDisplay))
@@ -155,18 +154,34 @@ static void set_window(){
}
#endif
+
+ mDrawColorKey();
+
mga_vid_config.x_org=drwcX;
mga_vid_config.y_org=drwcY;
mga_vid_config.dest_width=drwWidth;
mga_vid_config.dest_height=drwHeight;
-
+ if ( ps )
+ {
+ drwX-=vo_panscan_x>>1;
+ drwY-=vo_panscan_y>>1;
+ drwWidth+=vo_panscan_x;
+ drwHeight+=vo_panscan_y;
+
+ mga_vid_config.x_org-=vo_panscan_x>>1;
+ mga_vid_config.y_org-=vo_panscan_y>>1;
+ mga_vid_config.dest_width=drwWidth;
+ mga_vid_config.dest_height=drwHeight;
+ mDrawColorKey();
+ if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) ) mp_msg(MSGT_VO,MSGL_WARN,"Error in mga_vid_config ioctl (wrong mga_vid.o version?)" );
+ }
}
static void check_events(void)
{
int e=vo_x11_check_events(mDisplay);
if ( !(e&VO_EVENT_RESIZE) && !(e&VO_EVENT_EXPOSE) ) return;
- set_window();
+ set_window( 0 );
mDrawColorKey();
if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) ) mp_msg(MSGT_VO,MSGL_WARN,"Error in mga_vid_config ioctl (wrong mga_vid.o version?)" );
}
@@ -231,6 +246,8 @@ static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint3
mvWidth=width; mvHeight=height;
+ vo_panscan_x=vo_panscan_y=vo_panscan_amount=0;
+
vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2;
vo_dwidth=d_width; vo_dheight=d_height;
vo_mouse_autohide=1;
@@ -307,7 +324,7 @@ static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint3
if ( ( flags&1 )&&( !WinID ) ) { vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; vo_fs=1; }
- set_window();
+ set_window( 0 );
mga_vid_config.src_width=width;
mga_vid_config.src_height=height;
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index 39b087cf42..317941a04e 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -94,10 +94,6 @@ static uint32_t image_height;
static uint32_t image_format;
static int flip_flag;
-static int panscan_x;
-static int panscan_y;
-static float panscan_amount;
-
static Window mRoot;
static uint32_t drwX,drwY,drwBorderWidth,drwDepth;
static uint32_t dwidth,dheight;
@@ -338,9 +334,7 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32
static uint32_t vm_height;
#endif
- panscan_x = 0;
- panscan_y = 0;
- panscan_amount = 0.0f;
+ panscan_init();
aspect_save_orig(width,height);
aspect_save_prescale(d_width,d_height);
@@ -604,31 +598,19 @@ static void draw_osd(void)
static void flip_page(void)
{
- if((vo_fs && (vo_panscan != panscan_amount)) || (!vo_fs && panscan_amount))
- {
- int panscan_area = (vo_screenheight-vo_dheight);
-
- panscan_amount = vo_fs ? vo_panscan : 0;
-
- panscan_x = panscan_area * panscan_amount * (image_width / (float)image_height);
- panscan_y = panscan_area * panscan_amount;
-
- XClearWindow(mDisplay, vo_window);
- XFlush(mDisplay);
- }
if ( Shmem_Flag )
{
XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[current_buf],
0, 0, image_width, image_height,
- drwX-(panscan_x>>1),drwY-(panscan_y>>1),vo_dwidth+panscan_x,(vo_fs?vo_dheight - 1:vo_dheight)+panscan_y,
+ drwX-(vo_panscan_x>>1),drwY-(vo_panscan_y>>1),vo_dwidth+vo_panscan_x,(vo_fs?vo_dheight - 1:vo_dheight)+vo_panscan_y,
False);
}
else
{
XvPutImage(mDisplay, xv_port, vo_window, vo_gc, xvimage[current_buf],
0, 0, image_width, image_height,
- drwX-(panscan_x>>1),drwY-(panscan_y>>1),vo_dwidth+panscan_x,(vo_fs?vo_dheight - 1:vo_dheight)+panscan_y);
+ drwX-(vo_panscan_x>>1),drwY-(vo_panscan_y>>1),vo_dwidth+vo_panscan_x,(vo_fs?vo_dheight - 1:vo_dheight)+vo_panscan_y);
}
if (num_buffers>1){
current_buf=(current_buf+1)%num_buffers;
@@ -874,6 +856,20 @@ static uint32_t control(uint32_t request, void *data, ...)
case VOCTRL_FULLSCREEN:
vo_x11_fullscreen();
return VO_TRUE;
+ case VOCTRL_GUISUPPORT:
+ return VO_TRUE;
+ case VOCTRL_GET_PANSCAN:
+ return VO_TRUE;
+ case VOCTRL_SET_PANSCAN:
+
+// if((vo_fs && (vo_panscan != vo_panscan_amount)) || (!vo_fs && vo_panscan_amount))
+ if ( vo_fs && ( vo_panscan != vo_panscan_amount ) )
+ {
+ panscan_calc();
+ XClearWindow(mDisplay, vo_window);
+ XFlush(mDisplay);
+ }
+ return VO_TRUE;
}
return VO_NOTIMPL;
}
diff --git a/libvo/vo_xvidix.c b/libvo/vo_xvidix.c
index ffc712d812..c9df998db4 100644
--- a/libvo/vo_xvidix.c
+++ b/libvo/vo_xvidix.c
@@ -74,7 +74,7 @@ static uint32_t window_width, window_height;
static uint32_t drwX, drwY, drwWidth, drwHeight, drwBorderWidth,
drwDepth, drwcX, drwcY, dwidth, dheight;
-static void set_window(int force_update,const vo_tune_info_t *info)
+static void set_window(int force_update,const vo_tune_info_t *info, int ps)
{
Window mRoot;
if ( WinID )
@@ -82,9 +82,9 @@ static void set_window(int force_update,const vo_tune_info_t *info)
XGetGeometry(mDisplay, vo_window, &mRoot, &drwX, &drwY, &drwWidth,
&drwHeight, &drwBorderWidth, &drwDepth);
drwX = drwY = 0;
+
XTranslateCoordinates(mDisplay, vo_window, mRoot, 0, 0,
&drwcX, &drwcY, &mRoot);
-
aspect(&dwidth,&dheight,A_NOZOOM);
if (!vo_fs)
mp_msg(MSGT_VO, MSGL_V, "[xvidix] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",
@@ -113,6 +113,8 @@ static void set_window(int force_update,const vo_tune_info_t *info)
}
#endif
+ vo_dwidth=drwWidth; vo_dheight=drwHeight;
+
#ifdef HAVE_XINERAMA
if (XineramaIsActive(mDisplay))
{
@@ -135,6 +137,16 @@ static void set_window(int force_update,const vo_tune_info_t *info)
}
#endif
+ if ( ps )
+ {
+ drwcX-=vo_panscan_x >> 1;
+ drwcY-=vo_panscan_y >> 1;
+ drwX-=vo_panscan_x >> 1;
+ drwY-=vo_panscan_y >> 1;
+ drwWidth+=vo_panscan_x;
+ drwHeight+=vo_panscan_y;
+ }
+
/* set new values in VIDIX */
if (force_update || (window_x != drwcX) || (window_y != drwcY) ||
(window_width != drwWidth) || (window_height != drwHeight))
@@ -196,6 +208,8 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
// free(title);
title = "MPlayer VIDIX X11 Overlay";
+ panscan_init();
+
image_height = height;
image_width = width;
image_format = format;
@@ -349,7 +363,7 @@ else
vidix_grkey_set(&gr_key);
}
- set_window(1,info);
+ set_window(1,info,0);
if(info) memcpy(&vtune,info,sizeof(vo_tune_info_t));
else memset(&vtune,0,sizeof(vo_tune_info_t));
XFlush(mDisplay);
@@ -370,7 +384,7 @@ static void check_events(void)
const int event = vo_x11_check_events(mDisplay);
if ((event & VO_EVENT_RESIZE) || (event & VO_EVENT_EXPOSE))
- set_window(0,&vtune);
+ set_window(0,&vtune,0);
return;
}
@@ -449,6 +463,15 @@ static uint32_t control(uint32_t request, void *data, ...)
case VOCTRL_FULLSCREEN:
vo_x11_fullscreen();
return VO_TRUE;
+ case VOCTRL_GET_PANSCAN:
+ return VO_TRUE;
+ case VOCTRL_SET_PANSCAN:
+ if ( vo_fs && ( vo_panscan != vo_panscan_amount ) )
+ {
+ panscan_calc();
+ set_window( 0,&vtune,1 );
+ }
+ return VO_TRUE;
}
return VO_NOTIMPL;
}