GNOME Bugzilla – Bug 702921
[pygi] python applications cannot interpret buffer metadata
Last modified: 2015-10-27 13:01:00 UTC
Use case: udpsrc ! fakesink Buffer probe on src pad of udpsrc, callback fires on packet. Try to find out what the remote IP and port is. This has been added as metadata on a per buffer basis. Came up with the following: def on_udp_packet_arrived(pad, info, _user_data): net_address_type = GObject.type_from_name("GstNetAddressMetaAPI") buf = Gst.PadProbeInfo.get_buffer(info) info = buf.get_meta(net_address_type) print(dir(info)) This outputs: ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__gtype__', '__hash__', '__info__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'api_type_has_tag', 'api_type_register', 'flags', 'get_info', 'info', 'register'] Looking at the info property shows not much useful.
You should do: > from gi.repository import GstNet > def on_udp_packet_arrived(pad, info, _user_data): > buf = Gst.PadProbeInfo.get_buffer(info) > info = buf.get_meta(GstNet.NetAddressMeta) > print(dir(info))
Hello, I try to find help first on the gstreamer-devel ML : http://lists.freedesktop.org/archives/gstreamer-devel/2014-November/050337.html I can write a "hello world" plugin, but I don't succeed in getting metadata linked with buffers. I can get the adress of the corresponding metadata, but all I get is a "void" object (see below). MyMetaAPI comes from a C header file (I can provide it if necessary). I posted the code here : https://gist.github.com/macq-jdemeyer/1856b0045244e4c56205 the " print(meta)" instructions returns : <void at 0xb4e0fd54> Thanks !
Created attachment 314130 [details] [review] netaddressmeta: gst_buffer_get_net_address_meta() as function Implement gst_buffer_get_net_address_meta() as a function instead of a macro in order to get gobject-introspection to work.
Example usage with the patch above: meta = GstNet.buffer_get_net_address_meta(buffer) sockaddr = meta.addr address = sockaddr.get_address() port = sockaddr.get_port()
Thanks, pushed: commit 85b93fa347262b6d7384e577664a658fe8854c88 Author: Stian Selnes <stian@pexip.com> Date: Mon Oct 26 12:50:12 2015 +0100 netaddressmeta: gst_buffer_get_net_address_meta() as function Implement gst_buffer_get_net_address_meta() as a function instead of a macro in order to get gobject-introspection to work. https://bugzilla.gnome.org/show_bug.cgi?id=702921 without the 'Since' marker though (since that would be confusing IMHO, as it applies to the C API).