annotate libvo/vo_gl.c @ 13551:2466b2ee99a8

move the file writers after vo_null so they don't get autoselected - following the same logic as in libao2
author alex
date Mon, 04 Oct 2004 19:36:12 +0000
parents f85c105bfeaa
children d3ef52aafb54
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12843
52d493f0ac79 changed misleading TEXTUREFORMAT_32BPP (was 24bpp!) to vo_gl2 style TEXTUREFORMAT_ALWAYS
reimar
parents: 12749
diff changeset
1 #define TEXTUREFORMAT_ALWAYS GL_RGB8
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3 #include <stdio.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 #include <stdlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 #include <string.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 #include <math.h>
4737
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4658
diff changeset
7 #include <errno.h>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8
11988
ccb15c72f331 printf -> mp_msg
attila
parents: 11542
diff changeset
9 #include "mp_msg.h"
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 #include "config.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 #include "video_out.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 #include "video_out_internal.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 #include <X11/Xlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 #include <X11/Xutil.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 //#include <X11/keysym.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 #include <GL/glx.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 #include <errno.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 #include <GL/gl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
22 #include "x11_common.h"
2057
378aed6b232d Use aspect()
atmos4
parents: 2041
diff changeset
23 #include "aspect.h"
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
24
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7931
diff changeset
25 static vo_info_t info =
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27 "X11 (OpenGL)",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 "gl",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 "Arpad Gereoffy <arpi@esp-team.scene.hu>",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 ""
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7931
diff changeset
33 LIBVO_EXTERN(gl)
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7931
diff changeset
34
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 static GLXContext wsGLXContext;
2041
ba8a225d1a18 now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents: 2040
diff changeset
36 static int wsGLXAttrib[] = { GLX_RGBA,
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 GLX_RED_SIZE,1,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 GLX_GREEN_SIZE,1,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 GLX_BLUE_SIZE,1,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 GLX_DOUBLEBUFFER,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 None };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 static uint32_t image_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 static uint32_t image_height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46 static uint32_t image_bytes;
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
47 static int many_fmts;
12445
d97398ed403e changes to get manyfmts nearer to working and fixed memory leak
reimar
parents: 12212
diff changeset
48 static GLenum gl_texfmt;
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
49 static GLenum gl_format;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
50 static GLenum gl_type;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51
10757
3aea64e0d6d9 Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents: 10138
diff changeset
52 static int int_pause;
3aea64e0d6d9 Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents: 10138
diff changeset
53
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 static uint32_t texture_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 static uint32_t texture_height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56
13237
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
57 static unsigned int slice_height = 1;
8654
2c4cebb8637d - optional slice height for -vo gl (example: -vo gl:32)
arpi
parents: 8148
diff changeset
58
612
77e0094f0cce some warnings killed
szabii
parents: 384
diff changeset
59 static void resize(int x,int y){
11988
ccb15c72f331 printf -> mp_msg
attila
parents: 11542
diff changeset
60 mp_msg(MSGT_VO, MSGL_V, "[gl] Resize: %dx%d\n",x,y);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 glViewport( 0, 0, x, y );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 glMatrixMode(GL_PROJECTION);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 glLoadIdentity();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 glOrtho(0, image_width, image_height, 0, -1,1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 glMatrixMode(GL_MODELVIEW);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 glLoadIdentity();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
71 static int find_gl_format (uint32_t format)
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
72 {
12445
d97398ed403e changes to get manyfmts nearer to working and fixed memory leak
reimar
parents: 12212
diff changeset
73 image_bytes = (IMGFMT_RGB_DEPTH(format)+7)/8;
d97398ed403e changes to get manyfmts nearer to working and fixed memory leak
reimar
parents: 12212
diff changeset
74 gl_texfmt = 3;
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
75 switch (format) {
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
76 case IMGFMT_RGB24:
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
77 gl_format = GL_RGB;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
78 gl_type = GL_UNSIGNED_BYTE;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
79 break;
13206
6e8d1ac141fc Using updated colorspace specifications from colorspaces.txt.
reimar
parents: 13188
diff changeset
80 case IMGFMT_RGBA:
12445
d97398ed403e changes to get manyfmts nearer to working and fixed memory leak
reimar
parents: 12212
diff changeset
81 gl_texfmt = 4;
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
82 gl_format = GL_RGBA;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
83 gl_type = GL_UNSIGNED_BYTE;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
84 break;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
85 case IMGFMT_Y800:
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
86 case IMGFMT_Y8:
12445
d97398ed403e changes to get manyfmts nearer to working and fixed memory leak
reimar
parents: 12212
diff changeset
87 gl_texfmt = 1;
d97398ed403e changes to get manyfmts nearer to working and fixed memory leak
reimar
parents: 12212
diff changeset
88 image_bytes = 1;
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
89 gl_format = GL_LUMINANCE;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
90 gl_type = GL_UNSIGNED_BYTE;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
91 break;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
92 #ifdef GL_VERSION_1_2
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
93 case IMGFMT_RGB8:
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
94 gl_format = GL_RGB;
13206
6e8d1ac141fc Using updated colorspace specifications from colorspaces.txt.
reimar
parents: 13188
diff changeset
95 gl_type = GL_UNSIGNED_BYTE_2_3_3_REV;
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
96 break;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
97 case IMGFMT_RGB15:
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
98 gl_format = GL_RGBA;
13206
6e8d1ac141fc Using updated colorspace specifications from colorspaces.txt.
reimar
parents: 13188
diff changeset
99 gl_type = GL_UNSIGNED_SHORT_1_5_5_5_REV;
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
100 break;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
101 case IMGFMT_RGB16:
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
102 gl_format = GL_RGB;
13206
6e8d1ac141fc Using updated colorspace specifications from colorspaces.txt.
reimar
parents: 13188
diff changeset
103 gl_type = GL_UNSIGNED_SHORT_5_6_5_REV;
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
104 break;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
105 case IMGFMT_BGR8:
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
106 // special case as red and blue have a differen number of bits.
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
107 // GL_BGR and GL_UNSIGNED_BYTE_3_3_2 isn't supported at least
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
108 // by nVidia drivers, and in addition would give more bits to
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
109 // blue than to red, which isn't wanted
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
110 gl_format = GL_RGB;
13206
6e8d1ac141fc Using updated colorspace specifications from colorspaces.txt.
reimar
parents: 13188
diff changeset
111 gl_type = GL_UNSIGNED_BYTE_3_3_2;
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
112 break;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
113 case IMGFMT_BGR15:
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
114 gl_format = GL_BGRA;
13206
6e8d1ac141fc Using updated colorspace specifications from colorspaces.txt.
reimar
parents: 13188
diff changeset
115 gl_type = GL_UNSIGNED_SHORT_1_5_5_5_REV;
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
116 break;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
117 case IMGFMT_BGR16:
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
118 gl_format = GL_RGB;
13206
6e8d1ac141fc Using updated colorspace specifications from colorspaces.txt.
reimar
parents: 13188
diff changeset
119 gl_type = GL_UNSIGNED_SHORT_5_6_5;
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
120 break;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
121 case IMGFMT_BGR24:
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
122 gl_format = GL_BGR;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
123 gl_type = GL_UNSIGNED_BYTE;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
124 break;
13206
6e8d1ac141fc Using updated colorspace specifications from colorspaces.txt.
reimar
parents: 13188
diff changeset
125 case IMGFMT_BGRA:
12445
d97398ed403e changes to get manyfmts nearer to working and fixed memory leak
reimar
parents: 12212
diff changeset
126 gl_texfmt = 4;
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
127 gl_format = GL_BGRA;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
128 gl_type = GL_UNSIGNED_BYTE;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
129 break;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
130 #endif
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
131 default:
12445
d97398ed403e changes to get manyfmts nearer to working and fixed memory leak
reimar
parents: 12212
diff changeset
132 gl_texfmt = 4;
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
133 gl_format = GL_RGBA;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
134 gl_type = GL_UNSIGNED_BYTE;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
135 return 0;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
136 }
12843
52d493f0ac79 changed misleading TEXTUREFORMAT_32BPP (was 24bpp!) to vo_gl2 style TEXTUREFORMAT_ALWAYS
reimar
parents: 12749
diff changeset
137 #ifdef TEXTUREFORMAT_ALWAYS
52d493f0ac79 changed misleading TEXTUREFORMAT_32BPP (was 24bpp!) to vo_gl2 style TEXTUREFORMAT_ALWAYS
reimar
parents: 12749
diff changeset
138 gl_texfmt = TEXTUREFORMAT_ALWAYS;
12445
d97398ed403e changes to get manyfmts nearer to working and fixed memory leak
reimar
parents: 12212
diff changeset
139 #endif
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
140 return 1;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
141 }
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
142
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143 /* connect to server, create and map window,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
144 * allocate colors and (shared) memory
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146 static uint32_t
7124
eca7dbad0166 finally removed query_vaa, bes_da and vo_tune_info - the obsoleted libvo api
alex
parents: 7111
diff changeset
147 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
148 {
12445
d97398ed403e changes to get manyfmts nearer to working and fixed memory leak
reimar
parents: 12212
diff changeset
149 unsigned char *ImageData=NULL;
2041
ba8a225d1a18 now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents: 2040
diff changeset
150 // int screen;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
151 unsigned int fg, bg;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152 XSizeHints hint;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 XVisualInfo *vinfo;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
154 XEvent xev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
155
1109
a013b2124f05 -Wall like fixes
al3x
parents: 614
diff changeset
156 // XGCValues xgcv;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
157
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
158 image_height = height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159 image_width = width;
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
160 find_gl_format (format);
10919
dbb3f474c9de fix fullscreen switching in vo gl and vo gl2
faust3
parents: 10757
diff changeset
161 vo_dwidth = d_width;
dbb3f474c9de fix fullscreen switching in vo gl and vo gl2
faust3
parents: 10757
diff changeset
162 vo_dheight = d_height;
10757
3aea64e0d6d9 Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents: 10138
diff changeset
163
3aea64e0d6d9 Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents: 10138
diff changeset
164 int_pause = 0;
3aea64e0d6d9 Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents: 10138
diff changeset
165
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
166 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
167 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
168 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
169
48f0ac1e9d13 Update to new (cleaner, more bugfree, better) aspect api. vo_gl vo_gl2 and vo_xmga are untested!
atmos4
parents: 2057
diff changeset
170 aspect(&d_width,&d_height,A_NOZOOM);
2040
bf7764f429c9 -fs fix
atmos4
parents: 1501
diff changeset
171 #ifdef X11_FULLSCREEN
6095
891cff8aba60 some cleanup, gl/gl2 updated to use vo_window
arpi
parents: 5651
diff changeset
172 // if( flags&0x01 ){ // (-fs)
891cff8aba60 some cleanup, gl/gl2 updated to use vo_window
arpi
parents: 5651
diff changeset
173 // aspect(&d_width,&d_height,A_ZOOM);
891cff8aba60 some cleanup, gl/gl2 updated to use vo_window
arpi
parents: 5651
diff changeset
174 // }
2040
bf7764f429c9 -fs fix
atmos4
parents: 1501
diff changeset
175 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176 hint.x = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177 hint.y = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178 hint.width = d_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179 hint.height = d_height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180 hint.flags = PPosition | PSize;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182 /* Get some colors */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183
2041
ba8a225d1a18 now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents: 2040
diff changeset
184 bg = WhitePixel(mDisplay, mScreen);
ba8a225d1a18 now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents: 2040
diff changeset
185 fg = BlackPixel(mDisplay, mScreen);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 /* Make the window */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188
2041
ba8a225d1a18 now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents: 2040
diff changeset
189 vinfo=glXChooseVisual( mDisplay,mScreen,wsGLXAttrib );
1290
af0b764f34c5 no segfault if no glx present
alex
parents: 1137
diff changeset
190 if (vinfo == NULL)
af0b764f34c5 no segfault if no glx present
alex
parents: 1137
diff changeset
191 {
11988
ccb15c72f331 printf -> mp_msg
attila
parents: 11542
diff changeset
192 mp_msg(MSGT_VO, MSGL_ERR, "[gl] no GLX support present\n");
1290
af0b764f34c5 no segfault if no glx present
alex
parents: 1137
diff changeset
193 return -1;
af0b764f34c5 no segfault if no glx present
alex
parents: 1137
diff changeset
194 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195
10757
3aea64e0d6d9 Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents: 10138
diff changeset
196
1137
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 1109
diff changeset
197
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
198 if ( vo_window == None )
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
199 {
10757
3aea64e0d6d9 Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents: 10138
diff changeset
200 vo_window = vo_x11_create_smooth_window(mDisplay, mRootWin, vinfo->visual, hint.x, hint.y, hint.width, hint.height,
3aea64e0d6d9 Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents: 10138
diff changeset
201 vinfo->depth, XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocNone));
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
203 vo_x11_classhint( mDisplay,vo_window,"gl" );
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
204 vo_hidecursor(mDisplay,vo_window);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
206 // if ( flags&0x01 ) vo_x11_decoration( mDisplay,vo_window,0 );
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
207 XSelectInput(mDisplay, vo_window, StructureNotifyMask);
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
208 /* Tell other applications about this window */
10138
5e286cc6ad21 Removed YUV (YV12) and BGR support, leaving the native RGB support. Also cleaned some other parts.
alex
parents: 8654
diff changeset
209 XSetStandardProperties(mDisplay, vo_window, title, title, None, NULL, 0, &hint);
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
210 /* Map window. */
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
211 XMapWindow(mDisplay, vo_window);
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
212 if ( flags&1 ) vo_x11_fullscreen();
4017
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 2732
diff changeset
213 #ifdef HAVE_XINERAMA
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
214 vo_x11_xinerama_move(mDisplay,vo_window);
4017
21a75ab24703 Xinerama patch number two by attila.
atmos4
parents: 2732
diff changeset
215 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
217 /* Wait for map. */
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
218 do
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
219 {
2041
ba8a225d1a18 now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents: 2040
diff changeset
220 XNextEvent(mDisplay, &xev);
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
221 }
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
222 while (xev.type != MapNotify || xev.xmap.event != vo_window);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
224 XSelectInput(mDisplay, vo_window, NoEventMask);
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
225 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
226
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
227 if ( vo_config_count ) glXDestroyContext( mDisplay,wsGLXContext );
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
228 wsGLXContext=glXCreateContext( mDisplay,vinfo,NULL,True );
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
229 glXMakeCurrent( mDisplay,vo_window,wsGLXContext );
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
230
2041
ba8a225d1a18 now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents: 2040
diff changeset
231 XSync(mDisplay, False);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
232
6953
ce67cc1f0beb ignore BadAccess error at XSelectInput() (grabbing mouse etc) with warning
arpi
parents: 6212
diff changeset
233 vo_x11_selectinput_witherr(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PointerMotionMask
10757
3aea64e0d6d9 Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents: 10138
diff changeset
234 | ButtonPressMask | ButtonReleaseMask | ExposureMask
4658
93d562ad1c22 Added new input mouse support in x11 vo
albeu
parents: 4596
diff changeset
235 );
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
236
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237 texture_width=32;
10138
5e286cc6ad21 Removed YUV (YV12) and BGR support, leaving the native RGB support. Also cleaned some other parts.
alex
parents: 8654
diff changeset
238 while(texture_width<image_width || texture_width<image_height) texture_width*=2;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
239 texture_height=texture_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
240
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241 ImageData=malloc(texture_width*texture_height*image_bytes);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
242 memset(ImageData,128,texture_width*texture_height*image_bytes);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
243
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
244 glDisable(GL_BLEND);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
245 glDisable(GL_DEPTH_TEST);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
246 glDepthMask(GL_FALSE);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
247 glDisable(GL_CULL_FACE);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
248
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
249 glEnable(GL_TEXTURE_2D);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
250
11988
ccb15c72f331 printf -> mp_msg
attila
parents: 11542
diff changeset
251 mp_msg(MSGT_VO, MSGL_V, "[gl] Creating %dx%d texture...\n",texture_width,texture_height);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
252
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
253 #if 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
254 // glBindTexture(GL_TEXTURE_2D, texture_id);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
255 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
256 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR);
12445
d97398ed403e changes to get manyfmts nearer to working and fixed memory leak
reimar
parents: 12212
diff changeset
257 glTexImage2D(GL_TEXTURE_2D, 0, gl_texfmt, texture_width, texture_height, 0,
d97398ed403e changes to get manyfmts nearer to working and fixed memory leak
reimar
parents: 12212
diff changeset
258 gl_format, gl_type, ImageData);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
259 #endif
12445
d97398ed403e changes to get manyfmts nearer to working and fixed memory leak
reimar
parents: 12212
diff changeset
260
d97398ed403e changes to get manyfmts nearer to working and fixed memory leak
reimar
parents: 12212
diff changeset
261 free (ImageData);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
262
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
263 resize(d_width,d_height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
264
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
265 glClearColor( 1.0f,0.0f,1.0f,0.0f );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
266 glClear( GL_COLOR_BUFFER_BIT );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
267
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
268 // printf("OpenGL setup OK!\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
269
11542
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 10919
diff changeset
270 if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 10919
diff changeset
271
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
272 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
273 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
274
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
275 static void check_events(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
276 {
2041
ba8a225d1a18 now using x11_common stuff for X11 opening and w/h/bpp query
arpi
parents: 2040
diff changeset
277 int e=vo_x11_check_events(mDisplay);
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
278 if(e&VO_EVENT_RESIZE) resize(vo_dwidth,vo_dheight);
10757
3aea64e0d6d9 Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents: 10138
diff changeset
279 if(e&VO_EVENT_EXPOSE && int_pause) flip_page();
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
280 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
281
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1302
diff changeset
282 static void draw_osd(void)
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1302
diff changeset
283 {
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1302
diff changeset
284 }
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
285
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
286 static void
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
287 flip_page(void)
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
288 {
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
289
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
290 // glEnable(GL_TEXTURE_2D);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
291 // glBindTexture(GL_TEXTURE_2D, texture_id);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
292
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
293 glColor3f(1,1,1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
294 glBegin(GL_QUADS);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
295 glTexCoord2f(0,0);glVertex2i(0,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
296 glTexCoord2f(0,1);glVertex2i(0,texture_height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
297 glTexCoord2f(1,1);glVertex2i(texture_width,texture_height);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
298 glTexCoord2f(1,0);glVertex2i(texture_width,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
299 glEnd();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
300
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
301 // glFlush();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
302 glFinish();
6095
891cff8aba60 some cleanup, gl/gl2 updated to use vo_window
arpi
parents: 5651
diff changeset
303 glXSwapBuffers( mDisplay,vo_window );
891cff8aba60 some cleanup, gl/gl2 updated to use vo_window
arpi
parents: 5651
diff changeset
304
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
305 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
306
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
307 //static inline uint32_t draw_slice_x11(uint8_t *src[], uint32_t slice_num)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
308 static uint32_t draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
309 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
310 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
311 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
312
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
313
10138
5e286cc6ad21 Removed YUV (YV12) and BGR support, leaving the native RGB support. Also cleaned some other parts.
alex
parents: 8654
diff changeset
314 static uint32_t
5e286cc6ad21 Removed YUV (YV12) and BGR support, leaving the native RGB support. Also cleaned some other parts.
alex
parents: 8654
diff changeset
315 draw_frame(uint8_t *src[])
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
316 {
13237
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
317 unsigned int i;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
318 uint8_t *ImageData=src[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
319
12212
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
320 if (slice_height == 0)
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
321 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, image_width, image_height,
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
322 gl_format, gl_type, ImageData);
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
323 else
8654
2c4cebb8637d - optional slice height for -vo gl (example: -vo gl:32)
arpi
parents: 8148
diff changeset
324 for(i=0;i<image_height;i+=slice_height){
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
325 glTexSubImage2D( GL_TEXTURE_2D, // target
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
326 0, // level
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
327 0, // x offset
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
328 // image_height-1-i, // y offset
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
329 i, // y offset
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
330 image_width, // width
8654
2c4cebb8637d - optional slice height for -vo gl (example: -vo gl:32)
arpi
parents: 8148
diff changeset
331 (i+slice_height<=image_height)?slice_height:image_height-i, // height
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
332 gl_format,
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
333 gl_type,
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
334 ImageData+i*image_bytes*image_width ); // *pixels
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
335 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
336
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
337 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
338 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
339
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
340 static uint32_t
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
341 query_format(uint32_t format)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
342 {
13206
6e8d1ac141fc Using updated colorspace specifications from colorspaces.txt.
reimar
parents: 13188
diff changeset
343 if ((format == IMGFMT_RGB24) || (format == IMGFMT_RGBA))
6212
2001affedb75 query_format revised
alex
parents: 6095
diff changeset
344 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
345 if (many_fmts && find_gl_format(format))
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
346 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
347 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
348 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
349
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
350
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
351 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
352 uninit(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
353 {
6095
891cff8aba60 some cleanup, gl/gl2 updated to use vo_window
arpi
parents: 5651
diff changeset
354 if ( !vo_config_count ) return;
891cff8aba60 some cleanup, gl/gl2 updated to use vo_window
arpi
parents: 5651
diff changeset
355 vo_x11_uninit();
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
356 }
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4017
diff changeset
357
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4017
diff changeset
358 static uint32_t preinit(const char *arg)
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4017
diff changeset
359 {
12212
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
360 int parse_err = 0;
13237
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
361 unsigned int parse_pos = 0;
12159
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
362 many_fmts = 0;
9d96071652c4 vo_gl supporting more color formats for testing
reimar
parents: 11988
diff changeset
363 slice_height = 4;
4737
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4658
diff changeset
364 if(arg)
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4658
diff changeset
365 {
13237
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
366 while (arg[parse_pos] && !parse_err) {
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
367 if (strncmp (&arg[parse_pos], "manyfmts", 8) == 0) {
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
368 parse_pos += 8;
12212
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
369 many_fmts = 1;
13237
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
370 } else if (strncmp (&arg[parse_pos], "nomanyfmts", 10) == 0) {
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
371 parse_pos += 10;
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
372 many_fmts = 0;
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
373 } else if (strncmp (&arg[parse_pos], "slice-height=", 13) == 0) {
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
374 int val;
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
375 char *end;
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
376 parse_pos += 13;
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
377 val = strtol(&arg[parse_pos], &end, 0);
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
378 if (val < 0) parse_err = 1;
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
379 else {
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
380 slice_height = val;
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
381 parse_pos = end - arg;
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
382 }
12212
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
383 }
13237
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
384 if (arg[parse_pos] == ':') parse_pos++;
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
385 else if (arg[parse_pos]) parse_err = 1;
12212
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
386 }
8654
2c4cebb8637d - optional slice height for -vo gl (example: -vo gl:32)
arpi
parents: 8148
diff changeset
387 }
12212
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
388 if (parse_err) {
13237
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
389 unsigned int i;
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
390 mp_msg(MSGT_VO, MSGL_FATAL, "Could not parse arguments:\n%s\n", arg);
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
391 for (i = 0; i < parse_pos; i++)
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
392 mp_msg(MSGT_VO, MSGL_FATAL, " ");
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
393 mp_msg(MSGT_VO, MSGL_FATAL, "^\n");
f85c105bfeaa improved suboption parsing, fixes also compiler warnings
reimar
parents: 13206
diff changeset
394 mp_msg(MSGT_VO, MSGL_FATAL,
12212
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
395 "\n-vo gl command line help:\n"
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
396 "Example: mplayer -vo gl:slice-height=4\n"
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
397 "\nOptions:\n"
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
398 " manyfmts\n"
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
399 " Enable extended color formats for OpenGL 1.2 and later\n"
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
400 " slice-height=<0-...>\n"
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
401 " Slice size for texture transfer, 0 for whole image\n"
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
402 "\n" );
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
403 return -1;
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
404 }
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
405 if (many_fmts)
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
406 mp_msg (MSGT_VO, MSGL_WARN, "[gl] using extended formats.\n"
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
407 "Make sure you have OpenGL >= 1.2 and used corresponding "
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
408 "headers for compiling!\n");
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
409 mp_msg (MSGT_VO, MSGL_INFO, "[gl] Using %d as slice height "
2e8b305586a0 fixed suboption parsing, added help for suboptions
reimar
parents: 12159
diff changeset
410 "(0 means image height).\n", slice_height);
7931
48c71b6c7389 vo_init() moved to/fixed in preinit()
arpi
parents: 7777
diff changeset
411 if( !vo_init() ) return -1; // Can't open X11
7777
ed7b05575aab -fixed-vo support
pontscho
parents: 7124
diff changeset
412
4737
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4658
diff changeset
413 return 0;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4017
diff changeset
414 }
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4017
diff changeset
415
4596
c35d7ce151b3 10000hl to Holm... control MUST BE static...
arpi
parents: 4592
diff changeset
416 static uint32_t control(uint32_t request, void *data, ...)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4017
diff changeset
417 {
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4448
diff changeset
418 switch (request) {
10757
3aea64e0d6d9 Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents: 10138
diff changeset
419 case VOCTRL_PAUSE: return (int_pause=1);
3aea64e0d6d9 Avoid flickering during resizes. Keep video contents even when paused. Fix by Tomas Simonaitis <haden@homelan.lt>
mosu
parents: 10138
diff changeset
420 case VOCTRL_RESUME: return (int_pause=0);
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4448
diff changeset
421 case VOCTRL_QUERY_FORMAT:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4448
diff changeset
422 return query_format(*((uint32_t*)data));
11542
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 10919
diff changeset
423 case VOCTRL_ONTOP:
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 10919
diff changeset
424 vo_x11_ontop();
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 10919
diff changeset
425 return VO_TRUE;
6095
891cff8aba60 some cleanup, gl/gl2 updated to use vo_window
arpi
parents: 5651
diff changeset
426 case VOCTRL_FULLSCREEN:
891cff8aba60 some cleanup, gl/gl2 updated to use vo_window
arpi
parents: 5651
diff changeset
427 vo_x11_fullscreen();
891cff8aba60 some cleanup, gl/gl2 updated to use vo_window
arpi
parents: 5651
diff changeset
428 return VO_TRUE;
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4448
diff changeset
429 }
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4448
diff changeset
430 return VO_NOTIMPL;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 4017
diff changeset
431 }