Mercurial > sdl-ios-xcode
comparison src/video/Xext/Xv/Xv.c @ 1668:4da1ee79c9af SDL-1.3
more tweaking indent options
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 29 May 2006 04:04:35 +0000 |
parents | 782fd950bd46 |
children |
comparison
equal
deleted
inserted
replaced
1667:1fddae038bc8 | 1668:4da1ee79c9af |
---|---|
61 static char *xv_extension_name = XvName; | 61 static char *xv_extension_name = XvName; |
62 | 62 |
63 #define XvCheckExtension(dpy, i, val) \ | 63 #define XvCheckExtension(dpy, i, val) \ |
64 XextCheckExtension(dpy, i, xv_extension_name, val) | 64 XextCheckExtension(dpy, i, xv_extension_name, val) |
65 | 65 |
66 static char *xv_error_string (); | 66 static char *xv_error_string(); |
67 static int xv_close_display (); | 67 static int xv_close_display(); |
68 static Bool xv_wire_to_event (); | 68 static Bool xv_wire_to_event(); |
69 | 69 |
70 static XExtensionHooks xv_extension_hooks = { | 70 static XExtensionHooks xv_extension_hooks = { |
71 NULL, /* create_gc */ | 71 NULL, /* create_gc */ |
72 NULL, /* copy_gc */ | 72 NULL, /* copy_gc */ |
73 NULL, /* flush_gc */ | 73 NULL, /* flush_gc */ |
87 "BadEncoding", /* XvBadEncoding */ | 87 "BadEncoding", /* XvBadEncoding */ |
88 "BadControl" /* XvBadControl */ | 88 "BadControl" /* XvBadControl */ |
89 }; | 89 }; |
90 | 90 |
91 static | 91 static |
92 XEXT_GENERATE_CLOSE_DISPLAY (xv_close_display, xv_info) | 92 XEXT_GENERATE_CLOSE_DISPLAY(xv_close_display, xv_info) |
93 static XEXT_GENERATE_FIND_DISPLAY (xv_find_display, xv_info, | 93 static XEXT_GENERATE_FIND_DISPLAY(xv_find_display, xv_info, |
94 xv_extension_name, | 94 xv_extension_name, |
95 &xv_extension_hooks, | 95 &xv_extension_hooks, XvNumEvents, NULL) |
96 XvNumEvents, NULL) | 96 static XEXT_GENERATE_ERROR_STRING(xv_error_string, xv_extension_name, |
97 static XEXT_GENERATE_ERROR_STRING (xv_error_string, xv_extension_name, | 97 XvNumErrors, xv_error_list) |
98 XvNumErrors, xv_error_list) | 98 int SDL_NAME(XvQueryExtension) (Display * dpy, |
99 int SDL_NAME (XvQueryExtension) (Display * dpy, | 99 unsigned int *p_version, |
100 unsigned int *p_version, | 100 unsigned int *p_revision, |
101 unsigned int *p_revision, | 101 unsigned int *p_requestBase, |
102 unsigned int *p_requestBase, | 102 unsigned int *p_eventBase, |
103 unsigned int *p_eventBase, | 103 unsigned int *p_errorBase) |
104 unsigned int *p_errorBase) | 104 { |
105 { | 105 XExtDisplayInfo *info = xv_find_display(dpy); |
106 XExtDisplayInfo *info = xv_find_display (dpy); | |
107 xvQueryExtensionReq *req; | 106 xvQueryExtensionReq *req; |
108 xvQueryExtensionReply rep; | 107 xvQueryExtensionReply rep; |
109 | 108 |
110 XvCheckExtension (dpy, info, XvBadExtension); | 109 XvCheckExtension(dpy, info, XvBadExtension); |
111 | 110 |
112 LockDisplay (dpy); | 111 LockDisplay(dpy); |
113 | 112 |
114 XvGetReq (QueryExtension, req); | 113 XvGetReq(QueryExtension, req); |
115 | 114 |
116 if (!_XReply (dpy, (xReply *) & rep, 0, xFalse)) { | 115 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { |
117 UnlockDisplay (dpy); | 116 UnlockDisplay(dpy); |
118 SyncHandle (); | 117 SyncHandle(); |
119 return XvBadExtension; | 118 return XvBadExtension; |
120 } | 119 } |
121 | 120 |
122 *p_version = rep.version; | 121 *p_version = rep.version; |
123 *p_revision = rep.revision; | 122 *p_revision = rep.revision; |
124 *p_requestBase = info->codes->major_opcode; | 123 *p_requestBase = info->codes->major_opcode; |
125 *p_eventBase = info->codes->first_event; | 124 *p_eventBase = info->codes->first_event; |
126 *p_errorBase = info->codes->first_error; | 125 *p_errorBase = info->codes->first_error; |
127 | 126 |
128 UnlockDisplay (dpy); | 127 UnlockDisplay(dpy); |
129 SyncHandle (); | 128 SyncHandle(); |
130 | 129 |
131 return Success; | 130 return Success; |
132 } | 131 } |
133 | 132 |
134 int | 133 int |
135 SDL_NAME (XvQueryAdaptors) (Display * dpy, | 134 SDL_NAME(XvQueryAdaptors) (Display * dpy, |
136 Window window, | 135 Window window, |
137 unsigned int *p_nAdaptors, | 136 unsigned int *p_nAdaptors, |
138 SDL_NAME (XvAdaptorInfo) ** p_pAdaptors) | 137 SDL_NAME(XvAdaptorInfo) ** p_pAdaptors) |
139 { | 138 { |
140 XExtDisplayInfo *info = xv_find_display (dpy); | 139 XExtDisplayInfo *info = xv_find_display(dpy); |
141 xvQueryAdaptorsReq *req; | 140 xvQueryAdaptorsReq *req; |
142 xvQueryAdaptorsReply rep; | 141 xvQueryAdaptorsReply rep; |
143 int size, ii, jj; | 142 int size, ii, jj; |
144 char *name; | 143 char *name; |
145 SDL_NAME (XvAdaptorInfo) * pas, *pa; | 144 SDL_NAME(XvAdaptorInfo) * pas, *pa; |
146 SDL_NAME (XvFormat) * pfs, *pf; | 145 SDL_NAME(XvFormat) * pfs, *pf; |
147 char *buffer; | 146 char *buffer; |
148 union | 147 union |
149 { | 148 { |
150 char *buffer; | 149 char *buffer; |
151 char *string; | 150 char *string; |
152 xvAdaptorInfo *pa; | 151 xvAdaptorInfo *pa; |
153 xvFormat *pf; | 152 xvFormat *pf; |
154 } u; | 153 } u; |
155 | 154 |
156 XvCheckExtension (dpy, info, XvBadExtension); | 155 XvCheckExtension(dpy, info, XvBadExtension); |
157 | 156 |
158 LockDisplay (dpy); | 157 LockDisplay(dpy); |
159 | 158 |
160 XvGetReq (QueryAdaptors, req); | 159 XvGetReq(QueryAdaptors, req); |
161 req->window = window; | 160 req->window = window; |
162 | 161 |
163 /* READ THE REPLY */ | 162 /* READ THE REPLY */ |
164 | 163 |
165 if (_XReply (dpy, (xReply *) & rep, 0, xFalse) == 0) { | 164 if (_XReply(dpy, (xReply *) & rep, 0, xFalse) == 0) { |
166 UnlockDisplay (dpy); | 165 UnlockDisplay(dpy); |
167 SyncHandle (); | 166 SyncHandle(); |
168 return (XvBadReply); | 167 return (XvBadReply); |
169 } | 168 } |
170 | 169 |
171 size = rep.length << 2; | 170 size = rep.length << 2; |
172 if ((buffer = (char *) Xmalloc ((unsigned) size)) == NULL) { | 171 if ((buffer = (char *) Xmalloc((unsigned) size)) == NULL) { |
173 UnlockDisplay (dpy); | 172 UnlockDisplay(dpy); |
174 SyncHandle (); | 173 SyncHandle(); |
175 return (XvBadAlloc); | 174 return (XvBadAlloc); |
176 } | 175 } |
177 _XRead (dpy, buffer, size); | 176 _XRead(dpy, buffer, size); |
178 | 177 |
179 u.buffer = buffer; | 178 u.buffer = buffer; |
180 | 179 |
181 /* GET INPUT ADAPTORS */ | 180 /* GET INPUT ADAPTORS */ |
182 | 181 |
183 if (rep.num_adaptors == 0) { | 182 if (rep.num_adaptors == 0) { |
184 pas = NULL; | 183 pas = NULL; |
185 } else { | 184 } else { |
186 size = rep.num_adaptors * sizeof (SDL_NAME (XvAdaptorInfo)); | 185 size = rep.num_adaptors * sizeof(SDL_NAME(XvAdaptorInfo)); |
187 if ((pas = (SDL_NAME (XvAdaptorInfo) *) Xmalloc (size)) == NULL) { | 186 if ((pas = (SDL_NAME(XvAdaptorInfo) *) Xmalloc(size)) == NULL) { |
188 Xfree (buffer); | 187 Xfree(buffer); |
189 UnlockDisplay (dpy); | 188 UnlockDisplay(dpy); |
190 SyncHandle (); | 189 SyncHandle(); |
191 return (XvBadAlloc); | 190 return (XvBadAlloc); |
192 } | 191 } |
193 } | 192 } |
194 | 193 |
195 /* INIT ADAPTOR FIELDS */ | 194 /* INIT ADAPTOR FIELDS */ |
196 | 195 |
197 pa = pas; | 196 pa = pas; |
198 for (ii = 0; ii < rep.num_adaptors; ii++) { | 197 for (ii = 0; ii < rep.num_adaptors; ii++) { |
199 pa->num_adaptors = 0; | 198 pa->num_adaptors = 0; |
200 pa->name = (char *) NULL; | 199 pa->name = (char *) NULL; |
201 pa->formats = (SDL_NAME (XvFormat) *) NULL; | 200 pa->formats = (SDL_NAME(XvFormat) *) NULL; |
202 pa++; | 201 pa++; |
203 } | 202 } |
204 | 203 |
205 pa = pas; | 204 pa = pas; |
206 for (ii = 0; ii < rep.num_adaptors; ii++) { | 205 for (ii = 0; ii < rep.num_adaptors; ii++) { |
213 /* GET ADAPTOR NAME */ | 212 /* GET ADAPTOR NAME */ |
214 | 213 |
215 size = u.pa->name_size; | 214 size = u.pa->name_size; |
216 u.buffer += (sz_xvAdaptorInfo + 3) & ~3; | 215 u.buffer += (sz_xvAdaptorInfo + 3) & ~3; |
217 | 216 |
218 if ((name = (char *) Xmalloc (size + 1)) == NULL) { | 217 if ((name = (char *) Xmalloc(size + 1)) == NULL) { |
219 SDL_NAME (XvFreeAdaptorInfo) (pas); | 218 SDL_NAME(XvFreeAdaptorInfo) (pas); |
220 Xfree (buffer); | 219 Xfree(buffer); |
221 UnlockDisplay (dpy); | 220 UnlockDisplay(dpy); |
222 SyncHandle (); | 221 SyncHandle(); |
223 return (XvBadAlloc); | 222 return (XvBadAlloc); |
224 } | 223 } |
225 SDL_strlcpy (name, u.string, size); | 224 SDL_strlcpy(name, u.string, size); |
226 pa->name = name; | 225 pa->name = name; |
227 | 226 |
228 u.buffer += (size + 3) & ~3; | 227 u.buffer += (size + 3) & ~3; |
229 | 228 |
230 /* GET FORMATS */ | 229 /* GET FORMATS */ |
231 | 230 |
232 size = pa->num_formats * sizeof (SDL_NAME (XvFormat)); | 231 size = pa->num_formats * sizeof(SDL_NAME(XvFormat)); |
233 if ((pfs = (SDL_NAME (XvFormat) *) Xmalloc (size)) == NULL) { | 232 if ((pfs = (SDL_NAME(XvFormat) *) Xmalloc(size)) == NULL) { |
234 SDL_NAME (XvFreeAdaptorInfo) (pas); | 233 SDL_NAME(XvFreeAdaptorInfo) (pas); |
235 Xfree (buffer); | 234 Xfree(buffer); |
236 UnlockDisplay (dpy); | 235 UnlockDisplay(dpy); |
237 SyncHandle (); | 236 SyncHandle(); |
238 return (XvBadAlloc); | 237 return (XvBadAlloc); |
239 } | 238 } |
240 | 239 |
241 pf = pfs; | 240 pf = pfs; |
242 for (jj = 0; jj < pa->num_formats; jj++) { | 241 for (jj = 0; jj < pa->num_formats; jj++) { |
254 } | 253 } |
255 | 254 |
256 *p_nAdaptors = rep.num_adaptors; | 255 *p_nAdaptors = rep.num_adaptors; |
257 *p_pAdaptors = pas; | 256 *p_pAdaptors = pas; |
258 | 257 |
259 Xfree (buffer); | 258 Xfree(buffer); |
260 UnlockDisplay (dpy); | 259 UnlockDisplay(dpy); |
261 SyncHandle (); | 260 SyncHandle(); |
262 | 261 |
263 return (Success); | 262 return (Success); |
264 } | 263 } |
265 | 264 |
266 | 265 |
267 void SDL_NAME (XvFreeAdaptorInfo) (SDL_NAME (XvAdaptorInfo) * pAdaptors) | 266 void SDL_NAME(XvFreeAdaptorInfo) (SDL_NAME(XvAdaptorInfo) * pAdaptors) |
268 { | 267 { |
269 | 268 |
270 SDL_NAME (XvAdaptorInfo) * pa; | 269 SDL_NAME(XvAdaptorInfo) * pa; |
271 int ii; | 270 int ii; |
272 | 271 |
273 if (!pAdaptors) | 272 if (!pAdaptors) |
274 return; | 273 return; |
275 | 274 |
276 pa = pAdaptors; | 275 pa = pAdaptors; |
277 | 276 |
278 for (ii = 0; ii < pAdaptors->num_adaptors; ii++, pa++) { | 277 for (ii = 0; ii < pAdaptors->num_adaptors; ii++, pa++) { |
279 if (pa->name) { | 278 if (pa->name) { |
280 Xfree (pa->name); | 279 Xfree(pa->name); |
281 } | 280 } |
282 if (pa->formats) { | 281 if (pa->formats) { |
283 Xfree (pa->formats); | 282 Xfree(pa->formats); |
284 } | 283 } |
285 } | 284 } |
286 | 285 |
287 Xfree (pAdaptors); | 286 Xfree(pAdaptors); |
288 } | 287 } |
289 | 288 |
290 int | 289 int |
291 SDL_NAME (XvQueryEncodings) (Display * dpy, | 290 SDL_NAME(XvQueryEncodings) (Display * dpy, |
292 XvPortID port, | 291 XvPortID port, |
293 unsigned int *p_nEncodings, | 292 unsigned int *p_nEncodings, |
294 SDL_NAME (XvEncodingInfo) ** p_pEncodings) | 293 SDL_NAME(XvEncodingInfo) ** p_pEncodings) |
295 { | 294 { |
296 XExtDisplayInfo *info = xv_find_display (dpy); | 295 XExtDisplayInfo *info = xv_find_display(dpy); |
297 xvQueryEncodingsReq *req; | 296 xvQueryEncodingsReq *req; |
298 xvQueryEncodingsReply rep; | 297 xvQueryEncodingsReply rep; |
299 int size, jj; | 298 int size, jj; |
300 char *name; | 299 char *name; |
301 SDL_NAME (XvEncodingInfo) * pes, *pe; | 300 SDL_NAME(XvEncodingInfo) * pes, *pe; |
302 char *buffer; | 301 char *buffer; |
303 union | 302 union |
304 { | 303 { |
305 char *buffer; | 304 char *buffer; |
306 char *string; | 305 char *string; |
307 xvEncodingInfo *pe; | 306 xvEncodingInfo *pe; |
308 } u; | 307 } u; |
309 | 308 |
310 XvCheckExtension (dpy, info, XvBadExtension); | 309 XvCheckExtension(dpy, info, XvBadExtension); |
311 | 310 |
312 LockDisplay (dpy); | 311 LockDisplay(dpy); |
313 | 312 |
314 XvGetReq (QueryEncodings, req); | 313 XvGetReq(QueryEncodings, req); |
315 req->port = port; | 314 req->port = port; |
316 | 315 |
317 /* READ THE REPLY */ | 316 /* READ THE REPLY */ |
318 | 317 |
319 if (_XReply (dpy, (xReply *) & rep, 0, xFalse) == 0) { | 318 if (_XReply(dpy, (xReply *) & rep, 0, xFalse) == 0) { |
320 UnlockDisplay (dpy); | 319 UnlockDisplay(dpy); |
321 SyncHandle (); | 320 SyncHandle(); |
322 return (XvBadReply); | 321 return (XvBadReply); |
323 } | 322 } |
324 | 323 |
325 size = rep.length << 2; | 324 size = rep.length << 2; |
326 if ((buffer = (char *) Xmalloc ((unsigned) size)) == NULL) { | 325 if ((buffer = (char *) Xmalloc((unsigned) size)) == NULL) { |
327 UnlockDisplay (dpy); | 326 UnlockDisplay(dpy); |
328 SyncHandle (); | 327 SyncHandle(); |
329 return (XvBadAlloc); | 328 return (XvBadAlloc); |
330 } | 329 } |
331 _XRead (dpy, buffer, size); | 330 _XRead(dpy, buffer, size); |
332 | 331 |
333 u.buffer = buffer; | 332 u.buffer = buffer; |
334 | 333 |
335 /* GET ENCODINGS */ | 334 /* GET ENCODINGS */ |
336 | 335 |
337 size = rep.num_encodings * sizeof (SDL_NAME (XvEncodingInfo)); | 336 size = rep.num_encodings * sizeof(SDL_NAME(XvEncodingInfo)); |
338 if ((pes = (SDL_NAME (XvEncodingInfo) *) Xmalloc (size)) == NULL) { | 337 if ((pes = (SDL_NAME(XvEncodingInfo) *) Xmalloc(size)) == NULL) { |
339 Xfree (buffer); | 338 Xfree(buffer); |
340 UnlockDisplay (dpy); | 339 UnlockDisplay(dpy); |
341 SyncHandle (); | 340 SyncHandle(); |
342 return (XvBadAlloc); | 341 return (XvBadAlloc); |
343 } | 342 } |
344 | 343 |
345 /* INITIALIZE THE ENCODING POINTER */ | 344 /* INITIALIZE THE ENCODING POINTER */ |
346 | 345 |
361 pe->num_encodings = rep.num_encodings - jj; | 360 pe->num_encodings = rep.num_encodings - jj; |
362 | 361 |
363 size = u.pe->name_size; | 362 size = u.pe->name_size; |
364 u.buffer += (sz_xvEncodingInfo + 3) & ~3; | 363 u.buffer += (sz_xvEncodingInfo + 3) & ~3; |
365 | 364 |
366 if ((name = (char *) Xmalloc (size + 1)) == NULL) { | 365 if ((name = (char *) Xmalloc(size + 1)) == NULL) { |
367 Xfree (buffer); | 366 Xfree(buffer); |
368 UnlockDisplay (dpy); | 367 UnlockDisplay(dpy); |
369 SyncHandle (); | 368 SyncHandle(); |
370 return (XvBadAlloc); | 369 return (XvBadAlloc); |
371 } | 370 } |
372 SDL_strlcpy (name, u.string, size); | 371 SDL_strlcpy(name, u.string, size); |
373 pe->name = name; | 372 pe->name = name; |
374 pe++; | 373 pe++; |
375 | 374 |
376 u.buffer += (size + 3) & ~3; | 375 u.buffer += (size + 3) & ~3; |
377 } | 376 } |
378 | 377 |
379 *p_nEncodings = rep.num_encodings; | 378 *p_nEncodings = rep.num_encodings; |
380 *p_pEncodings = pes; | 379 *p_pEncodings = pes; |
381 | 380 |
382 Xfree (buffer); | 381 Xfree(buffer); |
383 UnlockDisplay (dpy); | 382 UnlockDisplay(dpy); |
384 SyncHandle (); | 383 SyncHandle(); |
385 | 384 |
386 return (Success); | 385 return (Success); |
387 } | 386 } |
388 | 387 |
389 void SDL_NAME (XvFreeEncodingInfo) (SDL_NAME (XvEncodingInfo) * pEncodings) | 388 void SDL_NAME(XvFreeEncodingInfo) (SDL_NAME(XvEncodingInfo) * pEncodings) |
390 { | 389 { |
391 | 390 |
392 SDL_NAME (XvEncodingInfo) * pe; | 391 SDL_NAME(XvEncodingInfo) * pe; |
393 int ii; | 392 int ii; |
394 | 393 |
395 if (!pEncodings) | 394 if (!pEncodings) |
396 return; | 395 return; |
397 | 396 |
398 pe = pEncodings; | 397 pe = pEncodings; |
399 | 398 |
400 for (ii = 0; ii < pEncodings->num_encodings; ii++, pe++) { | 399 for (ii = 0; ii < pEncodings->num_encodings; ii++, pe++) { |
401 if (pe->name) | 400 if (pe->name) |
402 Xfree (pe->name); | 401 Xfree(pe->name); |
403 } | 402 } |
404 | 403 |
405 Xfree (pEncodings); | 404 Xfree(pEncodings); |
406 } | 405 } |
407 | 406 |
408 int | 407 int |
409 SDL_NAME (XvPutVideo) (Display * dpy, | 408 SDL_NAME(XvPutVideo) (Display * dpy, |
410 XvPortID port, | 409 XvPortID port, |
411 Drawable d, | 410 Drawable d, |
412 GC gc, | 411 GC gc, |
413 int vx, int vy, | 412 int vx, int vy, |
414 unsigned int vw, unsigned int vh, | 413 unsigned int vw, unsigned int vh, |
415 int dx, int dy, unsigned int dw, unsigned int dh) | 414 int dx, int dy, unsigned int dw, unsigned int dh) |
416 { | 415 { |
417 XExtDisplayInfo *info = xv_find_display (dpy); | 416 XExtDisplayInfo *info = xv_find_display(dpy); |
418 xvPutVideoReq *req; | 417 xvPutVideoReq *req; |
419 | 418 |
420 XvCheckExtension (dpy, info, XvBadExtension); | 419 XvCheckExtension(dpy, info, XvBadExtension); |
421 | 420 |
422 LockDisplay (dpy); | 421 LockDisplay(dpy); |
423 | 422 |
424 FlushGC (dpy, gc); | 423 FlushGC(dpy, gc); |
425 | 424 |
426 XvGetReq (PutVideo, req); | 425 XvGetReq(PutVideo, req); |
427 | 426 |
428 req->port = port; | 427 req->port = port; |
429 req->drawable = d; | 428 req->drawable = d; |
430 req->gc = gc->gid; | 429 req->gc = gc->gid; |
431 req->vid_x = vx; | 430 req->vid_x = vx; |
435 req->drw_x = dx; | 434 req->drw_x = dx; |
436 req->drw_y = dy; | 435 req->drw_y = dy; |
437 req->drw_w = dw; | 436 req->drw_w = dw; |
438 req->drw_h = dh; | 437 req->drw_h = dh; |
439 | 438 |
440 UnlockDisplay (dpy); | 439 UnlockDisplay(dpy); |
441 SyncHandle (); | 440 SyncHandle(); |
442 | 441 |
443 return Success; | 442 return Success; |
444 } | 443 } |
445 | 444 |
446 int | 445 int |
447 SDL_NAME (XvPutStill) (Display * dpy, | 446 SDL_NAME(XvPutStill) (Display * dpy, |
448 XvPortID port, | 447 XvPortID port, |
449 Drawable d, | 448 Drawable d, |
450 GC gc, | 449 GC gc, |
451 int vx, int vy, | 450 int vx, int vy, |
452 unsigned int vw, unsigned int vh, | 451 unsigned int vw, unsigned int vh, |
453 int dx, int dy, unsigned int dw, unsigned int dh) | 452 int dx, int dy, unsigned int dw, unsigned int dh) |
454 { | 453 { |
455 XExtDisplayInfo *info = xv_find_display (dpy); | 454 XExtDisplayInfo *info = xv_find_display(dpy); |
456 xvPutStillReq *req; | 455 xvPutStillReq *req; |
457 | 456 |
458 XvCheckExtension (dpy, info, XvBadExtension); | 457 XvCheckExtension(dpy, info, XvBadExtension); |
459 | 458 |
460 LockDisplay (dpy); | 459 LockDisplay(dpy); |
461 | 460 |
462 FlushGC (dpy, gc); | 461 FlushGC(dpy, gc); |
463 | 462 |
464 XvGetReq (PutStill, req); | 463 XvGetReq(PutStill, req); |
465 req->port = port; | 464 req->port = port; |
466 req->drawable = d; | 465 req->drawable = d; |
467 req->gc = gc->gid; | 466 req->gc = gc->gid; |
468 req->vid_x = vx; | 467 req->vid_x = vx; |
469 req->vid_y = vy; | 468 req->vid_y = vy; |
472 req->drw_x = dx; | 471 req->drw_x = dx; |
473 req->drw_y = dy; | 472 req->drw_y = dy; |
474 req->drw_w = dw; | 473 req->drw_w = dw; |
475 req->drw_h = dh; | 474 req->drw_h = dh; |
476 | 475 |
477 UnlockDisplay (dpy); | 476 UnlockDisplay(dpy); |
478 SyncHandle (); | 477 SyncHandle(); |
479 | 478 |
480 return Success; | 479 return Success; |
481 } | 480 } |
482 | 481 |
483 int | 482 int |
484 SDL_NAME (XvGetVideo) (Display * dpy, | 483 SDL_NAME(XvGetVideo) (Display * dpy, |
485 XvPortID port, | 484 XvPortID port, |
486 Drawable d, | 485 Drawable d, |
487 GC gc, | 486 GC gc, |
488 int vx, int vy, | 487 int vx, int vy, |
489 unsigned int vw, unsigned int vh, | 488 unsigned int vw, unsigned int vh, |
490 int dx, int dy, unsigned int dw, unsigned int dh) | 489 int dx, int dy, unsigned int dw, unsigned int dh) |
491 { | 490 { |
492 XExtDisplayInfo *info = xv_find_display (dpy); | 491 XExtDisplayInfo *info = xv_find_display(dpy); |
493 xvGetVideoReq *req; | 492 xvGetVideoReq *req; |
494 | 493 |
495 XvCheckExtension (dpy, info, XvBadExtension); | 494 XvCheckExtension(dpy, info, XvBadExtension); |
496 | 495 |
497 LockDisplay (dpy); | 496 LockDisplay(dpy); |
498 | 497 |
499 FlushGC (dpy, gc); | 498 FlushGC(dpy, gc); |
500 | 499 |
501 XvGetReq (GetVideo, req); | 500 XvGetReq(GetVideo, req); |
502 req->port = port; | 501 req->port = port; |
503 req->drawable = d; | 502 req->drawable = d; |
504 req->gc = gc->gid; | 503 req->gc = gc->gid; |
505 req->vid_x = vx; | 504 req->vid_x = vx; |
506 req->vid_y = vy; | 505 req->vid_y = vy; |
509 req->drw_x = dx; | 508 req->drw_x = dx; |
510 req->drw_y = dy; | 509 req->drw_y = dy; |
511 req->drw_w = dw; | 510 req->drw_w = dw; |
512 req->drw_h = dh; | 511 req->drw_h = dh; |
513 | 512 |
514 UnlockDisplay (dpy); | 513 UnlockDisplay(dpy); |
515 SyncHandle (); | 514 SyncHandle(); |
516 | 515 |
517 return Success; | 516 return Success; |
518 } | 517 } |
519 | 518 |
520 int | 519 int |
521 SDL_NAME (XvGetStill) (Display * dpy, | 520 SDL_NAME(XvGetStill) (Display * dpy, |
522 XvPortID port, | 521 XvPortID port, |
523 Drawable d, | 522 Drawable d, |
524 GC gc, | 523 GC gc, |
525 int vx, int vy, | 524 int vx, int vy, |
526 unsigned int vw, unsigned int vh, | 525 unsigned int vw, unsigned int vh, |
527 int dx, int dy, unsigned int dw, unsigned int dh) | 526 int dx, int dy, unsigned int dw, unsigned int dh) |
528 { | 527 { |
529 XExtDisplayInfo *info = xv_find_display (dpy); | 528 XExtDisplayInfo *info = xv_find_display(dpy); |
530 xvGetStillReq *req; | 529 xvGetStillReq *req; |
531 | 530 |
532 XvCheckExtension (dpy, info, XvBadExtension); | 531 XvCheckExtension(dpy, info, XvBadExtension); |
533 | 532 |
534 LockDisplay (dpy); | 533 LockDisplay(dpy); |
535 | 534 |
536 FlushGC (dpy, gc); | 535 FlushGC(dpy, gc); |
537 | 536 |
538 XvGetReq (GetStill, req); | 537 XvGetReq(GetStill, req); |
539 req->port = port; | 538 req->port = port; |
540 req->drawable = d; | 539 req->drawable = d; |
541 req->gc = gc->gid; | 540 req->gc = gc->gid; |
542 req->vid_x = vx; | 541 req->vid_x = vx; |
543 req->vid_y = vy; | 542 req->vid_y = vy; |
546 req->drw_x = dx; | 545 req->drw_x = dx; |
547 req->drw_y = dy; | 546 req->drw_y = dy; |
548 req->drw_w = dw; | 547 req->drw_w = dw; |
549 req->drw_h = dh; | 548 req->drw_h = dh; |
550 | 549 |
551 UnlockDisplay (dpy); | 550 UnlockDisplay(dpy); |
552 SyncHandle (); | 551 SyncHandle(); |
553 | 552 |
554 return Success; | 553 return Success; |
555 } | 554 } |
556 | 555 |
557 int SDL_NAME (XvStopVideo) (Display * dpy, XvPortID port, Drawable draw) | 556 int SDL_NAME(XvStopVideo) (Display * dpy, XvPortID port, Drawable draw) |
558 { | 557 { |
559 XExtDisplayInfo *info = xv_find_display (dpy); | 558 XExtDisplayInfo *info = xv_find_display(dpy); |
560 xvStopVideoReq *req; | 559 xvStopVideoReq *req; |
561 | 560 |
562 XvCheckExtension (dpy, info, XvBadExtension); | 561 XvCheckExtension(dpy, info, XvBadExtension); |
563 | 562 |
564 LockDisplay (dpy); | 563 LockDisplay(dpy); |
565 | 564 |
566 XvGetReq (StopVideo, req); | 565 XvGetReq(StopVideo, req); |
567 req->port = port; | 566 req->port = port; |
568 req->drawable = draw; | 567 req->drawable = draw; |
569 | 568 |
570 UnlockDisplay (dpy); | 569 UnlockDisplay(dpy); |
571 SyncHandle (); | 570 SyncHandle(); |
572 | 571 |
573 return Success; | 572 return Success; |
574 } | 573 } |
575 | 574 |
576 int SDL_NAME (XvGrabPort) (Display * dpy, XvPortID port, Time time) | 575 int SDL_NAME(XvGrabPort) (Display * dpy, XvPortID port, Time time) |
577 { | 576 { |
578 XExtDisplayInfo *info = xv_find_display (dpy); | 577 XExtDisplayInfo *info = xv_find_display(dpy); |
579 int result; | 578 int result; |
580 xvGrabPortReply rep; | 579 xvGrabPortReply rep; |
581 xvGrabPortReq *req; | 580 xvGrabPortReq *req; |
582 | 581 |
583 XvCheckExtension (dpy, info, XvBadExtension); | 582 XvCheckExtension(dpy, info, XvBadExtension); |
584 | 583 |
585 LockDisplay (dpy); | 584 LockDisplay(dpy); |
586 | 585 |
587 XvGetReq (GrabPort, req); | 586 XvGetReq(GrabPort, req); |
588 req->port = port; | 587 req->port = port; |
589 req->time = time; | 588 req->time = time; |
590 | 589 |
591 if (_XReply (dpy, (xReply *) & rep, 0, xTrue) == 0) | 590 if (_XReply(dpy, (xReply *) & rep, 0, xTrue) == 0) |
592 rep.result = GrabSuccess; | 591 rep.result = GrabSuccess; |
593 | 592 |
594 result = rep.result; | 593 result = rep.result; |
595 | 594 |
596 UnlockDisplay (dpy); | 595 UnlockDisplay(dpy); |
597 SyncHandle (); | 596 SyncHandle(); |
598 | 597 |
599 return result; | 598 return result; |
600 } | 599 } |
601 | 600 |
602 int SDL_NAME (XvUngrabPort) (Display * dpy, XvPortID port, Time time) | 601 int SDL_NAME(XvUngrabPort) (Display * dpy, XvPortID port, Time time) |
603 { | 602 { |
604 XExtDisplayInfo *info = xv_find_display (dpy); | 603 XExtDisplayInfo *info = xv_find_display(dpy); |
605 xvUngrabPortReq *req; | 604 xvUngrabPortReq *req; |
606 | 605 |
607 XvCheckExtension (dpy, info, XvBadExtension); | 606 XvCheckExtension(dpy, info, XvBadExtension); |
608 | 607 |
609 LockDisplay (dpy); | 608 LockDisplay(dpy); |
610 | 609 |
611 XvGetReq (UngrabPort, req); | 610 XvGetReq(UngrabPort, req); |
612 req->port = port; | 611 req->port = port; |
613 req->time = time; | 612 req->time = time; |
614 | 613 |
615 UnlockDisplay (dpy); | 614 UnlockDisplay(dpy); |
616 SyncHandle (); | 615 SyncHandle(); |
617 | 616 |
618 return Success; | 617 return Success; |
619 } | 618 } |
620 | 619 |
621 int | 620 int |
622 SDL_NAME (XvSelectVideoNotify) (Display * dpy, Drawable drawable, Bool onoff) | 621 SDL_NAME(XvSelectVideoNotify) (Display * dpy, Drawable drawable, Bool onoff) |
623 { | 622 { |
624 XExtDisplayInfo *info = xv_find_display (dpy); | 623 XExtDisplayInfo *info = xv_find_display(dpy); |
625 xvSelectVideoNotifyReq *req; | 624 xvSelectVideoNotifyReq *req; |
626 | 625 |
627 XvCheckExtension (dpy, info, XvBadExtension); | 626 XvCheckExtension(dpy, info, XvBadExtension); |
628 | 627 |
629 LockDisplay (dpy); | 628 LockDisplay(dpy); |
630 | 629 |
631 XvGetReq (SelectVideoNotify, req); | 630 XvGetReq(SelectVideoNotify, req); |
632 req->drawable = drawable; | 631 req->drawable = drawable; |
633 req->onoff = onoff; | 632 req->onoff = onoff; |
634 | 633 |
635 UnlockDisplay (dpy); | 634 UnlockDisplay(dpy); |
636 SyncHandle (); | 635 SyncHandle(); |
637 | 636 |
638 return Success; | 637 return Success; |
639 } | 638 } |
640 | 639 |
641 int SDL_NAME (XvSelectPortNotify) (Display * dpy, XvPortID port, Bool onoff) | 640 int SDL_NAME(XvSelectPortNotify) (Display * dpy, XvPortID port, Bool onoff) |
642 { | 641 { |
643 XExtDisplayInfo *info = xv_find_display (dpy); | 642 XExtDisplayInfo *info = xv_find_display(dpy); |
644 xvSelectPortNotifyReq *req; | 643 xvSelectPortNotifyReq *req; |
645 | 644 |
646 XvCheckExtension (dpy, info, XvBadExtension); | 645 XvCheckExtension(dpy, info, XvBadExtension); |
647 | 646 |
648 LockDisplay (dpy); | 647 LockDisplay(dpy); |
649 | 648 |
650 XvGetReq (SelectPortNotify, req); | 649 XvGetReq(SelectPortNotify, req); |
651 req->port = port; | 650 req->port = port; |
652 req->onoff = onoff; | 651 req->onoff = onoff; |
653 | 652 |
654 UnlockDisplay (dpy); | 653 UnlockDisplay(dpy); |
655 SyncHandle (); | 654 SyncHandle(); |
656 | 655 |
657 return Success; | 656 return Success; |
658 } | 657 } |
659 | 658 |
660 int | 659 int |
661 SDL_NAME (XvSetPortAttribute) (Display * dpy, | 660 SDL_NAME(XvSetPortAttribute) (Display * dpy, |
662 XvPortID port, Atom attribute, int value) | 661 XvPortID port, Atom attribute, int value) |
663 { | 662 { |
664 XExtDisplayInfo *info = xv_find_display (dpy); | 663 XExtDisplayInfo *info = xv_find_display(dpy); |
665 xvSetPortAttributeReq *req; | 664 xvSetPortAttributeReq *req; |
666 | 665 |
667 XvCheckExtension (dpy, info, XvBadExtension); | 666 XvCheckExtension(dpy, info, XvBadExtension); |
668 | 667 |
669 LockDisplay (dpy); | 668 LockDisplay(dpy); |
670 | 669 |
671 XvGetReq (SetPortAttribute, req); | 670 XvGetReq(SetPortAttribute, req); |
672 req->port = port; | 671 req->port = port; |
673 req->attribute = attribute; | 672 req->attribute = attribute; |
674 req->value = value; | 673 req->value = value; |
675 | 674 |
676 UnlockDisplay (dpy); | 675 UnlockDisplay(dpy); |
677 SyncHandle (); | 676 SyncHandle(); |
678 | 677 |
679 return (Success); | 678 return (Success); |
680 } | 679 } |
681 | 680 |
682 int | 681 int |
683 SDL_NAME (XvGetPortAttribute) (Display * dpy, | 682 SDL_NAME(XvGetPortAttribute) (Display * dpy, |
684 XvPortID port, Atom attribute, int *p_value) | 683 XvPortID port, Atom attribute, int *p_value) |
685 { | 684 { |
686 XExtDisplayInfo *info = xv_find_display (dpy); | 685 XExtDisplayInfo *info = xv_find_display(dpy); |
687 xvGetPortAttributeReq *req; | 686 xvGetPortAttributeReq *req; |
688 xvGetPortAttributeReply rep; | 687 xvGetPortAttributeReply rep; |
689 | 688 |
690 XvCheckExtension (dpy, info, XvBadExtension); | 689 XvCheckExtension(dpy, info, XvBadExtension); |
691 | 690 |
692 LockDisplay (dpy); | 691 LockDisplay(dpy); |
693 | 692 |
694 XvGetReq (GetPortAttribute, req); | 693 XvGetReq(GetPortAttribute, req); |
695 req->port = port; | 694 req->port = port; |
696 req->attribute = attribute; | 695 req->attribute = attribute; |
697 | 696 |
698 /* READ THE REPLY */ | 697 /* READ THE REPLY */ |
699 | 698 |
700 if (_XReply (dpy, (xReply *) & rep, 0, xFalse) == 0) { | 699 if (_XReply(dpy, (xReply *) & rep, 0, xFalse) == 0) { |
701 UnlockDisplay (dpy); | 700 UnlockDisplay(dpy); |
702 SyncHandle (); | 701 SyncHandle(); |
703 return (XvBadReply); | 702 return (XvBadReply); |
704 } | 703 } |
705 | 704 |
706 *p_value = rep.value; | 705 *p_value = rep.value; |
707 | 706 |
708 UnlockDisplay (dpy); | 707 UnlockDisplay(dpy); |
709 SyncHandle (); | 708 SyncHandle(); |
710 | 709 |
711 return (Success); | 710 return (Success); |
712 } | 711 } |
713 | 712 |
714 int | 713 int |
715 SDL_NAME (XvQueryBestSize) (Display * dpy, | 714 SDL_NAME(XvQueryBestSize) (Display * dpy, |
716 XvPortID port, | 715 XvPortID port, |
717 Bool motion, | 716 Bool motion, |
718 unsigned int vid_w, | 717 unsigned int vid_w, |
719 unsigned int vid_h, | 718 unsigned int vid_h, |
720 unsigned int drw_w, | 719 unsigned int drw_w, |
721 unsigned int drw_h, | 720 unsigned int drw_h, |
722 unsigned int *p_actual_width, | 721 unsigned int *p_actual_width, |
723 unsigned int *p_actual_height) | 722 unsigned int *p_actual_height) |
724 { | 723 { |
725 XExtDisplayInfo *info = xv_find_display (dpy); | 724 XExtDisplayInfo *info = xv_find_display(dpy); |
726 xvQueryBestSizeReq *req; | 725 xvQueryBestSizeReq *req; |
727 xvQueryBestSizeReply rep; | 726 xvQueryBestSizeReply rep; |
728 | 727 |
729 XvCheckExtension (dpy, info, XvBadExtension); | 728 XvCheckExtension(dpy, info, XvBadExtension); |
730 | 729 |
731 LockDisplay (dpy); | 730 LockDisplay(dpy); |
732 | 731 |
733 XvGetReq (QueryBestSize, req); | 732 XvGetReq(QueryBestSize, req); |
734 req->port = port; | 733 req->port = port; |
735 req->motion = motion; | 734 req->motion = motion; |
736 req->vid_w = vid_w; | 735 req->vid_w = vid_w; |
737 req->vid_h = vid_h; | 736 req->vid_h = vid_h; |
738 req->drw_w = drw_w; | 737 req->drw_w = drw_w; |
739 req->drw_h = drw_h; | 738 req->drw_h = drw_h; |
740 | 739 |
741 /* READ THE REPLY */ | 740 /* READ THE REPLY */ |
742 | 741 |
743 if (_XReply (dpy, (xReply *) & rep, 0, xFalse) == 0) { | 742 if (_XReply(dpy, (xReply *) & rep, 0, xFalse) == 0) { |
744 UnlockDisplay (dpy); | 743 UnlockDisplay(dpy); |
745 SyncHandle (); | 744 SyncHandle(); |
746 return (XvBadReply); | 745 return (XvBadReply); |
747 } | 746 } |
748 | 747 |
749 *p_actual_width = rep.actual_width; | 748 *p_actual_width = rep.actual_width; |
750 *p_actual_height = rep.actual_height; | 749 *p_actual_height = rep.actual_height; |
751 | 750 |
752 UnlockDisplay (dpy); | 751 UnlockDisplay(dpy); |
753 SyncHandle (); | 752 SyncHandle(); |
754 | 753 |
755 return (Success); | 754 return (Success); |
756 } | 755 } |
757 | 756 |
758 | 757 |
759 SDL_NAME (XvAttribute) * | 758 SDL_NAME(XvAttribute) * |
760 SDL_NAME (XvQueryPortAttributes) (Display * dpy, XvPortID port, int *num) | 759 SDL_NAME(XvQueryPortAttributes) (Display * dpy, XvPortID port, int *num) |
761 { | 760 { |
762 XExtDisplayInfo *info = xv_find_display (dpy); | 761 XExtDisplayInfo *info = xv_find_display(dpy); |
763 xvQueryPortAttributesReq *req; | 762 xvQueryPortAttributesReq *req; |
764 xvQueryPortAttributesReply rep; | 763 xvQueryPortAttributesReply rep; |
765 SDL_NAME (XvAttribute) * ret = NULL; | 764 SDL_NAME(XvAttribute) * ret = NULL; |
766 | 765 |
767 *num = 0; | 766 *num = 0; |
768 | 767 |
769 XvCheckExtension (dpy, info, NULL); | 768 XvCheckExtension(dpy, info, NULL); |
770 | 769 |
771 LockDisplay (dpy); | 770 LockDisplay(dpy); |
772 | 771 |
773 XvGetReq (QueryPortAttributes, req); | 772 XvGetReq(QueryPortAttributes, req); |
774 req->port = port; | 773 req->port = port; |
775 | 774 |
776 /* READ THE REPLY */ | 775 /* READ THE REPLY */ |
777 | 776 |
778 if (_XReply (dpy, (xReply *) & rep, 0, xFalse) == 0) { | 777 if (_XReply(dpy, (xReply *) & rep, 0, xFalse) == 0) { |
779 UnlockDisplay (dpy); | 778 UnlockDisplay(dpy); |
780 SyncHandle (); | 779 SyncHandle(); |
781 return ret; | 780 return ret; |
782 } | 781 } |
783 | 782 |
784 if (rep.num_attributes) { | 783 if (rep.num_attributes) { |
785 int size = | 784 int size = |
786 (rep.num_attributes * sizeof (SDL_NAME (XvAttribute))) + | 785 (rep.num_attributes * sizeof(SDL_NAME(XvAttribute))) + |
787 rep.text_size; | 786 rep.text_size; |
788 | 787 |
789 if ((ret = Xmalloc (size))) { | 788 if ((ret = Xmalloc(size))) { |
790 char *marker = (char *) (&ret[rep.num_attributes]); | 789 char *marker = (char *) (&ret[rep.num_attributes]); |
791 xvAttributeInfo Info; | 790 xvAttributeInfo Info; |
792 int i; | 791 int i; |
793 | 792 |
794 for (i = 0; i < rep.num_attributes; i++) { | 793 for (i = 0; i < rep.num_attributes; i++) { |
795 _XRead (dpy, (char *) (&Info), sz_xvAttributeInfo); | 794 _XRead(dpy, (char *) (&Info), sz_xvAttributeInfo); |
796 ret[i].flags = (int) Info.flags; | 795 ret[i].flags = (int) Info.flags; |
797 ret[i].min_value = Info.min; | 796 ret[i].min_value = Info.min; |
798 ret[i].max_value = Info.max; | 797 ret[i].max_value = Info.max; |
799 ret[i].name = marker; | 798 ret[i].name = marker; |
800 _XRead (dpy, marker, Info.size); | 799 _XRead(dpy, marker, Info.size); |
801 marker += Info.size; | 800 marker += Info.size; |
802 (*num)++; | 801 (*num)++; |
803 } | 802 } |
804 } else | 803 } else |
805 _XEatData (dpy, rep.length << 2); | 804 _XEatData(dpy, rep.length << 2); |
806 } | 805 } |
807 | 806 |
808 UnlockDisplay (dpy); | 807 UnlockDisplay(dpy); |
809 SyncHandle (); | 808 SyncHandle(); |
810 | 809 |
811 return ret; | 810 return ret; |
812 } | 811 } |
813 | 812 |
814 SDL_NAME (XvImageFormatValues) * SDL_NAME (XvListImageFormats) (Display * dpy, | 813 SDL_NAME(XvImageFormatValues) * SDL_NAME(XvListImageFormats) (Display * dpy, |
815 XvPortID port, | 814 XvPortID port, |
816 int *num) | 815 int *num) |
817 { | 816 { |
818 XExtDisplayInfo *info = xv_find_display (dpy); | 817 XExtDisplayInfo *info = xv_find_display(dpy); |
819 xvListImageFormatsReq *req; | 818 xvListImageFormatsReq *req; |
820 xvListImageFormatsReply rep; | 819 xvListImageFormatsReply rep; |
821 SDL_NAME (XvImageFormatValues) * ret = NULL; | 820 SDL_NAME(XvImageFormatValues) * ret = NULL; |
822 | 821 |
823 *num = 0; | 822 *num = 0; |
824 | 823 |
825 XvCheckExtension (dpy, info, NULL); | 824 XvCheckExtension(dpy, info, NULL); |
826 | 825 |
827 LockDisplay (dpy); | 826 LockDisplay(dpy); |
828 | 827 |
829 XvGetReq (ListImageFormats, req); | 828 XvGetReq(ListImageFormats, req); |
830 req->port = port; | 829 req->port = port; |
831 | 830 |
832 /* READ THE REPLY */ | 831 /* READ THE REPLY */ |
833 | 832 |
834 if (_XReply (dpy, (xReply *) & rep, 0, xFalse) == 0) { | 833 if (_XReply(dpy, (xReply *) & rep, 0, xFalse) == 0) { |
835 UnlockDisplay (dpy); | 834 UnlockDisplay(dpy); |
836 SyncHandle (); | 835 SyncHandle(); |
837 return NULL; | 836 return NULL; |
838 } | 837 } |
839 | 838 |
840 if (rep.num_formats) { | 839 if (rep.num_formats) { |
841 int size = | 840 int size = (rep.num_formats * sizeof(SDL_NAME(XvImageFormatValues))); |
842 (rep.num_formats * sizeof (SDL_NAME (XvImageFormatValues))); | 841 |
843 | 842 if ((ret = Xmalloc(size))) { |
844 if ((ret = Xmalloc (size))) { | |
845 xvImageFormatInfo Info; | 843 xvImageFormatInfo Info; |
846 int i; | 844 int i; |
847 | 845 |
848 for (i = 0; i < rep.num_formats; i++) { | 846 for (i = 0; i < rep.num_formats; i++) { |
849 _XRead (dpy, (char *) (&Info), sz_xvImageFormatInfo); | 847 _XRead(dpy, (char *) (&Info), sz_xvImageFormatInfo); |
850 ret[i].id = Info.id; | 848 ret[i].id = Info.id; |
851 ret[i].type = Info.type; | 849 ret[i].type = Info.type; |
852 ret[i].byte_order = Info.byte_order; | 850 ret[i].byte_order = Info.byte_order; |
853 memcpy (&(ret[i].guid[0]), &(Info.guid[0]), 16); | 851 memcpy(&(ret[i].guid[0]), &(Info.guid[0]), 16); |
854 ret[i].bits_per_pixel = Info.bpp; | 852 ret[i].bits_per_pixel = Info.bpp; |
855 ret[i].format = Info.format; | 853 ret[i].format = Info.format; |
856 ret[i].num_planes = Info.num_planes; | 854 ret[i].num_planes = Info.num_planes; |
857 ret[i].depth = Info.depth; | 855 ret[i].depth = Info.depth; |
858 ret[i].red_mask = Info.red_mask; | 856 ret[i].red_mask = Info.red_mask; |
865 ret[i].horz_u_period = Info.horz_u_period; | 863 ret[i].horz_u_period = Info.horz_u_period; |
866 ret[i].horz_v_period = Info.horz_v_period; | 864 ret[i].horz_v_period = Info.horz_v_period; |
867 ret[i].vert_y_period = Info.vert_y_period; | 865 ret[i].vert_y_period = Info.vert_y_period; |
868 ret[i].vert_u_period = Info.vert_u_period; | 866 ret[i].vert_u_period = Info.vert_u_period; |
869 ret[i].vert_v_period = Info.vert_v_period; | 867 ret[i].vert_v_period = Info.vert_v_period; |
870 memcpy (&(ret[i].component_order[0]), | 868 memcpy(&(ret[i].component_order[0]), |
871 &(Info.comp_order[0]), 32); | 869 &(Info.comp_order[0]), 32); |
872 ret[i].scanline_order = Info.scanline_order; | 870 ret[i].scanline_order = Info.scanline_order; |
873 (*num)++; | 871 (*num)++; |
874 } | 872 } |
875 } else | 873 } else |
876 _XEatData (dpy, rep.length << 2); | 874 _XEatData(dpy, rep.length << 2); |
877 } | 875 } |
878 | 876 |
879 UnlockDisplay (dpy); | 877 UnlockDisplay(dpy); |
880 SyncHandle (); | 878 SyncHandle(); |
881 | 879 |
882 return ret; | 880 return ret; |
883 } | 881 } |
884 | 882 |
885 SDL_NAME (XvImage) * SDL_NAME (XvCreateImage) (Display * dpy, | 883 SDL_NAME(XvImage) * SDL_NAME(XvCreateImage) (Display * dpy, |
886 XvPortID port, | 884 XvPortID port, |
887 int id, | 885 int id, |
888 char *data, | 886 char *data, |
889 int width, int height) | 887 int width, int height) |
890 { | 888 { |
891 XExtDisplayInfo *info = xv_find_display (dpy); | 889 XExtDisplayInfo *info = xv_find_display(dpy); |
892 xvQueryImageAttributesReq *req; | 890 xvQueryImageAttributesReq *req; |
893 xvQueryImageAttributesReply rep; | 891 xvQueryImageAttributesReply rep; |
894 SDL_NAME (XvImage) * ret = NULL; | 892 SDL_NAME(XvImage) * ret = NULL; |
895 | 893 |
896 XvCheckExtension (dpy, info, NULL); | 894 XvCheckExtension(dpy, info, NULL); |
897 | 895 |
898 LockDisplay (dpy); | 896 LockDisplay(dpy); |
899 | 897 |
900 XvGetReq (QueryImageAttributes, req); | 898 XvGetReq(QueryImageAttributes, req); |
901 req->id = id; | 899 req->id = id; |
902 req->port = port; | 900 req->port = port; |
903 req->width = width; | 901 req->width = width; |
904 req->height = height; | 902 req->height = height; |
905 | 903 |
906 /* READ THE REPLY */ | 904 /* READ THE REPLY */ |
907 | 905 |
908 if (!_XReply (dpy, (xReply *) & rep, 0, xFalse)) { | 906 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { |
909 UnlockDisplay (dpy); | 907 UnlockDisplay(dpy); |
910 SyncHandle (); | 908 SyncHandle(); |
911 return NULL; | 909 return NULL; |
912 } | 910 } |
913 | 911 |
914 if ((ret = | 912 if ((ret = |
915 (SDL_NAME (XvImage) *) Xmalloc (sizeof (SDL_NAME (XvImage)) + | 913 (SDL_NAME(XvImage) *) Xmalloc(sizeof(SDL_NAME(XvImage)) + |
916 (rep.num_planes << 3)))) { | 914 (rep.num_planes << 3)))) { |
917 ret->id = id; | 915 ret->id = id; |
918 ret->width = rep.width; | 916 ret->width = rep.width; |
919 ret->height = rep.height; | 917 ret->height = rep.height; |
920 ret->data_size = rep.data_size; | 918 ret->data_size = rep.data_size; |
921 ret->num_planes = rep.num_planes; | 919 ret->num_planes = rep.num_planes; |
922 ret->pitches = (int *) (&ret[1]); | 920 ret->pitches = (int *) (&ret[1]); |
923 ret->offsets = ret->pitches + rep.num_planes; | 921 ret->offsets = ret->pitches + rep.num_planes; |
924 ret->data = data; | 922 ret->data = data; |
925 ret->obdata = NULL; | 923 ret->obdata = NULL; |
926 _XRead (dpy, (char *) (ret->pitches), rep.num_planes << 2); | 924 _XRead(dpy, (char *) (ret->pitches), rep.num_planes << 2); |
927 _XRead (dpy, (char *) (ret->offsets), rep.num_planes << 2); | 925 _XRead(dpy, (char *) (ret->offsets), rep.num_planes << 2); |
928 } else | 926 } else |
929 _XEatData (dpy, rep.length << 2); | 927 _XEatData(dpy, rep.length << 2); |
930 | 928 |
931 UnlockDisplay (dpy); | 929 UnlockDisplay(dpy); |
932 SyncHandle (); | 930 SyncHandle(); |
933 return ret; | 931 return ret; |
934 } | 932 } |
935 | 933 |
936 SDL_NAME (XvImage) * SDL_NAME (XvShmCreateImage) (Display * dpy, | 934 SDL_NAME(XvImage) * SDL_NAME(XvShmCreateImage) (Display * dpy, |
937 XvPortID port, | 935 XvPortID port, |
938 int id, | 936 int id, |
939 char *data, | 937 char *data, |
940 int width, | 938 int width, |
941 int height, | 939 int height, |
942 XShmSegmentInfo * shminfo) | 940 XShmSegmentInfo * shminfo) |
943 { | 941 { |
944 SDL_NAME (XvImage) * ret; | 942 SDL_NAME(XvImage) * ret; |
945 | 943 |
946 ret = SDL_NAME (XvCreateImage) (dpy, port, id, data, width, height); | 944 ret = SDL_NAME(XvCreateImage) (dpy, port, id, data, width, height); |
947 | 945 |
948 if (ret) | 946 if (ret) |
949 ret->obdata = (XPointer) shminfo; | 947 ret->obdata = (XPointer) shminfo; |
950 | 948 |
951 return ret; | 949 return ret; |
952 } | 950 } |
953 | 951 |
954 int SDL_NAME (XvPutImage) (Display * dpy, | 952 int SDL_NAME(XvPutImage) (Display * dpy, |
955 XvPortID port, | 953 XvPortID port, |
956 Drawable d, | 954 Drawable d, |
957 GC gc, | 955 GC gc, |
958 SDL_NAME (XvImage) * image, | 956 SDL_NAME(XvImage) * image, |
959 int src_x, | 957 int src_x, |
960 int src_y, | 958 int src_y, |
961 unsigned int src_w, | 959 unsigned int src_w, |
962 unsigned int src_h, | 960 unsigned int src_h, |
963 int dest_x, | 961 int dest_x, |
964 int dest_y, | 962 int dest_y, |
965 unsigned int dest_w, unsigned int dest_h) | 963 unsigned int dest_w, unsigned int dest_h) |
966 { | 964 { |
967 XExtDisplayInfo *info = xv_find_display (dpy); | 965 XExtDisplayInfo *info = xv_find_display(dpy); |
968 xvPutImageReq *req; | 966 xvPutImageReq *req; |
969 int len; | 967 int len; |
970 | 968 |
971 XvCheckExtension (dpy, info, XvBadExtension); | 969 XvCheckExtension(dpy, info, XvBadExtension); |
972 | 970 |
973 LockDisplay (dpy); | 971 LockDisplay(dpy); |
974 | 972 |
975 FlushGC (dpy, gc); | 973 FlushGC(dpy, gc); |
976 | 974 |
977 XvGetReq (PutImage, req); | 975 XvGetReq(PutImage, req); |
978 | 976 |
979 req->port = port; | 977 req->port = port; |
980 req->drawable = d; | 978 req->drawable = d; |
981 req->gc = gc->gid; | 979 req->gc = gc->gid; |
982 req->id = image->id; | 980 req->id = image->id; |
990 req->drw_h = dest_h; | 988 req->drw_h = dest_h; |
991 req->width = image->width; | 989 req->width = image->width; |
992 req->height = image->height; | 990 req->height = image->height; |
993 | 991 |
994 len = (image->data_size + 3) >> 2; | 992 len = (image->data_size + 3) >> 2; |
995 SetReqLen (req, len, len); | 993 SetReqLen(req, len, len); |
996 | 994 |
997 /* Yes it's kindof lame that we are sending the whole thing, | 995 /* Yes it's kindof lame that we are sending the whole thing, |
998 but for video all of it may be needed even if displaying | 996 but for video all of it may be needed even if displaying |
999 only a subsection, and I don't want to go through the | 997 only a subsection, and I don't want to go through the |
1000 trouble of creating subregions to send */ | 998 trouble of creating subregions to send */ |
1001 Data (dpy, (char *) image->data, image->data_size); | 999 Data(dpy, (char *) image->data, image->data_size); |
1002 | 1000 |
1003 UnlockDisplay (dpy); | 1001 UnlockDisplay(dpy); |
1004 SyncHandle (); | 1002 SyncHandle(); |
1005 | 1003 |
1006 return Success; | 1004 return Success; |
1007 } | 1005 } |
1008 | 1006 |
1009 int SDL_NAME (XvShmPutImage) (Display * dpy, | 1007 int SDL_NAME(XvShmPutImage) (Display * dpy, |
1010 XvPortID port, | 1008 XvPortID port, |
1011 Drawable d, | 1009 Drawable d, |
1012 GC gc, | 1010 GC gc, |
1013 SDL_NAME (XvImage) * image, | 1011 SDL_NAME(XvImage) * image, |
1014 int src_x, | 1012 int src_x, |
1015 int src_y, | 1013 int src_y, |
1016 unsigned int src_w, | 1014 unsigned int src_w, |
1017 unsigned int src_h, | 1015 unsigned int src_h, |
1018 int dest_x, | 1016 int dest_x, |
1019 int dest_y, | 1017 int dest_y, |
1020 unsigned int dest_w, | 1018 unsigned int dest_w, |
1021 unsigned int dest_h, Bool send_event) | 1019 unsigned int dest_h, Bool send_event) |
1022 { | 1020 { |
1023 XExtDisplayInfo *info = xv_find_display (dpy); | 1021 XExtDisplayInfo *info = xv_find_display(dpy); |
1024 XShmSegmentInfo *shminfo = (XShmSegmentInfo *) image->obdata; | 1022 XShmSegmentInfo *shminfo = (XShmSegmentInfo *) image->obdata; |
1025 xvShmPutImageReq *req; | 1023 xvShmPutImageReq *req; |
1026 | 1024 |
1027 XvCheckExtension (dpy, info, XvBadExtension); | 1025 XvCheckExtension(dpy, info, XvBadExtension); |
1028 | 1026 |
1029 LockDisplay (dpy); | 1027 LockDisplay(dpy); |
1030 | 1028 |
1031 FlushGC (dpy, gc); | 1029 FlushGC(dpy, gc); |
1032 | 1030 |
1033 XvGetReq (ShmPutImage, req); | 1031 XvGetReq(ShmPutImage, req); |
1034 | 1032 |
1035 req->port = port; | 1033 req->port = port; |
1036 req->drawable = d; | 1034 req->drawable = d; |
1037 req->gc = gc->gid; | 1035 req->gc = gc->gid; |
1038 req->shmseg = shminfo->shmseg; | 1036 req->shmseg = shminfo->shmseg; |
1048 req->offset = image->data - shminfo->shmaddr; | 1046 req->offset = image->data - shminfo->shmaddr; |
1049 req->width = image->width; | 1047 req->width = image->width; |
1050 req->height = image->height; | 1048 req->height = image->height; |
1051 req->send_event = send_event; | 1049 req->send_event = send_event; |
1052 | 1050 |
1053 UnlockDisplay (dpy); | 1051 UnlockDisplay(dpy); |
1054 SyncHandle (); | 1052 SyncHandle(); |
1055 | 1053 |
1056 return Success; | 1054 return Success; |
1057 } | 1055 } |
1058 | 1056 |
1059 | 1057 |
1060 static Bool | 1058 static Bool |
1061 xv_wire_to_event (Display * dpy, XEvent * host, xEvent * wire) | 1059 xv_wire_to_event(Display * dpy, XEvent * host, xEvent * wire) |
1062 { | 1060 { |
1063 XExtDisplayInfo *info = xv_find_display (dpy); | 1061 XExtDisplayInfo *info = xv_find_display(dpy); |
1064 SDL_NAME (XvEvent) * re = (SDL_NAME (XvEvent) *) host; | 1062 SDL_NAME(XvEvent) * re = (SDL_NAME(XvEvent) *) host; |
1065 xvEvent *event = (xvEvent *) wire; | 1063 xvEvent *event = (xvEvent *) wire; |
1066 | 1064 |
1067 XvCheckExtension (dpy, info, False); | 1065 XvCheckExtension(dpy, info, False); |
1068 | 1066 |
1069 switch ((event->u.u.type & 0x7F) - info->codes->first_event) { | 1067 switch ((event->u.u.type & 0x7F) - info->codes->first_event) { |
1070 case XvVideoNotify: | 1068 case XvVideoNotify: |
1071 re->xvvideo.type = event->u.u.type & 0x7f; | 1069 re->xvvideo.type = event->u.u.type & 0x7f; |
1072 re->xvvideo.serial = | 1070 re->xvvideo.serial = |
1073 _XSetLastRequestRead (dpy, (xGenericReply *) event); | 1071 _XSetLastRequestRead(dpy, (xGenericReply *) event); |
1074 re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0); | 1072 re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0); |
1075 re->xvvideo.display = dpy; | 1073 re->xvvideo.display = dpy; |
1076 re->xvvideo.time = event->u.videoNotify.time; | 1074 re->xvvideo.time = event->u.videoNotify.time; |
1077 re->xvvideo.reason = event->u.videoNotify.reason; | 1075 re->xvvideo.reason = event->u.videoNotify.reason; |
1078 re->xvvideo.drawable = event->u.videoNotify.drawable; | 1076 re->xvvideo.drawable = event->u.videoNotify.drawable; |
1079 re->xvvideo.port_id = event->u.videoNotify.port; | 1077 re->xvvideo.port_id = event->u.videoNotify.port; |
1080 break; | 1078 break; |
1081 case XvPortNotify: | 1079 case XvPortNotify: |
1082 re->xvport.type = event->u.u.type & 0x7f; | 1080 re->xvport.type = event->u.u.type & 0x7f; |
1083 re->xvport.serial = | 1081 re->xvport.serial = |
1084 _XSetLastRequestRead (dpy, (xGenericReply *) event); | 1082 _XSetLastRequestRead(dpy, (xGenericReply *) event); |
1085 re->xvport.send_event = ((event->u.u.type & 0x80) != 0); | 1083 re->xvport.send_event = ((event->u.u.type & 0x80) != 0); |
1086 re->xvport.display = dpy; | 1084 re->xvport.display = dpy; |
1087 re->xvport.time = event->u.portNotify.time; | 1085 re->xvport.time = event->u.portNotify.time; |
1088 re->xvport.port_id = event->u.portNotify.port; | 1086 re->xvport.port_id = event->u.portNotify.port; |
1089 re->xvport.attribute = event->u.portNotify.attribute; | 1087 re->xvport.attribute = event->u.portNotify.attribute; |