[MPlayer-cvslog] r29618 - trunk/libvo/vo_quartz.c
reimar
subversion at mplayerhq.hu
Wed Sep 2 11:51:39 CEST 2009
Author: reimar
Date: Wed Sep 2 11:51:38 2009
New Revision: 29618
Log:
vo_quartz: change deallocation/uninit to more reliably free allocated data.
Modified:
trunk/libvo/vo_quartz.c
Modified: trunk/libvo/vo_quartz.c
==============================================================================
--- trunk/libvo/vo_quartz.c Tue Sep 1 23:16:58 2009 (r29617)
+++ trunk/libvo/vo_quartz.c Wed Sep 2 11:51:38 2009 (r29618)
@@ -607,12 +607,28 @@ static void update_screen_info(void)
aspect_save_screenres(vo_screenwidth, vo_screenheight);
}
+static void free_video_specific(void)
+{
+ if (seqId) CDSequenceEnd(seqId);
+ seqId = 0;
+ free(image_data);
+ image_data = NULL;
+ free(P);
+ P = NULL;
+ CGDataProviderRelease(dataProviderRef);
+ dataProviderRef = NULL;
+ CGImageRelease(image);
+ image = NULL;
+}
+
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)
{
WindowAttributes windowAttrs;
OSErr qterr;
CGRect tmpBounds;
+ free_video_specific();
+
vo_dwidth = d_width *= winSizeMult;
vo_dheight = d_height *= winSizeMult;
config_movie_aspect((float)d_width / d_height);
@@ -634,9 +650,6 @@ static int config(uint32_t width, uint32
}
image_size = ((imgRect.right * imgRect.bottom * image_depth) + 7) / 8;
- if (image_data)
- free(image_data);
-
image_data = malloc(image_size);
// Create player window//////////////////////////////////////////////////
@@ -789,9 +802,6 @@ static int config(uint32_t width, uint32
{
mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: AddImageDescriptionExtension [pasp] (%d)\n", qterr);
}
- if (P != NULL) { // second or subsequent movie
- free(P);
- }
P = calloc(sizeof(PlanarPixmapInfoYUV420) + image_size, 1);
switch (image_format)
{
@@ -1054,29 +1064,10 @@ static int query_format(uint32_t format)
static void uninit(void)
{
- OSErr qterr;
-
- switch (image_format)
- {
- case IMGFMT_YV12:
- case IMGFMT_IYUV:
- case IMGFMT_I420:
- case IMGFMT_UYVY:
- case IMGFMT_YUY2:
- {
- if (EnterMoviesDone)
- {
- qterr = CDSequenceEnd(seqId);
- if (qterr)
- {
- mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: CDSequenceEnd (%d)\n", qterr);
- }
- }
- break;
- }
- default:
- break;
- }
+ free_video_specific();
+ if (EnterMoviesDone)
+ ExitMovies();
+ EnterMoviesDone = 0;
ShowMenuBar();
}
More information about the MPlayer-cvslog
mailing list