gst: Add factory Gst.AllocationParams.create()
Let me know what you think!
There is no direct way to create a Gst.AllocationParams in Vala. This is because GStreamer code usually stack-allocates AllocationParams instances. Add a custom factory function that heap-allocates an instance. Use the slice allocator since gst_allocation_params_free() assumes that instances are slice-allocated.
The ugly part is that it uses a variable with a cname
that is a full allocation expression. I tried a number of different options and couldn't find a better way --- I'm hoping you know of one! I did see that #442 and #749 seem to be related issues that constrain the options.
With this change, the following test program compiles and runs:
using Gst;
public int main()
{
AllocationParams a = Gst.AllocationParams.create(); // Call the new factory function
print("%p: flags %x align %zu prefix %zu padding %zu\n",
&a, a.flags, a.align, a.prefix, a.padding);
return 0;
}
(Download the above source or the generated C code)
Edited by Chris White