From 88636982aecac804d5683b6991d2d225825044e7 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Mon, 18 Oct 2010 23:15:30 +0200 Subject: [PATCH] Use sample_rate and channels from libspotify in buffer caps, assert that the sample_type doesn't change --- mopidy/backends/libspotify/session_manager.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mopidy/backends/libspotify/session_manager.py b/mopidy/backends/libspotify/session_manager.py index b3e71c27..3b6f9f0b 100644 --- a/mopidy/backends/libspotify/session_manager.py +++ b/mopidy/backends/libspotify/session_manager.py @@ -69,16 +69,19 @@ class LibspotifySessionManager(SpotifySessionManager, BaseThread): def music_delivery(self, session, frames, frame_size, num_frames, sample_type, sample_rate, channels): """Callback used by pyspotify""" - # TODO Base caps_string on arguments + assert sample_type == 0, u'Expects 16-bit signed integer samples' capabilites = """ audio/x-raw-int, endianness=(int)1234, - channels=(int)2, + channels=(int)%(channels)d, width=(int)16, depth=(int)16, - signed=True, - rate=(int)44100 - """ + signed=(boolean)true, + rate=(int)%(sample_rate)d + """ % { + 'sample_rate': sample_rate, + 'channels': channels, + } self.output.deliver_data(capabilites, bytes(frames)) def play_token_lost(self, session):