Gst.Object.Replace doesn't seem to work
I'm trying to create a player, similar to (https://github.com/GStreamer/gst-plugins-base/blob/master/tools/gst-play.c)
In the handler for
GST_MESSAGE_STREAM_COLLECTION (line 534) there's a call to
gst_object_replace. If I understand correctly, it's supposed to replace an old collection with the new by replacing the pointers.
I try to use
Gst.Object.Replace, but it doesn't seem to work and there's an error:
(GstPlayer.exe:19812): GStreamer-CRITICAL **: gst_object_replace: assertion 'oldobj != NULL' failed
When I look at the code for the
Replace method it seems that there are a few errors.
gst_object_replacetakes a **, so the import should probably be
static extern bool gst_object_replace(ref IntPtr oldobj, IntPtr newobj);// note the ref oldobj
- Also, the
Replacemethod should also take a
ref Gst.Object oldobjparameter.
- In the case when the oldptr==null , the IntPtr value sent to the
gst_object_replaceis not an
oldobj, so the
- However, since handles in Gst.Object cannot just be replaced, when
gst_object_replacereturns true, a new value for the
oldobjneeds to be created with the replaced handle.
Attached are the test and the patch. There are two versions of Replace, a generic and non-generic. Test shows the usage for both of them.
Hope it's OK, Tom