gst1: Call Gst.init() and remove sys.argv hack

GStreamer no longer use sys.argv directly. If you want GStreamer to
handle command line arguments, you must pass them explicitly to
Gst.init().
This commit is contained in:
Stein Magnus Jodal 2015-09-02 00:27:59 +02:00
parent 8c82f4773f
commit 1d269af210
4 changed files with 6 additions and 9 deletions

View File

@ -22,6 +22,7 @@ except ImportError:
raise
GObject.threads_init()
Gst.init()
try:
# Make GObject's mainloop the event loop for python-dbus
@ -33,13 +34,6 @@ except ImportError:
import pykka.debug
# Extract any command line arguments. This needs to be done before GStreamer is
# imported, so that GStreamer doesn't hijack e.g. ``--help``.
mopidy_args = sys.argv[1:]
sys.argv[1:] = []
from mopidy import commands, config as config_lib, ext
from mopidy.internal import encoding, log, path, process, versioning
@ -73,7 +67,7 @@ def main():
data.command.set(extension=data.extension)
root_cmd.add_child(data.extension.ext_name, data.command)
args = root_cmd.parse(mopidy_args)
args = root_cmd.parse(sys.argv[1:])
config, config_errors = config_lib.load(
args.config_files,

View File

@ -191,6 +191,7 @@ if __name__ == '__main__':
from mopidy.internal import path
GObject.threads_init()
Gst.init()
scanner = Scanner(5000)
for uri in sys.argv[1:]:

View File

@ -6,7 +6,9 @@ import unittest
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
GObject.threads_init()
Gst.init()
import mock

View File

@ -8,7 +8,7 @@ gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
GObject.threads_init()
Gst.init(None)
Gst.init()
from mopidy import exceptions
from mopidy.audio import scan