diff utils.c @ 12134:cb3eb3a2fc96 libavcodec

Add avsubtitle_free function.
author reimar
date Sun, 11 Jul 2010 07:35:00 +0000
parents c35d7bc64882
children b8a0924d6e42
line wrap: on
line diff
--- a/utils.c	Sun Jul 11 06:59:21 2010 +0000
+++ b/utils.c	Sun Jul 11 07:35:00 2010 +0000
@@ -689,6 +689,26 @@
     return ret;
 }
 
+void avsubtitle_free(AVSubtitle *sub)
+{
+    int i;
+
+    for (i = 0; i < sub->num_rects; i++)
+    {
+        av_freep(sub->rects[i]->pict.data[0]);
+        av_freep(sub->rects[i]->pict.data[1]);
+        av_freep(sub->rects[i]->pict.data[2]);
+        av_freep(sub->rects[i]->pict.data[3]);
+        av_freep(sub->rects[i]->text);
+        av_freep(sub->rects[i]->ass);
+        av_freep(sub->rects[i]);
+    }
+
+    av_freep(sub->rects);
+
+    memset(sub, 0, sizeof(AVSubtitle));
+}
+
 av_cold int avcodec_close(AVCodecContext *avctx)
 {
     /* If there is a user-supplied mutex locking routine, call it. */