summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-09-02 09:51:38 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-09-02 09:51:38 +0000
commit144b7f598915c2a6f79ba400d7831b6193e3f928 (patch)
tree5f1bde3bc69e8a91e8b572b7fefda747984b8582 /libvo
parent1b3c42472d2e088a134c1f020b2ae4de3fb3a159 (diff)
downloadmpv-144b7f598915c2a6f79ba400d7831b6193e3f928.tar.bz2
mpv-144b7f598915c2a6f79ba400d7831b6193e3f928.tar.xz
vo_quartz: change deallocation/uninit to more reliably free allocated data.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29618 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_quartz.c49
1 files changed, 20 insertions, 29 deletions
diff --git a/libvo/vo_quartz.c b/libvo/vo_quartz.c
index 7e634ce663..7926153fde 100644
--- a/libvo/vo_quartz.c
+++ b/libvo/vo_quartz.c
@@ -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_t height, uint32_t d_width, uint32_t d_
}
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_t height, uint32_t d_width, uint32_t d_
{
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();
}