Merge commit 'adamcik/gstreamer'

This commit is contained in:
Stein Magnus Jodal 2010-04-14 23:09:32 +02:00
commit 7ba13ecaf8
14 changed files with 24 additions and 10 deletions

View File

@ -17,8 +17,10 @@ logger = logging.getLogger(u'backends.gstreamer')
class GStreamerMessages(threading.Thread):
def run(self):
gobject.MainLoop().run()
GStreamerMessages().start()
message_thread = GStreamerMessages()
message_thread.daemon = True
message_thread.start()
class GStreamerBackend(BaseBackend):
"""
@ -88,7 +90,8 @@ class GStreamerPlaybackController(BasePlaybackController):
def time_position(self):
try:
return self._bin.query_position(gst.FORMAT_TIME)[0] // gst.MSECOND
except gst.QueryError:
except gst.QueryError, e:
logger.error('time_position failed: %s',e )
return 0
def destroy(self):

View File

@ -1,5 +1,6 @@
import random
import time
import threading
from mopidy.mixers.dummy import DummyMixer
from mopidy.models import Playlist, Track
@ -546,19 +547,21 @@ class BasePlaybackControllerTest(object):
@populate_playlist
def test_end_of_track_callback_gets_called(self):
end_of_track_callback = self.playback.end_of_track_callback
event = threading.Event()
def wrapper():
wrapper.called = True
return end_of_track_callback()
wrapper.called = False
result = end_of_track_callback()
event.set()
return result
self.playback.end_of_track_callback= wrapper
self.playback.play()
self.playback.seek(self.tracks[0].length - 1)
time.sleep(0.5)
self.playback.seek(self.tracks[0].length - 10)
self.assert_(wrapper.called)
event.wait(5)
self.assert_(event.is_set())
@populate_playlist
def test_new_playlist_loaded_callback_when_playing(self):
@ -737,9 +740,8 @@ class BasePlaybackControllerTest(object):
@populate_playlist
def test_time_position_when_playing(self):
self.playback.play()
time.sleep(0.2)
first = self.playback.time_position
time.sleep(0.2)
time.sleep(1)
second = self.playback.time_position
self.assert_(second > first, '%s - %s' % (first, second))

BIN
tests/data/blank.flac Normal file

Binary file not shown.

BIN
tests/data/blank.ogg Normal file

Binary file not shown.

BIN
tests/data/blank.wav Normal file

Binary file not shown.

1
tests/data/song1.flac Symbolic link
View File

@ -0,0 +1 @@
blank.flac

1
tests/data/song1.ogg Symbolic link
View File

@ -0,0 +1 @@
blank.ogg

1
tests/data/song1.wav Symbolic link
View File

@ -0,0 +1 @@
blank.wav

1
tests/data/song2.flac Symbolic link
View File

@ -0,0 +1 @@
blank.flac

1
tests/data/song2.ogg Symbolic link
View File

@ -0,0 +1 @@
blank.ogg

1
tests/data/song2.wav Symbolic link
View File

@ -0,0 +1 @@
blank.wav

1
tests/data/song3.flac Symbolic link
View File

@ -0,0 +1 @@
blank.flac

1
tests/data/song3.ogg Symbolic link
View File

@ -0,0 +1 @@
blank.ogg

1
tests/data/song3.wav Symbolic link
View File

@ -0,0 +1 @@
blank.wav