mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
Avoid warning about gi.require_version not being called
This commit is contained in:
parent
1fe791cafa
commit
8b94b967a0
2 changed files with 24 additions and 2 deletions
|
@ -27,11 +27,15 @@
|
||||||
from ..overrides import override as override_
|
from ..overrides import override as override_
|
||||||
from ..importer import modules
|
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
|
GstPbutils = modules['GstPbutils']._introspection_module
|
||||||
__all__ = []
|
__all__ = []
|
||||||
|
|
||||||
|
|
||||||
def override(cls):
|
def override(cls):
|
||||||
name = cls.__name__
|
name = cls.__name__
|
||||||
globals()[name] = override_(cls)
|
globals()[name] = override_(cls)
|
||||||
|
@ -39,6 +43,7 @@ def override(cls):
|
||||||
|
|
||||||
return cls
|
return cls
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
class EncodingVideoProfile(GstPbutils.EncodingVideoProfile):
|
class EncodingVideoProfile(GstPbutils.EncodingVideoProfile):
|
||||||
def __init__(self, format, preset=None, restriction=None, presence=0):
|
def __init__(self, format, preset=None, restriction=None, presence=0):
|
||||||
|
@ -51,6 +56,7 @@ class EncodingVideoProfile(GstPbutils.EncodingVideoProfile):
|
||||||
self.set_restriction(restriction)
|
self.set_restriction(restriction)
|
||||||
self.set_presence(presence)
|
self.set_presence(presence)
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
class EncodingAudioProfile(GstPbutils.EncodingAudioProfile):
|
class EncodingAudioProfile(GstPbutils.EncodingAudioProfile):
|
||||||
def __init__(self, format, preset=None, restriction=None, presence=0):
|
def __init__(self, format, preset=None, restriction=None, presence=0):
|
||||||
|
@ -63,6 +69,7 @@ class EncodingAudioProfile(GstPbutils.EncodingAudioProfile):
|
||||||
self.set_restriction(restriction)
|
self.set_restriction(restriction)
|
||||||
self.set_presence(presence)
|
self.set_presence(presence)
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
class EncodingContainerProfile(GstPbutils.EncodingContainerProfile):
|
class EncodingContainerProfile(GstPbutils.EncodingContainerProfile):
|
||||||
def __init__(self, name, description, format, preset=None):
|
def __init__(self, name, description, format, preset=None):
|
||||||
|
|
|
@ -211,7 +211,7 @@ static gboolean
|
||||||
plugin_init (GstPlugin * plugin)
|
plugin_init (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
PyGILState_STATE state;
|
PyGILState_STATE state;
|
||||||
PyObject *gst, *dict, *pyplugin;
|
PyObject *gi, *require_version, *args, *gst, *dict, *pyplugin;
|
||||||
gboolean we_initialized = FALSE;
|
gboolean we_initialized = FALSE;
|
||||||
GModule *libpython;
|
GModule *libpython;
|
||||||
gpointer has_python = NULL;
|
gpointer has_python = NULL;
|
||||||
|
@ -260,6 +260,21 @@ plugin_init (GstPlugin * plugin)
|
||||||
return FALSE;
|
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");
|
gst = PyImport_ImportModule ("gi.repository.Gst");
|
||||||
if (!gst) {
|
if (!gst) {
|
||||||
g_critical ("can't find gi.repository.Gst");
|
g_critical ("can't find gi.repository.Gst");
|
||||||
|
|
Loading…
Reference in a new issue