Re: python binding - Gst.Message.new_error doesn't know how many arguments it wants

Jan Spurný JSpurny at seznam.cz
Thu Oct 29 08:33:24 PDT 2015


Hi,

thanks... that's exactly what I was affraid of :( I'll file a bugreport, but
it won't help me much because I need to post error message..

Is there any way to do it using Gst.Message.new_custom? I tried to convert C
code from gstmessage.c:

  GstMessage *message;
  GstStructure *structure;

  structure = gst_structure_new_id (GST_QUARK (MESSAGE_ERROR),
      GST_QUARK (GERROR), G_TYPE_ERROR, error,
      GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);
  message = gst_message_new_custom (GST_MESSAGE_ERROR, src, structure);

in Python as:

struct = Gst.Structure.new_id_empty(GLib.quark_from_string('GST_QUARK_
MESSAGE_ERROR'))

val1 = GObject.Value()
val1.init(GObject.TYPE_ERROR)
val1.set_error(GLib.Error())
struct['GST_QUARK_GERROR'] = val1

val2 = GObject.Value()
val2.init(GObject.TYPE_STRING)
val2.set_string('abc')
struct['GST_QUARK_DEBUG'] = val2

e = Gst.Message.new_custom(Gst.MessageType.ERROR, o, struct)


but I'm stuck because GLib.GValue doesn't accept GLib.Error.. which is 
probably similar problem..

Is there any other way to post error message from Element in python?

Or perhaps I got it wrong and I should just "raise(GLib.Error(...))" ? but 
then I wouldn't be able to return Gst.FlowReturn.ERROR...



---------- Původní zpráva ----------
Od: Thibault Saunier <tsaunier at gnome.org>
Komu: Discussion of the development of and with GStreamer <gstreamer-devel@
lists.freedesktop.org>
Datum: 29. 10. 2015 15:46:22
Předmět: Re: python binding - Gst.Message.new_error doesn't know how many 
arguments it wants

"Hello,

I confirm there is a bug here, and I have the feeling that it is in
PyGObject which getting messed up because of the GError which it does
not know how to deal with (usually GError are out arguments and are
used by PyGObject to throw exceptions).

Please open a bug report :)

Regards,

Thibault

On Thu, Oct 29, 2015 at 12:56 PM, Jan Spurný <JSpurny at seznam.cz> wrote:
> Hi,
>
> I encountered really weird behaviour of Gst.Message.new_error - according 
to
> documentation, it should accept 3 arguments - src, error and debug. But if
I
> pass 3 arguments, it throws an exception complaining that it needs 2
> arguments. When I pass 2 arguments, it suddenly wants 3. I'm stuck, 
because I
> can't use it.
>
> This is how to reproduce the behaviour:
>
>>>> import gi
>>>> gi.require_version('Gst', '1.0')
>>>> from gi.repository import Gst
>>>> Gst.init(None)
> []
>>>> o = Gst.ElementFactory.make('fakesink')
>>>> e = Gst.Message.new_error(o, None, None)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> TypeError: new_error() takes exactly 2 arguments (3 given)
>>>> e = Gst.Message.new_error(o, None)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> TypeError: new_error() takes exactly 3 argument(s) (2 given)
>>>>
>
> Debian Linux 8.2 amd64, python2.7, gstreamer 1.4.4.0
>
> Am I doing something wrong or am I forgetting something?
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20151029/30fb958b/attachment.html>


More information about the gstreamer-devel mailing list