data = (guint8 *) mem + sizeof (GstMemoryDefault);
if ((aoffset = ((guintptr) data & align)))
- aoffset = align - aoffset;
+ aoffset = (align + 1) - aoffset;
_default_mem_init (mem, 0, NULL, slice_size, data, NULL, maxsize + align,
aoffset + offset, size);
* @maxsize: allocated size of @data
* @align: alignment for the data
*
- * Allocate a new memory block with memory that is at least @maxsize big and las
+ * Allocate a new memory block with memory that is at least @maxsize big and has
* the given alignment.
*
+ * @align is given as a bitmask so that @align + 1 equals the amount of bytes to
+ * align to. For example, to align to 8 bytes, use an alignment of 7.
+ *
* Returns: a new #GstMemory.
*/
GstMemory *
{
GstMemoryDefault *mem;
+ g_return_val_if_fail (((align + 1) & align) == 0, NULL);
+
mem = _default_mem_new_block (maxsize, align, 0, maxsize);
return (GstMemory *) mem;