annotate libvo/vo_xmga.c @ 6237:2eec40929570

warning fixes (string.h is required for memset) moved config.h at the top of the include (often avoids 10L when adding a new #include ;)
author pl
date Thu, 30 May 2002 11:53:51 +0000
parents 891cff8aba60
children 74115095d9fe
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 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 * video_out_xmga.c
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 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 * mpeg2dec is free software; you can redistribute it and/or modify
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 * the Free Software Foundation; either version 2, or (at your option)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 * any later version.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 * mpeg2dec is distributed in the hope that it will be useful,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 * GNU General Public License for more details.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 * along with GNU Make; see the file COPYING. If not, write to
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27 #include <stdio.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 #include <stdlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 #include <string.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 #include "config.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 #include "video_out.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 #include "video_out_internal.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 LIBVO_EXTERN( xmga )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 #include <sys/ioctl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 #include <unistd.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 #include <fcntl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 #include <sys/mman.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 #include "drivers/mga_vid.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 #include <X11/Xlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 #include <X11/Xutil.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46 #include <errno.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47
4017
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
48 #ifdef HAVE_XINERAMA
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
49 #include <X11/extensions/Xinerama.h>
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
50 #endif
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
51
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
52 #include "x11_common.h"
616
41d6eec69b60 clean up
pontscho
parents: 614
diff changeset
53 #include "sub.h"
2057
378aed6b232d Use aspect()
atmos4
parents: 2039
diff changeset
54 #include "aspect.h"
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
55
182
80a7b40f201a *** empty log message ***
pontscho
parents: 120
diff changeset
56 #ifdef SHOW_TIME
100
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
57 #include "../linux/timer.h"
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
58 static unsigned int timer=0;
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
59 static unsigned int timerd=0;
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
60 #endif
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
61
5955
caac20b1ca79 fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents: 5945
diff changeset
62 #ifdef HAVE_NEW_GUI
caac20b1ca79 fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents: 5945
diff changeset
63 #include "../Gui/interface.h"
caac20b1ca79 fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents: 5945
diff changeset
64 #endif
caac20b1ca79 fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents: 5945
diff changeset
65
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 static vo_info_t vo_info =
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 {
4993
53c569d36b2c small changes in libvo's X11 support
pontscho
parents: 4985
diff changeset
68 "X11 (Matrox G200/G4x0/G550 overlay in window using /dev/mga_vid)",
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 "xmga",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 "Zoltan Ponekker <pontscho@makacs.poliod.hu>",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 ""
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 static XGCValues wGCV;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 static XImage * myximage;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 static uint32_t mDepth, bpp, mode;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 static XWindowAttributes attribs;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 static uint32_t fgColor;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 static uint32_t mvHeight;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 static uint32_t mvWidth;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 static Window mRoot;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 static uint32_t drwX,drwY,drwWidth,drwHeight,drwBorderWidth,drwDepth;
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
87 static uint32_t drwcX,drwcY,dwidth,dheight;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 static XSetWindowAttributes xWAttribs;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
91 #define VO_XMGA
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 #include "mga_common.c"
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
93 #undef VO_XMGA
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 static void mDrawColorKey( void )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 {
4795
b18e61cb457a small changes
pontscho
parents: 4784
diff changeset
97 XSetBackground( mDisplay,vo_gc,0 );
b18e61cb457a small changes
pontscho
parents: 4784
diff changeset
98 XClearWindow( mDisplay,vo_window );
b18e61cb457a small changes
pontscho
parents: 4784
diff changeset
99 XSetForeground( mDisplay,vo_gc,fgColor );
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
100 XFillRectangle( mDisplay,vo_window,vo_gc,drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight) );
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101 XFlush( mDisplay );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103
120
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
104 static void set_window(){
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
105
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
106 if ( WinID )
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
107 {
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
108 XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth );
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
109 fprintf( stderr,"[xmga] x: %d y: %d w: %d h: %d\n",drwX,drwY,drwWidth,drwHeight );
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
110 drwX=0; drwY=0;
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
111 XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot );
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
112 fprintf( stderr,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight );
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
113 }
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
114 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
115
3558
1dbf58c3d50c aspect ratio bug fix for gui
pontscho
parents: 2249
diff changeset
116 aspect(&dwidth,&dheight,A_NOZOOM);
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
117 if ( vo_fs )
120
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
118 {
3558
1dbf58c3d50c aspect ratio bug fix for gui
pontscho
parents: 2249
diff changeset
119 aspect(&dwidth,&dheight,A_ZOOM);
120
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
120 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
121 drwcX+=drwX;
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
122 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
123 drwcY+=drwY;
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
124 drwWidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth);
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
125 drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight);
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1783
diff changeset
126 fprintf( stderr,"[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
127 }
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
128
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
129 mDrawColorKey();
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
130
4017
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
131 #ifdef HAVE_XINERAMA
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
132 if(XineramaIsActive(mDisplay))
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 XineramaScreenInfo *screens;
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
135 int num_screens;
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
136 int i;
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
137
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
138 screens = XineramaQueryScreens(mDisplay,&num_screens);
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 /* find the screen we are on */
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
141 i = 0;
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
142 while(!(screens[i].x_org <= drwcX && screens[i].y_org <= drwcY &&
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
143 screens[i].x_org + screens[i].width >= drwcX &&
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
144 screens[i].y_org + screens[i].height >= drwcY ))
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
145 {
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
146 i++;
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
147 }
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
148
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
149 /* set drwcX and drwcY to the right values */
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
150 drwcX = drwcX - screens[i].x_org;
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
151 drwcY = drwcY - screens[i].y_org;
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
152 XFree(screens);
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
153 }
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
154
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
155 #endif
120
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
156 mga_vid_config.x_org=drwcX;
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
157 mga_vid_config.y_org=drwcY;
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
158 mga_vid_config.dest_width=drwWidth;
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
159 mga_vid_config.dest_height=drwHeight;
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
160
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
161 }
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
162
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
163 static void check_events(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
164 {
4303
a53d7ca1ed84 move bug fixed
pontscho
parents: 4017
diff changeset
165 int e=vo_x11_check_events(mDisplay);
a53d7ca1ed84 move bug fixed
pontscho
parents: 4017
diff changeset
166 if ( !(e&VO_EVENT_RESIZE) && !(e&VO_EVENT_EXPOSE) ) return;
5945
f9fe22a52e80 fix aspect ratio handling
pontscho
parents: 5835
diff changeset
167 set_window();
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
168 mDrawColorKey();
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
169 if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) ) printf( "Error in mga_vid_config ioctl (wrong mga_vid.o version?)" );
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
170 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1210
diff changeset
172 static void draw_osd(void)
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1210
diff changeset
173 { vo_draw_text(mga_vid_config.src_width,mga_vid_config.src_height,draw_alpha);}
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1210
diff changeset
174
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
175 static void flip_page(void){
182
80a7b40f201a *** empty log message ***
pontscho
parents: 120
diff changeset
176 #ifdef SHOW_TIME
100
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
177 unsigned int t;
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
178 t=GetTimer();
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
179 printf(" [timer: %08X diff: %6d dd: %6d ] \n",t,t-timer,(t-timer)-timerd);
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
180 timerd=t-timer;
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
181 timer=t;
182
80a7b40f201a *** empty log message ***
pontscho
parents: 120
diff changeset
182 #endif
100
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
183
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1210
diff changeset
184 vo_mga_flip_page();
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
185 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186
5158
3dbceaff9f77 uninit bugs fixed
arpi
parents: 5007
diff changeset
187 static int inited=0;
3dbceaff9f77 uninit bugs fixed
arpi
parents: 5007
diff changeset
188
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
189 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,const vo_tune_info_t* info)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191 char * mTitle=(title == NULL) ? "XMGA render" : title;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 XVisualInfo vinfo;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194 unsigned long xswamask;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195
6016
be9cd7d845c2 -zoom, -fs with x[11|mga|v] fix -- round two
pontscho
parents: 6009
diff changeset
196 if (!vo_init()) return -1;
be9cd7d845c2 -zoom, -fs with x[11|mga|v] fix -- round two
pontscho
parents: 6009
diff changeset
197
5007
18690b95b24c round up width/height if mod 2 != 0
arpi
parents: 4993
diff changeset
198 width+=width&1;
18690b95b24c round up width/height if mod 2 != 0
arpi
parents: 4993
diff changeset
199
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 switch(format)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 {
182
80a7b40f201a *** empty log message ***
pontscho
parents: 120
diff changeset
202 case IMGFMT_YV12:
5007
18690b95b24c round up width/height if mod 2 != 0
arpi
parents: 4993
diff changeset
203 height+=height&1;
5317
80fbb03b385a U,V plane odrer fixed
arpi
parents: 5158
diff changeset
204 mga_vid_config.format=MGA_VID_FORMAT_IYUV;
182
80a7b40f201a *** empty log message ***
pontscho
parents: 120
diff changeset
205 mga_vid_config.frame_size=( ( width + 31 ) & ~31 ) * height + ( ( ( width + 31 ) & ~31 ) * height ) / 2;
56
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
206 break;
470
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 448
diff changeset
207 case IMGFMT_I420:
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 448
diff changeset
208 case IMGFMT_IYUV:
5007
18690b95b24c round up width/height if mod 2 != 0
arpi
parents: 4993
diff changeset
209 height+=height&1;
5317
80fbb03b385a U,V plane odrer fixed
arpi
parents: 5158
diff changeset
210 mga_vid_config.format=MGA_VID_FORMAT_YV12;
470
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 448
diff changeset
211 mga_vid_config.frame_size=( ( width + 31 ) & ~31 ) * height + ( ( ( width + 31 ) & ~31 ) * height ) / 2;
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 448
diff changeset
212 break;
56
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
213 case IMGFMT_YUY2:
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
214 mga_vid_config.format=MGA_VID_FORMAT_YUY2;
182
80a7b40f201a *** empty log message ***
pontscho
parents: 120
diff changeset
215 mga_vid_config.frame_size=( ( width + 31 ) & ~31 ) * height * 2;
56
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
216 break;
448
198b46b739d8 qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents: 384
diff changeset
217 case IMGFMT_UYVY:
198b46b739d8 qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents: 384
diff changeset
218 mga_vid_config.format=MGA_VID_FORMAT_UYVY;
198b46b739d8 qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents: 384
diff changeset
219 mga_vid_config.frame_size=( ( width + 31 ) & ~31 ) * height * 2;
198b46b739d8 qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents: 384
diff changeset
220 break;
614
f83ec60bce49 fprintf(stderr converted to printf(
szabii
parents: 612
diff changeset
221 default: printf("mga: invalid output format %0X\n",format); return (-1);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223
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
224 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
225 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
226 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
227
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
228 mvWidth=width; mvHeight=height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
229
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
230 vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2;
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
231 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
232 vo_mouse_autohide=1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
234 switch ( vo_depthonscreen )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
235 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
236 case 32:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237 case 24: fgColor=0x00ff00ffL; break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
238 case 16: fgColor=0xf81fL; break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
239 case 15: fgColor=0x7c1fL; break;
614
f83ec60bce49 fprintf(stderr converted to printf(
szabii
parents: 612
diff changeset
240 default: printf( "Sorry, this (%d) color depth not supported.\n",vo_depthonscreen ); return -1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
242
5158
3dbceaff9f77 uninit bugs fixed
arpi
parents: 5007
diff changeset
243 inited=1;
3dbceaff9f77 uninit bugs fixed
arpi
parents: 5007
diff changeset
244
6016
be9cd7d845c2 -zoom, -fs with x[11|mga|v] fix -- round two
pontscho
parents: 6009
diff changeset
245 aspect(&vo_dwidth,&vo_dheight,A_NOZOOM);
5985
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
246
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1637
diff changeset
247 #ifdef HAVE_NEW_GUI
5985
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
248 if(use_gui)
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
249 guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
250 else
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
251 #endif
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
252 {
2039
452f3cb96b32 Make aware of new -fs calling.
atmos4
parents: 1924
diff changeset
253 #ifdef X11_FULLSCREEN
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
254 if ( flags&1 ) aspect(&dwidth,&dheight,A_ZOOM);
2039
452f3cb96b32 Make aware of new -fs calling.
atmos4
parents: 1924
diff changeset
255 #endif
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
256
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
257 XGetWindowAttributes( mDisplay,mRootWin,&attribs );
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
258 mDepth=attribs.depth;
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
259 if ( mDepth != 15 && mDepth != 16 && mDepth != 24 && mDepth != 32 ) mDepth=24;
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
260 XMatchVisualInfo( mDisplay,mScreen,mDepth,TrueColor,&vinfo );
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
261 xWAttribs.colormap=XCreateColormap( mDisplay,mRootWin,vinfo.visual,AllocNone );
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
262 xWAttribs.background_pixel=0;
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
263 xWAttribs.border_pixel=0;
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
264 xWAttribs.event_mask=StructureNotifyMask | ExposureMask | KeyPressMask |
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
265 ((WinID==0)?0:(ButtonPressMask | ButtonReleaseMask | PointerMotionMask | PropertyChangeMask));
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
266 xswamask=CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
267
3847
c8c7ba08ef44 -wid/-rootwin support
arpi
parents: 3558
diff changeset
268 if ( WinID>=0 ){
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
269
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
270 vo_window = WinID ? ((Window)WinID) : mRootWin;
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
271 if ( WinID )
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
272 {
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
273 XUnmapWindow( mDisplay,vo_window );
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
274 XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xWAttribs);
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
275 XSelectInput( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask );
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
276 } else XSelectInput( mDisplay,vo_window,ExposureMask );
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
277
3847
c8c7ba08ef44 -wid/-rootwin support
arpi
parents: 3558
diff changeset
278 } else
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
279 {
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
280 vo_window=XCreateWindow( mDisplay,mRootWin,
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
281 vo_dx,vo_dy,
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
282 vo_dwidth,vo_dheight,
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
283 xWAttribs.border_pixel,
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
284 mDepth,
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
285 InputOutput,
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
286 vinfo.visual,xswamask,&xWAttribs );
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
287
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
288 vo_x11_classhint( mDisplay,vo_window,"xmga" );
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
289 vo_hidecursor(mDisplay,vo_window);
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
290 vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight,0 );
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
291
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
292 XStoreName( mDisplay,vo_window,mTitle );
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
293 XMapWindow( mDisplay,vo_window );
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
294
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
295 if ( flags&1 ) vo_x11_fullscreen();
5999
792d58595767 fix -fs and 'f'
pontscho
parents: 5985
diff changeset
296
3990
87538547c8f4 xinerama fix by attila
atmos4
parents: 3847
diff changeset
297 #ifdef HAVE_XINERAMA
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
298 vo_x11_xinerama_move(mDisplay,vo_window);
3990
87538547c8f4 xinerama fix by attila
atmos4
parents: 3847
diff changeset
299 #endif
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
300 }
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
301 vo_gc=XCreateGC( mDisplay,vo_window,GCForeground,&wGCV );
5985
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
302 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
303
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
304 if ( ( flags&1 )&&( !WinID ) ) { vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; vo_fs=1; }
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
305
120
93ea0c6aae7f common window setup code moved to set_window()
arpi_esp
parents: 100
diff changeset
306 set_window();
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
307
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
308 mga_vid_config.src_width=width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
309 mga_vid_config.src_height=height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
310
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
311 mga_vid_config.colkey_on=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
312 mga_vid_config.colkey_red=255;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
313 mga_vid_config.colkey_green=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
314 mga_vid_config.colkey_blue=255;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
315
56
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
316 if(mga_init()) return -1;
1852
58dd326fcc4a fix xshape, mixer, fullscreen, etc
pontscho
parents: 1783
diff changeset
317
4795
b18e61cb457a small changes
pontscho
parents: 4784
diff changeset
318 XFlush( mDisplay );
b18e61cb457a small changes
pontscho
parents: 4784
diff changeset
319 XSync( mDisplay,False );
4316
9f8a618e87c3 fix screen saver bug under gui
pontscho
parents: 4303
diff changeset
320
9f8a618e87c3 fix screen saver bug under gui
pontscho
parents: 4303
diff changeset
321 saver_off(mDisplay);
324
720c640332c8 Szebb es jobb screensaver-kikapcsolo resz
laaz
parents: 213
diff changeset
322
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
323 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
324 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
325
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
326 static const vo_info_t* get_info( void )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
327 { return &vo_info; }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
328
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
329
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
330 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
331 uninit(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
332 {
5158
3dbceaff9f77 uninit bugs fixed
arpi
parents: 5007
diff changeset
333 if(!inited) return;
3dbceaff9f77 uninit bugs fixed
arpi
parents: 5007
diff changeset
334 inited=0;
3dbceaff9f77 uninit bugs fixed
arpi
parents: 5007
diff changeset
335 mga_uninit();
4316
9f8a618e87c3 fix screen saver bug under gui
pontscho
parents: 4303
diff changeset
336 saver_on(mDisplay);
6095
891cff8aba60 some cleanup, gl/gl2 updated to use vo_window
arpi
parents: 6059
diff changeset
337 vo_x11_uninit();
1637
248972c26eee fixed mga uninit
arpi
parents: 1501
diff changeset
338 printf("vo: uninit!\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
339 }
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4316
diff changeset
340