Commit graph

69 commits

Author SHA1 Message Date
Mathieu Duponchelle
055e2e17ec Remove __init__.py files
They were not installed, and were simply used for our
uninstalled setup, which we now implement differently.
2018-10-28 14:14:09 +01:00
Havard Graff
e9d615bf53 gstmodule: fix warning when building against python2
PyMapping_GetItemString’ discards ‘const’ qualifier from pointer target type

https://bugzilla.gnome.org/show_bug.cgi?id=796093
2018-05-14 07:51:43 -04:00
Emilio Pozuelo Monfort
e84b9b05f2 overrides: use get_introspection_module
https://bugzilla.gnome.org/show_bug.cgi?id=795555
2018-04-25 15:10:28 -03:00
Thibault Saunier
861a67bde6 overrides: Fix mixup between query function and chain one 2018-04-07 21:47:29 -03:00
Nicolas Dufresne
146b8cca43 makefiles: Add missing dist files
https://bugzilla.gnome.org/show_bug.cgi?id=793560
2018-02-22 17:05:35 -05:00
Thibault Saunier
693005716e bitmask: Do not use long() directly with python3
It doesn't exist anymore there
2018-02-22 08:05:54 -03:00
Thibault Saunier
fb9401d6e9 gi: Check Gst has not been initialized before loading bindings
It can have been initialized by some C code (in a C app with plugins
for example).

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=788088
2018-02-22 07:52:24 -03:00
Sebastian Dröge
063562c986 Allow Bitmask to be created from ints and longs but always store as long
We need a 64 bit integer, and previously the test failed because it was
already created from longs in various cases (e.g. when reading from a
GstStructure).
2018-02-22 10:58:48 +01:00
Mathieu Duponchelle
8a807cc1be overrides: accept Gst.Structure in Caps.__new__
Also rename misleading parameter (*kwargs -> *args)

https://bugzilla.gnome.org/show_bug.cgi?id=793493
2018-02-15 20:23:34 +01:00
Sebastian Dröge
2dd3bb0cb7 Ship meson build system in autotools generated tarballs 2018-01-23 19:32:18 +02:00
Thibault Saunier
a8aaada019 meson: Fix detection of overrides path in some cases 2017-08-03 14:38:36 -04:00
Thibault Saunier
fcbca025e3 Fix simply running testsuite in meson
- Make sure to never have root folder in sys.path when running meson,
  as pythondetector won't be able to access gi._overridesdir

- Generate a mesonconfig.py file that will be used by the testsuite to
  know where meson generated files, making `python -m unittest` working.
2017-07-26 15:27:21 -04:00
Thibault Saunier
cb0dd804f7 Add support for Gst.Bitmask 2017-07-26 15:27:21 -04:00
Thibault Saunier
dd943155a1 structure: Add a .keys() method and implement __str__
We are making it behave like a dict, so we should provide the
same kind of utilities.
2017-07-26 15:27:21 -04:00
Thibault Saunier
31dfe42b37 Return a Gst.*Range instead of a python range converting from GValue to python
Otherwise we lose the information about what type of range it is, which
is mandatory, especially when dealing with Structure and Caps.
2017-07-26 15:27:21 -04:00
Thibault Saunier
02ddaf29f9 structures: Override __new__ to make it more pythonic 2017-07-26 15:27:19 -04:00
Olivier Crête
24156b0b0d overrides: Remove IntRange And Int64Range on Python2
They use the range() built-in type which is a Python 3 change.

https://bugzilla.gnome.org/show_bug.cgi?id=782927
2017-05-21 18:08:36 +02:00
Nicolas Dufresne
d44975a1fe array/list: Make gvalue conversion symmetric
This is needed to support matrix. Otherwise, getting
a matrix would remove the rows envelopess, which would
make the "cast" fails, since it would not know if the
internal rows are ValueArray or ValueList. I think reading,
modifying and setting back the matrix is an important use
case.
2017-03-27 15:02:41 -04:00
Nicolas Dufresne
c6dee2c26b gstmodule: Factor out gst type creation
This reduces a lot the boiler plate all over. At the same
time, use N instead of O when passing PyObject to fix
the objects leaks.
2017-03-27 14:52:24 -04:00
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