[Mplayer-cvslog] CVS: main/libvo aspect.c,1.8,1.9 aspect.h,1.3,1.4 mga_common.c,1.33,1.34 video_out.h,1.34,1.35 vo_xmga.c,1.70,1.71 vo_xv.c,1.93,1.94 vo_xvidix.c,1.38,1.39
Zoltan Ponekker
pontscho at mplayerhq.hu
Wed Jun 5 21:35:57 CEST 2002
Update of /cvsroot/mplayer/main/libvo
In directory mail:/var/tmp.root/cvs-serv21753/libvo
Modified Files:
aspect.c aspect.h mga_common.c video_out.h vo_xmga.c vo_xv.c
vo_xvidix.c
Log Message:
added panscan support for xmga/xvidix
Index: aspect.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/aspect.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- aspect.c 14 May 2002 00:22:03 -0000 1.8
+++ aspect.c 5 Jun 2002 19:35:54 -0000 1.9
@@ -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 @@
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 @@
#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;
}
Index: aspect.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/aspect.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- aspect.h 18 Oct 2001 02:42:20 -0000 1.3
+++ aspect.h 5 Jun 2002 19:35:54 -0000 1.4
@@ -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);
Index: mga_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/mga_common.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- mga_common.c 7 May 2002 13:31:29 -0000 1.33
+++ mga_common.c 5 Jun 2002 19:35:54 -0000 1.34
@@ -280,6 +280,17 @@
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;
}
Index: video_out.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/video_out.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- video_out.h 4 Jun 2002 20:17:07 -0000 1.34
+++ video_out.h 5 Jun 2002 19:35:54 -0000 1.35
@@ -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
Index: vo_xmga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xmga.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- vo_xmga.c 3 Jun 2002 23:23:03 -0000 1.70
+++ vo_xmga.c 5 Jun 2002 19:35:54 -0000 1.71
@@ -103,7 +103,7 @@
XFlush( mDisplay );
}
-static void set_window(){
+static void set_window( int ps ){
if ( WinID )
{
@@ -127,8 +127,7 @@
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 @@
}
#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 @@
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 @@
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;
Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- vo_xv.c 4 Jun 2002 20:17:07 -0000 1.93
+++ vo_xv.c 5 Jun 2002 19:35:54 -0000 1.94
@@ -94,10 +94,6 @@
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;
@@ -337,9 +333,7 @@
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);
@@ -603,31 +597,19 @@
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;
@@ -872,6 +854,20 @@
return get_image(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;
Index: vo_xvidix.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xvidix.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- vo_xvidix.c 4 Jun 2002 18:39:16 -0000 1.38
+++ vo_xvidix.c 5 Jun 2002 19:35:54 -0000 1.39
@@ -74,7 +74,7 @@
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 @@
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 @@
}
#endif
+ vo_dwidth=drwWidth; vo_dheight=drwHeight;
+
#ifdef HAVE_XINERAMA
if (XineramaIsActive(mDisplay))
{
@@ -135,6 +137,16 @@
}
#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 @@
// free(title);
title = "MPlayer VIDIX X11 Overlay";
+ panscan_init();
+
image_height = height;
image_width = width;
image_format = format;
@@ -349,7 +363,7 @@
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 @@
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 @@
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;
}
More information about the MPlayer-cvslog
mailing list