from ..overrides import override as override_
from ..importer import modules
-from gi.repository import Gst
+import gi
+gi.require_version('Gst', '1.0')
+
+from gi.repository import Gst # noqa
GstPbutils = modules['GstPbutils']._introspection_module
__all__ = []
+
def override(cls):
name = cls.__name__
globals()[name] = override_(cls)
return cls
+
@override
class EncodingVideoProfile(GstPbutils.EncodingVideoProfile):
def __init__(self, format, preset=None, restriction=None, presence=0):
self.set_restriction(restriction)
self.set_presence(presence)
+
@override
class EncodingAudioProfile(GstPbutils.EncodingAudioProfile):
def __init__(self, format, preset=None, restriction=None, presence=0):
self.set_restriction(restriction)
self.set_presence(presence)
+
@override
class EncodingContainerProfile(GstPbutils.EncodingContainerProfile):
def __init__(self, name, description, format, preset=None):
plugin_init (GstPlugin * plugin)
{
PyGILState_STATE state;
- PyObject *gst, *dict, *pyplugin;
+ PyObject *gi, *require_version, *args, *gst, *dict, *pyplugin;
gboolean we_initialized = FALSE;
GModule *libpython;
gpointer has_python = NULL;
return FALSE;
}
+ gi = PyImport_ImportModule ("gi");
+ if (!gi) {
+ g_critical ("can't find gi");
+ return FALSE;
+ }
+
+
+ require_version = PyObject_GetAttrString (gi, (char *) "require_version");
+ args = PyTuple_Pack (2, PyUnicode_FromString ("Gst"),
+ PyUnicode_FromString ("1.0"));
+ PyObject_CallObject (require_version, args);
+ Py_DECREF (require_version);
+ Py_DECREF (args);
+ Py_DECREF (gi);
+
gst = PyImport_ImportModule ("gi.repository.Gst");
if (!gst) {
g_critical ("can't find gi.repository.Gst");