#endif
#include "gsttizenbufferpool.h"
+#include <tbm_surface_internal.h>
GST_DEBUG_CATEGORY_STATIC (gst_tizen_vidbufpool_debug);
#define GST_CAT_DEFAULT gst_tizen_vidbufpool_debug
}
static void
-_destroy_tbm_surface (struct UserPtrData *data)
+_destroy_tbm_surface (tbm_surface_h surface)
{
- GST_DEBUG ("destroy surface %p", data);
- tbm_surface_internal_destroy ((tbm_surface_h)data);
+ GST_DEBUG ("destroy surface %p", surface);
+ tbm_surface_internal_destroy (surface);
}
/* This function handles GstBuffer creation */
GstVideoInfo *info;
GstBuffer *buf;
GstMemory *tizen_mem;
- gint offsets[4] = {0, };
+ gsize offsets[4] = {0, };
GST_DEBUG_OBJECT (pool, "gst_tizen_buffer_pool_alloc");
info = &_tpool->info;
return GST_FLOW_OK;
}
-void
+static void
gst_tizen_buffer_pool_release_buffer (GstBufferPool * bpool, GstBuffer * buffer)
{
GstTizenBufferPool *_tpool = GST_TIZEN_BUFFER_POOL_CAST (bpool);
G_OBJECT_CLASS (gst_tizen_buffer_pool_parent_class)->finalize (object);
}
-GstBufferPool *
-gst_tizen_buffer_pool_new ()
+static void
+gst_tizen_buffer_pool_init (GstTizenBufferPool * pool)
{
- return GST_BUFFER_POOL_CAST (g_object_new (GST_TYPE_TIZEN_BUFFER_POOL, NULL));
+ g_mutex_init (&pool->lock);
+ pool->priv = gst_tizen_buffer_pool_get_instance_private (pool);
+ pool->buffers = g_ptr_array_new ();
+ pool->allocator = gst_tizen_allocator_new ();
+ g_atomic_int_set(&pool->outstandings, 0);
+ GST_LOG_OBJECT (pool, "Tizen buffer pool init %p", pool);
}
static void
gstbufferpool_class->release_buffer = gst_tizen_buffer_pool_release_buffer;
}
-static void
-gst_tizen_buffer_pool_init (GstTizenBufferPool * pool)
+GstBufferPool *
+gst_tizen_buffer_pool_new (void)
{
- g_mutex_init (&pool->lock);
- pool->priv = gst_tizen_buffer_pool_get_instance_private (pool);
- pool->buffers = g_ptr_array_new ();
- pool->allocator = gst_tizen_allocator_new ();
- g_atomic_int_set(&pool->outstandings, 0);
- GST_LOG_OBJECT (pool, "Tizen buffer pool init %p", pool);
+ return GST_BUFFER_POOL_CAST (g_object_new (GST_TYPE_TIZEN_BUFFER_POOL, NULL));
}
-
#include "config.h"
#endif
+#include "gstdmabuf.h"
#include "gsttizenmemory.h"
#include <tbm_surface_internal.h>
#define GST_TIZEN_ALLOCATOR_NAME "TizenVideoMemory"
-
-static GstAllocator *_tizen_allocator;
-
GST_DEBUG_CATEGORY_STATIC (gst_tizenmemory_debug);
#define GST_CAT_DEFAULT gst_tizenmemory_debug
allocator_class->free = gst_tizen_mem_free;
object_class->finalize = gst_tizen_allocator_finalize;
-
}
static void
GstAllocator *
gst_tizen_allocator_new (void)
{
- static volatile gsize _init = 0;
-
- if (g_once_init_enter (&_init)) {
-
- _tizen_allocator = g_object_new (GST_TYPE_TIZEN_ALLOCATOR, NULL);
- gst_allocator_register (GST_TIZEN_ALLOCATOR_NAME,
- gst_object_ref (_tizen_allocator));
- g_once_init_leave (&_init, 1);
- }
- return _tizen_allocator;
+ return g_object_new (GST_TYPE_TIZEN_ALLOCATOR, NULL);
}
GstMemory *
gst_tizen_allocator_alloc (GstAllocator * allocator, GstVideoInfo * vinfo)
{
- return (GstMemory *)_tizen_video_mem_new (_tizen_allocator, NULL, vinfo, NULL, NULL, NULL);
+ g_return_val_if_fail (GST_IS_TIZEN_ALLOCATOR (allocator), NULL);
+
+ return (GstMemory *)_tizen_video_mem_new (allocator, NULL, vinfo, NULL, NULL, NULL);
}
GstMemory *
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, user_data, notify);
+ g_return_val_if_fail (GST_IS_TIZEN_ALLOCATOR (allocator), NULL);
+
+ return (GstMemory *)_tizen_video_mem_new (allocator, NULL, vinfo, surface, user_data, notify);
}
gboolean
{
GstTizenMemory *tmem;
- g_return_val_if_fail (mem != NULL, NULL);
- g_return_val_if_fail (GST_IS_TIZEN_ALLOCATOR (mem->allocator), NULL);
+ g_return_val_if_fail (mem != NULL, -1);
+ g_return_val_if_fail (GST_IS_TIZEN_ALLOCATOR (mem->allocator), -1);
tmem = (GstTizenMemory *)mem;
gpointer * data, gint * stride, GstMapFlags flags)
{
gint err;
- gint bo_idx;
tbm_surface_info_s surface_info;
GstBuffer *buffer = meta->buffer;
GstTizenMemory *vmem =
(GstTizenMemory *) gst_buffer_get_memory (buffer, 0);
- g_return_val_if_fail (((GstMemory *) vmem)->allocator == _tizen_allocator,
- FALSE);
+ g_return_val_if_fail (GST_IS_TIZEN_ALLOCATOR (((GstMemory *) vmem)->allocator), FALSE);
err = tbm_surface_map (vmem->surface, TBM_SURF_OPTION_WRITE|TBM_SURF_OPTION_READ, &surface_info);
if (err == TBM_SURFACE_ERROR_NONE) {
GstTizenMemory *vmem =
(GstTizenMemory *) gst_buffer_get_memory (buffer, 0);
- g_return_val_if_fail (((GstMemory *) vmem)->allocator == _tizen_allocator,
- FALSE);
+ g_return_val_if_fail (GST_IS_TIZEN_ALLOCATOR (((GstMemory *) vmem)->allocator), FALSE);
tbm_surface_unmap (vmem->surface);
GST_DEBUG ("_video_memory_unmap -> plane : %d", plane);