comparison src/video/quartz/SDL_QuartzYUV.m @ 1659:14717b52abc0 SDL-1.3

Merge trunk-1.3-3
author Sam Lantinga <slouken@libsdl.org>
date Wed, 17 May 2006 08:18:28 +0000
parents 9f59d4c5aaea
children 782fd950bd46 4d11f2ae7582
comparison
equal deleted inserted replaced
1658:e49147870aac 1659:14717b52abc0
89 static void QZ_FreeHWYUV (_THIS, SDL_Overlay *overlay) { 89 static void QZ_FreeHWYUV (_THIS, SDL_Overlay *overlay) {
90 90
91 CDSequenceEnd (yuv_seq); 91 CDSequenceEnd (yuv_seq);
92 ExitMovies(); 92 ExitMovies();
93 93
94 free (overlay->hwfuncs); 94 SDL_free (overlay->hwfuncs);
95 free (overlay->pitches); 95 SDL_free (overlay->pitches);
96 free (overlay->pixels); 96 SDL_free (overlay->pixels);
97 97
98 if (SDL_VideoSurface->flags & SDL_FULLSCREEN) { 98 if (SDL_VideoSurface->flags & SDL_FULLSCREEN) {
99 [ qz_window close ]; 99 [ qz_window close ];
100 qz_window = nil; 100 qz_window = nil;
101 } 101 }
102 102
103 free (yuv_matrix); 103 SDL_free (yuv_matrix);
104 DisposeHandle ((Handle)yuv_idh); 104 DisposeHandle ((Handle)yuv_idh);
105 } 105 }
106 106
107 /* check for 16 byte alignment, bail otherwise */ 107 /* check for 16 byte alignment, bail otherwise */
108 #define CHECK_ALIGN(x) do { if ((Uint32)x & 15) { SDL_SetError("Alignment error"); return NULL; } } while(0) 108 #define CHECK_ALIGN(x) do { if ((Uint32)x & 15) { SDL_SetError("Alignment error"); return NULL; } } while(0)
132 if (yuv_idh == NULL) { 132 if (yuv_idh == NULL) {
133 SDL_OutOfMemory(); 133 SDL_OutOfMemory();
134 return NULL; 134 return NULL;
135 } 135 }
136 136
137 yuv_matrix = (MatrixRecordPtr) malloc (sizeof(MatrixRecord)); 137 yuv_matrix = (MatrixRecordPtr) SDL_malloc (sizeof(MatrixRecord));
138 if (yuv_matrix == NULL) { 138 if (yuv_matrix == NULL) {
139 SDL_OutOfMemory(); 139 SDL_OutOfMemory();
140 return NULL; 140 return NULL;
141 } 141 }
142 142
232 if (err != noErr) { 232 if (err != noErr) {
233 SDL_SetError ("Error trying to start YUV codec."); 233 SDL_SetError ("Error trying to start YUV codec.");
234 return NULL; 234 return NULL;
235 } 235 }
236 236
237 overlay = (SDL_Overlay*) malloc (sizeof(*overlay)); 237 overlay = (SDL_Overlay*) SDL_malloc (sizeof(*overlay));
238 if (overlay == NULL) { 238 if (overlay == NULL) {
239 SDL_OutOfMemory(); 239 SDL_OutOfMemory();
240 return NULL; 240 return NULL;
241 } 241 }
242 242
265 else { 265 else {
266 SDL_SetError("Unsupported YUV format"); 266 SDL_SetError("Unsupported YUV format");
267 return NULL; 267 return NULL;
268 } 268 }
269 269
270 pixels = (Uint8**) malloc (sizeof(*pixels) * 3); 270 pixels = (Uint8**) SDL_malloc (sizeof(*pixels) * 3);
271 pitches = (Uint16*) malloc (sizeof(*pitches) * 3); 271 pitches = (Uint16*) SDL_malloc (sizeof(*pitches) * 3);
272 if (pixels == NULL || pitches == NULL) { 272 if (pixels == NULL || pitches == NULL) {
273 SDL_OutOfMemory(); 273 SDL_OutOfMemory();
274 return NULL; 274 return NULL;
275 } 275 }
276 276
277 yuv_pixmap = (PlanarPixmapInfoYUV420*) 277 yuv_pixmap = (PlanarPixmapInfoYUV420*)
278 malloc (sizeof(PlanarPixmapInfoYUV420) + 278 SDL_malloc (sizeof(PlanarPixmapInfoYUV420) +
279 (width * height * 2)); 279 (width * height * 2));
280 if (yuv_pixmap == NULL) { 280 if (yuv_pixmap == NULL) {
281 SDL_OutOfMemory (); 281 SDL_OutOfMemory ();
282 return NULL; 282 return NULL;
283 } 283 }
308 308
309 overlay->pixels = pixels; 309 overlay->pixels = pixels;
310 overlay->pitches = pitches; 310 overlay->pitches = pitches;
311 } 311 }
312 312
313 overlay->hwfuncs = malloc (sizeof(*overlay->hwfuncs)); 313 overlay->hwfuncs = SDL_malloc (sizeof(*overlay->hwfuncs));
314 if (overlay->hwfuncs == NULL) { 314 if (overlay->hwfuncs == NULL) {
315 SDL_OutOfMemory(); 315 SDL_OutOfMemory();
316 return NULL; 316 return NULL;
317 } 317 }
318 318