X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gst%2Fgstallocator.c;h=20ced4873aff42a708ab8677a0b07920b2613c1e;hb=5470f6df00595f4ab44871e0e633bf15006abc5c;hp=367fc2a93fb6b12f11e2b50da02d943c0e758e46;hpb=a837ff6581ba16180e89352a753296cd74a85a72;p=platform%2Fupstream%2Fgstreamer.git diff --git a/gst/gstallocator.c b/gst/gstallocator.c index 367fc2a..20ced48 100644 --- a/gst/gstallocator.c +++ b/gst/gstallocator.c @@ -21,6 +21,7 @@ /** * SECTION:gstallocator + * @title: GstAllocator * @short_description: allocate memory blocks * @see_also: #GstMemory * @@ -47,9 +48,6 @@ GST_DEBUG_CATEGORY_STATIC (gst_allocator_debug); #define GST_CAT_DEFAULT gst_allocator_debug -#define GST_ALLOCATOR_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_ALLOCATOR, GstAllocatorPrivate)) - struct _GstAllocatorPrivate { gpointer dummy; @@ -76,13 +74,12 @@ static GstAllocator *_sysmem_allocator; static GRWLock lock; static GHashTable *allocators; -G_DEFINE_ABSTRACT_TYPE (GstAllocator, gst_allocator, GST_TYPE_OBJECT); +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GstAllocator, gst_allocator, + GST_TYPE_OBJECT); static void gst_allocator_class_init (GstAllocatorClass * klass) { - g_type_class_add_private (klass, sizeof (GstAllocatorPrivate)); - GST_DEBUG_CATEGORY_INIT (gst_allocator_debug, "allocator", 0, "allocator debug"); } @@ -132,7 +129,7 @@ _fallback_mem_is_span (GstMemory * mem1, GstMemory * mem2, gsize * offset) static void gst_allocator_init (GstAllocator * allocator) { - allocator->priv = GST_ALLOCATOR_GET_PRIVATE (allocator); + allocator->priv = gst_allocator_get_instance_private (allocator); allocator->mem_copy = _fallback_mem_copy; allocator->mem_is_span = _fallback_mem_is_span; @@ -158,13 +155,13 @@ gst_allocation_params_init (GstAllocationParams * params) /** * gst_allocation_params_copy: - * @params: (transfer none): a #GstAllocationParams + * @params: (transfer none) (nullable): a #GstAllocationParams * * Create a copy of @params. * * Free-function: gst_allocation_params_free * - * Returns: (transfer full): a new ##GstAllocationParams, free with + * Returns: (transfer full) (nullable): a new ##GstAllocationParams, free with * gst_allocation_params_free(). */ GstAllocationParams * @@ -289,7 +286,7 @@ gst_allocator_set_default (GstAllocator * allocator) * the amount of bytes to align to. For example, to align to 8 bytes, * use an alignment of 7. * - * Returns: (transfer full): a new #GstMemory. + * Returns: (transfer full) (nullable): a new #GstMemory. */ GstMemory * gst_allocator_alloc (GstAllocator * allocator, gsize size, @@ -360,7 +357,7 @@ typedef struct GstAllocatorClass parent_class; } GstAllocatorSysmemClass; -GType gst_allocator_sysmem_get_type (void); +static GType gst_allocator_sysmem_get_type (void); G_DEFINE_TYPE (GstAllocatorSysmem, gst_allocator_sysmem, GST_TYPE_ALLOCATOR); /* initialize the fields */ @@ -593,6 +590,9 @@ _priv_gst_allocator_initialize (void) _sysmem_allocator = g_object_new (gst_allocator_sysmem_get_type (), NULL); + /* Clear floating flag */ + gst_object_ref_sink (_sysmem_allocator); + gst_allocator_register (GST_ALLOCATOR_SYSMEM, gst_object_ref (_sysmem_allocator)); @@ -627,7 +627,7 @@ _priv_gst_allocator_cleanup (void) * The prefix/padding must be filled with 0 if @flags contains * #GST_MEMORY_FLAG_ZERO_PREFIXED and #GST_MEMORY_FLAG_ZERO_PADDED respectively. * - * Returns: (transfer full): a new #GstMemory. + * Returns: (transfer full) (nullable): a new #GstMemory. */ GstMemory * gst_memory_new_wrapped (GstMemoryFlags flags, gpointer data,