Line
Link Here
|
0 |
-- a/gourmet/sound.py |
0 |
++ b/gourmet/sound.py |
Lines 1-5
Link Here
|
1 |
try: |
1 |
try: |
2 |
from sound_gst import Player |
2 |
import gi |
|
|
3 |
gi.require_version('Gst', '1.0') |
4 |
from gi.repository import GObject, Gst, Gtk |
3 |
except ImportError: |
5 |
except ImportError: |
4 |
print 'No gst player' |
6 |
print 'No gst player' |
5 |
try: |
7 |
try: |
6 |
-- a/gourmet/sound_gst.py |
8 |
++ b/gourmet/sound_gst.py |
Lines 1-15
Link Here
|
1 |
import pygst |
1 |
import gi |
2 |
pygst.require("0.10") |
2 |
gi.require_version('Gst', '1.0') |
3 |
import gst |
3 |
from gi.repository import GObject, Gst |
4 |
|
4 |
|
5 |
class Player: |
5 |
class Player: |
6 |
def __init__ (self): |
6 |
def __init__ (self): |
7 |
self.player = gst.element_factory_make('playbin2','player') |
7 |
self.player = Gst.element_factory_make('playbin2','player') |
8 |
|
8 |
|
9 |
def play_file (self,path): |
9 |
def play_file (self,path): |
10 |
self.player.set_state(gst.STATE_NULL) |
10 |
self.player.set_state(Gst.STATE_NULL) |
11 |
self.player.set_property('uri','file://'+path) |
11 |
self.player.set_property('uri','file://'+path) |
12 |
self.player.set_state(gst.STATE_PLAYING) |
12 |
self.player.set_state(Gst.STATE_PLAYING) |
13 |
|
13 |
|
14 |
def stop_play (self,path): |
14 |
def stop_play (self,path): |
15 |
self.player.set_state(gst.STATE_NULL) |
15 |
self.player.set_state(Gst.STATE_NULL) |