} GstMetaMemoryImpl;
static gpointer
-meta_memory_mmap (GstMetaMemoryImpl * meta, gsize offset, gsize * size,
+meta_memory_mmap (GstMetaMemory * meta, gsize offset, gsize * size,
GstMetaMapFlags flags)
{
- *size = meta->params.size - offset;
- return meta->params.data + offset;
+ GstMetaMemoryImpl *impl = (GstMetaMemoryImpl *) meta;
+
+ *size = impl->params.size - offset;
+ return impl->params.data + offset;
}
static gboolean
-meta_memory_munmap (GstMetaMemoryImpl * meta, gpointer data, gsize size)
+meta_memory_munmap (GstMetaMemory * meta, gpointer data, gsize size)
{
return TRUE;
}
meta_memory_init (GstMetaMemoryImpl * meta, GstMetaMemoryParams * params,
GstBuffer * buffer)
{
- meta->memory.mmap_func = (GstMetaMapFunc) meta_memory_mmap;
- meta->memory.munmap_func = (GstMetaUnmapFunc) meta_memory_munmap;
+ meta->memory.mmap_func = meta_memory_mmap;
+ meta->memory.munmap_func = meta_memory_munmap;
meta->params = *params;
return TRUE;
}
typedef struct _GstMetaMemory GstMetaMemory;
+const GstMetaInfo *gst_meta_memory_get_info(void);
+#define GST_META_MEMORY_INFO (gst_meta_memory_get_info())
+
typedef enum {
GST_META_MAP_NONE = 0,
GST_META_MAP_READ = (1 << 0),
GST_META_MAP_WRITE = (1 << 1)
} GstMetaMapFlags;
-typedef gpointer (*GstMetaMapFunc) (GstMetaMemory *meta, guint offset, guint *size,
- GstMetaMapFlags flags);
-typedef gboolean (*GstMetaUnmapFunc) (GstMetaMemory *meta, gpointer data, guint size);
-
struct _GstMetaMemory
{
- GstMeta meta;
+ GstMeta meta;
- GstMetaMapFunc mmap_func;
- GstMetaUnmapFunc munmap_func;
+ gpointer (*mmap_func) (GstMetaMemory *meta, gsize offset, gsize *size,
+ GstMetaMapFlags flags);
+ gboolean (*munmap_func) (GstMetaMemory *meta, gpointer data, gsize size);
};
#define gst_meta_memory_map(m,o,s,f) ((m)->mmap_func(m, o, s, f))
#define gst_meta_memory_unmap(m,d,s) ((m)->munmap_func(m, d, s))
-const GstMetaInfo *gst_meta_memory_get_info(void);
-#define GST_META_MEMORY_INFO (gst_meta_memory_get_info())
+#define gst_buffer_get_meta_memory(b) ((GstMetaMemory*)gst_buffer_get_meta((b),GST_META_MEMORY_INFO))
GstMetaMemory * gst_buffer_add_meta_memory (GstBuffer *buffer, gpointer data,
GFreeFunc free_func,