annotate libvo/vo_xmga.c @ 11619:179138947307

This patch contains bugfixes for the esd audio output driver that I uncovered while trying to send sound to a remote esd server over a wireless (11 mbs, just enough to handle to sound) link. First, the sound was full "ticking" sounds. I found a bug that prevented the "send the remainder of this block" code from ever being called - so large chunks of audio were simply being ignored. Fixing this bug removed the "ticking" from audio streams. Fixing this bug, however, uncovered another problem - when the socket buffer was full, doing a blocking write to finish the buffer would take far too long and would turn video into a chunky mess. I'd imagine this blocking write would be fine for an audio-only stream, but it turns out to hold up the video far too much. The solution in this patch is to write as much data as possible to the socket, and then return as soon as possible, reporting the number of bytes actually written accurately back to mplayer. I've tested it on both local and remote esd servers, and it works well. Patch by Benjamin Osheroff <ben@gimbo.net>
author attila
date Wed, 10 Dec 2003 12:19:13 +0000
parents 85e503ddf65f
children 162c80b2d432
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
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 #include "video_out.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 #include "video_out_internal.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 #include <sys/ioctl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 #include <unistd.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 #include <fcntl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 #include <sys/mman.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 #include "drivers/mga_vid.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 #include <X11/Xlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 #include <X11/Xutil.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 #include <errno.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31
4017
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
32 #ifdef HAVE_XINERAMA
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
33 #include <X11/extensions/Xinerama.h>
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
34 #endif
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 3990
diff changeset
35
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
36 #include "x11_common.h"
616
41d6eec69b60 clean up
pontscho
parents: 614
diff changeset
37 #include "sub.h"
2057
378aed6b232d Use aspect()
atmos4
parents: 2039
diff changeset
38 #include "aspect.h"
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
39
182
80a7b40f201a *** empty log message ***
pontscho
parents: 120
diff changeset
40 #ifdef SHOW_TIME
9380
edfe34c5405d linux->osdep
arpi
parents: 8148
diff changeset
41 #include "../osdep/timer.h"
100
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
42 static unsigned int timer=0;
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
43 static unsigned int timerd=0;
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
44 #endif
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
45
5955
caac20b1ca79 fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents: 5945
diff changeset
46 #ifdef HAVE_NEW_GUI
caac20b1ca79 fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents: 5945
diff changeset
47 #include "../Gui/interface.h"
caac20b1ca79 fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents: 5945
diff changeset
48 #endif
caac20b1ca79 fix xmga fs, resize to movie size and mouse auto hide + dga
pontscho
parents: 5945
diff changeset
49
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 8017
diff changeset
50 static vo_info_t info =
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 {
7680
d60cfb1f8b37 more cleanup, some -vo mga fullscreen fixes
arpi
parents: 7679
diff changeset
52 "Matrox G200/G4x0/G550 overlay in X11 window (using /dev/mga_vid)",
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 "xmga",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 "Zoltan Ponekker <pontscho@makacs.poliod.hu>",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 ""
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 8017
diff changeset
58 LIBVO_EXTERN( xmga )
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 8017
diff changeset
59
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 8017
diff changeset
60
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 static XGCValues wGCV;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62
7472
c4434bdf6e51 tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents: 7124
diff changeset
63 static uint32_t mDepth;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 static XWindowAttributes attribs;
10988
c2bff70784d5 user settable colorkey
alex
parents: 10729
diff changeset
65 static int colorkey;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 static uint32_t mvHeight;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 static uint32_t mvWidth;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 static Window mRoot;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 static XSetWindowAttributes xWAttribs;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73
6311
da2dda48b7ec add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents: 6307
diff changeset
74 static int inited=0;
da2dda48b7ec add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
pontscho
parents: 6307
diff changeset
75
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
76 #define VO_XMGA
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 #include "mga_common.c"
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
78 #undef VO_XMGA
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 static void mDrawColorKey( void )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 {
4795
b18e61cb457a small changes
pontscho
parents: 4784
diff changeset
82 XSetBackground( mDisplay,vo_gc,0 );
b18e61cb457a small changes
pontscho
parents: 4784
diff changeset
83 XClearWindow( mDisplay,vo_window );
10988
c2bff70784d5 user settable colorkey
alex
parents: 10729
diff changeset
84 XSetForeground( mDisplay,vo_gc,colorkey );
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
85 XFillRectangle( mDisplay,vo_window,vo_gc,drwX,drwY,drwWidth,(vo_fs?drwHeight - 1:drwHeight) );
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 XFlush( mDisplay );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
89 static void check_events(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 {
4303
a53d7ca1ed84 move bug fixed
pontscho
parents: 4017
diff changeset
91 int e=vo_x11_check_events(mDisplay);
a53d7ca1ed84 move bug fixed
pontscho
parents: 4017
diff changeset
92 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
93 set_window();
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
94 mDrawColorKey();
6296
74115095d9fe msg/i18n fixes and some printf->mp_msg
arpi
parents: 6095
diff changeset
95 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
96 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
98 static void flip_page(void){
182
80a7b40f201a *** empty log message ***
pontscho
parents: 120
diff changeset
99 #ifdef SHOW_TIME
100
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
100 unsigned int t;
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
101 t=GetTimer();
6296
74115095d9fe msg/i18n fixes and some printf->mp_msg
arpi
parents: 6095
diff changeset
102 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
103 timerd=t-timer;
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
104 timer=t;
182
80a7b40f201a *** empty log message ***
pontscho
parents: 120
diff changeset
105 #endif
100
201c2f931497 added #define SHOW_TIME option... (debug)
arpi_esp
parents: 56
diff changeset
106
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1210
diff changeset
107 vo_mga_flip_page();
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
108 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109
7124
eca7dbad0166 finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents: 6953
diff changeset
110 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
111 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 char * mTitle=(title == NULL) ? "XMGA render" : title;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 XVisualInfo vinfo;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 unsigned long xswamask;
10988
c2bff70784d5 user settable colorkey
alex
parents: 10729
diff changeset
115 int r, g, b;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
117 if(mga_init(width,height,format)) return -1; // ioctl errors?
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118
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
119 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
120 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
121 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
122
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123 mvWidth=width; mvHeight=height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
124
6307
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
125 vo_panscan_x=vo_panscan_y=vo_panscan_amount=0;
72c87b2ec779 added panscan support for xmga/xvidix
pontscho
parents: 6296
diff changeset
126
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
127 vo_dx=( vo_screenwidth - d_width ) / 2;
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
128 vo_dy=( vo_screenheight - d_height ) / 2;
10729
07870312c054 while we are at it: geometry support for xmga
attila
parents: 9380
diff changeset
129 geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, vo_screenheight);
4981
bfc652fc7f43 rewrite fullscreen support in some libvo driver
pontscho
parents: 4970
diff changeset
130 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
131 vo_mouse_autohide=1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
132
10988
c2bff70784d5 user settable colorkey
alex
parents: 10729
diff changeset
133 r = (vo_colorkey & 0x00ff0000) >> 16;
c2bff70784d5 user settable colorkey
alex
parents: 10729
diff changeset
134 g = (vo_colorkey & 0x0000ff00) >> 8;
c2bff70784d5 user settable colorkey
alex
parents: 10729
diff changeset
135 b = vo_colorkey & 0x000000ff;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
136 switch ( vo_depthonscreen )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 {
10988
c2bff70784d5 user settable colorkey
alex
parents: 10729
diff changeset
138 case 32: colorkey = vo_colorkey; break;
c2bff70784d5 user settable colorkey
alex
parents: 10729
diff changeset
139 case 24: colorkey = vo_colorkey & 0x00ffffff; break;
c2bff70784d5 user settable colorkey
alex
parents: 10729
diff changeset
140 case 16: colorkey = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3); break;
c2bff70784d5 user settable colorkey
alex
parents: 10729
diff changeset
141 case 15: colorkey = ((r >> 3) << 10) | ((g >> 3) << 5) | (b >> 3); break;
6296
74115095d9fe msg/i18n fixes and some printf->mp_msg
arpi
parents: 6095
diff changeset
142 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
143 }
10988
c2bff70784d5 user settable colorkey
alex
parents: 10729
diff changeset
144 mp_msg(MSGT_VO, MSGL_INFO, "Using colorkey: %x\n", colorkey);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145
5158
3dbceaff9f77 uninit bugs fixed
arpi
parents: 5007
diff changeset
146 inited=1;
3dbceaff9f77 uninit bugs fixed
arpi
parents: 5007
diff changeset
147
10729
07870312c054 while we are at it: geometry support for xmga
attila
parents: 9380
diff changeset
148 aspect(&d_width,&d_height,A_NOZOOM);
5985
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
149
1723
5e4214a7540e GUI stuff. now seeking works, and xmga renders to video window
arpi
parents: 1637
diff changeset
150 #ifdef HAVE_NEW_GUI
5985
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
151 if(use_gui)
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
152 guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
153 else
cb393303865d the Right Fix for gui window setup
arpi
parents: 5975
diff changeset
154 #endif
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
155 {
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
156 if ( flags&1 ) aspect(&dwidth,&dheight,A_ZOOM);
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
157
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
158 XGetWindowAttributes( mDisplay,mRootWin,&attribs );
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
159 mDepth=attribs.depth;
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
160 if ( mDepth != 15 && mDepth != 16 && mDepth != 24 && mDepth != 32 ) mDepth=24;
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
161 XMatchVisualInfo( mDisplay,mScreen,mDepth,TrueColor,&vinfo );
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
162 xWAttribs.colormap=XCreateColormap( mDisplay,mRootWin,vinfo.visual,AllocNone );
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
163 xWAttribs.background_pixel=0;
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
164 xWAttribs.border_pixel=0;
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
165 xWAttribs.event_mask=StructureNotifyMask | ExposureMask | KeyPressMask |
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
166 ((WinID==0)?0:(ButtonPressMask | ButtonReleaseMask | PointerMotionMask | PropertyChangeMask));
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
167 xswamask=CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168
3847
c8c7ba08ef44 -wid/-rootwin support
arpi
parents: 3558
diff changeset
169 if ( WinID>=0 ){
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
170
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
171 vo_window = WinID ? ((Window)WinID) : mRootWin;
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
172 if ( WinID )
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
173 {
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
174 XUnmapWindow( mDisplay,vo_window );
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
175 XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xWAttribs);
6953
ce67cc1f0beb ignore BadAccess error at XSelectInput() (grabbing mouse etc) with warning
arpi
parents: 6755
diff changeset
176 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
177 } else XSelectInput( mDisplay,vo_window,ExposureMask );
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
178
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
179 } else {
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
180
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
181 if ( vo_window == None )
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
182 {
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
183 vo_window=XCreateWindow( mDisplay,mRootWin,
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
184 vo_dx,vo_dy,
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
185 vo_dwidth,vo_dheight,
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
186 xWAttribs.border_pixel,
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
187 mDepth,
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
188 InputOutput,
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
189 vinfo.visual,xswamask,&xWAttribs );
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
190
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
191 vo_x11_classhint( mDisplay,vo_window,"xmga" );
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
192 vo_hidecursor(mDisplay,vo_window);
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
193 vo_x11_sizehint( vo_dx,vo_dy,vo_dwidth,vo_dheight,0 );
723
c3e0bdb64027 add gui support
pontscho
parents: 616
diff changeset
194
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
195 XStoreName( mDisplay,vo_window,mTitle );
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
196 XMapWindow( mDisplay,vo_window );
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
197
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
198 if ( flags&1 ) vo_x11_fullscreen();
5999
792d58595767 fix -fs and 'f'
pontscho
parents: 5985
diff changeset
199
3990
87538547c8f4 xinerama fix by attila
atmos4
parents: 3847
diff changeset
200 #ifdef HAVE_XINERAMA
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
201 vo_x11_xinerama_move(mDisplay,vo_window);
3990
87538547c8f4 xinerama fix by attila
atmos4
parents: 3847
diff changeset
202 #endif
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
203 } 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
204 }
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
205
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
206 if ( vo_gc != None ) XFreeGC( mDisplay,vo_gc );
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
207 vo_gc=XCreateGC( mDisplay,vo_window,GCForeground,&wGCV );
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
208
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
209 } // !GUI
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210
6043
421781c5b128 fix some small bug and -rootwin
pontscho
parents: 6016
diff changeset
211 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
212
86d5fc5b54e2 fix panscan support and add Jesper Svennevid's <mplayer@svennevid.net> patch
pontscho
parents: 6311
diff changeset
213 panscan_calc();
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
214
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
215 mga_vid_config.colkey_on=1;
10988
c2bff70784d5 user settable colorkey
alex
parents: 10729
diff changeset
216 mga_vid_config.colkey_red=r;
c2bff70784d5 user settable colorkey
alex
parents: 10729
diff changeset
217 mga_vid_config.colkey_green=g;
c2bff70784d5 user settable colorkey
alex
parents: 10729
diff changeset
218 mga_vid_config.colkey_blue=b;
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
219
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
220 set_window(); // set up mga_vid_config.dest_width etc
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221
6755
a31b9f15cbff - fix audio equalizer
pontscho
parents: 6382
diff changeset
222 saver_off(mDisplay);
a31b9f15cbff - fix audio equalizer
pontscho
parents: 6382
diff changeset
223
11542
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 10988
diff changeset
224 if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 10988
diff changeset
225
6755
a31b9f15cbff - fix audio equalizer
pontscho
parents: 6382
diff changeset
226 XFlush( mDisplay );
a31b9f15cbff - fix audio equalizer
pontscho
parents: 6382
diff changeset
227 XSync( mDisplay,False );
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
228
ed7b05575aab -fixed-vo support
pontscho
parents: 7680
diff changeset
229 ioctl(f,MGA_VID_ON,0);
6755
a31b9f15cbff - fix audio equalizer
pontscho
parents: 6382
diff changeset
230
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
231 return 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
232 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
234 static void uninit(void){
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
235 mp_msg(MSGT_VO,MSGL_V,"vo: uninit!\n");
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
236 mga_uninit();
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
237 if(!inited) return; // no window?
5158
3dbceaff9f77 uninit bugs fixed
arpi
parents: 5007
diff changeset
238 inited=0;
4316
9f8a618e87c3 fix screen saver bug under gui
pontscho
parents: 4303
diff changeset
239 saver_on(mDisplay);
7679
e4e70b0e1786 some cleanup
arpi
parents: 7472
diff changeset
240 vo_x11_uninit(); // destroy the window
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241 }
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4316
diff changeset
242