comparison src/video/x11/SDL_x11yuv.c @ 1336:3692456e7b0f

Use SDL_ prefixed versions of C library functions. FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 06:59:48 +0000
parents c9b51268668f
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
220 pXSetErrorHandler(X_handler); 220 pXSetErrorHandler(X_handler);
221 SDL_NAME(XvSelectPortNotify)(GFX_Display, xv_port, False); 221 SDL_NAME(XvSelectPortNotify)(GFX_Display, xv_port, False);
222 } 222 }
223 223
224 /* Create the overlay structure */ 224 /* Create the overlay structure */
225 overlay = (SDL_Overlay *)malloc(sizeof *overlay); 225 overlay = (SDL_Overlay *)SDL_malloc(sizeof *overlay);
226 if ( overlay == NULL ) { 226 if ( overlay == NULL ) {
227 SDL_NAME(XvUngrabPort)(GFX_Display, xv_port, CurrentTime); 227 SDL_NAME(XvUngrabPort)(GFX_Display, xv_port, CurrentTime);
228 SDL_OutOfMemory(); 228 SDL_OutOfMemory();
229 return(NULL); 229 return(NULL);
230 } 230 }
231 memset(overlay, 0, (sizeof *overlay)); 231 SDL_memset(overlay, 0, (sizeof *overlay));
232 232
233 /* Fill in the basic members */ 233 /* Fill in the basic members */
234 overlay->format = format; 234 overlay->format = format;
235 overlay->w = width; 235 overlay->w = width;
236 overlay->h = height; 236 overlay->h = height;
238 /* Set up the YUV surface function structure */ 238 /* Set up the YUV surface function structure */
239 overlay->hwfuncs = &x11_yuvfuncs; 239 overlay->hwfuncs = &x11_yuvfuncs;
240 overlay->hw_overlay = 1; 240 overlay->hw_overlay = 1;
241 241
242 /* Create the pixel data and lookup tables */ 242 /* Create the pixel data and lookup tables */
243 hwdata = (struct private_yuvhwdata *)malloc(sizeof *hwdata); 243 hwdata = (struct private_yuvhwdata *)SDL_malloc(sizeof *hwdata);
244 overlay->hwdata = hwdata; 244 overlay->hwdata = hwdata;
245 if ( hwdata == NULL ) { 245 if ( hwdata == NULL ) {
246 SDL_NAME(XvUngrabPort)(GFX_Display, xv_port, CurrentTime); 246 SDL_NAME(XvUngrabPort)(GFX_Display, xv_port, CurrentTime);
247 SDL_OutOfMemory(); 247 SDL_OutOfMemory();
248 SDL_FreeYUVOverlay(overlay); 248 SDL_FreeYUVOverlay(overlay);
249 return(NULL); 249 return(NULL);
250 } 250 }
251 hwdata->port = xv_port; 251 hwdata->port = xv_port;
252 #ifndef NO_SHARED_MEMORY 252 #ifndef NO_SHARED_MEMORY
253 yuvshm = &hwdata->yuvshm; 253 yuvshm = &hwdata->yuvshm;
254 memset(yuvshm, 0, sizeof(*yuvshm)); 254 SDL_memset(yuvshm, 0, sizeof(*yuvshm));
255 hwdata->image = SDL_NAME(XvShmCreateImage)(GFX_Display, xv_port, format, 255 hwdata->image = SDL_NAME(XvShmCreateImage)(GFX_Display, xv_port, format,
256 0, width, height, yuvshm); 256 0, width, height, yuvshm);
257 #ifdef PITCH_WORKAROUND 257 #ifdef PITCH_WORKAROUND
258 if ( hwdata->image != NULL && hwdata->image->pitches[0] != (width*bpp) ) { 258 if ( hwdata->image != NULL && hwdata->image->pitches[0] != (width*bpp) ) {
259 /* Ajust overlay width according to pitch */ 259 /* Ajust overlay width according to pitch */
310 if ( hwdata->image == NULL ) { 310 if ( hwdata->image == NULL ) {
311 SDL_SetError("Couldn't create XVideo image"); 311 SDL_SetError("Couldn't create XVideo image");
312 SDL_FreeYUVOverlay(overlay); 312 SDL_FreeYUVOverlay(overlay);
313 return(NULL); 313 return(NULL);
314 } 314 }
315 hwdata->image->data = malloc(hwdata->image->data_size); 315 hwdata->image->data = SDL_malloc(hwdata->image->data_size);
316 if ( hwdata->image->data == NULL ) { 316 if ( hwdata->image->data == NULL ) {
317 SDL_OutOfMemory(); 317 SDL_OutOfMemory();
318 SDL_FreeYUVOverlay(overlay); 318 SDL_FreeYUVOverlay(overlay);
319 return(NULL); 319 return(NULL);
320 } 320 }
321 } 321 }
322 322
323 /* Find the pitch and offset values for the overlay */ 323 /* Find the pitch and offset values for the overlay */
324 overlay->planes = hwdata->image->num_planes; 324 overlay->planes = hwdata->image->num_planes;
325 overlay->pitches = (Uint16 *)malloc(overlay->planes * sizeof(Uint16)); 325 overlay->pitches = (Uint16 *)SDL_malloc(overlay->planes * sizeof(Uint16));
326 overlay->pixels = (Uint8 **)malloc(overlay->planes * sizeof(Uint8 *)); 326 overlay->pixels = (Uint8 **)SDL_malloc(overlay->planes * sizeof(Uint8 *));
327 if ( !overlay->pitches || !overlay->pixels ) { 327 if ( !overlay->pitches || !overlay->pixels ) {
328 SDL_OutOfMemory(); 328 SDL_OutOfMemory();
329 SDL_FreeYUVOverlay(overlay); 329 SDL_FreeYUVOverlay(overlay);
330 return(NULL); 330 return(NULL);
331 } 331 }
393 } 393 }
394 #endif 394 #endif
395 if ( hwdata->image ) { 395 if ( hwdata->image ) {
396 pXFree(hwdata->image); 396 pXFree(hwdata->image);
397 } 397 }
398 free(hwdata); 398 SDL_free(hwdata);
399 } 399 }
400 if ( overlay->pitches ) { 400 if ( overlay->pitches ) {
401 free(overlay->pitches); 401 SDL_free(overlay->pitches);
402 overlay->pitches = NULL; 402 overlay->pitches = NULL;
403 } 403 }
404 if ( overlay->pixels ) { 404 if ( overlay->pixels ) {
405 free(overlay->pixels); 405 SDL_free(overlay->pixels);
406 overlay->pixels = NULL; 406 overlay->pixels = NULL;
407 } 407 }
408 #ifdef XFREE86_REFRESH_HACK 408 #ifdef XFREE86_REFRESH_HACK
409 X11_EnableAutoRefresh(this); 409 X11_EnableAutoRefresh(this);
410 #endif 410 #endif