mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 13:11:06 +00:00
python: auto-pep8 whitespace issues in overrides
Needed because the next commit edits this file. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4753>
This commit is contained in:
parent
ca4762168f
commit
62951ed379
1 changed files with 70 additions and 9 deletions
|
@ -53,9 +53,11 @@ python module to use with Gst 0.10"
|
||||||
class URIHandler(Gst.URIHandler):
|
class URIHandler(Gst.URIHandler):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
URIHandler = override(URIHandler)
|
URIHandler = override(URIHandler)
|
||||||
__all__.append('URIHandler')
|
__all__.append('URIHandler')
|
||||||
|
|
||||||
|
|
||||||
class Element(Gst.Element):
|
class Element(Gst.Element):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def link_many(*args):
|
def link_many(*args):
|
||||||
|
@ -67,6 +69,7 @@ class Element(Gst.Element):
|
||||||
raise LinkError(
|
raise LinkError(
|
||||||
'Failed to link {} and {}'.format(pair[0], pair[1]))
|
'Failed to link {} and {}'.format(pair[0], pair[1]))
|
||||||
|
|
||||||
|
|
||||||
Element = override(Element)
|
Element = override(Element)
|
||||||
__all__.append('Element')
|
__all__.append('Element')
|
||||||
|
|
||||||
|
@ -95,6 +98,7 @@ class Bin(Gst.Bin):
|
||||||
Bin = override(Bin)
|
Bin = override(Bin)
|
||||||
__all__.append('Bin')
|
__all__.append('Bin')
|
||||||
|
|
||||||
|
|
||||||
class Caps(Gst.Caps):
|
class Caps(Gst.Caps):
|
||||||
|
|
||||||
def __nonzero__(self):
|
def __nonzero__(self):
|
||||||
|
@ -135,9 +139,11 @@ class Caps(Gst.Caps):
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return self.get_size()
|
return self.get_size()
|
||||||
|
|
||||||
|
|
||||||
Caps = override(Caps)
|
Caps = override(Caps)
|
||||||
__all__.append('Caps')
|
__all__.append('Caps')
|
||||||
|
|
||||||
|
|
||||||
class PadFunc:
|
class PadFunc:
|
||||||
def __init__(self, func):
|
def __init__(self, func):
|
||||||
self.func = func
|
self.func = func
|
||||||
|
@ -159,6 +165,7 @@ class PadFunc:
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
class Pad(Gst.Pad):
|
class Pad(Gst.Pad):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(Gst.Pad, self).__init__(*args, **kwargs)
|
super(Gst.Pad, self).__init__(*args, **kwargs)
|
||||||
|
@ -197,9 +204,11 @@ class Pad(Gst.Pad):
|
||||||
raise LinkError(ret)
|
raise LinkError(ret)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
Pad = override(Pad)
|
Pad = override(Pad)
|
||||||
__all__.append('Pad')
|
__all__.append('Pad')
|
||||||
|
|
||||||
|
|
||||||
class GhostPad(Gst.GhostPad):
|
class GhostPad(Gst.GhostPad):
|
||||||
def __init__(self, name, target=None, direction=None):
|
def __init__(self, name, target=None, direction=None):
|
||||||
if direction is None:
|
if direction is None:
|
||||||
|
@ -216,23 +225,36 @@ class GhostPad(Gst.GhostPad):
|
||||||
def query_caps(self, filter=None):
|
def query_caps(self, filter=None):
|
||||||
return Gst.GhostPad.query_caps(self, filter)
|
return Gst.GhostPad.query_caps(self, filter)
|
||||||
|
|
||||||
|
|
||||||
GhostPad = override(GhostPad)
|
GhostPad = override(GhostPad)
|
||||||
__all__.append('GhostPad')
|
__all__.append('GhostPad')
|
||||||
|
|
||||||
|
|
||||||
class IteratorError(Exception):
|
class IteratorError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
__all__.append('IteratorError')
|
__all__.append('IteratorError')
|
||||||
|
|
||||||
|
|
||||||
class AddError(Exception):
|
class AddError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
__all__.append('AddError')
|
__all__.append('AddError')
|
||||||
|
|
||||||
|
|
||||||
class LinkError(Exception):
|
class LinkError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
__all__.append('LinkError')
|
__all__.append('LinkError')
|
||||||
|
|
||||||
|
|
||||||
class MapError(Exception):
|
class MapError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
__all__.append('MapError')
|
__all__.append('MapError')
|
||||||
|
|
||||||
|
|
||||||
|
@ -248,6 +270,7 @@ class Iterator(Gst.Iterator):
|
||||||
|
|
||||||
yield value
|
yield value
|
||||||
|
|
||||||
|
|
||||||
Iterator = override(Iterator)
|
Iterator = override(Iterator)
|
||||||
__all__.append('Iterator')
|
__all__.append('Iterator')
|
||||||
|
|
||||||
|
@ -268,13 +291,16 @@ class ElementFactory(Gst.ElementFactory):
|
||||||
def make(cls, factory_name, instance_name=None):
|
def make(cls, factory_name, instance_name=None):
|
||||||
return Gst.ElementFactory.make(factory_name, instance_name)
|
return Gst.ElementFactory.make(factory_name, instance_name)
|
||||||
|
|
||||||
|
|
||||||
class Pipeline(Gst.Pipeline):
|
class Pipeline(Gst.Pipeline):
|
||||||
def __init__(self, name=None):
|
def __init__(self, name=None):
|
||||||
Gst.Pipeline.__init__(self, name=name)
|
Gst.Pipeline.__init__(self, name=name)
|
||||||
|
|
||||||
|
|
||||||
Pipeline = override(Pipeline)
|
Pipeline = override(Pipeline)
|
||||||
__all__.append('Pipeline')
|
__all__.append('Pipeline')
|
||||||
|
|
||||||
|
|
||||||
class Structure(Gst.Structure):
|
class Structure(Gst.Structure):
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
if not args:
|
if not args:
|
||||||
|
@ -305,6 +331,7 @@ class Structure(Gst.Structure):
|
||||||
|
|
||||||
def keys(self):
|
def keys(self):
|
||||||
keys = set()
|
keys = set()
|
||||||
|
|
||||||
def foreach(fid, value, unused1, udata):
|
def foreach(fid, value, unused1, udata):
|
||||||
keys.add(GLib.quark_to_string(fid))
|
keys.add(GLib.quark_to_string(fid))
|
||||||
return True
|
return True
|
||||||
|
@ -318,12 +345,14 @@ class Structure(Gst.Structure):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.to_string()
|
return self.to_string()
|
||||||
|
|
||||||
|
|
||||||
Structure = override(Structure)
|
Structure = override(Structure)
|
||||||
__all__.append('Structure')
|
__all__.append('Structure')
|
||||||
|
|
||||||
ElementFactory = override(ElementFactory)
|
ElementFactory = override(ElementFactory)
|
||||||
__all__.append('ElementFactory')
|
__all__.append('ElementFactory')
|
||||||
|
|
||||||
|
|
||||||
class Fraction(Gst.Fraction):
|
class Fraction(Gst.Fraction):
|
||||||
def __init__(self, num, denom=1):
|
def __init__(self, num, denom=1):
|
||||||
def __gcd(a, b):
|
def __gcd(a, b):
|
||||||
|
@ -405,6 +434,7 @@ class Fraction(Gst.Fraction):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '%d/%d' % (self.num, self.denom)
|
return '%d/%d' % (self.num, self.denom)
|
||||||
|
|
||||||
|
|
||||||
Fraction = override(Fraction)
|
Fraction = override(Fraction)
|
||||||
__all__.append('Fraction')
|
__all__.append('Fraction')
|
||||||
|
|
||||||
|
@ -443,6 +473,7 @@ class IntRange(Gst.IntRange):
|
||||||
return self.range == other.range
|
return self.range == other.range
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info >= (3, 0):
|
if sys.version_info >= (3, 0):
|
||||||
IntRange = override(IntRange)
|
IntRange = override(IntRange)
|
||||||
__all__.append('IntRange')
|
__all__.append('IntRange')
|
||||||
|
@ -482,6 +513,7 @@ class Int64Range(Gst.Int64Range):
|
||||||
return self.range == other.range
|
return self.range == other.range
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class Bitmask(Gst.Bitmask):
|
class Bitmask(Gst.Bitmask):
|
||||||
def __init__(self, v):
|
def __init__(self, v):
|
||||||
if not isinstance(v, int):
|
if not isinstance(v, int):
|
||||||
|
@ -545,6 +577,7 @@ class FractionRange(Gst.FractionRange):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '(fraction)[%s,%s]' % (str(self.start), str(self.stop))
|
return '(fraction)[%s,%s]' % (str(self.start), str(self.stop))
|
||||||
|
|
||||||
|
|
||||||
FractionRange = override(FractionRange)
|
FractionRange = override(FractionRange)
|
||||||
__all__.append('FractionRange')
|
__all__.append('FractionRange')
|
||||||
|
|
||||||
|
@ -568,6 +601,7 @@ class ValueArray(Gst.ValueArray):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<Gst.ValueArray %s>' % (str(self))
|
return '<Gst.ValueArray %s>' % (str(self))
|
||||||
|
|
||||||
|
|
||||||
ValueArray = override(ValueArray)
|
ValueArray = override(ValueArray)
|
||||||
__all__.append('ValueArray')
|
__all__.append('ValueArray')
|
||||||
|
|
||||||
|
@ -591,6 +625,7 @@ class ValueList(Gst.ValueList):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<Gst.ValueList %s>' % (str(self))
|
return '<Gst.ValueList %s>' % (str(self))
|
||||||
|
|
||||||
|
|
||||||
ValueList = override(ValueList)
|
ValueList = override(ValueList)
|
||||||
__all__.append('ValueList')
|
__all__.append('ValueList')
|
||||||
|
|
||||||
|
@ -602,6 +637,7 @@ def pairwise(iterable):
|
||||||
next(b, None)
|
next(b, None)
|
||||||
return zip(a, b)
|
return zip(a, b)
|
||||||
|
|
||||||
|
|
||||||
class MapInfo:
|
class MapInfo:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.memory = None
|
self.memory = None
|
||||||
|
@ -628,8 +664,10 @@ class MapInfo:
|
||||||
if not self.__parent__.unmap(self):
|
if not self.__parent__.unmap(self):
|
||||||
raise MapError('MappingError', 'Unmapping was not successful')
|
raise MapError('MappingError', 'Unmapping was not successful')
|
||||||
|
|
||||||
|
|
||||||
__all__.append("MapInfo")
|
__all__.append("MapInfo")
|
||||||
|
|
||||||
|
|
||||||
class Buffer(Gst.Buffer):
|
class Buffer(Gst.Buffer):
|
||||||
|
|
||||||
def map_range(self, idx, length, flags):
|
def map_range(self, idx, length, flags):
|
||||||
|
@ -650,9 +688,11 @@ class Buffer(Gst.Buffer):
|
||||||
mapinfo.__parent__ = None
|
mapinfo.__parent__ = None
|
||||||
return _gi_gst.buffer_override_unmap(self, mapinfo)
|
return _gi_gst.buffer_override_unmap(self, mapinfo)
|
||||||
|
|
||||||
|
|
||||||
Buffer = override(Buffer)
|
Buffer = override(Buffer)
|
||||||
__all__.append('Buffer')
|
__all__.append('Buffer')
|
||||||
|
|
||||||
|
|
||||||
class Memory(Gst.Memory):
|
class Memory(Gst.Memory):
|
||||||
|
|
||||||
def map(self, flags):
|
def map(self, flags):
|
||||||
|
@ -666,9 +706,11 @@ class Memory(Gst.Memory):
|
||||||
mapinfo.__parent__ = None
|
mapinfo.__parent__ = None
|
||||||
return _gi_gst.memory_override_unmap(self, mapinfo)
|
return _gi_gst.memory_override_unmap(self, mapinfo)
|
||||||
|
|
||||||
|
|
||||||
Memory = override(Memory)
|
Memory = override(Memory)
|
||||||
__all__.append('Memory')
|
__all__.append('Memory')
|
||||||
|
|
||||||
|
|
||||||
def TIME_ARGS(time):
|
def TIME_ARGS(time):
|
||||||
if time == Gst.CLOCK_TIME_NONE:
|
if time == Gst.CLOCK_TIME_NONE:
|
||||||
return "CLOCK_TIME_NONE"
|
return "CLOCK_TIME_NONE"
|
||||||
|
@ -677,6 +719,8 @@ def TIME_ARGS(time):
|
||||||
(time / (Gst.SECOND * 60)) % 60,
|
(time / (Gst.SECOND * 60)) % 60,
|
||||||
(time / Gst.SECOND) % 60,
|
(time / Gst.SECOND) % 60,
|
||||||
time % Gst.SECOND)
|
time % Gst.SECOND)
|
||||||
|
|
||||||
|
|
||||||
__all__.append('TIME_ARGS')
|
__all__.append('TIME_ARGS')
|
||||||
|
|
||||||
from gi.overrides import _gi_gst
|
from gi.overrides import _gi_gst
|
||||||
|
@ -694,10 +738,15 @@ Gst.fixme = _gi_gst.fixme
|
||||||
Gst.memdump = _gi_gst.memdump
|
Gst.memdump = _gi_gst.memdump
|
||||||
|
|
||||||
# Make sure PyGst is not usable if GStreamer has not been initialized
|
# Make sure PyGst is not usable if GStreamer has not been initialized
|
||||||
|
|
||||||
|
|
||||||
class NotInitialized(Exception):
|
class NotInitialized(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
__all__.append('NotInitialized')
|
__all__.append('NotInitialized')
|
||||||
|
|
||||||
|
|
||||||
def fake_method(*args):
|
def fake_method(*args):
|
||||||
raise NotInitialized("Please call Gst.init(argv) before using GStreamer")
|
raise NotInitialized("Please call Gst.init(argv) before using GStreamer")
|
||||||
|
|
||||||
|
@ -711,6 +760,7 @@ for cname_klass in [o for o in inspect.getmembers(Gst) if isinstance(o[1], type(
|
||||||
for o in cname_klass[1].__dict__
|
for o in cname_klass[1].__dict__
|
||||||
if isinstance(cname_klass[1].__dict__[o], type(Gst.init))]))
|
if isinstance(cname_klass[1].__dict__[o], type(Gst.init))]))
|
||||||
|
|
||||||
|
|
||||||
def init_pygst():
|
def init_pygst():
|
||||||
for fname, function in real_functions:
|
for fname, function in real_functions:
|
||||||
if fname not in ["init", "init_check", "deinit"]:
|
if fname not in ["init", "init_check", "deinit"]:
|
||||||
|
@ -729,7 +779,10 @@ def deinit_pygst():
|
||||||
for mname, method in methods:
|
for mname, method in methods:
|
||||||
setattr(cname_class[1], mname, fake_method)
|
setattr(cname_class[1], mname, fake_method)
|
||||||
|
|
||||||
|
|
||||||
real_init = Gst.init
|
real_init = Gst.init
|
||||||
|
|
||||||
|
|
||||||
def init(argv=None):
|
def init(argv=None):
|
||||||
init_pygst()
|
init_pygst()
|
||||||
|
|
||||||
|
@ -738,9 +791,12 @@ def init(argv=None):
|
||||||
|
|
||||||
return real_init(argv)
|
return real_init(argv)
|
||||||
|
|
||||||
|
|
||||||
Gst.init = init
|
Gst.init = init
|
||||||
|
|
||||||
real_init_check = Gst.init_check
|
real_init_check = Gst.init_check
|
||||||
|
|
||||||
|
|
||||||
def init_check(argv):
|
def init_check(argv):
|
||||||
init_pygst()
|
init_pygst()
|
||||||
if Gst.is_initialized():
|
if Gst.is_initialized():
|
||||||
|
@ -748,19 +804,24 @@ def init_check(argv):
|
||||||
|
|
||||||
return real_init_check(argv)
|
return real_init_check(argv)
|
||||||
|
|
||||||
|
|
||||||
Gst.init_check = init_check
|
Gst.init_check = init_check
|
||||||
|
|
||||||
real_deinit = Gst.deinit
|
real_deinit = Gst.deinit
|
||||||
|
|
||||||
|
|
||||||
def deinit():
|
def deinit():
|
||||||
deinit_pygst()
|
deinit_pygst()
|
||||||
return real_deinit()
|
return real_deinit()
|
||||||
|
|
||||||
|
|
||||||
def init_python():
|
def init_python():
|
||||||
if not Gst.is_initialized():
|
if not Gst.is_initialized():
|
||||||
raise NotInitialized("Gst.init_python should never be called before GStreamer itself is initialized")
|
raise NotInitialized("Gst.init_python should never be called before GStreamer itself is initialized")
|
||||||
|
|
||||||
init_pygst()
|
init_pygst()
|
||||||
|
|
||||||
|
|
||||||
Gst.deinit = deinit
|
Gst.deinit = deinit
|
||||||
Gst.init_python = init_python
|
Gst.init_python = init_python
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue