diff --git a/gst/gstallocator.h b/gst/gstallocator.h index 99deee212a..5dadd441eb 100644 --- a/gst/gstallocator.h +++ b/gst/gstallocator.h @@ -97,6 +97,8 @@ typedef enum { * @mem_copy: the implementation of the GstMemoryCopyFunction * @mem_share: the implementation of the GstMemoryShareFunction * @mem_is_span: the implementation of the GstMemoryIsSpanFunction + * @mem_unmap_full: the implementation of the GstMemoryUnmapFullFunction. + * Will be used instead of @mem_unmap if present. Since 1.6 * * The #GstAllocator is used to create new memory. */ @@ -104,18 +106,20 @@ struct _GstAllocator { GstObject object; - const gchar *mem_type; + const gchar *mem_type; /*< public >*/ - GstMemoryMapFunction mem_map; - GstMemoryUnmapFunction mem_unmap; + GstMemoryMapFunction mem_map; + GstMemoryUnmapFunction mem_unmap; - GstMemoryCopyFunction mem_copy; - GstMemoryShareFunction mem_share; - GstMemoryIsSpanFunction mem_is_span; + GstMemoryCopyFunction mem_copy; + GstMemoryShareFunction mem_share; + GstMemoryIsSpanFunction mem_is_span; + + GstMemoryUnmapFullFunction mem_unmap_full; /*< private >*/ - gpointer _gst_reserved[GST_PADDING]; + gpointer _gst_reserved[GST_PADDING - 1]; GstAllocatorPrivate *priv; }; diff --git a/gst/gstmemory.c b/gst/gstmemory.c index 5da0f58729..511a6f3dd5 100644 --- a/gst/gstmemory.c +++ b/gst/gstmemory.c @@ -338,7 +338,10 @@ gst_memory_unmap (GstMemory * mem, GstMapInfo * info) g_return_if_fail (info != NULL); g_return_if_fail (info->memory == mem); - mem->allocator->mem_unmap (mem); + if (mem->allocator->mem_unmap_full) + mem->allocator->mem_unmap_full (mem, info->flags); + else + mem->allocator->mem_unmap (mem); gst_memory_unlock (mem, (GstLockFlags) info->flags); } diff --git a/gst/gstmemory.h b/gst/gstmemory.h index 4819e2a16b..5c66464b01 100644 --- a/gst/gstmemory.h +++ b/gst/gstmemory.h @@ -237,11 +237,18 @@ typedef gpointer (*GstMemoryMapFunction) (GstMemory *mem, gsize maxsize * @mem: a #GstMemory * * Return the pointer previously retrieved with gst_memory_map(). - * - * Returns: %TRUE on success. */ typedef void (*GstMemoryUnmapFunction) (GstMemory *mem); +/** + * GstMemoryUnmapFullFunction: + * @mem: a #GstMemory + * @flags: a #GstMapFlags + * + * Return the pointer previously retrieved with gst_memory_map() with @flags. + */ +typedef void (*GstMemoryUnmapFullFunction) (GstMemory *mem, GstMapFlags flags); + /** * GstMemoryCopyFunction: * @mem: a #GstMemory