GNOME Bugzilla – Bug 729123
sdp: GstSdp.SDPMessage.parse_buffer needs a guint8* + annotation corrections
Last modified: 2014-09-24 08:28:08 UTC
To generated a sdpmessage from a string, one use in C the gst_sdp_message_parse_buffer function: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstsdpmessage.html#gst-sdp-message-parse-buffer
The Python introspection hence ask for a Python int. In addition, instead of returning the SDPMessage, it needs to be passed as an argument. In conclusion, the parse_buffer function cannot be called at all.
In addition, creating a SDPMessage object can be done via GstSdp.SDPMessage() or via GstSdp.SDPMessage.new(). With the former, segfault may appear when calling SDPMessage methods.
More generally, the GstSdp library may need an annotation update to be really usable with Python bindings. It may be interesting to do it before the arrival of webrtc element in gstreamer.
I'm willing to propose patches, but I can't guarantee their quality nor their arrivals.
This needs some gobject-introspection annotations in the code for the parameters. For the buffer and size (array length=buffer), for the SDP message something like (out) (transfer none), but not really. More like (ref) because the message must be allocated by the caller... but there seems to be nothing like that unless I'm missing something.
In general the SDP library needs some spreading around of gobject-introspection annotations to properly work with bindings. See https://wiki.gnome.org/action/show/Projects/GObjectIntrospection/Annotations
Ideally all functions here should have the SDP message as first parameter, but they don't. But can't you call msg = GstSdp.SDPMessage.new() and then GstSdp.SDPMessage.parse_buffer(buffer, msg)?
This is what is returned from introspection by ipython:
Docstring: parse_buffer(data:int, size:int, msg:GstSdp.SDPMessage)
As you can see, there is no way to call GstSdp.SDPMessage.parse_buffer(buffer, msg) as you proposed, even by allocating a SdpMessage before. I can't see any workaround here.
I acknowledge that the whole SDP library should have its gobject-introspection
annotations updated, I had the same conclusion. Especially, some functions like new() shouldn't be used at all, and shouldn't be seen by the gobject-introspection. The bug is more general that just the parse_buffer function.
I don't know how to update the introspection annotations yet. I'll try to submit patches in a couple of weeks. As mentionned, I believe that many people would use SDPMessage once a webrtc plugin is in the gstreamer tree.
Does this help?
I'll go over the other functions this evening and add annotations as necessary. My python-gi is broken currently, have to fix that first later to actually test these things :)
Author: Sebastian Dröge <email@example.com>
Date: Thu May 1 15:11:04 2014 +0200
sdp: Add some more gobject-introspection annotations for bindings
Sorry for the very late answer... I've struggled to compile gstreamer to test your commits.
I'd say that the new annotations seem to make Python bindings work, especially the parse_buffer function.
But there are still several annotations to edit to make the GstSdp library binding fully working. Is there any way I can help ?
You can provide patches, it's not too difficult and I can help you with that. Or you can file bugs about the functions that don't work, and how they don't work (so ideally with a simple testcase) and I (or someone else) can fix it :)