[libbluray-devel] Added reference-counting to TextST RLE encoder

hpi1 git at videolan.org
Thu Jun 20 14:23:14 CEST 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Jun 20 15:22:27 2013 +0300| [ad9c3bd1ca2bc67840e6e2dce355d33f79619825] | committer: hpi1

Added reference-counting to TextST RLE encoder
(was missing from previous commit)

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=ad9c3bd1ca2bc67840e6e2dce355d33f79619825
---

 src/libbluray/decoders/rle.h |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/libbluray/decoders/rle.h b/src/libbluray/decoders/rle.h
index 008dba6..7286591 100644
--- a/src/libbluray/decoders/rle.h
+++ b/src/libbluray/decoders/rle.h
@@ -41,13 +41,12 @@ typedef struct {
  */
 
 #include "util/macro.h"
-
-#include <stdlib.h>
+#include "util/refcnt.h"
 
 static void rle_begin(RLE_ENC *p)
 {
     p->num_elem = 1024;
-    p->start = malloc(p->num_elem * sizeof(BD_PG_RLE_ELEM));
+    p->start = refcnt_realloc(NULL, p->num_elem * sizeof(BD_PG_RLE_ELEM));
 
     p->elem   = p->start;
     p->elem->len = 0;
@@ -56,7 +55,8 @@ static void rle_begin(RLE_ENC *p)
 
 static void rle_end(RLE_ENC *p)
 {
-    X_FREE(p->start);
+    bd_refcnt_dec(p->start);
+    p->start = NULL;
 }
 
 static void _rle_grow(RLE_ENC *p)
@@ -65,7 +65,7 @@ static void _rle_grow(RLE_ENC *p)
     if (count >= p->num_elem) {
         /* realloc */
         p->num_elem = p->num_elem * 2;
-        p->start = realloc(p->start, p->num_elem * sizeof(BD_PG_RLE_ELEM));
+        p->start = refcnt_realloc(p->start, p->num_elem * sizeof(BD_PG_RLE_ELEM));
     }
 
     p->elem = p->start + count;



More information about the libbluray-devel mailing list