From 7723f35f7990eef391148b8f51d5019576379976 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Thu, 14 Feb 2013 05:20:35 +0000 Subject: [PATCH] Clear the allocated buffer. Only for the plugin type livebox. Change-Id: Ib3148f821bf6a0db7a246c95cc266b1e78eed4f9 --- packaging/liblivebox.spec | 2 +- src/livebox.c | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packaging/liblivebox.spec b/packaging/liblivebox.spec index 4270930..685d274 100644 --- a/packaging/liblivebox.spec +++ b/packaging/liblivebox.spec @@ -1,6 +1,6 @@ Name: liblivebox Summary: Library for the development of a livebox -Version: 0.1.13 +Version: 0.1.14 Release: 1 Group: main/app License: Flora License diff --git a/src/livebox.c b/src/livebox.c index 5c6f8d0..87e4aa1 100644 --- a/src/livebox.c +++ b/src/livebox.c @@ -526,11 +526,22 @@ EAPI int livebox_release_buffer(struct livebox_buffer *handle) EAPI void *livebox_ref_buffer(struct livebox_buffer *handle) { + void *data; + int w, h, size; + int ret; if (!handle) return -EINVAL; - DbgPrint("Ref buffer\n"); - return provider_buffer_ref(handle); + ret = provider_buffer_get_size(handle, &w, &h, &size); + + data = provider_buffer_ref(handle); + if (data && !ret && w > 0 && h > 0 && size > 0) { + memset(data, 0, w * h * size); + provider_buffer_sync(handle); + } + + DbgPrint("Ref buffer %ds%d(%d)\n", w, h, size); + return data; } EAPI int livebox_unref_buffer(void *buffer) -- 2.7.4