summaryrefslogtreecommitdiff
path: root/bindings
diff options
context:
space:
mode:
authorThibault Saunier <thibault.saunier@collabora.com>2012-09-14 01:05:45 +0200
committerThibault Saunier <thibault.saunier@collabora.com>2012-12-19 18:59:48 -0300
commitdf4040a10699e82372bae9083cf1689ed1cf727c (patch)
tree1d670f231da758ba0327b6991d8945d8253d15ca /bindings
parent3afd8fb88aeb29b179d031c8eb9db5c5f3469680 (diff)
bindings: Start implementing overrides for python
Diffstat (limited to 'bindings')
-rw-r--r--bindings/Makefile.am6
-rw-r--r--bindings/python/Makefile.am5
-rw-r--r--bindings/python/examples/Makefile.am0
-rw-r--r--bindings/python/gi/Makefile.am1
-rw-r--r--bindings/python/gi/__init__.py29
-rw-r--r--bindings/python/gi/overrides/GES.py64
-rw-r--r--bindings/python/gi/overrides/Makefile.am4
-rw-r--r--bindings/python/gi/overrides/__init__.py29
8 files changed, 138 insertions, 0 deletions
diff --git a/bindings/Makefile.am b/bindings/Makefile.am
new file mode 100644
index 00000000..be927819
--- /dev/null
+++ b/bindings/Makefile.am
@@ -0,0 +1,6 @@
+SUBDIRS =
+
+if WITH_PYTHON
+ SUBDIRS += python
+endif
+
diff --git a/bindings/python/Makefile.am b/bindings/python/Makefile.am
new file mode 100644
index 00000000..22bf444c
--- /dev/null
+++ b/bindings/python/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = gi
+
+if BUILD_EXAMPLES
+SUBDIRS += examples
+endif
diff --git a/bindings/python/examples/Makefile.am b/bindings/python/examples/Makefile.am
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/bindings/python/examples/Makefile.am
diff --git a/bindings/python/gi/Makefile.am b/bindings/python/gi/Makefile.am
new file mode 100644
index 00000000..eeba0934
--- /dev/null
+++ b/bindings/python/gi/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = overrides
diff --git a/bindings/python/gi/__init__.py b/bindings/python/gi/__init__.py
new file mode 100644
index 00000000..09d180b6
--- /dev/null
+++ b/bindings/python/gi/__init__.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+#
+# __init__.py
+#
+# Copyright (C) 2012 Thibault Saunier <thibaul.saunier@collabora.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+
+
+from pkgutil import extend_path
+
+__path__ = extend_path(__path__, __name__)
diff --git a/bindings/python/gi/overrides/GES.py b/bindings/python/gi/overrides/GES.py
new file mode 100644
index 00000000..4cffe4a5
--- /dev/null
+++ b/bindings/python/gi/overrides/GES.py
@@ -0,0 +1,64 @@
+# -*- Mode: Python; py-indent-offset: 4 -*-
+# vim: tabstop=4 shiftwidth=4 expandtab
+#
+# GES.py
+#
+# Copyright (C) 2012 Thibault Saunier <thibault.saunier@collabora.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+
+import sys
+from ..overrides import override
+from ..importer import modules
+
+if sys.version_info >= (3, 0):
+ _basestring = str
+ _callable = lambda c: hasattr(c, '__call__')
+else:
+ _basestring = basestring
+ _callable = callable
+
+GES = modules['GES']._introspection_module
+__all__ = []
+
+if GES._version == '0.10':
+ import warnings
+ warn_msg = "You have imported the GES 0.10 module. Because GES 0.10 \
+was not designed for use with introspection some of the \
+interfaces and API will fail. As such this is not supported \
+by the GStreamer development team and we encourage you to \
+port your app to GES 1 or greater. static python bindings is the recomended \
+python module to use with GES 0.10"
+
+ warnings.warn(warn_msg, RuntimeWarning)
+
+
+try:
+ from gi.repository import Gst
+ Gst
+except:
+ raise RuntimeError("GSt couldn't be imported, make sure you have gst-python installed")
+
+initialized = GES.init()
+
+if not initialized:
+ raise RuntimeError("GES couldn't be initialized, make sure you have gst-python installed")
+
+
diff --git a/bindings/python/gi/overrides/Makefile.am b/bindings/python/gi/overrides/Makefile.am
new file mode 100644
index 00000000..c876b5e9
--- /dev/null
+++ b/bindings/python/gi/overrides/Makefile.am
@@ -0,0 +1,4 @@
+pygesdir = $(pkgpyexecdir)
+pyges_PYTHON = GES.py
+
+EXTRA_DIST = GES.py
diff --git a/bindings/python/gi/overrides/__init__.py b/bindings/python/gi/overrides/__init__.py
new file mode 100644
index 00000000..5a1c721d
--- /dev/null
+++ b/bindings/python/gi/overrides/__init__.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+#
+# __init__.py
+#
+# Copyright (C) 2012 Thibault Saunier <thibaul.saunier@collabora.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+
+from pkgutil import extend_path
+
+__path__ = extend_path(__path__, __name__)
+print __path__, __name__