[gst-devel] what do people think about GError?
Andy Wingo
wingo at pobox.com
Tue Apr 9 19:54:07 CEST 2002
On Wed, 10 Apr 2002, Benjamin Otte wrote:
> I don't think GError should be used much in any library. It clutters up
> the code and makes it harder to understand (just look at the examples).
It does clutter a little bit, but it also documents the code. Granted,
this is a minor point.
> Input validation is most of the time a job that the application should do.
> Only functions that do user input validation (like gstparse) should use
> GError.
Agreed, and this is consistent with GError design. but...
> I really don't think function like gst_elementfactory_make should use
> GError to indicate if the error was "no such element", "not enough memory"
> or something else. If you're really interested in that, you can check this
> in advance.
In the specific case of gst_elementfactory_make (which probably should
be gst_element_factory_make, and padtemplate should be pad_template, but
that's a fight for another day...), the only error that one can get
while making is "no such element", so no GError is needed. For
GStreamer, I can't think of any functions that have multiple error
conditions, other than parse stuff. That was really my question.
> Sorry for ranting,
It's ok :-)
> PS: I don't think that the parsing stuff belongs into the core anyway. Or
> is there anything but -launch that uses it?
Nope. Although it is documented in the manual, and there is example
code, and -launch-gui uses it, and in the future I'd like to get the
editor to be able to use it. That said, I think a nice way to do it
would be to contain the main code in a plugin library, so that
gst_parse_launch can just gst_library_load ("gstparse"); and load it up
on demand. That would not be hard to do with the given code.
Regards,
wingo.
More information about the gstreamer-devel
mailing list