After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 702921 - [pygi] python applications cannot interpret buffer metadata
[pygi] python applications cannot interpret buffer metadata
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other All
: Normal normal
: 1.7.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-06-24 00:17 UTC by Zaheer Abbas Merali
Modified: 2015-10-27 13:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
netaddressmeta: gst_buffer_get_net_address_meta() as function (2.15 KB, patch)
2015-10-26 11:54 UTC, Stian Selnes (stianse)
committed Details | Review

Description Zaheer Abbas Merali 2013-06-24 00:17:19 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.
Comment 1 Thibault Saunier 2014-06-16 09:32:50 UTC
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))
Comment 2 jdemeyer 2014-11-12 09:37:48 UTC
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 !
Comment 3 Stian Selnes (stianse) 2015-10-26 11:54:37 UTC
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.
Comment 4 Stian Selnes (stianse) 2015-10-26 11:56:05 UTC
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()
Comment 5 Tim-Philipp Müller 2015-10-27 13:00:42 UTC
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).