Commit graph

50 commits

Author SHA1 Message Date
Nicolas Dufresne
a4566ffbc8 overrides: Add more GstValue overrides
This patch adds overrides to support IntRange, Int64Range, DoubleRange,
FractionRange, Array and List. For integer ranges, it maps this
to python 'range'. Gst.IntRange() and Gst.Int64Range() are simple cast
to let the underlying code know which GType to use. To set such range in
python you will do:

  structure["range"] = Gst.IntRange(range(0,10,2)))

Same for the 64 bit variant. And when you do:

  r = structure.get_value("range")

A range will be returned directly, without the wrapper. For DoubleRange
and FractionRange, there is no native support in python. So the usage
will be:

  structure["range"] = Gst.DoubleRange(0,10.0)
  structure["range"] =
      Gst.FractionRange(Gst.Fraction(1/30), Gst.Fraction(1/5)

When getting this value, Gst.DoubleRange and Gst.FractionRange class are
returned. They both have start/stop members. The naming was taken from
range type.

For Array and List, both uses the native list type, though they can be
constructed from any python sequence. So again, the class is just like
a cast, to let it pick the right GType and python list are being
returned.

  structure["list"] = Gst.ValueList([1,2,3,4])
  structure["array"] = Gst.ValueArray([1,2,3,4)

Using string and tuple could also work. Since Gst.ValueList/Array are
sequence, you can convert one to the other with:

  list = Gst.ValueList([1,2,3,4])
  array = Gst.ValueArray (list)

https://bugzilla.gnome.org/show_bug.cgi?id=753754
2017-03-24 13:26:21 -04:00
Thibault Saunier
16f971226d Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson
2016-09-05 12:13:03 -03:00
Hanno Boeck
58c324e0cc NULL-terminate PyMethodDef array
PyMethodDef arrays are supposed to end with an entry full of NULL/0 values.
This is missing in gst-python in the file gstmodule.c.

This causes out of bounds memory reads which can be seen / tested by compiling
gst-python with address sanitizer (-fsanitize=address in CFLAGS/LDFLAGS).

https://bugzilla.gnome.org/show_bug.cgi?id=762766
2016-02-27 13:52:07 +02:00
Thibault Saunier
eb043251ee Fix bug when checking template object type 2016-02-20 21:47:09 +01:00
Thibault Saunier
7b627c499d gst: Fix a crash when passing wrong type as __templates__ 2016-02-15 23:28:47 +01:00
Thibault Saunier
8b94b967a0 Avoid warning about gi.require_version not being called 2016-02-08 11:30:08 +01:00
Mark Nauwelaerts
9352c54ced overrides: also provide wrapper for trace level debug logging 2015-11-08 11:56:41 +01:00
Mark Nauwelaerts
664c153a5f overrides: fix a few typos in exception messages 2015-11-08 11:56:20 +01:00
Mark Nauwelaerts
1f26b4ad2b overrides: chain up to base __init__ in Pad override
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=757108
2015-10-26 14:36:00 +01:00
Thibault Saunier
ed1f9eccba tests: Fix tests in python2
Python2 core checks that the first argument of a method is of the type
of the object if it does not have any info about the method, so when
using Gst not initialized it raiser a TypeError and not a
Gst.NotInitialized as expected.

+ And fix a typo
2015-04-24 11:25:38 +02:00
Thibault Saunier
74f7ffbb24 overrides: Do not use inspect.signature as it is not avalaible in python2
Fix regression from https://bugzilla.gnome.org/show_bug.cgi?id=746329
2015-04-24 11:15:09 +02:00
Thibault Saunier
6b32ccbbb2 overrides: Disable all GStreamer APIs until Gst has been initialized
Summary:
And throw an exception if the user tries to call any Gst API without
initializing gst.

https://bugzilla.gnome.org/show_bug.cgi?id=747555

Reviewers: Mathieu_Du

Differential Revision: http://phabricator.freedesktop.org/D87
2015-04-24 09:16:53 +02:00
Thibault Saunier
3d19875eb7 overrides: Try hard to make the query writable in the pad query function
Summary:
We know that the bindings will get an extra ref but we know that
it is not actually needed, so we are safe to decrease the refcount
by one in that particular context making sure we give PyGI its
ref back when we are done.

Reviewers: Mathieu_Du

Differential Revision: http://phabricator.freedesktop.org/D41

https://bugzilla.gnome.org/show_bug.cgi?id=746329
2015-03-19 10:27:51 +01:00
Thibault Saunier
ed1c9866a2 Add an example sink element and override the chain and event functions of pads
Otherwize we will get 2 time acces to the element in it, which does
not make much sense. The _full variant can still be used.
2014-06-06 10:35:09 +02:00
Christoph Reiter
4c08c3396c overrides: Don't pass arguments to Boxed base class __init__() in Gst.Caps override.
This is needed since: https://git.gnome.org/browse/pygobject/commit/?id=3a2bfc8bf01fcae3863

https://bugzilla.gnome.org/show_bug.cgi?id=730596
2014-05-22 23:09:27 +02:00
Lubosz Sarnecki
16979ed48b python3: apply pep 238 for division overload
Python 3 needs an __truediv__ operator method, used in GstFraction.

see: http://legacy.python.org/dev/peps/pep-0238/

https://bugzilla.gnome.org/show_bug.cgi?id=726920
2014-04-01 09:56:13 +02:00
Thibault Saunier
edd21362f6 overrides: Import the _gi_gst module relative
We always expect it to be in the same directory and it fixes its import
with python3

https://bugzilla.gnome.org/show_bug.cgi?id=726921
2014-04-01 09:56:13 +02:00
Sebastian Dröge
bf9f11ee07 Fix automake warning
INCLUDES is the old name of AM_CPPFLAGS and is deprecated.
2014-03-29 15:01:26 +01:00
Sebastian Dröge
9f0eb95a7a Fix extension of native Python module
When building debug modules this e.g. has to be _d.so instead of just .so
2014-03-29 15:01:24 +01:00
Thibault Saunier
8cc4bda46a overrides: Checking an empty caps should return False 2014-03-15 16:27:44 +01:00
Simon Farnsworth
c889037e40 Fix zip code of new FSF address
I missed the zip code last time round - fix it. Thanks to Michael Schwendt
in https://bugzilla.redhat.com/show_bug.cgi?id=1034341#c11 for pointing this
out to me.

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>

https://bugzilla.gnome.org/show_bug.cgi?id=720317
2013-12-12 11:35:41 +00:00
Olivier Crête
8542c4b219 Gst: Add python version of GST_TIME_ARGS 2013-12-03 18:00:38 -05:00
Simon Farnsworth
2ad767a74c Update FSF address
The FSF has moved since these files were created. Update the address, in
order to keep packaging tools such as rpmlint quiet.

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>

https://bugzilla.gnome.org/show_bug.cgi?id=715182
2013-11-26 15:28:53 +00:00
Sebastian Dröge
25a0d4b8f9 Fix another syntax error with newer Python versions 2013-09-30 13:27:33 +02:00
Sebastian Dröge
46cab502ef Fix compilation with Python 3.0
Changes partially taken from pygobject.
2013-09-30 12:45:59 +02:00
Thibault Saunier
9d1666ad07 Gst: Do not initialize Gst at init
Letting the user choose when to initialize it himself
2013-08-26 17:35:48 -04:00
Thibault Saunier
637fdac676 overrides: Force symlinks when making
Making make distcheck pass
2013-08-23 22:01:46 -04:00
Thibault Saunier
2ac104ea94 gstmodule: Check that we could retrieve the module before using it
And plug a small leak
2013-08-23 21:49:12 -04:00
Mark Nauwelaerts
5a08c1ba41 overrides: symlink some more to use uninstalled out-of-source build 2012-12-30 16:11:30 +01:00
Thibault Saunier
827a137189 overrides: implement Gst.Structure.__setitem__ 2012-12-07 14:18:21 -03:00
Alessandro Decina
33d57f045a overrides: implement Gst.Structure.__getitem__ 2012-11-22 07:11:45 +01:00
Alessandro Decina
02ca5d3ad2 overrides: move add(*args) override from Gst.Pipeline to Gst.Bin 2012-11-04 17:02:24 +01:00
Alessandro Decina
d6c8df0352 overrides: move the Gst.Pad override before Gst.GhostPad
...else gi will screw up the type hierarchy and GhostPad will inherit from the
non-overridden Gst.Pad. Got it?
2012-11-04 17:00:14 +01:00
Alessandro Decina
aba84580b3 overrides: override GhostPad.__init__ 2012-10-24 20:47:37 +02:00
Alessandro Decina
33541f1cd8 overrides: make Gst.Pad.link still return Gst.PadLinkReturn when successful 2012-10-15 09:56:43 +02:00
Alessandro Decina
f08af0a173 overrides: add encoding profile(s) overrides in GstPbutils 2012-10-15 09:49:25 +02:00
Alessandro Decina
374a4b50da overrides: make filter arg in Gst.Pad.query_caps(filter) default to None 2012-10-15 09:29:06 +02:00
Alessandro Decina
64db9c4771 overrides: set default value for name arg in ElementFactory.make(factory, name)
So you can use Gst.ElementFactory.make('fakesrc') instead of
Gst.ElementFactory.make('fakesrc', None)
2012-10-15 09:29:06 +02:00
Alessandro Decina
ec51f6bfd7 overrides: make Gst.Pad.link raise Gst.LinkError 2012-10-15 09:29:06 +02:00
Alessandro Decina
73fd67f6d3 overrides: implement Gst.Pipeline.add(e1, e2, ...) 2012-10-15 09:29:06 +02:00
Alessandro Decina
501db56597 overrides: implement the python iterator protocol for Gst.Iterator
So that you can use: for value in gst_iterator: ...
2012-10-15 09:29:06 +02:00
Alessandro Decina
0b0202cfbe overrides: implement caps[i] and len(caps) 2012-10-15 09:29:06 +02:00
Alessandro Decina
50db685aef overrides: don't install our gi/overrides/__init__.py
We don't want to override the gi/overrides/__init__.py from pygobject
2012-10-15 09:28:57 +02:00
Mark Nauwelaerts
93ab67c78b overrides: provide for gst-python style debug logging
Also provide a default debug category for the binding glue code.
2012-09-27 14:41:29 +02:00
Mark Nauwelaerts
c4026f81f1 overrides: symlink some more to use uninstalled 2012-09-27 14:19:52 +02:00
René Stadler
acd4de381c overrides: Fix crash in add_template
templ vs. templates. Moved variable declarations to the inner scope to prevent
such a mistake.
2012-08-29 10:05:37 -07:00
Thibault Saunier
bfcf304857 Make it possible to use uninstalled symlinking the .so file 2012-08-19 23:00:53 -04:00
Thibault Saunier
5adc55d50f overrides: Make it possible to add metadatas and PadTemplates to GstElementClass 2012-08-19 22:45:58 -04:00
Thibault Saunier
0f8f27e55c Implement the glue code so GstFraction works 2012-08-19 18:56:29 -04:00
Thibault Saunier
7ee9ce29ea Add overrides for GObject Introspection 2012-08-19 18:54:37 -04:00