}
static GstTizenMemory *
-_tizen_video_mem_new (GstAllocator * allocator, GstMemory * parent, GstVideoInfo * vinfo, tbm_surface_h surface)
+_tizen_video_mem_new (GstAllocator * allocator, GstMemory * parent, GstVideoInfo * vinfo,
+ tbm_surface_h surface, gpointer user_data, GDestroyNotify notify)
{
gint width, height;
GstTizenMemory *tmem;
/* Creates the tbm_surface with buffer objects. */
if (surface) {
+ tbm_surface_internal_ref (surface);
tmem->surface = surface;
} else {
width = GST_VIDEO_INFO_WIDTH (vinfo);
allocator, parent, GST_VIDEO_INFO_SIZE (vinfo), 0, 0,
GST_VIDEO_INFO_SIZE (vinfo));
+ tmem->notify = notify;
+ tmem->user_data = user_data;
g_mutex_init (&tmem->lock);
GST_DEBUG ("%p: surface: %p size %" G_GSIZE_FORMAT, tmem, tmem->surface,
{
GstTizenMemory *tmem = (GstTizenMemory *) mem;
+ tbm_surface_internal_unref (tmem->surface);
GST_DEBUG ("free surface from mem : %p", tmem->surface);
- tbm_surface_internal_destroy (tmem->surface);
+
+ if (tmem->notify)
+ tmem->notify (tmem->user_data);
g_mutex_clear (&tmem->lock);
g_slice_free (GstTizenMemory, tmem);
GstMemory *
gst_tizen_allocator_alloc (GstAllocator * allocator, GstVideoInfo * vinfo)
{
- return (GstMemory *)_tizen_video_mem_new (_tizen_allocator, NULL, vinfo, NULL);
+ return (GstMemory *)_tizen_video_mem_new (_tizen_allocator, NULL, vinfo, NULL, NULL, NULL);
}
GstMemory *
-gst_tizen_allocator_alloc_surface (GstAllocator * allocator, GstVideoInfo * vinfo, tbm_surface_h surface)
+gst_tizen_allocator_alloc_surface (GstAllocator * allocator, GstVideoInfo * vinfo,
+ tbm_surface_h surface, gpointer user_data, GDestroyNotify notify)
{
- return (GstMemory *)_tizen_video_mem_new (_tizen_allocator, NULL, vinfo, surface);
+ return (GstMemory *)_tizen_video_mem_new (_tizen_allocator, NULL, vinfo, surface, user_data, notify);
}
gboolean
GstMemory * gst_tizen_allocator_alloc (GstAllocator * allocator, GstVideoInfo * vinfo);
-GstMemory * gst_tizen_allocator_alloc_surface (GstAllocator * allocator, GstVideoInfo * vinfo, tbm_surface_h surface);
+GstMemory * gst_tizen_allocator_alloc_surface (GstAllocator * allocator, GstVideoInfo * vinfo,
+ tbm_surface_h surface, gpointer user_data, GDestroyNotify notify);
gboolean gst_is_tizen_memory (GstMemory *mem);