Mercurial > mplayer.hg
comparison libvo/vo_corevideo.m @ 29573:2b14be337eaf
Fix some of the major memleaks of vo_corevideo with -fixed-vo
author | reimar |
---|---|
date | Tue, 01 Sep 2009 20:09:01 +0000 |
parents | 349de9bdfcce |
children | 0aa36133f638 |
comparison
equal
deleted
inserted
replaced
29572:4890363e713a | 29573:2b14be337eaf |
---|---|
132 vo_screenheight = screen_frame.size.height; | 132 vo_screenheight = screen_frame.size.height; |
133 xinerama_x = xinerama_y = 0; | 133 xinerama_x = xinerama_y = 0; |
134 aspect_save_screenres(vo_screenwidth, vo_screenheight); | 134 aspect_save_screenres(vo_screenwidth, vo_screenheight); |
135 } | 135 } |
136 | 136 |
137 static void free_file_specific(void) | |
138 { | |
139 if(shared_buffer) | |
140 { | |
141 [mplayerosxProto stop]; | |
142 mplayerosxProto = nil; | |
143 [mplayerosxProxy release]; | |
144 mplayerosxProxy = nil; | |
145 | |
146 if (munmap(image_data, image_width*image_height*image_bytes) == -1) | |
147 mp_msg(MSGT_VO, MSGL_FATAL, "[vo_corevideo] uninit: munmap failed. Error: %s\n", strerror(errno)); | |
148 | |
149 if (shm_unlink(buffer_name) == -1) | |
150 mp_msg(MSGT_VO, MSGL_FATAL, "[vo_corevideo] uninit: shm_unlink failed. Error: %s\n", strerror(errno)); | |
151 } else { | |
152 free(image_datas[0]); | |
153 if (vo_doublebuffering) | |
154 free(image_datas[1]); | |
155 image_datas[0] = NULL; | |
156 image_datas[1] = NULL; | |
157 image_data = NULL; | |
158 } | |
159 } | |
160 | |
137 static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) | 161 static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) |
138 { | 162 { |
163 free_file_specific(); | |
139 config_movie_aspect((float)d_width/d_height); | 164 config_movie_aspect((float)d_width/d_height); |
140 | 165 |
141 vo_dwidth = d_width *= mpGLView->winSizeMult; | 166 vo_dwidth = d_width *= mpGLView->winSizeMult; |
142 vo_dheight = d_height *= mpGLView->winSizeMult; | 167 vo_dheight = d_height *= mpGLView->winSizeMult; |
143 | 168 |
291 return 0; | 316 return 0; |
292 } | 317 } |
293 | 318 |
294 static void uninit(void) | 319 static void uninit(void) |
295 { | 320 { |
296 if(shared_buffer) | |
297 { | |
298 [mplayerosxProto stop]; | |
299 mplayerosxProto = nil; | |
300 [mplayerosxProxy release]; | |
301 mplayerosxProxy = nil; | |
302 | |
303 if (munmap(image_data, image_width*image_height*image_bytes) == -1) | |
304 mp_msg(MSGT_VO, MSGL_FATAL, "[vo_corevideo] uninit: munmap failed. Error: %s\n", strerror(errno)); | |
305 | |
306 if (shm_unlink(buffer_name) == -1) | |
307 mp_msg(MSGT_VO, MSGL_FATAL, "[vo_corevideo] uninit: shm_unlink failed. Error: %s\n", strerror(errno)); | |
308 | |
309 } | |
310 | |
311 SetSystemUIMode( kUIModeNormal, 0); | 321 SetSystemUIMode( kUIModeNormal, 0); |
312 CGDisplayShowCursor(kCGDirectMainDisplay); | 322 CGDisplayShowCursor(kCGDirectMainDisplay); |
323 | |
324 free_file_specific(); | |
313 | 325 |
314 if(mpGLView) | 326 if(mpGLView) |
315 { | 327 { |
316 NSAutoreleasePool *finalPool; | 328 NSAutoreleasePool *finalPool; |
317 mpGLView = nil; | 329 mpGLView = nil; |
318 [autoreleasepool release]; | 330 [autoreleasepool release]; |
319 finalPool = [[NSAutoreleasePool alloc] init]; | 331 finalPool = [[NSAutoreleasePool alloc] init]; |
320 [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]; | 332 [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]; |
321 [finalPool release]; | 333 [finalPool release]; |
322 } | |
323 if (!shared_buffer) | |
324 { | |
325 free(image_datas[0]); | |
326 if (vo_doublebuffering) | |
327 free(image_datas[1]); | |
328 image_datas[0] = NULL; | |
329 image_datas[1] = NULL; | |
330 image_data = NULL; | |
331 } | 334 } |
332 | 335 |
333 if (buffer_name) free(buffer_name); | 336 if (buffer_name) free(buffer_name); |
334 buffer_name = NULL; | 337 buffer_name = NULL; |
335 } | 338 } |