Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-09-06 10:54:01 (GMT)
committer Simon Schampijer <simon@laptop.org>2012-09-07 09:14:27 (GMT)
commitf5d6cb7044e8b7e2d902c7a1358f3d585a7ca110 (patch)
treeb672354f599db44ce282a2b5fb36cb7f066eda23
parent560a3699c3bba14313cd597dce6b2a994579be97 (diff)
Model Speech: use GStreamer 1.0 through introspection
Signed-off-by: Daniel Narvaez <dwnarvaez@gmail.com> Acked-by: Manuel QuiƱones <manuq@laptop.org>
-rwxr-xr-xbin/sugar-session4
-rw-r--r--src/jarabe/model/speech.py20
2 files changed, 14 insertions, 10 deletions
diff --git a/bin/sugar-session b/bin/sugar-session
index fca94f6..1519a20 100755
--- a/bin/sugar-session
+++ b/bin/sugar-session
@@ -28,12 +28,14 @@ if os.environ.get('SUGAR_LOGGER_LEVEL', '') == 'debug':
import gettext
import logging
+import sys
from gi.repository import GConf
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkX11
from gi.repository import GObject
+from gi.repository import Gst
import dbus.glib
from gi.repository import Wnck
@@ -47,6 +49,8 @@ except ImportError:
Gdk.threads_init()
dbus.glib.threads_init()
+Gst.init(sys.argv)
+
def cleanup_logs(logs_dir):
"""Clean up the log directory, moving old logs into a numbered backup
directory. We only keep `_MAX_BACKUP_DIRS` of these backup directories
diff --git a/src/jarabe/model/speech.py b/src/jarabe/model/speech.py
index 86a30d9..864f639 100644
--- a/src/jarabe/model/speech.py
+++ b/src/jarabe/model/speech.py
@@ -18,7 +18,7 @@ import os
import logging
from gi.repository import GConf
-import gst
+from gi.repository import Gst
from gi.repository import Gtk
from gi.repository import GObject
@@ -143,21 +143,21 @@ class _GstSpeechPlayer(GObject.GObject):
logging.debug('Trying to restart not initialized sound device')
return
- self._pipeline.set_state(gst.STATE_PLAYING)
+ self._pipeline.set_state(Gst.State.PLAYING)
self.emit('play')
def pause_sound_device(self):
if self._pipeline is None:
return
- self._pipeline.set_state(gst.STATE_PAUSED)
+ self._pipeline.set_state(Gst.State.PAUSED)
self.emit('pause')
def stop_sound_device(self):
if self._pipeline is None:
return
- self._pipeline.set_state(gst.STATE_NULL)
+ self._pipeline.set_state(Gst.State.NULL)
self.emit('stop')
def make_pipeline(self, command):
@@ -165,18 +165,18 @@ class _GstSpeechPlayer(GObject.GObject):
self.stop_sound_device()
del self._pipeline
- self._pipeline = gst.parse_launch(command)
+ self._pipeline = Gst.parse_launch(command)
bus = self._pipeline.get_bus()
bus.add_signal_watch()
bus.connect('message', self.__pipe_message_cb)
def __pipe_message_cb(self, bus, message):
- if message.type == gst.MESSAGE_EOS:
- self._pipeline.set_state(gst.STATE_NULL)
+ if message.type == Gst.MessageType.EOS:
+ self._pipeline.set_state(Gst.State.NULL)
self.emit('stop')
- elif message.type == gst.MESSAGE_ERROR:
- self._pipeline.set_state(gst.STATE_NULL)
+ elif message.type == Gst.MessageType.ERROR:
+ self._pipeline.set_state(Gst.State.NULL)
self.emit('stop')
def speak(self, pitch, rate, voice_name, text):
@@ -197,7 +197,7 @@ class _GstSpeechPlayer(GObject.GObject):
def get_all_voices(self):
all_voices = {}
- for voice in gst.element_factory_make('espeak').props.voices:
+ for voice in Gst.ElementFactory.make('espeak', None).props.voices:
name, language, dialect = voice
if dialect != 'none':
all_voices[language + '_' + dialect] = name