Commit graph

40 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
Thibault Saunier
bfcf304857 Make it possible to use uninstalled symlinking the .so file 2012-08-19 23:00:53 -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