annotate libvo/vo_xmga.c @ 8013:bd100a3d486f

Here's a new vo plugin that uses DirectFB. It's meant for Matrox G400 cards and TV out. It's works like DVDMax in Windows. Instructions on how to make it work are at: http://www.sci.fi/~syrjala/directfb/readme.txt patch by Ville Syrj¸«£l¸«£ <syrjala@sci.fi>
author arpi
date Thu, 31 Oct 2002 23:54:26 +0000
parents ed7b05575aab
children a57aac3a927a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
100
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
1
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
2 //#define SHOW_TIME
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 /*
7680
d60cfb1f8b37 more cleanup, some -vo mga fullscreen fixes
arpi
parents: 7679
diff changeset
5 * vo_xmga.c
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 * Copyright (C) Zoltan Ponekker - Jan 2001
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 #include <stdio.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 #include <stdlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 #include <string.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 #include "config.h"
6296
74115095d9fe msg/i18n fixes and some printf->mp_msg
arpi
parents: 6095
diff changeset
16 #include "mp_msg.h"
74115095d9fe msg/i18n fixes and some printf->mp_msg
arpi
parents: 6095
diff changeset
17
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 #include "video_out.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 #include "video_out_internal.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 LIBVO_EXTERN( xmga )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 #include <sys/ioctl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 #include <unistd.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 #include <fcntl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 #include <sys/mman.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 #include "drivers/mga_vid.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 #include <X11/Xlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 #include <X11/Xutil.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 #include <errno.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33
4017
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
34 #ifdef HAVE_XINERAMA
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
35 #include <X11/extensions/Xinerama.h>
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
36 #endif
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
37
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
38 #include "x11_common.h"
616
41d6eec69b60 clean up
pontscho
parents: 614
diff changeset
39 #include "sub.h"
2057
378aed6b232d Use aspect()
atmos4
parents: 2039
diff changeset
40 #include "aspect.h"
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
41
182
80a7b40f201a *** empty log message ***
pontscho
parents: 120
diff changeset
42 #ifdef SHOW_TIME
100
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
43 #include "../linux/timer.h"
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
44 static unsigned int timer=0;
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
45 static unsigned int timerd=0;
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
46 #endif
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
47
5955
caac20b1ca79 fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents: 5945
diff changeset
48 #ifdef HAVE_NEW_GUI
caac20b1ca79 fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents: 5945
diff changeset
49 #include "../Gui/interface.h"
caac20b1ca79 fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents: 5945
diff changeset
50 #endif
caac20b1ca79 fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents: 5945
diff changeset
51
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52 static vo_info_t vo_info =
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 {
7680
d60cfb1f8b37 more cleanup, some -vo mga fullscreen fixes
arpi
parents: 7679
diff changeset
54 "Matrox G200/G4x0/G550 overlay in X11 window (using /dev/mga_vid)",
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 "xmga",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 "Zoltan Ponekker <pontscho@makacs.poliod.hu>",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 ""
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 static XGCValues wGCV;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61
7472
c4434bdf6e51 tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents: 7124
diff changeset
62 static uint32_t mDepth;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 static XWindowAttributes attribs;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 static uint32_t fgColor;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 static uint32_t mvHeight;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 static uint32_t mvWidth;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 static Window mRoot;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 static uint32_t drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth;
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
71 static uint32_t drwcX,drwcY,dwidth,dheight;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 static XSetWindowAttributes xWAttribs;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74
6311
da2dda48b7ec add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents: 6307
diff changeset
75 static int inited=0;
da2dda48b7ec add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents: 6307
diff changeset
76
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
77 #define VO_XMGA
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 #include "mga_common.c"
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
79 #undef VO_XMGA
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 static void mDrawColorKey( void )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 {
4795
b18e61cb457a small changes
pontscho
parents: 4784
diff changeset
83 XSetBackground( mDisplay,vo_gc,0 );
b18e61cb457a small changes
pontscho
parents: 4784
diff changeset
84 XClearWindow( mDisplay,vo_window );
b18e61cb457a small changes
pontscho
parents: 4784
diff changeset
85 XSetForeground( mDisplay,vo_gc,fgColor );
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
86 XFillRectangle( mDisplay,vo_window,vo_gc,drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight) );
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 XFlush( mDisplay );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89
6382
86d5fc5b54e2 fix panscan support and add Jesper Svennevid's <mplayer@svennevid.net> patch
pontscho
parents: 6311
diff changeset
90 static void set_window( void ){
120
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
91
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
92 if ( WinID )
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
93 {
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
94 XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
6296
74115095d9fe msg/i18n fixes and some printf->mp_msg
arpi
parents: 6095
diff changeset
95 mp_msg(MSGT_VO,MSGL_V,"[xmga] x: %d y: %d w: %d h: %d\n",drwX,drwY,drwWidth,drwHeight );
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
96 drwX=0; drwY=0;
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
97 XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot );
6296
74115095d9fe msg/i18n fixes and some printf->mp_msg
arpi
parents: 6095
diff changeset
98 mp_msg(MSGT_VO,MSGL_V,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
99 }
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
100 else { drwX=drwcX=vo_dx; drwY=drwcY=vo_dy; drwWidth=vo_dwidth; drwHeight=vo_dheight; }
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1783
diff changeset
101
3558
1dbf58c3d50c aspect ratio bug fix for gui
pontscho
parents: 2249
diff changeset
102 aspect(&dwidth,&dheight,A_NOZOOM);
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
103 if ( vo_fs )
120
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
104 {
3558
1dbf58c3d50c aspect ratio bug fix for gui
pontscho
parents: 2249
diff changeset
105 aspect(&dwidth,&dheight,A_ZOOM);
120
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
106 drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2;
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
107 drwcX+=drwX;
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
108 drwY=( vo_screenheight - (dheight > vo_screenheight?vo_screenheight:dheight) ) / 2;
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
109 drwcY+=drwY;
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
110 drwWidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth);
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
111 drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight);
6296
74115095d9fe msg/i18n fixes and some printf->mp_msg
arpi
parents: 6095
diff changeset
112 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 );
120
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
113 }
6307
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
114 vo_dwidth=drwWidth; vo_dheight=drwHeight;
120
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
115
4017
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
116 #ifdef HAVE_XINERAMA
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
117 if(XineramaIsActive(mDisplay))
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
118 {
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
119 XineramaScreenInfo *screens;
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
120 int num_screens;
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
121 int i;
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
122
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
123 screens = XineramaQueryScreens(mDisplay,&num_screens);
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
124
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
125 /* find the screen we are on */
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
126 i = 0;
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
127 while(!(screens[i].x_org <= drwcX && screens[i].y_org <= drwcY &&
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
128 screens[i].x_org + screens[i].width >= drwcX &&
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
129 screens[i].y_org + screens[i].height >= drwcY ))
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
130 {
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
131 i++;
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
132 }
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
133
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
134 /* set drwcX and drwcY to the right values */
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
135 drwcX = drwcX - screens[i].x_org;
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
136 drwcY = drwcY - screens[i].y_org;
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
137 XFree(screens);
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
138 }
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
139
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
140 #endif
6307
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
141
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
142 mDrawColorKey();
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
143
120
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
144 mga_vid_config.x_org=drwcX;
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
145 mga_vid_config.y_org=drwcY;
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
146 mga_vid_config.dest_width=drwWidth;
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
147 mga_vid_config.dest_height=drwHeight;
6382
86d5fc5b54e2 fix panscan support and add Jesper Svennevid's <mplayer@svennevid.net> patch
pontscho
parents: 6311
diff changeset
148 if ( vo_panscan > 0.0f && vo_fs )
6307
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
149 {
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
150 drwX-=vo_panscan_x>>1;
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
151 drwY-=vo_panscan_y>>1;
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
152 drwWidth+=vo_panscan_x;
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
153 drwHeight+=vo_panscan_y;
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
154
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
155 mga_vid_config.x_org-=vo_panscan_x>>1;
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
156 mga_vid_config.y_org-=vo_panscan_y>>1;
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
157 mga_vid_config.dest_width=drwWidth;
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
158 mga_vid_config.dest_height=drwHeight;
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
159 mDrawColorKey();
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
160 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?)" );
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
161 }
120
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
162 }
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
163
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
164 static void check_events(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
165 {
4303
a53d7ca1ed84 move bug fixed
pontscho
parents: 4017
diff changeset
166 int e=vo_x11_check_events(mDisplay);
a53d7ca1ed84 move bug fixed
pontscho
parents: 4017
diff changeset
167 if ( !(e&VO_EVENT_RESIZE) && !(e&VO_EVENT_EXPOSE) ) return;
6382
86d5fc5b54e2 fix panscan support and add Jesper Svennevid's <mplayer@svennevid.net> patch
pontscho
parents: 6311
diff changeset
168 set_window();
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
169 mDrawColorKey();
6296
74115095d9fe msg/i18n fixes and some printf->mp_msg
arpi
parents: 6095
diff changeset
170 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?)" );
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
172
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
173 static void flip_page(void){
182
80a7b40f201a *** empty log message ***
pontscho
parents: 120
diff changeset
174 #ifdef SHOW_TIME
100
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
175 unsigned int t;
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
176 t=GetTimer();
6296
74115095d9fe msg/i18n fixes and some printf->mp_msg
arpi
parents: 6095
diff changeset
177 mp_msg(MSGT_VO,MSGL_STATUS," [timer: %08X diff: %6d dd: %6d ] \n",t,t-timer,(t-timer)-timerd);
100
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
178 timerd=t-timer;
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
179 timer=t;
182
80a7b40f201a *** empty log message ***
pontscho
parents: 120
diff changeset
180 #endif
100
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
181
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1210
diff changeset
182 vo_mga_flip_page();
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
183 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184
7124
eca7dbad0166 finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents: 6953
diff changeset
185 static uint32_t config( uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 char * mTitle=(title == NULL) ? "XMGA render" : title;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188 XVisualInfo vinfo;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 unsigned long xswamask;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
191 if(mga_init(width,height,format)) return -1; // ioctl errors?
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192
2249
48f0ac1e9d13 Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents: 2057
diff changeset
193 aspect_save_orig(width,height);
48f0ac1e9d13 Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents: 2057
diff changeset
194 aspect_save_prescale(d_width,d_height);
48f0ac1e9d13 Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents: 2057
diff changeset
195 aspect_save_screenres(vo_screenwidth,vo_screenheight);
48f0ac1e9d13 Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents: 2057
diff changeset
196
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197 mvWidth=width; mvHeight=height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198
6307
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
199 vo_panscan_x=vo_panscan_y=vo_panscan_amount=0;
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
200
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
201 vo_dx=( vo_screenwidth - d_width ) / 2;
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
202 vo_dy=( vo_screenheight - d_height ) / 2;
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
203 vo_dwidth=d_width; vo_dheight=d_height;
5955
caac20b1ca79 fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents: 5945
diff changeset
204 vo_mouse_autohide=1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206 switch ( vo_depthonscreen )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208 case 32:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209 case 24: fgColor=0x00ff00ffL; break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210 case 16: fgColor=0xf81fL; break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211 case 15: fgColor=0x7c1fL; break;
6296
74115095d9fe msg/i18n fixes and some printf->mp_msg
arpi
parents: 6095
diff changeset
212 default: mp_msg(MSGT_VO,MSGL_ERR,"Sorry, this (%d) color depth not supported.\n",vo_depthonscreen ); return -1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214
5158
3dbceaff9f77 uninit bugs fixed
arpi
parents: 5007
diff changeset
215 inited=1;
3dbceaff9f77 uninit bugs fixed
arpi
parents: 5007
diff changeset
216
6016
be9cd7d845c2 -zoom, -fs with x[11|mga|v] fix -- round two
pontscho
parents: 6009
diff changeset
217 aspect(&vo_dwidth,&vo_dheight,A_NOZOOM);
5985
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
218
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1637
diff changeset
219 #ifdef HAVE_NEW_GUI
5985
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
220 if(use_gui)
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
221 guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
222 else
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
223 #endif
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
224 {
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
225 if ( flags&1 ) aspect(&dwidth,&dheight,A_ZOOM);
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
226
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
227 XGetWindowAttributes( mDisplay,mRootWin,&attribs );
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
228 mDepth=attribs.depth;
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
229 if ( mDepth != 15 && mDepth != 16 && mDepth != 24 && mDepth != 32 ) mDepth=24;
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
230 XMatchVisualInfo( mDisplay,mScreen,mDepth,TrueColor,&vinfo );
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
231 xWAttribs.colormap=XCreateColormap( mDisplay,mRootWin,vinfo.visual,AllocNone );
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
232 xWAttribs.background_pixel=0;
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
233 xWAttribs.border_pixel=0;
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
234 xWAttribs.event_mask=StructureNotifyMask | ExposureMask | KeyPressMask |
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
235 ((WinID==0)?0:(ButtonPressMask | ButtonReleaseMask | PointerMotionMask | PropertyChangeMask));
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
236 xswamask=CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237
3847
c8c7ba08ef44 -wid/-rootwin support
arpi
parents: 3558
diff changeset
238 if ( WinID>=0 ){
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
239
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
240 vo_window = WinID ? ((Window)WinID) : mRootWin;
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
241 if ( WinID )
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
242 {
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
243 XUnmapWindow( mDisplay,vo_window );
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
244 XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xWAttribs);
6953
ce67cc1f0beb ignore BadAccess error at XSelectInput() (grabbing mouse etc) with warning
arpi
parents: 6755
diff changeset
245 vo_x11_selectinput_witherr( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
246 } else XSelectInput( mDisplay,vo_window,ExposureMask );
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
247
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
248 } else {
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
249
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
250 if ( vo_window == None )
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
251 {
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
252 vo_window=XCreateWindow( mDisplay,mRootWin,
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
253 vo_dx,vo_dy,
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
254 vo_dwidth,vo_dheight,
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
255 xWAttribs.border_pixel,
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
256 mDepth,
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
257 InputOutput,
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
258 vinfo.visual,xswamask,&xWAttribs );
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
259
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
260 vo_x11_classhint( mDisplay,vo_window,"xmga" );
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
261 vo_hidecursor(mDisplay,vo_window);
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
262 vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight,0 );
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
263
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
264 XStoreName( mDisplay,vo_window,mTitle );
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
265 XMapWindow( mDisplay,vo_window );
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
266
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
267 if ( flags&1 ) vo_x11_fullscreen();
5999
792d58595767 fix -fs and 'f'
pontscho
parents: 5985
diff changeset
268
3990
87538547c8f4 xinerama fix by attila
atmos4
parents: 3847
diff changeset
269 #ifdef HAVE_XINERAMA
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
270 vo_x11_xinerama_move(mDisplay,vo_window);
3990
87538547c8f4 xinerama fix by attila
atmos4
parents: 3847
diff changeset
271 #endif
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
272 } else if ( !(flags&1) ) XMoveResizeWindow( mDisplay,vo_window,vo_dx,vo_dy,vo_dwidth,vo_dheight );
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
273 }
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
274
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
275 if ( vo_gc != None ) XFreeGC( mDisplay,vo_gc );
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
276 vo_gc=XCreateGC( mDisplay,vo_window,GCForeground,&wGCV );
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
277
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
278 } // !GUI
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
279
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
280 if ( ( flags&1 )&&( !WinID ) ) { vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; vo_fs=1; }
6382
86d5fc5b54e2 fix panscan support and add Jesper Svennevid's <mplayer@svennevid.net> patch
pontscho
parents: 6311
diff changeset
281
86d5fc5b54e2 fix panscan support and add Jesper Svennevid's <mplayer@svennevid.net> patch
pontscho
parents: 6311
diff changeset
282 panscan_calc();
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
283
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
284 mga_vid_config.colkey_on=1;
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
285 mga_vid_config.colkey_red=255;
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
286 mga_vid_config.colkey_green=0;
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
287 mga_vid_config.colkey_blue=255;
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
288
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
289 set_window(); // set up mga_vid_config.dest_width etc
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
290
6755
a31b9f15cbff - fix audio equalizer
pontscho
parents: 6382
diff changeset
291 saver_off(mDisplay);
a31b9f15cbff - fix audio equalizer
pontscho
parents: 6382
diff changeset
292
a31b9f15cbff - fix audio equalizer
pontscho
parents: 6382
diff changeset
293 XFlush( mDisplay );
a31b9f15cbff - fix audio equalizer
pontscho
parents: 6382
diff changeset
294 XSync( mDisplay,False );
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
295
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
296 ioctl(f,MGA_VID_ON,0);
6755
a31b9f15cbff - fix audio equalizer
pontscho
parents: 6382
diff changeset
297
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
298 return 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
299 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
300
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
301 static const vo_info_t* get_info( void ){ return &vo_info; }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
302
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
303 static void uninit(void){
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
304 mp_msg(MSGT_VO,MSGL_V,"vo: uninit!\n");
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
305 mga_uninit();
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
306 if(!inited) return; // no window?
5158
3dbceaff9f77 uninit bugs fixed
arpi
parents: 5007
diff changeset
307 inited=0;
4316
9f8a618e87c3 fix screen saver bug under gui
pontscho
parents: 4303
diff changeset
308 saver_on(mDisplay);
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
309 vo_x11_uninit(); // destroy the window
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
310 }
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4316
diff changeset
311