banshee r4438 - in trunk/banshee: . build build/m4/banshee src/Extensions src/Extensions/Banshee.RemoteAudio src/Extensions/Banshee.RemoteAudio/Banshee.RemoteAudio
- From: btaylor svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4438 - in trunk/banshee: . build build/m4/banshee src/Extensions src/Extensions/Banshee.RemoteAudio src/Extensions/Banshee.RemoteAudio/Banshee.RemoteAudio
- Date: Wed, 27 Aug 2008 23:55:02 +0000 (UTC)
Author: btaylor
Date: Wed Aug 27 23:55:02 2008
New Revision: 4438
URL: http://svn.gnome.org/viewvc/banshee?rev=4438&view=rev
Log:
2008-08-27 Brad Taylor <brad getcoded net>
* configure.ac:
* build/build.environment.mk:
* src/Extensions/Makefile.am:
* build/m4/banshee/remote-audio.m4:
* src/Extensions/Banshee.RemoteAudio/: Begin support for Remote Audio (aka
AirTunes).
Added:
trunk/banshee/build/m4/banshee/remote-audio.m4
trunk/banshee/src/Extensions/Banshee.RemoteAudio/ (props changed)
trunk/banshee/src/Extensions/Banshee.RemoteAudio/Banshee.RemoteAudio/
trunk/banshee/src/Extensions/Banshee.RemoteAudio/Banshee.RemoteAudio.addin.xml
trunk/banshee/src/Extensions/Banshee.RemoteAudio/Banshee.RemoteAudio/RemoteAudioService.cs
trunk/banshee/src/Extensions/Banshee.RemoteAudio/Banshee.RemoteAudio/RemoteSpeaker.cs
trunk/banshee/src/Extensions/Banshee.RemoteAudio/Makefile.am
Modified:
trunk/banshee/ChangeLog
trunk/banshee/build/build.environment.mk
trunk/banshee/configure.ac
trunk/banshee/src/Extensions/Makefile.am
Modified: trunk/banshee/build/build.environment.mk
==============================================================================
--- trunk/banshee/build/build.environment.mk (original)
+++ trunk/banshee/build/build.environment.mk Wed Aug 27 23:55:02 2008
@@ -127,6 +127,7 @@
$(LINK_EXTENSION_NOWPLAYING)
REF_EXTENSION_PODCASTING = $(LINK_MIGO_DEPS) $(LINK_BANSHEE_THICKCLIENT_DEPS)
REF_EXTENSION_SAMPLE = $(LINK_BANSHEE_THICKCLIENT_DEPS)
+REF_EXTENSION_REMOTE_AUDIO = $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_MONO_ZEROCONF)
# Backends
REF_BACKEND_GNOME = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_GCONF) $(LINK_GNOME) $(LINK_EXTENSION_NOWPLAYING_DEPS)
Added: trunk/banshee/build/m4/banshee/remote-audio.m4
==============================================================================
--- (empty file)
+++ trunk/banshee/build/m4/banshee/remote-audio.m4 Wed Aug 27 23:55:02 2008
@@ -0,0 +1,14 @@
+AC_DEFUN([BANSHEE_CHECK_REMOTE_AUDIO],
+[
+ MZC_REQUIRED=0.7.3
+
+ AC_ARG_ENABLE(remote_audio, AC_HELP_STRING([--disable-remote-audio], [Disable Remote Audio support]), , enable_remote_audio="no")
+
+ if test "x$enable_remote_audio" = "xyes"; then
+ PKG_CHECK_MODULES(MONO_ZEROCONF, mono-zeroconf >= $MZC_REQUIRED)
+ AC_SUBST(MONO_ZEROCONF_LIBS)
+ AM_CONDITIONAL(REMOTE_AUDIO_ENABLED, true)
+ else
+ AM_CONDITIONAL(REMOTE_AUDIO_ENABLED, false)
+ fi
+])
Modified: trunk/banshee/configure.ac
==============================================================================
--- trunk/banshee/configure.ac (original)
+++ trunk/banshee/configure.ac Wed Aug 27 23:55:02 2008
@@ -91,6 +91,9 @@
dnl DAAP support (optional)
BANSHEE_CHECK_DAAP
+dnl RemoteAudio support (optional)
+BANSHEE_CHECK_REMOTE_AUDIO
+
dnl MonoTorrent support (optional)
BANSHEE_CHECK_TORRENT
@@ -188,6 +191,7 @@
src/Extensions/Banshee.SqlDebugConsole/Makefile
src/Extensions/Banshee.Sample/Makefile
src/Extensions/Banshee.Torrent/Makefile
+src/Extensions/Banshee.RemoteAudio/Makefile
])
echo "
@@ -208,6 +212,7 @@
Karma: ${enable_karmasharp}
DAAP Support: ${enable_daap}
+ Remote Audio: ${enable_remote_audio}
Podcast Support: ${enable_podcast}
Boo Scripting: ${enable_boo}
X11 Video Support: ${have_xvidmode}
Added: trunk/banshee/src/Extensions/Banshee.RemoteAudio/Banshee.RemoteAudio.addin.xml
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.RemoteAudio/Banshee.RemoteAudio.addin.xml Wed Aug 27 23:55:02 2008
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Addin
+ id="Banshee.RemoteAudio"
+ version="1.0"
+ compatVersion="1.0"
+ copyright="Â 2008 Novell Inc. Licensed under the MIT X11 license."
+ name="Remote Audio"
+ category=""
+ description="Provides support for remote speakers like the Airport Express"
+ author="Brad Taylor"
+ url="http://banshee-project.org/"
+ defaultEnabled="true">
+
+ <Dependencies>
+ <Addin id="Banshee.Services" version="1.0"/>
+ </Dependencies>
+
+ <Extension path="/Banshee/ServiceManager/Service">
+ <Service class="Banshee.RemoteAudio.RemoteAudioService"/>
+ </Extension>
+
+</Addin>
Added: trunk/banshee/src/Extensions/Banshee.RemoteAudio/Banshee.RemoteAudio/RemoteAudioService.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.RemoteAudio/Banshee.RemoteAudio/RemoteAudioService.cs Wed Aug 27 23:55:02 2008
@@ -0,0 +1,150 @@
+//
+// RemoteAudioService.cs
+//
+// Authors:
+// Brad Taylor <brad getcoded net>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Net;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+
+using Mono.Zeroconf;
+
+using Hyena;
+using Banshee.Base;
+using Banshee.ServiceStack;
+using Banshee.Networking;
+
+namespace Banshee.RemoteAudio
+{
+ public class RemoteAudioService : IExtensionService, IDisposable
+ {
+ private const string RAOP_MDNS_TYPE = "_raop._tcp";
+
+ private ServiceBrowser browser;
+ private List<RemoteSpeaker> speakers = new List<RemoteSpeaker> ();
+
+ public event EventHandler SpeakersChanged;
+
+ public RemoteAudioService ()
+ {
+ }
+
+ public ReadOnlyCollection<RemoteSpeaker> Speakers {
+ get { return speakers.AsReadOnly (); }
+ }
+
+ void IExtensionService.Initialize ()
+ {
+ Network network = ServiceManager.Get<Network> ();
+ network.StateChanged += OnNetworkStateChanged;
+
+ if (network.Connected) {
+ Browse ();
+ }
+ }
+
+ public void Dispose ()
+ {
+ browser.Dispose ();
+ }
+
+ string Banshee.ServiceStack.IService.ServiceName {
+ get { return "RemoteAudioService"; }
+ }
+
+ private void Browse ()
+ {
+ browser = new ServiceBrowser ();
+ browser.ServiceAdded += OnServiceAdded;
+ browser.ServiceRemoved += OnServiceRemoved;
+ browser.Browse (0, AddressProtocol.Any, RAOP_MDNS_TYPE, "local");
+ }
+
+ private void OnNetworkStateChanged (object o, NetworkStateChangedArgs args)
+ {
+ if (!args.Connected) {
+ browser.Dispose ();
+ browser = null;
+ return;
+ }
+
+ Browse ();
+ }
+
+ private void OnServiceAdded (object o, ServiceBrowseEventArgs args)
+ {
+ args.Service.Resolved += OnServiceResolved;
+ args.Service.Resolve ();
+ }
+
+ private void OnServiceRemoved (object o, ServiceBrowseEventArgs args)
+ {
+ // TODO: remove service
+ }
+
+ private void OnServiceResolved (object o, ServiceResolvedEventArgs args)
+ {
+ IResolvableService service = o as IResolvableService;
+ if (service == null) {
+ return;
+ }
+
+ Log.DebugFormat ("Resolved a service! ip = {0}", service.HostEntry.AddressList[0]);
+
+ ITxtRecord record = service.TxtRecord;
+
+ string version = String.Empty;
+ int sample_size = 16, sample_rate = 44100, channels = 2;
+
+ for (int i = 0, n = record.Count; i < n; i++) {
+ TxtRecordItem item = record.GetItemAt(i);
+ switch (item.Key) {
+ case "vs":
+ version = item.ValueString;
+ break;
+ case "ss":
+ sample_size = Convert.ToInt32 (item.ValueString);
+ break;
+ case "sr":
+ sample_rate = Convert.ToInt32 (item.ValueString);
+ break;
+ case "ch":
+ channels = Convert.ToInt32 (item.ValueString);
+ break;
+ }
+ }
+
+ speakers.Add (new RemoteSpeaker (service.HostEntry.AddressList[0], service.Port,
+ version, sample_rate, sample_size, channels));
+
+ EventHandler handler = SpeakersChanged;
+ if (handler != null) {
+ handler (this, EventArgs.Empty);
+ }
+ }
+ }
+}
Added: trunk/banshee/src/Extensions/Banshee.RemoteAudio/Banshee.RemoteAudio/RemoteSpeaker.cs
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.RemoteAudio/Banshee.RemoteAudio/RemoteSpeaker.cs Wed Aug 27 23:55:02 2008
@@ -0,0 +1,78 @@
+//
+// RemoteSpeaker.cs
+//
+// Authors:
+// Brad Taylor <brad getcoded net>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Net;
+
+namespace Banshee.RemoteAudio
+{
+ public class RemoteSpeaker
+ {
+ public IPAddress Host {
+ get { return host; }
+ }
+
+ public short Port {
+ get { return port; }
+ }
+
+ public string Version {
+ get { return version; }
+ }
+
+ public int SampleRate {
+ get { return sample_rate; }
+ }
+
+ public int SampleSize {
+ get { return sample_size; }
+ }
+
+ public int Channels {
+ get { return channels; }
+ }
+
+ internal RemoteSpeaker (IPAddress host, short port, string version,
+ int sample_rate, int sample_size, int channels)
+ {
+ this.host = host;
+ this.port = port;
+ this.version = version;
+ this.sample_rate = sample_rate;
+ this.sample_size = sample_size;
+ this.channels = channels;
+ }
+
+ private IPAddress host;
+ private short port;
+ private string version;
+ private int sample_rate;
+ private int sample_size;
+ private int channels;
+ }
+}
Added: trunk/banshee/src/Extensions/Banshee.RemoteAudio/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.RemoteAudio/Makefile.am Wed Aug 27 23:55:02 2008
@@ -0,0 +1,16 @@
+ASSEMBLY = Banshee.RemoteAudio
+TARGET = library
+LINK = $(REF_EXTENSION_REMOTE_AUDIO)
+INSTALL_DIR = $(EXTENSIONS_INSTALL_DIR)
+
+SOURCES = \
+ Banshee.RemoteAudio/RemoteAudioService.cs \
+ Banshee.RemoteAudio/RemoteSpeaker.cs
+
+RESOURCES = Banshee.RemoteAudio.addin.xml
+
+if REMOTE_AUDIO_ENABLED
+include $(top_srcdir)/build/build.mk
+else
+EXTRA_DIST = $(SOURCES) $(RESOURCES)
+endif
Modified: trunk/banshee/src/Extensions/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Makefile.am (original)
+++ trunk/banshee/src/Extensions/Makefile.am Wed Aug 27 23:55:02 2008
@@ -16,6 +16,7 @@
Banshee.Podcasting \
Banshee.Sample \
Banshee.SqlDebugConsole \
- Banshee.Torrent
+ Banshee.Torrent \
+ Banshee.RemoteAudio
MAINTAINERCLEANFILES = Makefile.in
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]