gstreamer-python 1.27.90__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gstreamer_python/Lib/girepository-1.0/GdkPixbuf-2.0.typelib +0 -0
- gstreamer_python/Lib/girepository-1.0/HarfBuzz-0.0.typelib +0 -0
- gstreamer_python/Lib/girepository-1.0/Json-1.0.typelib +0 -0
- gstreamer_python/Lib/girepository-1.0/Pango-1.0.typelib +0 -0
- gstreamer_python/Lib/girepository-1.0/PangoCairo-1.0.typelib +0 -0
- gstreamer_python/Lib/girepository-1.0/Soup-3.0.typelib +0 -0
- gstreamer_python/Lib/gstreamer-1.0/gstpython.dll +0 -0
- gstreamer_python/Lib/site-packages/PyGObject-3.50.2.dist-info/METADATA +21 -0
- gstreamer_python/Lib/site-packages/cairo/__init__.py +25 -0
- gstreamer_python/Lib/site-packages/cairo/__init__.pyi +5889 -0
- gstreamer_python/Lib/site-packages/cairo/_cairo.cp313-win_amd64.pyd +0 -0
- gstreamer_python/Lib/site-packages/cairo/include/py3cairo.h +266 -0
- gstreamer_python/Lib/site-packages/cairo/py.typed +0 -0
- gstreamer_python/Lib/site-packages/gi/__init__.py +197 -0
- gstreamer_python/Lib/site-packages/gi/_constants.py +47 -0
- gstreamer_python/Lib/site-packages/gi/_error.py +55 -0
- gstreamer_python/Lib/site-packages/gi/_gi.cp313-win_amd64.pyd +0 -0
- gstreamer_python/Lib/site-packages/gi/_gi_cairo.cp313-win_amd64.pyd +0 -0
- gstreamer_python/Lib/site-packages/gi/_gtktemplate.py +307 -0
- gstreamer_python/Lib/site-packages/gi/_option.py +379 -0
- gstreamer_python/Lib/site-packages/gi/_ossighelper.py +275 -0
- gstreamer_python/Lib/site-packages/gi/_propertyhelper.py +402 -0
- gstreamer_python/Lib/site-packages/gi/_signalhelper.py +249 -0
- gstreamer_python/Lib/site-packages/gi/docstring.py +205 -0
- gstreamer_python/Lib/site-packages/gi/events.py +674 -0
- gstreamer_python/Lib/site-packages/gi/importer.py +153 -0
- gstreamer_python/Lib/site-packages/gi/module.py +269 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GES.py +94 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GIMarshallingTests.py +72 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GLib.py +882 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GObject.py +692 -0
- gstreamer_python/Lib/site-packages/gi/overrides/Gdk.py +444 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GdkPixbuf.py +53 -0
- gstreamer_python/Lib/site-packages/gi/overrides/Gio.py +655 -0
- gstreamer_python/Lib/site-packages/gi/overrides/Gst.py +1273 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GstAnalytics.py +106 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GstApp.py +50 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GstAudio.py +18 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GstPbutils.py +99 -0
- gstreamer_python/Lib/site-packages/gi/overrides/GstVideo.py +17 -0
- gstreamer_python/Lib/site-packages/gi/overrides/Gtk.py +1707 -0
- gstreamer_python/Lib/site-packages/gi/overrides/Pango.py +58 -0
- gstreamer_python/Lib/site-packages/gi/overrides/__init__.py +357 -0
- gstreamer_python/Lib/site-packages/gi/overrides/_gi_gst.cp313-win_amd64.pyd +0 -0
- gstreamer_python/Lib/site-packages/gi/overrides/_gi_gst_analytics.cp313-win_amd64.pyd +0 -0
- gstreamer_python/Lib/site-packages/gi/overrides/keysyms.py +53 -0
- gstreamer_python/Lib/site-packages/gi/pygtkcompat.py +26 -0
- gstreamer_python/Lib/site-packages/gi/repository/__init__.py +28 -0
- gstreamer_python/Lib/site-packages/gi/types.py +350 -0
- gstreamer_python/Lib/site-packages/pycairo-1.27.0.dist-info/METADATA +9 -0
- gstreamer_python/__init__.py +32 -0
- gstreamer_python-1.27.90.dist-info/METADATA +26 -0
- gstreamer_python-1.27.90.dist-info/RECORD +55 -0
- gstreamer_python-1.27.90.dist-info/WHEEL +5 -0
- gstreamer_python-1.27.90.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# -*- Mode: Python; py-indent-offset: 4 -*-
|
|
2
|
+
# vim: tabstop=4 shiftwidth=4 expandtab
|
|
3
|
+
#
|
|
4
|
+
# Copyright (C) 2005-2009 Johan Dahlin <johan@gnome.org>
|
|
5
|
+
# 2015 Christoph Reiter
|
|
6
|
+
#
|
|
7
|
+
# importer.py: dynamic importer for introspected libraries.
|
|
8
|
+
#
|
|
9
|
+
# This library is free software; you can redistribute it and/or
|
|
10
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
11
|
+
# License as published by the Free Software Foundation; either
|
|
12
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
13
|
+
#
|
|
14
|
+
# This library is distributed in the hope that it will be useful,
|
|
15
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
17
|
+
# Lesser General Public License for more details.
|
|
18
|
+
#
|
|
19
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
20
|
+
# License along with this library; if not, write to the Free Software
|
|
21
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
|
|
22
|
+
# USA
|
|
23
|
+
|
|
24
|
+
import sys
|
|
25
|
+
import warnings
|
|
26
|
+
import importlib
|
|
27
|
+
from contextlib import contextmanager
|
|
28
|
+
|
|
29
|
+
import gi
|
|
30
|
+
from ._gi import Repository, RepositoryError
|
|
31
|
+
from ._gi import PyGIWarning
|
|
32
|
+
from .module import get_introspection_module
|
|
33
|
+
from .overrides import load_overrides
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
repository = Repository.get_default()
|
|
37
|
+
|
|
38
|
+
# only for backwards compatibility
|
|
39
|
+
modules = {}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@contextmanager
|
|
43
|
+
def _check_require_version(namespace, stacklevel):
|
|
44
|
+
"""A context manager which tries to give helpful warnings
|
|
45
|
+
about missing gi.require_version() which could potentially
|
|
46
|
+
break code if only an older version than expected is installed
|
|
47
|
+
or a new version gets introduced.
|
|
48
|
+
|
|
49
|
+
::
|
|
50
|
+
|
|
51
|
+
with _check_require_version("Gtk", stacklevel):
|
|
52
|
+
load_namespace_and_overrides()
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
was_loaded = repository.is_registered(namespace)
|
|
56
|
+
|
|
57
|
+
yield
|
|
58
|
+
|
|
59
|
+
if was_loaded:
|
|
60
|
+
# it was loaded before by another import which depended on this
|
|
61
|
+
# namespace or by C code like libpeas
|
|
62
|
+
return
|
|
63
|
+
|
|
64
|
+
if namespace in ("GLib", "GObject", "Gio", "GioUnix", "GioWin32"):
|
|
65
|
+
# part of glib (we have bigger problems if versions change there)
|
|
66
|
+
return
|
|
67
|
+
|
|
68
|
+
if gi.get_required_version(namespace) is not None:
|
|
69
|
+
# the version was forced using require_version()
|
|
70
|
+
return
|
|
71
|
+
|
|
72
|
+
version = repository.get_version(namespace)
|
|
73
|
+
warnings.warn(
|
|
74
|
+
"%(namespace)s was imported without specifying a version first. "
|
|
75
|
+
"Use gi.require_version('%(namespace)s', '%(version)s') before "
|
|
76
|
+
"import to ensure that the right version gets loaded."
|
|
77
|
+
% {"namespace": namespace, "version": version},
|
|
78
|
+
PyGIWarning, stacklevel=stacklevel)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def get_import_stacklevel(import_hook):
|
|
82
|
+
"""Returns the stacklevel value for warnings.warn() for when the warning
|
|
83
|
+
gets emitted by an imported module, but the warning should point at the
|
|
84
|
+
code doing the import.
|
|
85
|
+
|
|
86
|
+
Pass import_hook=True if the warning gets generated by an import hook
|
|
87
|
+
(warn() gets called in load_module(), see PEP302)
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
py_version = sys.version_info[:2]
|
|
91
|
+
if py_version <= (3, 2):
|
|
92
|
+
# 2.7 included
|
|
93
|
+
return 4 if import_hook else 2
|
|
94
|
+
elif py_version == (3, 3):
|
|
95
|
+
return 8 if import_hook else 10
|
|
96
|
+
elif py_version == (3, 4):
|
|
97
|
+
return 10 if import_hook else 8
|
|
98
|
+
else:
|
|
99
|
+
# fixed again in 3.5+, see https://bugs.python.org/issue24305
|
|
100
|
+
return 4 if import_hook else 2
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class DynamicImporter(object):
|
|
104
|
+
|
|
105
|
+
# Note: see PEP302 for the Importer Protocol implemented below.
|
|
106
|
+
|
|
107
|
+
def __init__(self, path):
|
|
108
|
+
self.path = path
|
|
109
|
+
|
|
110
|
+
def _find_module_check(self, fullname):
|
|
111
|
+
if not fullname.startswith(self.path):
|
|
112
|
+
return False
|
|
113
|
+
|
|
114
|
+
path, namespace = fullname.rsplit('.', 1)
|
|
115
|
+
return path == self.path
|
|
116
|
+
|
|
117
|
+
def find_spec(self, fullname, path=None, target=None):
|
|
118
|
+
if self._find_module_check(fullname):
|
|
119
|
+
return importlib.util.spec_from_loader(fullname, self)
|
|
120
|
+
|
|
121
|
+
def find_module(self, fullname, path=None):
|
|
122
|
+
if self._find_module_check(fullname):
|
|
123
|
+
return self
|
|
124
|
+
|
|
125
|
+
def create_module(self, spec):
|
|
126
|
+
path, namespace = spec.name.rsplit('.', 1)
|
|
127
|
+
|
|
128
|
+
# is_registered() is faster than enumerate_versions() and
|
|
129
|
+
# in the common case of a namespace getting loaded before its
|
|
130
|
+
# dependencies, is_registered() returns True for all dependencies.
|
|
131
|
+
if not repository.is_registered(namespace) and not \
|
|
132
|
+
repository.enumerate_versions(namespace):
|
|
133
|
+
raise ImportError('cannot import name %s, '
|
|
134
|
+
'introspection typelib not found' % namespace)
|
|
135
|
+
|
|
136
|
+
stacklevel = get_import_stacklevel(import_hook=True)
|
|
137
|
+
with _check_require_version(namespace, stacklevel=stacklevel):
|
|
138
|
+
try:
|
|
139
|
+
introspection_module = get_introspection_module(namespace)
|
|
140
|
+
except RepositoryError as e:
|
|
141
|
+
raise ImportError(e)
|
|
142
|
+
# Import all dependencies first so their init functions
|
|
143
|
+
# (gdk_init, ..) in overrides get called.
|
|
144
|
+
# https://bugzilla.gnome.org/show_bug.cgi?id=656314
|
|
145
|
+
for dep in repository.get_immediate_dependencies(namespace):
|
|
146
|
+
importlib.import_module('gi.repository.' + dep.split("-")[0])
|
|
147
|
+
dynamic_module = load_overrides(introspection_module)
|
|
148
|
+
|
|
149
|
+
return dynamic_module
|
|
150
|
+
|
|
151
|
+
def exec_module(self, fullname):
|
|
152
|
+
# “exec” the module and consequently populate the module’s namespace
|
|
153
|
+
pass
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# -*- Mode: Python; py-indent-offset: 4 -*-
|
|
2
|
+
# vim: tabstop=4 shiftwidth=4 expandtab
|
|
3
|
+
#
|
|
4
|
+
# Copyright (C) 2007-2009 Johan Dahlin <johan@gnome.org>
|
|
5
|
+
#
|
|
6
|
+
# module.py: dynamic module for introspected libraries.
|
|
7
|
+
#
|
|
8
|
+
# This library is free software; you can redistribute it and/or
|
|
9
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
10
|
+
# License as published by the Free Software Foundation; either
|
|
11
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
12
|
+
#
|
|
13
|
+
# This library is distributed in the hope that it will be useful,
|
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
16
|
+
# Lesser General Public License for more details.
|
|
17
|
+
#
|
|
18
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
19
|
+
# License along with this library; if not, write to the Free Software
|
|
20
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
|
|
21
|
+
# USA
|
|
22
|
+
|
|
23
|
+
import importlib
|
|
24
|
+
from threading import Lock
|
|
25
|
+
|
|
26
|
+
import gi
|
|
27
|
+
|
|
28
|
+
from ._gi import \
|
|
29
|
+
Repository, \
|
|
30
|
+
FunctionInfo, \
|
|
31
|
+
RegisteredTypeInfo, \
|
|
32
|
+
EnumInfo, \
|
|
33
|
+
ObjectInfo, \
|
|
34
|
+
InterfaceInfo, \
|
|
35
|
+
ConstantInfo, \
|
|
36
|
+
StructInfo, \
|
|
37
|
+
UnionInfo, \
|
|
38
|
+
CallbackInfo, \
|
|
39
|
+
Struct, \
|
|
40
|
+
Boxed, \
|
|
41
|
+
Fundamental, \
|
|
42
|
+
CCallback, \
|
|
43
|
+
enum_add, \
|
|
44
|
+
enum_register_new_gtype_and_add, \
|
|
45
|
+
flags_add, \
|
|
46
|
+
flags_register_new_gtype_and_add, \
|
|
47
|
+
GInterface
|
|
48
|
+
from .types import \
|
|
49
|
+
GObjectMeta, \
|
|
50
|
+
StructMeta
|
|
51
|
+
|
|
52
|
+
from ._constants import \
|
|
53
|
+
TYPE_NONE, \
|
|
54
|
+
TYPE_BOXED, \
|
|
55
|
+
TYPE_POINTER, \
|
|
56
|
+
TYPE_ENUM, \
|
|
57
|
+
TYPE_FLAGS
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
repository = Repository.get_default()
|
|
61
|
+
|
|
62
|
+
# Cache of IntrospectionModules that have been loaded.
|
|
63
|
+
_introspection_modules = {}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def get_parent_for_object(object_info):
|
|
67
|
+
parent_object_info = object_info.get_parent()
|
|
68
|
+
|
|
69
|
+
if not parent_object_info:
|
|
70
|
+
# If we reach the end of the introspection info class hierarchy, look
|
|
71
|
+
# for an existing wrapper on the GType and use it as a base for the
|
|
72
|
+
# new introspection wrapper. This allows static C wrappers already
|
|
73
|
+
# registered with the GType to be used as the introspection base
|
|
74
|
+
# (_gi.GObject for example)
|
|
75
|
+
gtype = object_info.get_g_type()
|
|
76
|
+
if gtype and gtype.pytype:
|
|
77
|
+
return gtype.pytype
|
|
78
|
+
|
|
79
|
+
if object_info.get_fundamental() and gtype.is_instantiatable():
|
|
80
|
+
return Fundamental
|
|
81
|
+
|
|
82
|
+
# Otherwise use builtins.object as the base
|
|
83
|
+
return object
|
|
84
|
+
|
|
85
|
+
namespace = parent_object_info.get_namespace()
|
|
86
|
+
name = parent_object_info.get_name()
|
|
87
|
+
|
|
88
|
+
module = importlib.import_module('gi.repository.' + namespace)
|
|
89
|
+
return getattr(module, name)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def get_interfaces_for_object(object_info):
|
|
93
|
+
interfaces = []
|
|
94
|
+
for interface_info in object_info.get_interfaces():
|
|
95
|
+
namespace = interface_info.get_namespace()
|
|
96
|
+
name = interface_info.get_name()
|
|
97
|
+
|
|
98
|
+
module = importlib.import_module('gi.repository.' + namespace)
|
|
99
|
+
interfaces.append(getattr(module, name))
|
|
100
|
+
return interfaces
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class IntrospectionModule(object):
|
|
104
|
+
"""An object which wraps an introspection typelib.
|
|
105
|
+
|
|
106
|
+
This wrapping creates a python module like representation of the typelib
|
|
107
|
+
using gi repository as a foundation. Accessing attributes of the module
|
|
108
|
+
will dynamically pull them in and create wrappers for the members.
|
|
109
|
+
These members are then cached on this introspection module.
|
|
110
|
+
"""
|
|
111
|
+
def __init__(self, namespace, version=None):
|
|
112
|
+
"""Might raise gi._gi.RepositoryError"""
|
|
113
|
+
|
|
114
|
+
repository.require(namespace, version)
|
|
115
|
+
self._namespace = namespace
|
|
116
|
+
self._version = version
|
|
117
|
+
self.__name__ = 'gi.repository.' + namespace
|
|
118
|
+
|
|
119
|
+
path = repository.get_typelib_path(self._namespace)
|
|
120
|
+
self.__path__ = [path]
|
|
121
|
+
|
|
122
|
+
if self._version is None:
|
|
123
|
+
self._version = repository.get_version(self._namespace)
|
|
124
|
+
|
|
125
|
+
self._lock = Lock()
|
|
126
|
+
|
|
127
|
+
def __getattr__(self, name):
|
|
128
|
+
info = repository.find_by_name(self._namespace, name)
|
|
129
|
+
if not info:
|
|
130
|
+
raise AttributeError("%r object has no attribute %r" % (
|
|
131
|
+
self.__name__, name))
|
|
132
|
+
|
|
133
|
+
if isinstance(info, EnumInfo):
|
|
134
|
+
g_type = info.get_g_type()
|
|
135
|
+
|
|
136
|
+
with self._lock:
|
|
137
|
+
wrapper = g_type.pytype
|
|
138
|
+
|
|
139
|
+
if wrapper is None:
|
|
140
|
+
if info.is_flags():
|
|
141
|
+
if g_type.is_a(TYPE_FLAGS):
|
|
142
|
+
wrapper = flags_add(g_type)
|
|
143
|
+
else:
|
|
144
|
+
assert g_type == TYPE_NONE
|
|
145
|
+
wrapper = flags_register_new_gtype_and_add(info)
|
|
146
|
+
else:
|
|
147
|
+
if g_type.is_a(TYPE_ENUM):
|
|
148
|
+
wrapper = enum_add(g_type)
|
|
149
|
+
else:
|
|
150
|
+
assert g_type == TYPE_NONE
|
|
151
|
+
wrapper = enum_register_new_gtype_and_add(info)
|
|
152
|
+
|
|
153
|
+
wrapper.__info__ = info
|
|
154
|
+
wrapper.__module__ = 'gi.repository.' + info.get_namespace()
|
|
155
|
+
|
|
156
|
+
# Don't use upper() here to avoid locale specific
|
|
157
|
+
# identifier conversion (e. g. in Turkish 'i'.upper() == 'i')
|
|
158
|
+
# see https://bugzilla.gnome.org/show_bug.cgi?id=649165
|
|
159
|
+
ascii_upper_trans = ''.maketrans(
|
|
160
|
+
'abcdefgjhijklmnopqrstuvwxyz',
|
|
161
|
+
'ABCDEFGJHIJKLMNOPQRSTUVWXYZ')
|
|
162
|
+
for value_info in info.get_values():
|
|
163
|
+
value_name = value_info.get_name_unescaped().translate(ascii_upper_trans)
|
|
164
|
+
setattr(wrapper, value_name, wrapper(value_info.get_value()))
|
|
165
|
+
for method_info in info.get_methods():
|
|
166
|
+
setattr(wrapper, method_info.__name__, method_info)
|
|
167
|
+
|
|
168
|
+
if g_type != TYPE_NONE:
|
|
169
|
+
g_type.pytype = wrapper
|
|
170
|
+
|
|
171
|
+
elif isinstance(info, RegisteredTypeInfo):
|
|
172
|
+
g_type = info.get_g_type()
|
|
173
|
+
|
|
174
|
+
# Create a wrapper.
|
|
175
|
+
if isinstance(info, ObjectInfo):
|
|
176
|
+
parent = get_parent_for_object(info)
|
|
177
|
+
interfaces = tuple(interface for interface in get_interfaces_for_object(info)
|
|
178
|
+
if not issubclass(parent, interface))
|
|
179
|
+
bases = (parent,) + interfaces
|
|
180
|
+
metaclass = GObjectMeta
|
|
181
|
+
elif isinstance(info, CallbackInfo):
|
|
182
|
+
bases = (CCallback,)
|
|
183
|
+
metaclass = GObjectMeta
|
|
184
|
+
elif isinstance(info, InterfaceInfo):
|
|
185
|
+
bases = (GInterface,)
|
|
186
|
+
metaclass = GObjectMeta
|
|
187
|
+
elif isinstance(info, (StructInfo, UnionInfo)):
|
|
188
|
+
if g_type.is_a(TYPE_BOXED):
|
|
189
|
+
bases = (Boxed,)
|
|
190
|
+
elif (g_type.is_a(TYPE_POINTER) or
|
|
191
|
+
g_type == TYPE_NONE or
|
|
192
|
+
g_type.fundamental == g_type):
|
|
193
|
+
bases = (Struct,)
|
|
194
|
+
else:
|
|
195
|
+
raise TypeError("unable to create a wrapper for %s.%s" % (info.get_namespace(), info.get_name()))
|
|
196
|
+
metaclass = StructMeta
|
|
197
|
+
else:
|
|
198
|
+
raise NotImplementedError(info)
|
|
199
|
+
|
|
200
|
+
with self._lock:
|
|
201
|
+
# Check if there is already a Python wrapper that is not a parent class
|
|
202
|
+
# of the wrapper being created. If it is a parent, it is ok to clobber
|
|
203
|
+
# g_type.pytype with a new child class wrapper of the existing parent.
|
|
204
|
+
# Note that the return here never occurs under normal circumstances due
|
|
205
|
+
# to caching on the __dict__ itself.
|
|
206
|
+
if g_type != TYPE_NONE:
|
|
207
|
+
type_ = g_type.pytype
|
|
208
|
+
if type_ is not None and type_ not in bases:
|
|
209
|
+
self.__dict__[name] = type_
|
|
210
|
+
return type_
|
|
211
|
+
|
|
212
|
+
dict_ = {
|
|
213
|
+
'__info__': info,
|
|
214
|
+
'__module__': 'gi.repository.' + self._namespace,
|
|
215
|
+
'__gtype__': g_type
|
|
216
|
+
}
|
|
217
|
+
wrapper = metaclass(name, bases, dict_)
|
|
218
|
+
|
|
219
|
+
# Register the new Python wrapper.
|
|
220
|
+
if g_type != TYPE_NONE:
|
|
221
|
+
g_type.pytype = wrapper
|
|
222
|
+
|
|
223
|
+
elif isinstance(info, FunctionInfo):
|
|
224
|
+
wrapper = info
|
|
225
|
+
elif isinstance(info, ConstantInfo):
|
|
226
|
+
wrapper = info.get_value()
|
|
227
|
+
else:
|
|
228
|
+
raise NotImplementedError(info)
|
|
229
|
+
|
|
230
|
+
# Cache the newly created wrapper which will then be
|
|
231
|
+
# available directly on this introspection module instead of being
|
|
232
|
+
# lazily constructed through the __getattr__ we are currently in.
|
|
233
|
+
self.__dict__[name] = wrapper
|
|
234
|
+
return wrapper
|
|
235
|
+
|
|
236
|
+
def __repr__(self):
|
|
237
|
+
path = repository.get_typelib_path(self._namespace)
|
|
238
|
+
return "<IntrospectionModule %r from %r>" % (self._namespace, path)
|
|
239
|
+
|
|
240
|
+
def __dir__(self):
|
|
241
|
+
# Python's default dir() is just dir(self.__class__) + self.__dict__.keys()
|
|
242
|
+
result = set(dir(self.__class__))
|
|
243
|
+
result.update(self.__dict__.keys())
|
|
244
|
+
|
|
245
|
+
# update *set* because some repository attributes have already been
|
|
246
|
+
# wrapped by __getattr__() and included in self.__dict__; but skip
|
|
247
|
+
# Callback types, as these are not real objects which we can actually
|
|
248
|
+
# get
|
|
249
|
+
namespace_infos = repository.get_infos(self._namespace)
|
|
250
|
+
result.update(info.get_name() for info in namespace_infos if
|
|
251
|
+
not isinstance(info, CallbackInfo))
|
|
252
|
+
|
|
253
|
+
return list(result)
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
def get_introspection_module(namespace):
|
|
257
|
+
"""
|
|
258
|
+
:Returns:
|
|
259
|
+
An object directly wrapping the gi module without overrides.
|
|
260
|
+
|
|
261
|
+
Might raise gi._gi.RepositoryError
|
|
262
|
+
"""
|
|
263
|
+
if namespace in _introspection_modules:
|
|
264
|
+
return _introspection_modules[namespace]
|
|
265
|
+
|
|
266
|
+
version = gi.get_required_version(namespace)
|
|
267
|
+
module = IntrospectionModule(namespace, version)
|
|
268
|
+
_introspection_modules[namespace] = module
|
|
269
|
+
return module
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# -*- Mode: Python; py-indent-offset: 4 -*-
|
|
2
|
+
# vim: tabstop=4 shiftwidth=4 expandtab
|
|
3
|
+
#
|
|
4
|
+
# GES.py
|
|
5
|
+
#
|
|
6
|
+
# Copyright (C) 2012 Thibault Saunier <thibault.saunier@collabora.com>
|
|
7
|
+
#
|
|
8
|
+
# This library is free software; you can redistribute it and/or
|
|
9
|
+
# modify it under the terms of the GNU Library General Public
|
|
10
|
+
# License as published by the Free Software Foundation; either
|
|
11
|
+
# version 2 of the License, or (at your option) any later version.
|
|
12
|
+
#
|
|
13
|
+
# This library is distributed in the hope that it will be useful,
|
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
16
|
+
# Library General Public License for more details.
|
|
17
|
+
#
|
|
18
|
+
# You should have received a copy of the GNU Library General Public
|
|
19
|
+
# License along with this library; if not, write to the
|
|
20
|
+
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
21
|
+
# Boston, MA 02110-1301, USA.
|
|
22
|
+
|
|
23
|
+
import sys
|
|
24
|
+
from ..overrides import override
|
|
25
|
+
from ..importer import modules
|
|
26
|
+
from gi.repository import GObject
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
if sys.version_info >= (3, 0):
|
|
30
|
+
_basestring = str
|
|
31
|
+
_callable = lambda c: hasattr(c, '__call__')
|
|
32
|
+
else:
|
|
33
|
+
_basestring = basestring
|
|
34
|
+
_callable = callable
|
|
35
|
+
|
|
36
|
+
GES = modules['GES']._introspection_module
|
|
37
|
+
__all__ = []
|
|
38
|
+
|
|
39
|
+
if GES._version == '0.10':
|
|
40
|
+
import warnings
|
|
41
|
+
warn_msg = "You have imported the GES 0.10 module. Because GES 0.10 \
|
|
42
|
+
was not designed for use with introspection some of the \
|
|
43
|
+
interfaces and API will fail. As such this is not supported \
|
|
44
|
+
by the GStreamer development team and we encourage you to \
|
|
45
|
+
port your app to GES 1 or greater. static python bindings is the recomended \
|
|
46
|
+
python module to use with GES 0.10"
|
|
47
|
+
|
|
48
|
+
warnings.warn(warn_msg, RuntimeWarning)
|
|
49
|
+
|
|
50
|
+
def __timeline_element__repr__(self):
|
|
51
|
+
return "%s [%s (%s) %s]" % (
|
|
52
|
+
self.props.name,
|
|
53
|
+
Gst.TIME_ARGS(self.props.start),
|
|
54
|
+
Gst.TIME_ARGS(self.props.in_point),
|
|
55
|
+
Gst.TIME_ARGS(self.props.duration),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
__prev_set_child_property = GES.TimelineElement.set_child_property
|
|
59
|
+
def __timeline_element_set_child_property(self, prop_name, prop_value):
|
|
60
|
+
res, _, pspec = GES.TimelineElement.lookup_child(self, prop_name)
|
|
61
|
+
if not res:
|
|
62
|
+
return res
|
|
63
|
+
|
|
64
|
+
v = GObject.Value()
|
|
65
|
+
v.init(pspec.value_type)
|
|
66
|
+
v.set_value(prop_value)
|
|
67
|
+
|
|
68
|
+
return __prev_set_child_property(self, prop_name, v)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
GES.TimelineElement.__repr__ = __timeline_element__repr__
|
|
72
|
+
GES.TimelineElement.set_child_property = __timeline_element_set_child_property
|
|
73
|
+
GES.TrackElement.set_child_property = GES.TimelineElement.set_child_property
|
|
74
|
+
GES.Container.edit = GES.TimelineElement.edit
|
|
75
|
+
|
|
76
|
+
__prev_asset_repr = GES.Asset.__repr__
|
|
77
|
+
def __asset__repr__(self):
|
|
78
|
+
return "%s(%s)" % (__prev_asset_repr(self), self.props.id)
|
|
79
|
+
|
|
80
|
+
GES.Asset.__repr__ = __asset__repr__
|
|
81
|
+
|
|
82
|
+
def __timeline_iter_clips(self):
|
|
83
|
+
"""Iterate all clips in a timeline"""
|
|
84
|
+
for layer in self.get_layers():
|
|
85
|
+
for clip in layer.get_clips():
|
|
86
|
+
yield clip
|
|
87
|
+
|
|
88
|
+
GES.Timeline.iter_clips = __timeline_iter_clips
|
|
89
|
+
|
|
90
|
+
try:
|
|
91
|
+
from gi.repository import Gst
|
|
92
|
+
Gst
|
|
93
|
+
except:
|
|
94
|
+
raise RuntimeError("GSt couldn't be imported, make sure you have gst-python installed")
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# -*- Mode: Python; py-indent-offset: 4 -*-
|
|
2
|
+
# vim: tabstop=4 shiftwidth=4 expandtab
|
|
3
|
+
#
|
|
4
|
+
# Copyright (C) 2010 Simon van der Linden <svdlinden@src.gnome.org>
|
|
5
|
+
#
|
|
6
|
+
# This library is free software; you can redistribute it and/or
|
|
7
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
8
|
+
# License as published by the Free Software Foundation; either
|
|
9
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# This library is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14
|
+
# Lesser General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
17
|
+
# License along with this library; if not, write to the Free Software
|
|
18
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
|
|
19
|
+
# USA
|
|
20
|
+
|
|
21
|
+
from ..overrides import override
|
|
22
|
+
from ..module import get_introspection_module
|
|
23
|
+
|
|
24
|
+
GIMarshallingTests = get_introspection_module('GIMarshallingTests')
|
|
25
|
+
|
|
26
|
+
__all__ = []
|
|
27
|
+
|
|
28
|
+
OVERRIDES_CONSTANT = 7
|
|
29
|
+
__all__.append('OVERRIDES_CONSTANT')
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class OverridesStruct(GIMarshallingTests.OverridesStruct):
|
|
33
|
+
|
|
34
|
+
def __new__(cls, long_):
|
|
35
|
+
return GIMarshallingTests.OverridesStruct.__new__(cls)
|
|
36
|
+
|
|
37
|
+
def __init__(self, long_):
|
|
38
|
+
GIMarshallingTests.OverridesStruct.__init__(self)
|
|
39
|
+
self.long_ = long_
|
|
40
|
+
|
|
41
|
+
def method(self):
|
|
42
|
+
return GIMarshallingTests.OverridesStruct.method(self) / 7
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
OverridesStruct = override(OverridesStruct)
|
|
46
|
+
__all__.append('OverridesStruct')
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class OverridesObject(GIMarshallingTests.OverridesObject):
|
|
50
|
+
|
|
51
|
+
def __new__(cls, long_):
|
|
52
|
+
return GIMarshallingTests.OverridesObject.__new__(cls)
|
|
53
|
+
|
|
54
|
+
def __init__(self, long_):
|
|
55
|
+
GIMarshallingTests.OverridesObject.__init__(self)
|
|
56
|
+
# FIXME: doesn't work yet
|
|
57
|
+
# self.long_ = long_
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def new(cls, long_):
|
|
61
|
+
self = GIMarshallingTests.OverridesObject.new()
|
|
62
|
+
# FIXME: doesn't work yet
|
|
63
|
+
# self.long_ = long_
|
|
64
|
+
return self
|
|
65
|
+
|
|
66
|
+
def method(self):
|
|
67
|
+
"""Overridden doc string."""
|
|
68
|
+
return GIMarshallingTests.OverridesObject.method(self) / 7
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
OverridesObject = override(OverridesObject)
|
|
72
|
+
__all__.append('OverridesObject')
|