mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 11:55:39 +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 ..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)
|
||||
|
@ -39,6 +43,7 @@ def override(cls):
|
|||
|
||||
return cls
|
||||
|
||||
|
||||
@override
|
||||
class EncodingVideoProfile(GstPbutils.EncodingVideoProfile):
|
||||
def __init__(self, format, preset=None, restriction=None, presence=0):
|
||||
|
@ -51,6 +56,7 @@ class EncodingVideoProfile(GstPbutils.EncodingVideoProfile):
|
|||
self.set_restriction(restriction)
|
||||
self.set_presence(presence)
|
||||
|
||||
|
||||
@override
|
||||
class EncodingAudioProfile(GstPbutils.EncodingAudioProfile):
|
||||
def __init__(self, format, preset=None, restriction=None, presence=0):
|
||||
|
@ -63,6 +69,7 @@ class EncodingAudioProfile(GstPbutils.EncodingAudioProfile):
|
|||
self.set_restriction(restriction)
|
||||
self.set_presence(presence)
|
||||
|
||||
|
||||
@override
|
||||
class EncodingContainerProfile(GstPbutils.EncodingContainerProfile):
|
||||
def __init__(self, name, description, format, preset=None):
|
||||
|
|
|
@ -211,7 +211,7 @@ static gboolean
|
|||
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;
|
||||
|
@ -260,6 +260,21 @@ plugin_init (GstPlugin * plugin)
|
|||
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");
|
||||
|
|
Loading…
Reference in a new issue