#undef gst_buffer_new_wrapped_full
#define gst_buffer_new_wrapped_full(flags, data, maxsize, ofs, size, ud, udd) \
gst_compat_buffer_new_wrapped_full(flags, data, maxsize, ofs, size, ud, udd)
+#undef gst_buffer_new_allocate
+#define gst_buffer_new_allocate(allocator, size, params) \
+ gst_compat_buffer_new_allocate((allocator), (size), (params))
#undef gst_buffer_get_size
#define gst_buffer_get_size(buffer) gst_compat_buffer_get_size(buffer)
#undef gst_buffer_map
#undef gst_buffer_extract
#define gst_buffer_extract(buffer, offset, dest, size) \
gst_compat_buffer_extract(buffer, offset, dest, size)
+#undef gst_buffer_fill
+#define gst_buffer_fill(buffer, offset, src, size) \
+ gst_compat_buffer_fill((buffer), (offset), (src), (size))
#undef gst_buffer_copy_into
#define gst_buffer_copy_into(dest, src, flags, offset, size) \
gst_compat_buffer_copy_into(dest, src, flags, offset, size)
GstBuffer *buffer;
/* XXX: unsupported */
- g_return_val_if_fail(user_data == NULL, NULL);
- g_return_val_if_fail(notify == NULL, NULL);
g_return_val_if_fail(maxsize >= size, NULL);
buffer = gst_buffer_new();
GST_BUFFER_DATA(buffer) = data + offset;
GST_BUFFER_SIZE(buffer) = size;
+
+ if (notify)
+ gst_mini_object_weak_ref(GST_MINI_OBJECT_CAST(buffer),
+ (GstMiniObjectWeakNotify)notify, user_data);
return buffer;
}
+static inline GstBuffer *
+gst_compat_buffer_new_allocate(gpointer allocator, gsize size, gpointer params)
+{
+ /* XXX: unsupported */
+ g_return_val_if_fail(allocator == NULL, NULL);
+ g_return_val_if_fail(params == NULL, NULL);
+
+ return gst_buffer_new_and_alloc(size);
+}
+
static inline gsize
gst_compat_buffer_get_size(GstBuffer *buffer)
{
return esize;
}
+static inline gsize
+gst_compat_buffer_fill(GstBuffer *buffer, gsize offset, gconstpointer src,
+ gsize size)
+{
+ gsize fsize;
+
+ if (!buffer || !src || offset >= GST_BUFFER_SIZE(buffer))
+ return 0;
+
+ fsize = MIN(size, GST_BUFFER_SIZE(buffer) - offset);
+ memcpy(GST_BUFFER_DATA(buffer) + offset, src, fsize);
+ return fsize;
+}
+
static inline void
gst_compat_buffer_copy_into(GstBuffer *dest, GstBuffer *src,
GstBufferCopyFlags flags, gsize offset, gsize size)