diff --git a/MyAudioPlaybackAgent/AudioPlayer.cs b/MyAudioPlaybackAgent/AudioPlayer.cs
new file mode 100644
index 0000000..d22d482
--- /dev/null
+++ b/MyAudioPlaybackAgent/AudioPlayer.cs
@@ -0,0 +1,214 @@
+using System;
+using System.Diagnostics;
+using System.Windows;
+using Microsoft.Phone.BackgroundAudio;
+
+namespace MyAudioPlaybackAgent
+{
+ public class AudioPlayer : AudioPlayerAgent
+ {
+ ///
+ /// Le istanze di AudioPlayer possono condividere lo stesso processo.
+ /// I campi statici possono essere utilizzati per condividere lo stato tra le istanze di AudioPlayer
+ /// o per comunicare con l'agente di flusso audio.
+ ///
+ static AudioPlayer()
+ {
+ // La sottoscrizione del gestore eccezioni gestite
+ Deployment.Current.Dispatcher.BeginInvoke(delegate
+ {
+ Application.Current.UnhandledException += UnhandledException;
+ });
+ }
+
+ /// Codice da eseguire in caso di eccezioni non gestite
+ private static void UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
+ {
+ if (Debugger.IsAttached)
+ {
+ // Si è verificata un'eccezione non gestita; inserire un'interruzione nel debugger
+ Debugger.Break();
+ }
+ }
+
+ ///
+ /// Chiamata eseguita quando cambia lo stato della riproduzione, eccetto che per lo stato di errore (vedere OnError)
+ ///
+ /// BackgroundAudioPlayer
+ /// La traccia riprodotta in corrispondenza del cambiamento di stato della riproduzione
+ /// Il nuovo stato della riproduzione del lettore
+ ///
+ /// Impossibile annullare i cambiamenti di stato della riproduzione. I cambiamenti vengono generati anche se l'applicazione
+ /// ha causato il cambiamento dello stato stesso, presupponendo che l'applicazione abbia acconsentito esplicitamente al callback.
+ ///
+ /// Eventi rilevanti dello stato della riproduzione:
+ /// (a) TrackEnded: richiamato quando il lettore non contiene una traccia corrente. L'agente può impostare la traccia successiva.
+ /// (b) TrackReady: è stata impostata una traccia audio, la quale è pronta per la riproduzione.
+ ///
+ /// Chiamare NotifyComplete() solo una volta, dopo il completamento della richiesta dell'agente, inclusi i callback asincroni.
+ ///
+ protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
+ {
+ switch (playState)
+ {
+ case PlayState.TrackEnded:
+ player.Track = GetPreviousTrack();
+ break;
+ case PlayState.TrackReady:
+ player.Play();
+ break;
+ case PlayState.Shutdown:
+ // TODO: Gestire qui lo stato di arresto (ad esempio, salvare lo stato)
+ break;
+ case PlayState.Unknown:
+ break;
+ case PlayState.Stopped:
+ break;
+ case PlayState.Paused:
+ break;
+ case PlayState.Playing:
+ break;
+ case PlayState.BufferingStarted:
+ break;
+ case PlayState.BufferingStopped:
+ break;
+ case PlayState.Rewinding:
+ break;
+ case PlayState.FastForwarding:
+ break;
+ }
+
+ NotifyComplete();
+ }
+
+ ///
+ /// Chiamata eseguita quando l'utente richiede un'azione tramite l'interfaccia utente fornita dall'applicazione o dal sistema
+ ///
+ /// BackgroundAudioPlayer
+ /// La traccia riprodotta in corrispondenza del cambiamento di stato della riproduzione
+ /// L'azione richiesta dall'utente
+ /// I dati associati all'azione richiesta.
+ /// Nella versione corrente questo parametro può essere utilizzato solo con l'azione Seek,
+ /// per indicare la posizione richiesta di una traccia audio
+ ///
+ /// Le azioni dell'utente non apportano automaticamente cambiamenti nello stato del sistema. L'agente è responsabile
+ /// dell'esecuzione delle azioni dell'utente, se supportate.
+ ///
+ /// Chiamare NotifyComplete() solo una volta, dopo il completamento della richiesta dell'agente, inclusi i callback asincroni.
+ ///
+ protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
+ {
+ switch (action)
+ {
+ case UserAction.Play:
+ if (player.PlayerState != PlayState.Playing)
+ {
+ try
+ {
+ player.Play();
+ }
+ catch
+ {
+
+ }
+ }
+ break;
+ case UserAction.Stop:
+ try
+ {
+ player.Stop();
+ }
+ catch
+ {
+
+ }
+ break;
+ case UserAction.Pause:
+ player.Pause();
+ break;
+
+ }
+
+ NotifyComplete();
+ }
+
+ ///
+ /// Implementa la logica necessaria per ottenere l'istanza di AudioTrack successiva.
+ /// In una playlist l'origine può essere un file, una richiesta Web, ecc.
+ ///
+ ///
+ /// L'URI di AudioTrack determina l'origine, che può essere:
+ /// (a) File di spazio di memorizzazione isolato (URI relativo, rappresenta il percorso nello spazio di memorizzazione isolato)
+ /// (b) URL HTTP (URI assoluto)
+ /// (c) MediaStreamSource (null)
+ ///
+ /// istanza di AudioTrack o null se la riproduzione è stata completata
+ private AudioTrack GetNextTrack()
+ {
+ // TODO: aggiungere la logica per ottenere la traccia audio successiva
+
+ AudioTrack track = null;
+
+ // specificare la traccia
+
+ return track;
+ }
+
+ ///
+ /// Implementa la logica necessaria per ottenere l'istanza di AudioTrack precedente.
+ ///
+ ///
+ /// L'URI di AudioTrack determina l'origine, che può essere:
+ /// (a) File di spazio di memorizzazione isolato (URI relativo, rappresenta il percorso nello spazio di memorizzazione isolato)
+ /// (b) URL HTTP (URI assoluto)
+ /// (c) MediaStreamSource (null)
+ ///
+ /// istanza di AudioTrack o null se la traccia precedente non è consentita
+ private AudioTrack GetPreviousTrack()
+ {
+ // TODO: aggiungere la logica per ottenere la traccia audio precedente
+
+ AudioTrack track = null;
+
+ // specificare la traccia
+
+ return track;
+ }
+
+ ///
+ /// Chiamata eseguita quando si verifica un errore relativo alla riproduzione, ad esempio quando il download di AudioTrack non viene eseguito correttamente
+ ///
+ /// BackgroundAudioPlayer
+ /// La traccia che ha restituito l'errore
+ /// L'errore che si è verificato
+ /// Se true, la riproduzione non può continuare e la riproduzione della traccia verrà interrotta
+ ///
+ /// Questo metodo non viene chiamato in tutti i casi. Ad esempio, se l'agente in background
+ /// stesso rileva un'eccezione non gestita, non verrà richiamato per gestire i propri errori.
+ ///
+ protected override void OnError(BackgroundAudioPlayer player, AudioTrack track, Exception error, bool isFatal)
+ {
+ if (isFatal)
+ {
+ Abort();
+ }
+ else
+ {
+ NotifyComplete();
+ }
+
+ }
+
+ ///
+ /// Chiamata eseguita quando la richiesta dell'agente viene annullata
+ ///
+ ///
+ /// Dopo l'annullamento della richiesta, l'agente impiega 5 secondi per completare l'operazione,
+ /// chiamando NotifyComplete()/Abort().
+ ///
+ protected override void OnCancel()
+ {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/MyAudioPlaybackAgent/Bin/Debug/MyAudioPlaybackAgent.dll b/MyAudioPlaybackAgent/Bin/Debug/MyAudioPlaybackAgent.dll
new file mode 100644
index 0000000..2fe5e6d
Binary files /dev/null and b/MyAudioPlaybackAgent/Bin/Debug/MyAudioPlaybackAgent.dll differ
diff --git a/MyAudioPlaybackAgent/Bin/Debug/MyAudioPlaybackAgent.pdb b/MyAudioPlaybackAgent/Bin/Debug/MyAudioPlaybackAgent.pdb
new file mode 100644
index 0000000..b70e532
Binary files /dev/null and b/MyAudioPlaybackAgent/Bin/Debug/MyAudioPlaybackAgent.pdb differ
diff --git a/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/Shoutcast.Sample.Phone.Background.Playback.csproj b/MyAudioPlaybackAgent/MyAudioPlaybackAgent.csproj
similarity index 67%
rename from Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/Shoutcast.Sample.Phone.Background.Playback.csproj
rename to MyAudioPlaybackAgent/MyAudioPlaybackAgent.csproj
index 8bcee24..60a9ec1 100644
--- a/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/Shoutcast.Sample.Phone.Background.Playback.csproj
+++ b/MyAudioPlaybackAgent/MyAudioPlaybackAgent.csproj
@@ -1,40 +1,24 @@
-
+
Debug
AnyCPU
10.0.20506
2.0
- {12F8E56D-728C-4073-BDA5-058E6222DE51}
+ {408FDA62-9BCB-4BE0-9F74-D82B4A902468}
{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
Library
Properties
- Shoutcast.Sample.Phone.Background.PlaybackAgent
- Shoutcast.Sample.Phone.Background.PlaybackAgent
- v8.0
-
-
-
-
+ MyAudioPlaybackAgent
+ MyAudioPlaybackAgent
WindowsPhone
+ v8.0
+ $(TargetFrameworkVersion)
false
true
true
- AgentLibrary
-
-
-
-
-
-
-
-
-
-
-
-
- 4.0
11.0
+ AgentLibrary
true
@@ -57,43 +41,52 @@
prompt
4
-
-
- Bin\x86\Debug
+
true
full
false
+ Bin\x86\Debug
+ DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
+ true
+ true
+ prompt
+ 4
-
-
- Bin\x86\Release
+
pdbonly
true
+ Bin\x86\Release
+ TRACE;SILVERLIGHT;WINDOWS_PHONE
+ true
+ true
+ prompt
+ 4
-
-
- Bin\ARM\Debug
+
true
full
false
+ Bin\ARM\Debug
+ DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
+ true
+ true
+ prompt
+ 4
-
-
- Bin\ARM\Release
+
pdbonly
true
+ Bin\ARM\Release
+ TRACE;SILVERLIGHT;WINDOWS_PHONE
+ true
+ true
+ prompt
+ 4
-
-
-
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}
- Silverlight.Media.Shoutcast.Phone
-
-
diff --git a/MyAudioPlaybackAgent/Properties/AssemblyInfo.cs b/MyAudioPlaybackAgent/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..cae5c85
--- /dev/null
+++ b/MyAudioPlaybackAgent/Properties/AssemblyInfo.cs
@@ -0,0 +1,37 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Resources;
+
+// Le informazioni generali relative a un assembly sono controllate dal seguente
+// set di attributi. Modificare i valori di questi attributi per modificare le informazioni
+// associate a un assembly.
+[assembly: AssemblyTitle("MyAudioPlaybackAgent")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("MyAudioPlaybackAgent")]
+[assembly: AssemblyCopyright("Copyright © 2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
+// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
+// COM, impostare su true l'attributo ComVisible per tale tipo.
+[assembly: ComVisible(false)]
+
+// Se il progetto viene esposto a COM, il seguente GUID verrà utilizzato come ID della libreria dei tipi
+[assembly: Guid("408fda62-9bcb-4be0-9f74-d82b4a902468")]
+
+// Le informazioni sulla versione di un assembly sono costituite dai quattro valori seguenti:
+//
+// Versione principale
+// Versione secondaria
+// Numero build
+// Revisione
+//
+// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
+// utilizzando l'asterisco (*) come illustrato di seguito:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: NeutralResourcesLanguageAttribute("it-IT")]
diff --git a/MyAudioPlaybackAgent/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/MyAudioPlaybackAgent/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
new file mode 100644
index 0000000..194dc8f
Binary files /dev/null and b/MyAudioPlaybackAgent/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ
diff --git a/MyAudioPlaybackAgent/obj/Debug/MyAudioPlaybackAgent.csproj.FileListAbsolute.txt b/MyAudioPlaybackAgent/obj/Debug/MyAudioPlaybackAgent.csproj.FileListAbsolute.txt
new file mode 100644
index 0000000..72a2c8a
--- /dev/null
+++ b/MyAudioPlaybackAgent/obj/Debug/MyAudioPlaybackAgent.csproj.FileListAbsolute.txt
@@ -0,0 +1,4 @@
+C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\MyAudioPlaybackAgent\Bin\Debug\MyAudioPlaybackAgent.dll
+C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\MyAudioPlaybackAgent\Bin\Debug\MyAudioPlaybackAgent.pdb
+C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\MyAudioPlaybackAgent\obj\Debug\MyAudioPlaybackAgent.dll
+C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\MyAudioPlaybackAgent\obj\Debug\MyAudioPlaybackAgent.pdb
diff --git a/MyAudioPlaybackAgent/obj/Debug/MyAudioPlaybackAgent.dll b/MyAudioPlaybackAgent/obj/Debug/MyAudioPlaybackAgent.dll
new file mode 100644
index 0000000..2fe5e6d
Binary files /dev/null and b/MyAudioPlaybackAgent/obj/Debug/MyAudioPlaybackAgent.dll differ
diff --git a/MyAudioPlaybackAgent/obj/Debug/MyAudioPlaybackAgent.pdb b/MyAudioPlaybackAgent/obj/Debug/MyAudioPlaybackAgent.pdb
new file mode 100644
index 0000000..b70e532
Binary files /dev/null and b/MyAudioPlaybackAgent/obj/Debug/MyAudioPlaybackAgent.pdb differ
diff --git a/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/MyAudioPlaybackAgent/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
similarity index 100%
rename from Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
rename to MyAudioPlaybackAgent/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
diff --git a/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/MyAudioPlaybackAgent/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
similarity index 100%
rename from Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
rename to MyAudioPlaybackAgent/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
diff --git a/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/MyAudioPlaybackAgent/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
similarity index 100%
rename from Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
rename to MyAudioPlaybackAgent/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background.PlaybackAgent/AudioPlayer.cs b/Src/Backup/Shoutcast.Sample.Phone.Background.PlaybackAgent/AudioPlayer.cs
deleted file mode 100644
index c64360b..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone.Background.PlaybackAgent/AudioPlayer.cs
+++ /dev/null
@@ -1,203 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Shoutcast.Sample.Phone.Background.Playback
-{
- using System;
- using System.Windows;
- using Microsoft.Phone.BackgroundAudio;
-
- ///
- /// Shoutcast audio player for background audio.
- ///
- public class AudioPlayer : AudioPlayerAgent
- {
- ///
- /// Static field that denotes if this class has been initialized.
- ///
- private static volatile bool classInitialized;
-
- ///
- /// Initializes a new instance of the AudioPlayer class.
- ///
- ///
- /// AudioPlayer instances can share the same process.
- /// Static fields can be used to share state between AudioPlayer instances
- /// or to communicate with the Audio Streaming agent.
- ///
- public AudioPlayer()
- {
- if (!AudioPlayer.classInitialized)
- {
- AudioPlayer.classInitialized = true;
-
- // Subscribe to the managed exception handler
- Deployment.Current.Dispatcher.BeginInvoke(delegate
- {
- Application.Current.UnhandledException += this.AudioPlayer_UnhandledException;
- });
- }
- }
-
- ///
- /// Called when the playstate changes, except for the Error state (see OnError)
- ///
- /// The BackgroundAudioPlayer
- /// The track playing at the time the playstate changed
- /// The new playstate of the player
- ///
- ///
- /// Play State changes cannot be cancelled. They are raised even if the application
- /// caused the state change itself, assuming the application has opted-in to the callback.
- ///
- ///
- /// Notable playstate events:
- /// (a) TrackEnded: invoked when the player has no current track. The agent can set the next track.
- /// (b) TrackReady: an audio track has been set and it is now ready for playack.
- ///
- ///
- /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
- ///
- ///
- protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": OnPlayStateChanged() - {0}", playState);
- switch (playState)
- {
- case PlayState.TrackEnded:
- break;
- case PlayState.TrackReady:
- player.Play();
- break;
- case PlayState.Shutdown:
- // TODO: Handle the shutdown state here (e.g. save state)
- break;
- case PlayState.Unknown:
- break;
- case PlayState.Stopped:
- break;
- case PlayState.Paused:
- break;
- case PlayState.Playing:
- break;
- case PlayState.BufferingStarted:
- break;
- case PlayState.BufferingStopped:
- break;
- case PlayState.Rewinding:
- break;
- case PlayState.FastForwarding:
- break;
- }
-
- NotifyComplete();
- }
-
- ///
- /// Called when the user requests an action using application/system provided UI
- ///
- /// The BackgroundAudioPlayer
- /// The track playing at the time of the user action
- /// The action the user has requested
- /// The data associated with the requested action.
- /// In the current version this parameter is only for use with the Seek action,
- /// to indicate the requested position of an audio track
- ///
- /// User actions do not automatically make any changes in system state; the agent is responsible
- /// for carrying out the user actions if they are supported.
- /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
- ///
- protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": OnUserAction() - {0}", action);
- switch (action)
- {
- case UserAction.Play:
- // Since we are just restarting the same stream, this should be fine.
- player.Track = track;
- break;
- case UserAction.Stop:
- case UserAction.Pause:
- player.Stop();
-
- // Stop the background streaming agent.
- Shoutcast.Sample.Phone.Background.Playback.AudioTrackStreamer.ShutdownMediaStreamSource();
- break;
- case UserAction.FastForward:
- break;
- case UserAction.Rewind:
- break;
- case UserAction.Seek:
- break;
- case UserAction.SkipNext:
- break;
- case UserAction.SkipPrevious:
- break;
- }
-
- NotifyComplete();
- }
-
- ///
- /// Called whenever there is an error with playback, such as an AudioTrack not downloading correctly
- ///
- /// The BackgroundAudioPlayer
- /// The track that had the error
- /// The error that occured
- /// If true, playback cannot continue and playback of the track will stop
- ///
- /// This method is not guaranteed to be called in all cases. For example, if the background agent
- /// itself has an unhandled exception, it won't get called back to handle its own errors.
- ///
- protected override void OnError(BackgroundAudioPlayer player, AudioTrack track, Exception error, bool isFatal)
- {
- if (isFatal)
- {
- Abort();
- }
- else
- {
- player.Track = null;
- NotifyComplete();
- }
- }
-
- ///
- /// Called by the operating system to alert a background agent that it is going to be put into a dormant state or terminated.
- ///
- protected override void OnCancel()
- {
- base.OnCancel();
- this.NotifyComplete();
- }
-
- ///
- /// Code to execute unhandled exceptions.
- ///
- /// Sender of the event.
- /// ApplicationUnhandledExceptionEventArgs associated with this event.
- private void AudioPlayer_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
- {
- if (System.Diagnostics.Debugger.IsAttached)
- {
- // An unhandled exception has occurred; break into the debugger
- System.Diagnostics.Debugger.Break();
- }
- }
- }
-}
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background.PlaybackAgent/AudioTrackStreamer.cs b/Src/Backup/Shoutcast.Sample.Phone.Background.PlaybackAgent/AudioTrackStreamer.cs
deleted file mode 100644
index 32587eb..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone.Background.PlaybackAgent/AudioTrackStreamer.cs
+++ /dev/null
@@ -1,130 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Shoutcast.Sample.Phone.Background.Playback
-{
- using System;
- using System.Windows;
- using Microsoft.Phone.BackgroundAudio;
- using Silverlight.Media;
-
- ///
- /// A background agent that performs per-track streaming for playback
- ///
- public class AudioTrackStreamer : AudioStreamingAgent
- {
- ///
- /// Static field that contains the ShoutcastMediaStreamSource associated with this AudioStreamingAgent.
- ///
- private static ShoutcastMediaStreamSource mss;
-
- ///
- /// Static field used to synchronize access to the ShoutcastMediaStreamSource associated with this AudioStreamingAgent.
- ///
- private static object syncRoot = new object();
-
- ///
- /// Initializes a new instance of the AudioTrackStreamer class.
- ///
- public AudioTrackStreamer()
- : base()
- {
- }
-
- ///
- /// Completely shuts down the AudioTrackStreamer.
- ///
- public static void ShutdownMediaStreamSource()
- {
- if (AudioTrackStreamer.mss != null)
- {
- lock (AudioTrackStreamer.syncRoot)
- {
- if (AudioTrackStreamer.mss != null)
- {
- // Because of the NotifyComplete(), we need to set this BEFORE the MSS ends.
- ShoutcastMediaStreamSource temp = AudioTrackStreamer.mss;
- AudioTrackStreamer.mss = null;
- temp.MetadataChanged -= new System.Windows.RoutedEventHandler(AudioTrackStreamer.MetadataChanged);
- temp.Dispose();
- }
- }
- }
- }
-
- ///
- /// Called when a new track requires audio decoding
- /// (typically because it is about to start playing)
- ///
- ///
- /// The track that needs audio streaming
- ///
- ///
- /// The AudioStreamer object to which a MediaStreamSource should be
- /// attached to commence playback
- ///
- ///
- /// To invoke this method for a track set the Source parameter of the AudioTrack to null
- /// before setting into the Track property of the BackgroundAudioPlayer instance
- /// property set to true;
- /// otherwise it is assumed that the system will perform all streaming
- /// and decoding
- ///
- protected override void OnBeginStreaming(AudioTrack track, AudioStreamer streamer)
- {
- lock (AudioTrackStreamer.syncRoot)
- {
- AudioTrackStreamer.mss = new ShoutcastMediaStreamSource(new Uri(track.Tag));
- AudioTrackStreamer.mss.MetadataChanged += new RoutedEventHandler(AudioTrackStreamer.MetadataChanged);
- AudioTrackStreamer.mss.Closed += (s, e) =>
- {
- this.NotifyComplete();
- };
- streamer.SetSource(AudioTrackStreamer.mss);
- }
- }
-
- ///
- /// Called when the agent request is getting cancelled
- /// The call to base.OnCancel() is necessary to release the background streaming resources
- ///
- protected override void OnCancel()
- {
- base.OnCancel();
-
- // The shutdown calls NotifyComplete(), so we don't have to call it here.
- AudioTrackStreamer.ShutdownMediaStreamSource();
- }
-
- ///
- /// Code to execute when the Shoutcast stream metadata changes.
- ///
- /// Send of the event.
- /// RoutedEventArgs associated with this event.
- private static void MetadataChanged(object sender, RoutedEventArgs e)
- {
- var track = BackgroundAudioPlayer.Instance.Track;
- if (track != null)
- {
- track.BeginEdit();
- track.Artist = AudioTrackStreamer.mss.CurrentMetadata.Title;
- track.EndEdit();
- }
- }
- }
-}
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background.PlaybackAgent/Properties/AssemblyInfo.cs b/Src/Backup/Shoutcast.Sample.Phone.Background.PlaybackAgent/Properties/AssemblyInfo.cs
deleted file mode 100644
index 5db5cb1..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone.Background.PlaybackAgent/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Shoutcast.Sample.Phone.Background.PlaybackAgent")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Shoutcast.Sample.Phone.Background.PlaybackAgent")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("3903187c-bc99-40ff-a64c-750a0e462243")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
-[assembly: NeutralResourcesLanguageAttribute("en-US")]
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background.PlaybackAgent/Shoutcast.Sample.Phone.Background.Playback.csproj b/Src/Backup/Shoutcast.Sample.Phone.Background.PlaybackAgent/Shoutcast.Sample.Phone.Background.Playback.csproj
deleted file mode 100644
index 9d397f0..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone.Background.PlaybackAgent/Shoutcast.Sample.Phone.Background.Playback.csproj
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 10.0.20506
- 2.0
- {12F8E56D-728C-4073-BDA5-058E6222DE51}
- {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
- Library
- Properties
- Shoutcast.Sample.Phone.Background.PlaybackAgent
- Shoutcast.Sample.Phone.Background.PlaybackAgent
- v4.0
- $(TargetFrameworkVersion)
- WindowsPhone71
- Silverlight
- false
- true
- true
- AudioPlayerAgent
-
-
-
-
-
-
-
-
-
-
- true
- full
- false
- Bin\Debug
- DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
-
-
- pdbonly
- true
- Bin\Release
- TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}
- Silverlight.Media.Shoutcast.Phone
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background.PlaybackAgent/Shoutcast.Sample.Phone.Background.Playback.csproj.user b/Src/Backup/Shoutcast.Sample.Phone.Background.PlaybackAgent/Shoutcast.Sample.Phone.Background.Playback.csproj.user
deleted file mode 100644
index ac8712b..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone.Background.PlaybackAgent/Shoutcast.Sample.Phone.Background.Playback.csproj.user
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
- True
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background/App.xaml b/Src/Backup/Shoutcast.Sample.Phone.Background/App.xaml
deleted file mode 100644
index 4047f50..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone.Background/App.xaml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background/App.xaml.cs b/Src/Backup/Shoutcast.Sample.Phone.Background/App.xaml.cs
deleted file mode 100644
index 12466d7..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone.Background/App.xaml.cs
+++ /dev/null
@@ -1,192 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Shoutcast.Sample.Phone.Background
-{
- using System.Windows;
- using System.Windows.Navigation;
- using Microsoft.Phone.BackgroundAudio;
- using Microsoft.Phone.Controls;
- using Microsoft.Phone.Shell;
-
- ///
- /// This class represents our Windows Phone application.
- ///
- public partial class App : Application
- {
- ///
- /// Field used to avoid double-initialization.
- ///
- private bool phoneApplicationInitialized = false;
-
- ///
- /// Initializes a new instance of the App class.
- ///
- public App()
- {
- // Global handler for uncaught exceptions.
- UnhandledException += this.Application_UnhandledException;
-
- // Standard Silverlight initialization
- InitializeComponent();
-
- // Phone-specific initialization
- this.InitializePhoneApplication();
-
- // Show graphics profiling information while debugging.
- if (System.Diagnostics.Debugger.IsAttached)
- {
- // Display the current frame rate counters.
- Application.Current.Host.Settings.EnableFrameRateCounter = true;
-
- // Show the areas of the app that are being redrawn in each frame.
- // Application.Current.Host.Settings.EnableRedrawRegions = true;
-
- // Enable non-production analysis visualization mode,
- // which shows areas of a page that are handed off to GPU with a colored overlay.
- // Application.Current.Host.Settings.EnableCacheVisualization = true;
-
- // Disable the application idle detection by setting the UserIdleDetectionMode property of the
- // application's PhoneApplicationService object to Disabled.
- // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
- // and consume battery power when the user is not using the phone.
- PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
-
- // Make sure we aren't attached to the background agent
- BackgroundAudioPlayer.Instance.Close();
- }
- }
-
- ///
- /// Gets the root frame of the Phone Application.
- ///
- /// The root frame of the Phone Application.
- public PhoneApplicationFrame RootFrame { get; private set; }
-
- ///
- /// Method that is called when the application is launching (eg, from Start).
- /// This code will not execute when the application is reactivated.
- ///
- /// Sender of the event.
- /// LaunchingEventArgs associated with this event.
- private void Application_Launching(object sender, LaunchingEventArgs e)
- {
- }
-
- ///
- /// Method that is called when the application is activated (brought to foreground).
- /// This code will not execute when the application is first launched.
- ///
- /// Sender of the event.
- /// ActivatedEventArgs associated with this event.
- private void Application_Activated(object sender, ActivatedEventArgs e)
- {
- }
-
- ///
- /// Method that is called when the application is deactivated (sent to background).
- /// This code will not execute when the application is closing.
- ///
- /// Sender of the event.
- /// DeactivatedEventArgs associated with this event.
- private void Application_Deactivated(object sender, DeactivatedEventArgs e)
- {
- }
-
- ///
- /// Method that is called when the application is closing (eg, user hit Back).
- /// This code will not execute when the application is deactivated.
- ///
- /// Sender of the event.
- /// ClosingEventArgs associated with this event.
- private void Application_Closing(object sender, ClosingEventArgs e)
- {
- }
-
- ///
- /// Method that is called if a navigation fails.
- ///
- /// Sender of the event.
- /// NavigationFailedEventArgs associated with this event.
- private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
- {
- if (System.Diagnostics.Debugger.IsAttached)
- {
- // A navigation has failed; break into the debugger
- System.Diagnostics.Debugger.Break();
- }
- }
-
- ///
- /// Method that is called on Unhandled Exceptions.
- ///
- /// Sender of the event.
- /// ApplicationUnhandledExceptionEventArgs associated with this event.
- private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
- {
- if (System.Diagnostics.Debugger.IsAttached)
- {
- // An unhandled exception has occurred; break into the debugger
- System.Diagnostics.Debugger.Break();
- }
- }
-
- #region Phone application initialization
-
- ///
- /// Initializes the Windows Phone application. Do not add any additional code to this method!
- ///
- private void InitializePhoneApplication()
- {
- if (this.phoneApplicationInitialized)
- {
- return;
- }
-
- // Create the frame but don't set it as RootVisual yet; this allows the splash
- // screen to remain active until the application is ready to render.
- this.RootFrame = new PhoneApplicationFrame();
- this.RootFrame.Navigated += this.CompleteInitializePhoneApplication;
-
- // Handle navigation failures
- this.RootFrame.NavigationFailed += this.RootFrame_NavigationFailed;
-
- // Ensure we don't initialize again
- this.phoneApplicationInitialized = true;
- }
-
- ///
- /// Finalizes the initialization of the Windows Phone application. Do not add any additional code to this method!
- ///
- /// Sender of the event.
- /// NavigationEventArgs associated with this event.
- private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
- {
- // Set the root visual to allow the application to render
- if (RootVisual != this.RootFrame)
- {
- RootVisual = this.RootFrame;
- }
-
- // Remove this handler since it is no longer needed
- this.RootFrame.Navigated -= this.CompleteInitializePhoneApplication;
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background/ApplicationIcon.png b/Src/Backup/Shoutcast.Sample.Phone.Background/ApplicationIcon.png
deleted file mode 100644
index 5859393..0000000
Binary files a/Src/Backup/Shoutcast.Sample.Phone.Background/ApplicationIcon.png and /dev/null differ
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background/Background.png b/Src/Backup/Shoutcast.Sample.Phone.Background/Background.png
deleted file mode 100644
index e46f21d..0000000
Binary files a/Src/Backup/Shoutcast.Sample.Phone.Background/Background.png and /dev/null differ
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background/Images/appbar.transport.pause.rest.png b/Src/Backup/Shoutcast.Sample.Phone.Background/Images/appbar.transport.pause.rest.png
deleted file mode 100644
index 1df8283..0000000
Binary files a/Src/Backup/Shoutcast.Sample.Phone.Background/Images/appbar.transport.pause.rest.png and /dev/null differ
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background/Images/appbar.transport.play.rest.png b/Src/Backup/Shoutcast.Sample.Phone.Background/Images/appbar.transport.play.rest.png
deleted file mode 100644
index 5cf7d9c..0000000
Binary files a/Src/Backup/Shoutcast.Sample.Phone.Background/Images/appbar.transport.play.rest.png and /dev/null differ
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background/MainPage.xaml b/Src/Backup/Shoutcast.Sample.Phone.Background/MainPage.xaml
deleted file mode 100644
index de4be19..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone.Background/MainPage.xaml
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background/MainPage.xaml.cs b/Src/Backup/Shoutcast.Sample.Phone.Background/MainPage.xaml.cs
deleted file mode 100644
index 975b8cd..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone.Background/MainPage.xaml.cs
+++ /dev/null
@@ -1,203 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Shoutcast.Sample.Phone.Background
-{
- using System;
- using System.Windows;
- using System.Windows.Threading;
- using Microsoft.Phone.BackgroundAudio;
- using Microsoft.Phone.Controls;
- using Microsoft.Phone.Shell;
-
- ///
- /// This class represents the main page of our Windows Phone application.
- ///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "When the page is unloaded, the ShoutcastMediaStreamSource is disposed.")]
- public partial class MainPage : PhoneApplicationPage
- {
- ///
- /// Index for the play button in the ApplicationBar.Buttons.
- ///
- private const int PlayButtonIndex = 0;
-
- ///
- /// Index for the pause button in the ApplicationBar.Buttons.
- ///
- private const int PauseButtonIndex = 1;
-
- ///
- /// Private field that stores the timer for updating the UI
- ///
- private DispatcherTimer timer;
-
- ///
- /// Initializes a new instance of the MainPage class.
- ///
- public MainPage()
- {
- InitializeComponent();
- Loaded += new RoutedEventHandler(this.MainPage_Loaded);
- }
-
- ///
- /// Method called when the main page is loaded.
- ///
- /// Sender of the event.
- /// The RoutedEventArgs instance associated with this event.
- private void MainPage_Loaded(object sender, RoutedEventArgs e)
- {
- // Initialize a timer to update the UI every half-second.
- this.timer = new DispatcherTimer();
- this.timer.Interval = TimeSpan.FromSeconds(0.5);
- this.timer.Tick += new EventHandler(this.UpdateState);
-
- BackgroundAudioPlayer.Instance.PlayStateChanged += new EventHandler(this.Instance_PlayStateChanged);
-
- if (BackgroundAudioPlayer.Instance.PlayerState == PlayState.Playing)
- {
- // If audio was already playing when the app was launched, update the UI.
- // positionIndicator.IsIndeterminate = false;
- // positionIndicator.Maximum = BackgroundAudioPlayer.Instance.Track.Duration.TotalSeconds;
- this.UpdateButtons(false, true);
- this.UpdateState(null, null);
- }
- }
-
- ///
- /// PlayStateChanged event handler.
- ///
- /// Sender of the event.
- /// The EventArgs instance associated with this event.
- private void Instance_PlayStateChanged(object sender, EventArgs e)
- {
- // This is wonky
- PlayState playState = PlayState.Unknown;
- try
- {
- playState = BackgroundAudioPlayer.Instance.PlayerState;
- }
- catch (InvalidOperationException)
- {
- playState = PlayState.Stopped;
- }
-
- switch (playState)
- {
- case PlayState.Playing:
- // Update the UI.
- // positionIndicator.IsIndeterminate = false;
- // positionIndicator.Maximum = BackgroundAudioPlayer.Instance.Track.Duration.TotalSeconds;
- this.UpdateButtons(false, true);
- this.UpdateState(null, null);
-
- // Start the timer for updating the UI.
- this.timer.Start();
- break;
-
- case PlayState.Paused:
- // Stop the timer for updating the UI.
- this.timer.Stop();
-
- // Update the UI.
- this.UpdateButtons(true, false);
- this.UpdateState(null, null);
- break;
- case PlayState.Stopped:
- // Stop the timer for updating the UI.
- this.timer.Stop();
-
- // Update the UI.
- this.UpdateButtons(true, false);
- this.UpdateState(null, null);
- break;
- default:
- break;
- }
- }
-
- ///
- /// Helper method to update the state of the ApplicationBar.Buttons
- ///
- /// true if the Play button should be enabled, otherwise, false.
- /// true if the Pause button should be enabled, otherwise, false.
- private void UpdateButtons(bool playBtnEnabled, bool pauseBtnEnabled)
- {
- // Set the IsEnabled state of the ApplicationBar.Buttons array
- ((ApplicationBarIconButton)ApplicationBar.Buttons[PlayButtonIndex]).IsEnabled = playBtnEnabled;
- ((ApplicationBarIconButton)ApplicationBar.Buttons[PauseButtonIndex]).IsEnabled = pauseBtnEnabled;
- }
-
- ///
- /// Updates the status indicators including the State, Track title,
- ///
- /// Sender of the event.
- /// The EventArgs instance associated with this event.
- private void UpdateState(object sender, EventArgs e)
- {
- txtState.Text = string.Format("State: {0}", BackgroundAudioPlayer.Instance.PlayerState);
-
- AudioTrack audioTrack = BackgroundAudioPlayer.Instance.Track;
-
- if (audioTrack != null)
- {
- txtTitle.Text = string.Format("Title: {0}", audioTrack.Title);
- txtArtist.Text = string.Format("Artist: {0}", audioTrack.Artist);
-
- // Set the current position on the ProgressBar.
- // positionIndicator.Value = BackgroundAudioPlayer.Instance.Position.TotalSeconds;
-
- // Update the current playback position.
- TimeSpan position = new TimeSpan();
- position = BackgroundAudioPlayer.Instance.Position;
- textPosition.Text = String.Format("{0:d2}:{1:d2}:{2:d2}", position.Hours, position.Minutes, position.Seconds);
-
- // Update the time remaining digits.
- // TimeSpan timeRemaining = new TimeSpan();
- // timeRemaining = audioTrack.Duration - position;
- // textRemaining.Text = String.Format("-{0:d2}:{1:d2}:{2:d2}", timeRemaining.Hours, timeRemaining.Minutes, timeRemaining.Seconds);
- }
- }
-
- ///
- /// Click handler for the Play button
- ///
- /// Sender of the event.
- /// The EventArgs instance associated with this event.
- private void PlayButtonClick(object sender, EventArgs e)
- {
- // Tell the backgound audio agent to play the current track.
- BackgroundAudioPlayer.Instance.Track = new AudioTrack(null, "SKY.FM", null, null, null, "http://scfire-ntc-aa05.stream.aol.com:80/stream/1006", EnabledPlayerControls.Pause);
- BackgroundAudioPlayer.Instance.Volume = 1.0d;
- }
-
- ///
- /// Click handler for the Pause button
- ///
- /// Sender of the event.
- /// The EventArgs instance associated with this event.
- private void PauseButtonClick(object sender, EventArgs e)
- {
- // Tell the backgound audio agent to pause the current track.
- // We need to stop the timer before anything
- this.timer.Stop();
- BackgroundAudioPlayer.Instance.Stop();
- this.UpdateState(null, null);
- }
- }
-}
\ No newline at end of file
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background/Properties/AppManifest.xml b/Src/Backup/Shoutcast.Sample.Phone.Background/Properties/AppManifest.xml
deleted file mode 100644
index 6712a11..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone.Background/Properties/AppManifest.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background/Properties/AssemblyInfo.cs b/Src/Backup/Shoutcast.Sample.Phone.Background/Properties/AssemblyInfo.cs
deleted file mode 100644
index 72a9fca..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone.Background/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Shoutcast.Sample.Phone.Background")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Shoutcast.Sample.Phone.Background")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("cfe4a6f4-f696-41a2-875a-fdca146921dd")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
-[assembly: NeutralResourcesLanguageAttribute("en-US")]
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background/Properties/WMAppManifest.xml b/Src/Backup/Shoutcast.Sample.Phone.Background/Properties/WMAppManifest.xml
deleted file mode 100644
index 6808a8d..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone.Background/Properties/WMAppManifest.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
- ApplicationIcon.png
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Background.png
- 0
- Shoutcast.Sample.Phone.Background
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background/Shoutcast.Sample.Phone.Background.csproj b/Src/Backup/Shoutcast.Sample.Phone.Background/Shoutcast.Sample.Phone.Background.csproj
deleted file mode 100644
index a4497e9..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone.Background/Shoutcast.Sample.Phone.Background.csproj
+++ /dev/null
@@ -1,122 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 10.0.20506
- 2.0
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}
- {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
- Library
- Properties
- Shoutcast.Sample.Phone.Background
- Shoutcast.Sample.Phone.Background
- v4.0
- $(TargetFrameworkVersion)
- WindowsPhone71
- Silverlight
- true
-
-
- true
- true
- Shoutcast.Sample.Phone.Background.xap
- Properties\AppManifest.xml
- Shoutcast.Sample.Phone.Background.App
- true
- true
-
-
-
-
-
-
-
-
-
-
- true
- full
- false
- Bin\Debug
- DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
-
-
- pdbonly
- true
- Bin\Release
- TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
- App.xaml
-
-
- MainPage.xaml
-
-
-
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
-
-
-
-
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
-
-
-
- {12F8E56D-728C-4073-BDA5-058E6222DE51}
- Shoutcast.Sample.Phone.Background.Playback
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background/Shoutcast.Sample.Phone.Background.csproj.user b/Src/Backup/Shoutcast.Sample.Phone.Background/Shoutcast.Sample.Phone.Background.csproj.user
deleted file mode 100644
index ac8712b..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone.Background/Shoutcast.Sample.Phone.Background.csproj.user
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
- True
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Backup/Shoutcast.Sample.Phone.Background/SplashScreenImage.jpg b/Src/Backup/Shoutcast.Sample.Phone.Background/SplashScreenImage.jpg
deleted file mode 100644
index 353b192..0000000
Binary files a/Src/Backup/Shoutcast.Sample.Phone.Background/SplashScreenImage.jpg and /dev/null differ
diff --git a/Src/Backup/Shoutcast.Sample.Phone/App.xaml b/Src/Backup/Shoutcast.Sample.Phone/App.xaml
deleted file mode 100644
index 34e443f..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone/App.xaml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Backup/Shoutcast.Sample.Phone/App.xaml.cs b/Src/Backup/Shoutcast.Sample.Phone/App.xaml.cs
deleted file mode 100644
index 03d603c..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone/App.xaml.cs
+++ /dev/null
@@ -1,188 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Shoutcast.Sample.Phone
-{
- using System.Windows;
- using System.Windows.Navigation;
- using Microsoft.Phone.Controls;
- using Microsoft.Phone.Shell;
-
- ///
- /// This class represents our Windows Phone application.
- ///
- public partial class App : Application
- {
- ///
- /// Field used to avoid double-initialization.
- ///
- private bool phoneApplicationInitialized = false;
-
- ///
- /// Initializes a new instance of the App class.
- ///
- public App()
- {
- // Global handler for uncaught exceptions.
- UnhandledException += this.Application_UnhandledException;
-
- // Standard Silverlight initialization
- InitializeComponent();
-
- // Phone-specific initialization
- this.InitializePhoneApplication();
-
- // Show graphics profiling information while debugging.
- if (System.Diagnostics.Debugger.IsAttached)
- {
- // Display the current frame rate counters.
- Application.Current.Host.Settings.EnableFrameRateCounter = true;
-
- // Show the areas of the app that are being redrawn in each frame.
- // Application.Current.Host.Settings.EnableRedrawRegions = true;
-
- // Enable non-production analysis visualization mode,
- // which shows areas of a page that are handed off to GPU with a colored overlay.
- // Application.Current.Host.Settings.EnableCacheVisualization = true;
-
- // Disable the application idle detection by setting the UserIdleDetectionMode property of the
- // application's PhoneApplicationService object to Disabled.
- // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
- // and consume battery power when the user is not using the phone.
- PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
- }
- }
-
- ///
- /// Gets the root frame of the Phone Application.
- ///
- /// The root frame of the Phone Application.
- public PhoneApplicationFrame RootFrame { get; private set; }
-
- ///
- /// Method that is called when the application is launching (eg, from Start).
- /// This code will not execute when the application is reactivated.
- ///
- /// Sender of the event.
- /// LaunchingEventArgs associated with this event.
- private void Application_Launching(object sender, LaunchingEventArgs e)
- {
- }
-
- ///
- /// Method that is called when the application is activated (brought to foreground).
- /// This code will not execute when the application is first launched.
- ///
- /// Sender of the event.
- /// ActivatedEventArgs associated with this event.
- private void Application_Activated(object sender, ActivatedEventArgs e)
- {
- }
-
- ///
- /// Method that is called when the application is deactivated (sent to background).
- /// This code will not execute when the application is closing.
- ///
- /// Sender of the event.
- /// DeactivatedEventArgs associated with this event.
- private void Application_Deactivated(object sender, DeactivatedEventArgs e)
- {
- }
-
- ///
- /// Method that is called when the application is closing (eg, user hit Back).
- /// This code will not execute when the application is deactivated.
- ///
- /// Sender of the event.
- /// ClosingEventArgs associated with this event.
- private void Application_Closing(object sender, ClosingEventArgs e)
- {
- }
-
- ///
- /// Method that is called if a navigation fails.
- ///
- /// Sender of the event.
- /// NavigationFailedEventArgs associated with this event.
- private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
- {
- if (System.Diagnostics.Debugger.IsAttached)
- {
- // A navigation has failed; break into the debugger
- System.Diagnostics.Debugger.Break();
- }
- }
-
- ///
- /// Method that is called on Unhandled Exceptions.
- ///
- /// Sender of the event.
- /// ApplicationUnhandledExceptionEventArgs associated with this event.
- private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
- {
- if (System.Diagnostics.Debugger.IsAttached)
- {
- // An unhandled exception has occurred; break into the debugger
- System.Diagnostics.Debugger.Break();
- }
- }
-
- #region Phone application initialization
-
- ///
- /// Initializes the Windows Phone application. Do not add any additional code to this method!
- ///
- private void InitializePhoneApplication()
- {
- if (this.phoneApplicationInitialized)
- {
- return;
- }
-
- // Create the frame but don't set it as RootVisual yet; this allows the splash
- // screen to remain active until the application is ready to render.
- this.RootFrame = new PhoneApplicationFrame();
- this.RootFrame.Navigated += this.CompleteInitializePhoneApplication;
-
- // Handle navigation failures
- this.RootFrame.NavigationFailed += this.RootFrame_NavigationFailed;
-
- // Ensure we don't initialize again
- this.phoneApplicationInitialized = true;
- }
-
- ///
- /// Finalizes the initialization of the Windows Phone application. Do not add any additional code to this method!
- ///
- /// Sender of the event.
- /// NavigationEventArgs associated with this event.
- private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
- {
- // Set the root visual to allow the application to render
- if (RootVisual != this.RootFrame)
- {
- RootVisual = this.RootFrame;
- }
-
- // Remove this handler since it is no longer needed
- this.RootFrame.Navigated -= this.CompleteInitializePhoneApplication;
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Src/Backup/Shoutcast.Sample.Phone/ApplicationIcon.png b/Src/Backup/Shoutcast.Sample.Phone/ApplicationIcon.png
deleted file mode 100644
index 5859393..0000000
Binary files a/Src/Backup/Shoutcast.Sample.Phone/ApplicationIcon.png and /dev/null differ
diff --git a/Src/Backup/Shoutcast.Sample.Phone/Background.png b/Src/Backup/Shoutcast.Sample.Phone/Background.png
deleted file mode 100644
index e46f21d..0000000
Binary files a/Src/Backup/Shoutcast.Sample.Phone/Background.png and /dev/null differ
diff --git a/Src/Backup/Shoutcast.Sample.Phone/MainPage.xaml b/Src/Backup/Shoutcast.Sample.Phone/MainPage.xaml
deleted file mode 100644
index e0faa8b..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone/MainPage.xaml
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Backup/Shoutcast.Sample.Phone/MainPage.xaml.cs b/Src/Backup/Shoutcast.Sample.Phone/MainPage.xaml.cs
deleted file mode 100644
index 259a9c4..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone/MainPage.xaml.cs
+++ /dev/null
@@ -1,175 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Shoutcast.Sample.Phone
-{
- using System;
- using System.Globalization;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media;
- using Microsoft.Phone.Controls;
- using Silverlight.Media;
-
- ///
- /// This class represents the main page of our Windows Phone application.
- ///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "When the page is unloaded, the ShoutcastMediaStreamSource is disposed.")]
- public partial class MainPage : PhoneApplicationPage
- {
- ///
- /// ShoutcastMediaStreamSource representing a Shoutcast stream.
- ///
- private ShoutcastMediaStreamSource source;
-
- ///
- /// Boolean to stop the status update if an error has occured.
- ///
- private bool errorOccured;
-
- ///
- /// Initializes a new instance of the MainPage class.
- ///
- public MainPage()
- {
- InitializeComponent();
- }
-
- ///
- /// Gets the media element resource of the page.
- ///
- private MediaElement MediaPlayer
- {
- get { return this.Resources["mediaPlayer"] as MediaElement; }
- }
-
- ///
- /// Event handler called when the buffering progress of the media element has changed.
- ///
- /// Sender of the event.
- /// RoutedEventArgs associated with this event.
- private void BufferingProgressChanged(object sender, RoutedEventArgs e)
- {
- this.UpdateStatus();
- }
-
- ///
- /// Event handler called when the an exception is thrown parsing the streaming media.
- ///
- /// Sender of the event.
- /// ExceptionRoutedEventArgs associated with this event.
- private void MediaFailed(object sender, ExceptionRoutedEventArgs e)
- {
- this.errorOccured = true;
- this.statusTextBlock.Text = string.Format(CultureInfo.InvariantCulture, "Error: {0}", e.ErrorException.Message);
- }
-
- ///
- /// Event handler called when the play button is clicked.
- ///
- /// Sender of the event.
- /// RoutedEventArgs associated with this event.
- private void PlayClick(object sender, RoutedEventArgs e)
- {
- this.ResetMediaPlayer();
-
- Uri uri = new Uri(this.mp3StreamRadioButton.IsChecked.Value ?
- "http://scfire-ntc-aa05.stream.aol.com:80/stream/1006" : // MP3
- "http://72.26.204.18:6116"); // AAC+
- this.source = new ShoutcastMediaStreamSource(uri);
- this.source.MetadataChanged += this.MetadataChanged;
- this.MediaPlayer.SetSource(this.source);
- this.MediaPlayer.Play();
- }
-
- ///
- /// Event handler called when the metadata of the Shoutcast stream source changes.
- ///
- /// Sender of the event.
- /// MpegMetadataEventArgs associated with this event.
- private void MetadataChanged(object sender, RoutedEventArgs e)
- {
- this.UpdateStatus();
- }
-
- ///
- /// Updates the text block to show the MediaStreamSource's status in the UI.
- ///
- private void UpdateStatus()
- {
- // If we have an error, we don't want to overwrite the error status.
- if (this.errorOccured)
- {
- return;
- }
-
- MediaElementState state = this.MediaPlayer.CurrentState;
- string status = string.Empty;
- switch (state)
- {
- case MediaElementState.Buffering:
- status = string.Format(CultureInfo.InvariantCulture, "Buffering...{0:0%}", this.MediaPlayer.BufferingProgress);
- break;
- case MediaElementState.Playing:
- status = string.Format(CultureInfo.InvariantCulture, "Title: {0}", this.source.CurrentMetadata.Title);
- break;
- default:
- status = state.ToString();
- break;
- }
-
- this.statusTextBlock.Text = status;
- }
-
- ///
- /// Event handler called when the media element state changes.
- ///
- /// Sender of the event.
- /// RoutedEventArgs associated with this event.
- private void CurrentStateChanged(object sender, RoutedEventArgs e)
- {
- this.UpdateStatus();
- }
-
- ///
- /// Resets the media player.
- ///
- private void ResetMediaPlayer()
- {
- if ((this.MediaPlayer.CurrentState != MediaElementState.Stopped) && (this.MediaPlayer.CurrentState != MediaElementState.Closed))
- {
- this.MediaPlayer.Stop();
- this.MediaPlayer.Source = null;
- this.source.Dispose();
- this.source = null;
- }
-
- this.errorOccured = false;
- }
-
- ///
- /// Event handler called when this page is unloaded.
- ///
- /// Sender of the event.
- /// RoutedEventArgs associated with this event.
- private void PageUnloaded(object sender, RoutedEventArgs e)
- {
- this.ResetMediaPlayer();
- }
- }
-}
\ No newline at end of file
diff --git a/Src/Backup/Shoutcast.Sample.Phone/Properties/AppManifest.xml b/Src/Backup/Shoutcast.Sample.Phone/Properties/AppManifest.xml
deleted file mode 100644
index 6712a11..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone/Properties/AppManifest.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
diff --git a/Src/Backup/Shoutcast.Sample.Phone/Properties/AssemblyInfo.cs b/Src/Backup/Shoutcast.Sample.Phone/Properties/AssemblyInfo.cs
deleted file mode 100644
index 8a9385a..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Shoutcast.Sample.Phone")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Shoutcast.Sample.Phone")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("6d9cc826-af3f-4e3c-9307-3568a0c1055e")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
-[assembly: NeutralResourcesLanguageAttribute("en-US")]
diff --git a/Src/Backup/Shoutcast.Sample.Phone/Properties/WMAppManifest.xml b/Src/Backup/Shoutcast.Sample.Phone/Properties/WMAppManifest.xml
deleted file mode 100644
index 13c2abd..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone/Properties/WMAppManifest.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
- ApplicationIcon.png
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Background.png
- 0
- Shoutcast.Sample.Phone
-
-
-
-
-
diff --git a/Src/Backup/Shoutcast.Sample.Phone/Shoutcast.Sample.Phone.csproj b/Src/Backup/Shoutcast.Sample.Phone/Shoutcast.Sample.Phone.csproj
deleted file mode 100644
index 892317c..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone/Shoutcast.Sample.Phone.csproj
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 10.0.20506
- 2.0
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}
- {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
- Library
- Properties
- Shoutcast.Sample.Phone
- Shoutcast.Sample.Phone
- v4.0
- $(TargetFrameworkVersion)
- WindowsPhone71
- Silverlight
- true
-
-
- true
- true
- Shoutcast.Sample.Phone.xap
- Properties\AppManifest.xml
- Shoutcast.Sample.Phone.App
- true
- true
-
-
-
-
-
-
-
-
-
-
- true
- full
- false
- Bin\Debug
- DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
-
-
- pdbonly
- true
- Bin\Release
- TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
- App.xaml
-
-
- MainPage.xaml
-
-
-
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
-
-
-
-
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
-
-
-
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}
- Silverlight.Media.Shoutcast.Phone
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Backup/Shoutcast.Sample.Phone/Shoutcast.Sample.Phone.csproj.user b/Src/Backup/Shoutcast.Sample.Phone/Shoutcast.Sample.Phone.csproj.user
deleted file mode 100644
index ac8712b..0000000
--- a/Src/Backup/Shoutcast.Sample.Phone/Shoutcast.Sample.Phone.csproj.user
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
- True
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Backup/Shoutcast.Sample.Phone/SplashScreenImage.jpg b/Src/Backup/Shoutcast.Sample.Phone/SplashScreenImage.jpg
deleted file mode 100644
index 353b192..0000000
Binary files a/Src/Backup/Shoutcast.Sample.Phone/SplashScreenImage.jpg and /dev/null differ
diff --git a/Src/Backup/Silverlight.Media.Shoutcast.sln b/Src/Backup/Silverlight.Media.Shoutcast.sln
deleted file mode 100644
index 23bff33..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast.sln
+++ /dev/null
@@ -1,54 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silverlight.Media.Shoutcast", "Silverlight.Media.Shoutcast\Silverlight.Media.Shoutcast.csproj", "{65DD033A-AA4C-414F-8D23-F8642A74CC3F}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silverlight.Media.Shoutcast.Phone", "Silverlight.Media.Shoutcast\Silverlight.Media.Shoutcast.Phone.csproj", "{05CC4102-451C-4EB5-8FEA-614F5B49AB2D}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shoutcast.Sample.Phone", "Shoutcast.Sample.Phone\Shoutcast.Sample.Phone.csproj", "{EE25CCA0-8001-4420-B724-798E6FE7A46D}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shoutcast.Sample", "Shoutcast.Sample\Shoutcast.Sample.csproj", "{39F4E0A0-DDF1-4476-9C93-2D8301B955D9}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shoutcast.Sample.Phone.Background", "Shoutcast.Sample.Phone.Background\Shoutcast.Sample.Phone.Background.csproj", "{A80155C6-79E1-4EFE-B473-D6F9E0A49609}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shoutcast.Sample.Phone.Background.Playback", "Shoutcast.Sample.Phone.Background.PlaybackAgent\Shoutcast.Sample.Phone.Background.Playback.csproj", "{12F8E56D-728C-4073-BDA5-058E6222DE51}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {65DD033A-AA4C-414F-8D23-F8642A74CC3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {65DD033A-AA4C-414F-8D23-F8642A74CC3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {65DD033A-AA4C-414F-8D23-F8642A74CC3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {65DD033A-AA4C-414F-8D23-F8642A74CC3F}.Release|Any CPU.Build.0 = Release|Any CPU
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Release|Any CPU.Build.0 = Release|Any CPU
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Release|Any CPU.Build.0 = Release|Any CPU
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Release|Any CPU.Deploy.0 = Release|Any CPU
- {39F4E0A0-DDF1-4476-9C93-2D8301B955D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {39F4E0A0-DDF1-4476-9C93-2D8301B955D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {39F4E0A0-DDF1-4476-9C93-2D8301B955D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {39F4E0A0-DDF1-4476-9C93-2D8301B955D9}.Release|Any CPU.Build.0 = Release|Any CPU
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Release|Any CPU.Build.0 = Release|Any CPU
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Release|Any CPU.Deploy.0 = Release|Any CPU
- {12F8E56D-728C-4073-BDA5-058E6222DE51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {12F8E56D-728C-4073-BDA5-058E6222DE51}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {12F8E56D-728C-4073-BDA5-058E6222DE51}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {12F8E56D-728C-4073-BDA5-058E6222DE51}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/Src/Backup/Silverlight.Media.Shoutcast.v12.suo b/Src/Backup/Silverlight.Media.Shoutcast.v12.suo
deleted file mode 100644
index 336563a..0000000
Binary files a/Src/Backup/Silverlight.Media.Shoutcast.v12.suo and /dev/null differ
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/CircularBuffer.cs b/Src/Backup/Silverlight.Media.Shoutcast/CircularBuffer.cs
deleted file mode 100644
index 2db9aaa..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/CircularBuffer.cs
+++ /dev/null
@@ -1,427 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// (c) alexreg.
-// This source is subject to the Microsoft Public License (Ms-PL).
-// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
-// All other rights reserved.
-// Project site: http://circularbuffer.codeplex.com/
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Threading;
-
- ///
- /// Implements a circular buffer data structure.
- ///
- /// Type of elements contained in the circular buffer.
- public class CircularBuffer
- {
- ///
- /// Maximum number of elements allowed in the circular buffer.
- ///
- private int capacity;
-
- ///
- /// Current number of elements in the circular buffer.
- ///
- private int size;
-
- ///
- /// Current reading index.
- ///
- private int head;
-
- ///
- /// Current writing index.
- ///
- private int tail;
-
- ///
- /// Array containing the elements of the circular buffer.
- ///
- private T[] buffer;
-
- ///
- /// Initializes a new instance of the CircularBuffer class.
- ///
- /// Maximum number of elements allowed in the circular bufffer.
- public CircularBuffer(int capacity)
- : this(capacity, false)
- {
- }
-
- ///
- /// Initializes a new instance of the CircularBuffer class.
- ///
- /// Maximum number of elements allowed in the circular bufffer.
- /// true if overflow is allowed, otherwise, false.
- public CircularBuffer(int capacity, bool allowOverflow)
- {
- if (capacity < 0)
- {
- throw new ArgumentException("capacity must be greater than or equal to zero.", "capacity");
- }
-
- this.capacity = capacity;
- this.size = 0;
- this.head = 0;
- this.tail = 0;
- this.buffer = new T[capacity];
- this.AllowOverflow = allowOverflow;
- }
-
- ///
- /// Gets or sets a value indicating whether the circular buffer allows overflow.
- ///
- public bool AllowOverflow
- {
- get;
- set;
- }
-
- ///
- /// Gets or sets the maximum number of elements allowed in the circular buffer.
- ///
- public int Capacity
- {
- get
- {
- return this.capacity;
- }
-
- set
- {
- if (value == this.capacity)
- {
- return;
- }
-
- if (value < this.size)
- {
- throw new ArgumentOutOfRangeException("value", "value must be greater than or equal to the buffer size.");
- }
-
- var dst = new T[value];
- if (this.size > 0)
- {
- this.CopyTo(dst);
- }
-
- this.buffer = dst;
-
- this.capacity = value;
- }
- }
-
- ///
- /// Gets the current number of elements in the circular buffer.
- ///
- public int Size
- {
- get { return this.size; }
- }
-
- ///
- /// Searches the circular buffer for a particular item.
- ///
- /// Item for which to search.
- /// true if the item is found, otherwise, false.
- public bool Contains(T item)
- {
- int bufferIndex = this.head;
- var comparer = EqualityComparer.Default;
- for (int i = 0; i < this.size; i++, bufferIndex++)
- {
- if (bufferIndex == this.capacity)
- {
- bufferIndex = 0;
- }
-
- if (item == null && this.buffer[bufferIndex] == null)
- {
- return true;
- }
- else if ((this.buffer[bufferIndex] != null) &&
- comparer.Equals(this.buffer[bufferIndex], item))
- {
- return true;
- }
- }
-
- return false;
- }
-
- ///
- /// Clears the circular buffer.
- ///
- public void Clear()
- {
- this.size = 0;
- this.head = 0;
- this.tail = 0;
- }
-
- ///
- /// Writes data to the circular buffer.
- ///
- /// data to write to the circular buffer.
- /// Number of bytes written to the cirular buffer.
- public int Put(T[] src)
- {
- return this.Put(src, 0, src.Length);
- }
-
- ///
- /// Writes data to the circular buffer.
- ///
- /// Data to write to the circular buffer.
- /// A 32-bit integer that represents the index in the src at which reading begins.
- /// Number of elements to write.
- /// Number of bytes written to the cirular buffer.
- public int Put(T[] src, int offset, int count)
- {
- int realCount = this.AllowOverflow ? count : Math.Min(count, this.capacity - this.size);
- int srcIndex = offset;
- for (int i = 0; i < realCount; i++, this.tail++, srcIndex++)
- {
- if (this.tail == this.capacity)
- {
- this.tail = 0;
- }
-
- this.buffer[this.tail] = src[srcIndex];
- }
-
- this.size = Math.Min(this.size + realCount, this.capacity);
- return realCount;
- }
-
- ///
- /// Writes a single element to the circular buffer.
- ///
- /// Item to write to the circular buffer.
- public void Put(T item)
- {
- if ((!this.AllowOverflow) && (this.size == this.capacity))
- {
- throw new OverflowException("Buffer is full.");
- }
-
- this.buffer[this.tail] = item;
- if (this.tail++ == this.capacity)
- {
- this.tail = 0;
- }
-
- this.size++;
- }
-
- ///
- /// Advances the read pointer a specified number of elements.
- ///
- /// A 32-bit integer that represents the number of elements to skip.
- public void Skip(int count)
- {
- this.head += count;
- if (this.head >= this.capacity)
- {
- this.head -= this.capacity;
- }
- else if (this.head < 0)
- {
- // Handle negatives
- this.head += this.capacity;
- }
- }
-
- ///
- /// Reads a specified number of elements from the circular buffer without advancing the current read position.
- ///
- /// A 32-bit integer that represents the number of elements to read.
- /// An array containing the elements read.
- public T[] Peek(int count)
- {
- var dst = new T[count];
- this.Peek(dst);
- return dst;
- }
-
- ///
- /// Reads elements from the circular buffer without advancing the current read position.
- ///
- /// Buffer to receive the elements from the circular buffer.
- /// Number of bytes placed into the buffer.
- public int Peek(T[] dst)
- {
- return this.Peek(dst, 0, dst.Length);
- }
-
- ///
- /// Reads elements from the circular buffer without advancing the current read position.
- ///
- /// Buffer to receive the elements from the circular buffer.
- /// A 32-bit integer that represents the index in the src at which writing begins.
- /// Number of elements to read.
- /// Number of bytes placed into the buffer.
- public int Peek(T[] dst, int offset, int count)
- {
- int realCount = Math.Min(count, this.size);
- int dstIndex = offset;
- int tempHead = this.head;
- for (int i = 0; i < realCount; i++, tempHead++, dstIndex++)
- {
- if (tempHead == this.capacity)
- {
- tempHead = 0;
- }
-
- dst[dstIndex] = this.buffer[tempHead];
- }
-
- return realCount;
- }
-
- ///
- /// Reads a single element from the circular buffer without advancing the current read position.
- ///
- /// Element read from the circular buffer.
- public T Peek()
- {
- if (this.size == 0)
- {
- throw new InvalidOperationException("Buffer is empty.");
- }
-
- int tempHead = (this.head == this.capacity) ? 0 : this.head;
-
- var item = this.buffer[tempHead];
- return item;
- }
-
- ///
- /// Reads a specified number of elements from the circular buffer and advances the current read position.
- ///
- /// A 32-bit integer that represents the number of elements to read.
- /// An array containing the elements read.
- public T[] Get(int count)
- {
- var dst = new T[count];
- this.Get(dst);
- return dst;
- }
-
- ///
- /// Reads elements from the circular buffer and advances the current read position.
- ///
- /// Buffer to receive the elements from the circular buffer.
- /// Number of bytes placed into the buffer.
- public int Get(T[] dst)
- {
- return this.Get(dst, 0, dst.Length);
- }
-
- ///
- /// Reads elements from the circular buffer and advances the current read position.
- ///
- /// Buffer to receive the elements from the circular buffer.
- /// A 32-bit integer that represents the index in the src at which writing begins.
- /// Number of elements to read.
- /// Number of bytes placed into the buffer.
- public int Get(T[] dst, int offset, int count)
- {
- int realCount = Math.Min(count, this.size);
- int dstIndex = offset;
- for (int i = 0; i < realCount; i++, this.head++, dstIndex++)
- {
- if (this.head == this.capacity)
- {
- this.head = 0;
- }
-
- dst[dstIndex] = this.buffer[this.head];
- }
-
- this.size -= realCount;
- return realCount;
- }
-
- ///
- /// Reads a single element from the circular buffer and advances the current read position.
- ///
- /// Element read from the circular buffer.
- public T Get()
- {
- if (this.size == 0)
- {
- throw new InvalidOperationException("Buffer is empty.");
- }
-
- // Missing check for when size != 0 and one of the other get methods is called. It leaves the head pointer == capacity.
- if (this.head == this.capacity)
- {
- this.head = 0;
- }
-
- var item = this.buffer[this.head];
-
- // We probably don't need this now, as we are checking BEFORE we read, like the other methods.
- if (this.head++ == this.capacity)
- {
- this.head = 0;
- }
-
- this.size--;
- return item;
- }
-
- ///
- /// Copies the elements from the circular buffer to an array.
- ///
- /// Destination array.
- public void CopyTo(T[] array)
- {
- this.CopyTo(array, 0);
- }
-
- ///
- /// Copies the elements from the circular buffer to an array.
- ///
- /// Destination array.
- /// A 32-bit integer that represents the index in the array at which writing begins.
- public void CopyTo(T[] array, int arrayIndex)
- {
- // I'm thinking this is just wrong. We should be using the array.Length.
- this.CopyTo(array, arrayIndex, this.size);
- }
-
- ///
- /// Copies the elements from the circular buffer to an array.
- ///
- /// Destination array.
- /// A 32-bit integer that represents the index in the array at which writing begins.
- /// Number of elements to copy.
- public void CopyTo(T[] array, int arrayIndex, int count)
- {
- if (count > this.size)
- {
- throw new ArgumentOutOfRangeException("count", "count cannot be greater than the buffer size.");
- }
-
- int bufferIndex = this.head;
- for (int i = 0; i < count; i++, bufferIndex++, arrayIndex++)
- {
- if (bufferIndex == this.capacity)
- {
- bufferIndex = 0;
- }
-
- array[arrayIndex] = this.buffer[bufferIndex];
- }
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Extensions/WebHeaderCollectionExtensions.cs b/Src/Backup/Silverlight.Media.Shoutcast/Extensions/WebHeaderCollectionExtensions.cs
deleted file mode 100644
index a29f95a..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Extensions/WebHeaderCollectionExtensions.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Extensions
-{
- using System;
- using System.Collections.Generic;
- using System.Net;
-
- ///
- /// Extension methods for the WebHeaderCollection class.
- ///
- public static class WebHeaderCollectionExtensions
- {
- ///
- /// Converts a WebHeaderCollection to an IDictionary<string, string>.
- ///
- /// WebHeaderCollection to convert to an IDictionary<string, string>.
- /// IDictionary<string, string> representing the provided WebHeaderCollection.
- public static IDictionary ToDictionary(this WebHeaderCollection webHeaderCollection)
- {
- Dictionary headers = new Dictionary(StringComparer.OrdinalIgnoreCase);
- if (webHeaderCollection != null)
- {
- foreach (string key in webHeaderCollection.AllKeys)
- {
- headers.Add(key, webHeaderCollection[key]);
- }
- }
-
- return headers;
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/GPL.txt b/Src/Backup/Silverlight.Media.Shoutcast/GPL.txt
deleted file mode 100644
index 94a9ed0..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/GPL.txt
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/LICENSE.txt b/Src/Backup/Silverlight.Media.Shoutcast/LICENSE.txt
deleted file mode 100644
index 65c5ca8..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/LICENSE.txt
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Metadata/ShoutcastMetadata.cs b/Src/Backup/Silverlight.Media.Shoutcast/Metadata/ShoutcastMetadata.cs
deleted file mode 100644
index 8737600..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Metadata/ShoutcastMetadata.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Metadata
-{
- using System.Collections.Generic;
- using System.Linq;
-
- ///
- /// Parses MP3 stream metadata.
- ///
- public class ShoutcastMetadata
- {
- ///
- /// Key for the stream title.
- ///
- private const string StreamTitle = "StreamTitle";
-
- ///
- /// Key for the stream url.
- ///
- private const string StreamUrl = "StreamUrl";
-
- ///
- /// Dictionary<string, string> to store the parsed metadata key/value pairs.
- ///
- private Dictionary metadatas = new Dictionary();
-
- ///
- /// Initializes a new instance of the ShoutcastMetadata class.
- ///
- public ShoutcastMetadata()
- : this(string.Empty)
- {
- }
-
- ///
- /// Initializes a new instance of the ShoutcastMetadata class.
- ///
- /// String representing the MP3 stream metadata.
- public ShoutcastMetadata(string metadata)
- {
- this.Title = string.Empty;
- this.Url = string.Empty;
-
- // We'll parse in here for now.
- if (string.IsNullOrEmpty(metadata))
- {
- return;
- }
-
- this.ParseMetadata(metadata);
- }
-
- ///
- /// Gets a value representing the title from the audio stream metadata.
- ///
- public string Title { get; private set; }
-
- ///
- /// Gets a value representing the url from the audio stream metadata.
- ///
- public string Url { get; private set; }
-
- ///
- /// Determines whether the specified Object is equal to the current Object
- ///
- /// The object to compare with the current object.
- /// true if the specified Object is equal to the current Object; otherwise, false.
- public override bool Equals(object obj)
- {
- // We need value-type semantics.
- ShoutcastMetadata other = obj as ShoutcastMetadata;
- if (other == null)
- {
- return false;
- }
-
- return this.Title.Equals(other.Title) && this.Url.Equals(other.Url);
- }
-
- ///
- /// Serves as a hash function for a particular type.
- ///
- /// A hash code for the current Object.
- public override int GetHashCode()
- {
- return this.Title.GetHashCode() ^ this.Url.GetHashCode();
- }
-
- ///
- /// Parses the metadata from the MP3 audio stream.
- ///
- /// String representing the MP3 stream metadata.
- private void ParseMetadata(string metadata)
- {
- if (string.IsNullOrEmpty(metadata))
- {
- return;
- }
-
- // I'm bored, so we'll use some LINQ. :)
- this.metadatas = metadata.Replace("\0", string.Empty).Split(';').Where(s => (!string.IsNullOrEmpty(s)) && (s.IndexOf('=') > -1)).Select(s =>
- {
- int equalSignIndex = s.IndexOf('=');
- string key = s.Substring(0, equalSignIndex);
- string value = s.Length > equalSignIndex ? s.Substring(equalSignIndex + 1).Trim('\'') : string.Empty;
- return new { Key = key, Value = value };
- }).ToDictionary(a => a.Key, a => a.Value);
-
- // Parse out the known values
- string metadataValue;
-
- if (this.metadatas.TryGetValue(ShoutcastMetadata.StreamTitle, out metadataValue))
- {
- this.Title = metadataValue;
- }
-
- if (this.metadatas.TryGetValue(ShoutcastMetadata.StreamUrl, out metadataValue))
- {
- this.Url = metadataValue;
- }
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/AacpFrame.cs b/Src/Backup/Silverlight.Media.Shoutcast/Parsers/AacpFrame.cs
deleted file mode 100644
index a48cda5..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/AacpFrame.cs
+++ /dev/null
@@ -1,237 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Parsers
-{
- using System;
-
- ///
- /// A partial implementation of an AAC audio frame
- ///
- ///
- ///
- /// The primary purpose of this class is to represent an AAC audio file.
- /// Many of the features not explicitly needed for audio rendering are omitted from the implementation.
- ///
- ///
- /// Data on this format is readily discoverable in many books as well as by
- /// searching for "AAC Frame" in your favorite search engine. As always,
- /// Wikipedia is well stocked in all of these areas as well.
- ///
- ///
- public class AacpFrame : AudioFrame
- {
- ///
- /// AAC headers are 7 bytes long.
- ///
- public static readonly int FrameHeaderSize = 7;
-
- ///
- /// AAC frame synchronization bytes.
- ///
- public static readonly byte[] SyncBytes = new byte[] { 0xFF, 0xF0 };
-
- ///
- /// Frame Sync is 12 1s
- ///
- private static readonly int syncValue = 4095;
-
- ///
- /// A table of all of the possible sampling rates of AAC audio.
- ///
- private static int[] sampleRateTable = new int[] { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350, 0, 0, -1 };
-
- ///
- /// A table of all of the possible number of channels for AAC audio.
- ///
- private static int[] numberOfChannelsTable = new int[] { 0, 1, 2, 3, 4, 5, 6, 8, 0, 0, 0, 0, 0, 0, 0, 0 };
-
- ///
- /// Number of bits per block for AAC audio.
- ///
- private static int bitsPerBlock = 6144;
-
- ///
- /// Number of samples per block for AAC audio.
- ///
- private static int samplesPerBlock = 1024;
-
- ///
- /// Initializes a new instance of the AacpFrame class.
- ///
- ///
- ///
- /// This class is a partial implementation of an AAC audio frame. The primary purpose of this class is to represent an AAC
- /// file. Many of the features not explicitly needed for audio rendering are omitted from the implementation.
- ///
- ///
- /// Data on this format is readily discoverable in many books as well as by
- /// searching for "AAC Frame" in your favorite search engine. As always,
- /// Wikipedia is well stocked in all of these areas as well.
- ///
- ///
- /// Byte array containing 4 bytes representing an AAC header.
- public AacpFrame(byte[] frameHeader)
- : base()
- {
- if (frameHeader == null)
- {
- throw new ArgumentNullException("frameHeader");
- }
-
- // Sync
- int value = BitTools.MaskBits(frameHeader, 0, 12);
- if (value != syncValue)
- {
- throw new ArgumentException("Invalid sync value.");
- }
-
- this.NumberOfChannels = AacpFrame.ParseChannel(frameHeader);
- this.SamplingRate = AacpFrame.ParseSampleRate(frameHeader);
- this.BitRate = AacpFrame.CalculateBitRate(this.SamplingRate, this.NumberOfChannels);
- this.FrameSize = AacpFrame.ParseFrameSize(frameHeader);
-
- int objectTypeId = BitTools.MaskBits(frameHeader, 16, 2);
- }
-
- ///
- /// Quickly checks an array of bytes to see if it represents a valid AAC frame header.
- ///
- /// Bytes representing an AAC frame header.
- /// true if the supplied bytes are a valid frame header, otherwise, false.
- public static bool IsValidFrame(byte[] frameHeader)
- {
- if (frameHeader == null)
- {
- throw new ArgumentNullException("frameHeader");
- }
-
- int value = BitTools.MaskBits(frameHeader, 0, 12);
- if (value != AacpFrame.syncValue)
- {
- return false;
- }
-
- int sampleRate = AacpFrame.ParseSampleRate(frameHeader);
-
- if (sampleRate == -1)
- {
- return false;
- }
-
- int numberOfChannels = AacpFrame.ParseChannel(frameHeader);
- if (numberOfChannels == -1)
- {
- return false;
- }
-
- return true;
- }
-
- ///
- /// Determines whether the specified Object is equal to the current Object
- ///
- /// The object to compare with the current object.
- /// true if the specified Object is equal to the current Object; otherwise, false.
- public override bool Equals(object obj)
- {
- AacpFrame other = obj as AacpFrame;
-
- if (other == null)
- {
- return false;
- }
-
- return (this.NumberOfChannels == other.NumberOfChannels) &&
- (this.SamplingRate == other.SamplingRate) &&
- (this.BitRate == other.BitRate);
- }
-
- ///
- /// Generates a hash code for the current Object.
- ///
- /// A hash code for the current Object.
- public override int GetHashCode()
- {
- // Pick a Prime!
- const int Prime = 17;
- int hash = Prime;
- hash = (hash * Prime) + this.NumberOfChannels;
- hash = (hash * Prime) + this.SamplingRate;
- hash = (hash * Prime) + this.BitRate;
- return hash;
- }
-
- ///
- /// Calculates the bit rate for an AAC frame.
- ///
- /// Sample rate of the AAC frame.
- /// Number of channels of the AAC frame.
- /// Bit rate of an AAC frame with the given sample rate and number of channels.
- private static int CalculateBitRate(int sampleRate, int numberOfChannels)
- {
- return AacpFrame.bitsPerBlock / AacpFrame.samplesPerBlock * sampleRate * numberOfChannels;
- }
-
- ///
- /// Parses the AAC frame header to find the actual size of the header.
- ///
- /// Byte array containing the AAC frame header.
- /// Actual size of the supplied AAC frame header.
- private static int ParseFrameSize(byte[] frameHeader)
- {
- int value = BitTools.MaskBits(frameHeader, 30, 13);
- return value;
- }
-
- ///
- /// Parses the sample rate from the supplied AAC frame header.
- ///
- /// Byte array containing the AAC frame header.
- /// The sample rate of the supplied AAC frame header.
- private static int ParseSampleRate(byte[] frameHeader)
- {
- int sampleRateValue = BitTools.MaskBits(frameHeader, 18, 4);
-
- if ((sampleRateValue < 0) || (sampleRateValue > 15))
- {
- return -1;
- }
-
- return AacpFrame.sampleRateTable[sampleRateValue];
- }
-
- ///
- /// Parses the number of channels from the supplied AAC frame header.
- ///
- /// Byte array containing the AAC frame header.
- /// The number of channels of the supplied AAC frame header.
- private static int ParseChannel(byte[] frameHeader)
- {
- int channelValue = BitTools.MaskBits(frameHeader, 23, 3);
-
- if ((channelValue < 1) || (channelValue > 7))
- {
- // Invalid or reserved channel value
- return -1;
- }
-
- return AacpFrame.numberOfChannelsTable[channelValue];
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/AudioFrame.cs b/Src/Backup/Silverlight.Media.Shoutcast/Parsers/AudioFrame.cs
deleted file mode 100644
index 137d692..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/AudioFrame.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Parsers
-{
- ///
- /// Base class used to represent an audio frame.
- ///
- public class AudioFrame
- {
- ///
- /// Initializes a new instance of the AudioFrame class.
- ///
- protected AudioFrame()
- {
- }
-
- ///
- /// Gets or sets the number of channels of the audio frame.
- ///
- public int NumberOfChannels { get; protected set; }
-
- ///
- /// Gets or sets the bit rate of the audio frame.
- ///
- public int BitRate { get; protected set; }
-
- ///
- /// Gets or sets the sampling rate of the audio frame.
- ///
- public int SamplingRate { get; protected set; }
-
- ///
- /// Gets or sets the frame size of the audio frame.
- ///
- public int FrameSize { get; protected set; }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/BitTools.cs b/Src/Backup/Silverlight.Media.Shoutcast/Parsers/BitTools.cs
deleted file mode 100644
index 79f84ba..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/BitTools.cs
+++ /dev/null
@@ -1,335 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// (c) Copyright Larry Olson.
-// This source is subject to the Microsoft Public License (Ms-PL)
-// See http://code.msdn.microsoft.com/ManagedMediaHelpers/Project/License.aspx
-// All other rights reserved.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Parsers
-{
- using System;
- using System.Diagnostics;
-
- ///
- /// Helper methods for manipulating values at the byte and binary level.
- ///
- public static class BitTools
- {
- ///
- /// Defined by ID3v2 spec as 4 bytes
- ///
- private const int SyncSafeIntegerSize = 4;
-
- ///
- /// 1 Byte is 8 bits
- ///
- private const int ByteSize = 8;
-
- ///
- /// Masks out up to an integer sized (4 bytes) set of bits from an
- /// array of bytes.
- ///
- /// An array of data in Little Endian Order
- /// The bit index of the first bit
- /// The length of the mask in bits
- /// An integer of the bits masked out
- public static int MaskBits(byte[] data, int firstBit, int maskSize)
- {
- // Guard against null data
- if (data == null)
- {
- throw new ArgumentNullException("data");
- }
-
- // Clear out numbers which are too small
- if (data.Length <= 0 || firstBit < 0 || maskSize <= 0)
- {
- throw new ArgumentException("data array, firstBit, or maskSize are too small");
- }
-
- // Clear out numbers where you are masking outside of the valid
- // range
- if ((firstBit + maskSize) > data.Length * ByteSize)
- {
- throw new ArgumentException("Attempting to mask outside of the data array");
- }
-
- // Clear out masks which are larger than the number of bits in an
- // int
- if (maskSize > sizeof(int) * ByteSize)
- {
- throw new ArgumentException("maskSize is larger than an integer");
- }
-
- // Figure out what byte the starting bit is in
- int startByteIndex = firstBit / ByteSize; // Int div
-
- // Figure what byte the ending bit is in
- int endByteIndex = (firstBit + maskSize - 1) / ByteSize; // Int div
-
- // initialize the mask
- int mask = 0;
-
- // Build an initial mask with the proper number of bits set to 1
- for (int i = 0; i < maskSize; i++)
- {
- mask |= 1 << i;
- }
-
- // initialize the return value
- long headerValue = 0;
-
- // initialize the bytes to be masked
- /*
- * The desired bits could be spread across 5 bytes
- * but they probably will be spread over fewer bytes
- */
- long temp;
- int shiftAmount;
- for (int bi = startByteIndex; bi <= endByteIndex; bi++)
- {
- temp = data[bi];
-
- shiftAmount = (endByteIndex - bi) * ByteSize;
- temp = temp << shiftAmount;
-
- headerValue = headerValue | temp;
- }
-
- // shift the bits to the right to make an int
- headerValue = headerValue >> (((ByteSize * (endByteIndex + 1)) - (firstBit + maskSize)) % 8);
-
- // mask out the appropriate bits
- headerValue = headerValue & mask;
-
- return (int)headerValue;
- }
-
- ///
- /// Converts a Syncronization Safe integer from the ID3v2 spec into a
- /// standard integer.
- ///
- ///
- /// An array of bytes containing raw data in Syncronization Safe format
- /// as defined in the ID3v2 spec. This means that it is a 4 byte
- /// integer where the leading bit of each byte is a 0.
- /// For Example:
- /// 01111111 01111111 01111111 01111111
- /// Output would be:
- /// 00001111 11111111 11111111 11111111
- /// Assumes syncSafeData array is in Big Endiah Order.
- ///
- ///
- /// Where in the array of bytes, the syncsafe data starts. Note that
- /// data's size is assumed to be 4 bytes in length.
- ///
- ///
- /// A standard integer. Note that this integer can only have a data
- /// resolution of 28 bits (max value of this could only be 2^28 -1).
- ///
- public static int ConvertSyncSafeToInt32(
- byte[] syncSafeData,
- int startIndex)
- {
- int integer = 0;
- int syncSafeByte = 0; // Store byte in an int to enable shifting
- int shiftAmount = 0;
-
- // Guard
- if (syncSafeData == null)
- {
- throw new ArgumentNullException("syncSafeData");
- }
-
- // Guard
- if (startIndex < 0 || startIndex >= syncSafeData.Length)
- {
- throw new ArgumentOutOfRangeException("startIndex", "startIndex is outside of the syncSafeData array");
- }
-
- // Guard
- if (syncSafeData.Length < 4)
- {
- throw new ArgumentException("syncSafeData array is smaller than an integer(4 bytes)", "syncSafeData");
- }
-
- // Guard
- if (startIndex + SyncSafeIntegerSize - 1 >= syncSafeData.Length)
- {
- throw new ArgumentOutOfRangeException("startIndex", "This startIndex is too close to the end of the data array");
- }
-
- // Shifts the first three bytes left and copies them into the int
- // Stop shifting before you hit the last byte. The last byte is
- // already where it needs to be
- int i;
- for (i = 0; i < SyncSafeIntegerSize - 1; i++)
- {
- syncSafeByte = syncSafeData[startIndex + i];
- shiftAmount = (ByteSize - 1) * (SyncSafeIntegerSize - 1 - i);
- integer |= syncSafeByte << shiftAmount;
- }
-
- // Copy the unshifted fourth bit into the int
- syncSafeByte = syncSafeData[startIndex + i];
- integer |= syncSafeByte;
-
- Debug.Assert(integer >= 0, "SyncSafeIntegers after conversion should always have the first 4 bits be 0 by spec and therefore cannot be negative");
- return integer;
- }
-
- ///
- /// Searches a byte array for a pattern of bits.
- ///
- ///
- /// The array of bytes to search for the pattern within.
- ///
- ///
- /// The pattern of bytes to match with undesired bits zeroed out.
- ///
- ///
- /// A mask to zero out bits that aren't part of the pattern.
- ///
- ///
- /// The byte to begin the search from.
- ///
- ///
- /// Returns the location of the first byte in the pattern or -1 if
- /// nothing was found or there was an error.
- ///
- public static int FindBitPattern(byte[] data, byte[] pattern, byte[] mask, int startIndex)
- {
- // GUARD
- if (data == null)
- {
- throw new ArgumentNullException("data");
- }
-
- // GUARD
- if (pattern == null)
- {
- throw new ArgumentNullException("pattern");
- }
-
- // GUARD
- if (mask == null)
- {
- throw new ArgumentNullException("mask");
- }
-
- // GUARD
- if (pattern.Length <= 0 || data.Length <= 0 || data.Length < pattern.Length || mask.Length != pattern.Length)
- {
- return -1;
- }
-
- // GUARD
- if (startIndex < 0 || startIndex >= data.Length)
- {
- throw new ArgumentOutOfRangeException("startIndex", "Start index must be in the range [0,data.Length-1]");
- }
-
- int di = startIndex; // data index
- int pati = 0; // pattern index
-
- while (di < data.Length)
- {
- if (pattern[pati] == (data[di] & mask[pati]))
- {
- pati++;
- }
- else if (pattern[pati] != (data[di] & mask[pati]))
- {
- pati = 0;
- }
- else
- {
- Debug.Assert(false, "All possible states should have already been covered.");
- }
-
- di++;
-
- if (pati == pattern.Length)
- {
- return di - pattern.Length;
- }
- }
-
- return -1;
- }
-
- ///
- /// Searches a byte array for a pattern of bits.
- ///
- ///
- /// The array of bytes to search for the pattern within.
- ///
- ///
- /// The pattern of bytes to match with undesired bits zeroed out.
- ///
- ///
- /// A mask to zero out bits that aren't part of the pattern.
- ///
- ///
- /// Returns the location of the first byte in the pattern or -1 if
- /// nothing was found or there was an error.
- ///
- public static int FindBitPattern(byte[] data, byte[] pattern, byte[] mask)
- {
- return FindBitPattern(data, pattern, mask, 0);
- }
-
- ///
- /// Searches a byte array for a pattern of bytes.
- ///
- ///
- /// The array of bytes to search for the pattern within.
- ///
- ///
- /// The pattern of bytes to match.
- ///
- ///
- /// The byte to begin the search from.
- ///
- ///
- /// Returns the location of the first byte in the pattern or -1 if
- /// nothing was found or there was an error.
- ///
- public static int FindBytePattern(byte[] data, byte[] pattern, int startIndex)
- {
- // GUARD
- if (pattern == null)
- {
- throw new ArgumentNullException("pattern");
- }
-
- byte[] mask = new byte[pattern.Length];
- for (int i = 0; i < pattern.Length; i++)
- {
- mask[i] = byte.MaxValue; // 1111 1111
- }
-
- return FindBitPattern(data, pattern, mask, startIndex);
- }
-
- ///
- /// Searches a byte array for a pattern of bytes.
- ///
- ///
- /// The array of bytes to search for the pattern within.
- ///
- ///
- /// The pattern of bytes to match.
- ///
- ///
- /// Returns the location of the first byte in the pattern or -1 if
- /// nothing was found or there was an error.
- ///
- public static int FindBytePattern(byte[] data, byte[] pattern)
- {
- return FindBytePattern(data, pattern, 0);
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/HeAacWaveFormat.cs b/Src/Backup/Silverlight.Media.Shoutcast/Parsers/HeAacWaveFormat.cs
deleted file mode 100644
index 46e5227..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/HeAacWaveFormat.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Parsers
-{
- using System.Globalization;
-
- ///
- /// A managed representation of the multimedia HEAACWAVEINFO
- /// structure declared in mmreg.h.
- ///
- ///
- /// This was designed for usage in an environment where PInvokes are not
- /// allowed.
- ///
- public class HeAacWaveFormat : WaveFormat
- {
- ///
- /// Initializes a new instance of the HeAacWaveFormat class.
- ///
- /// WaveFormatExtensible instance representing this audio format.
- public HeAacWaveFormat(WaveFormatExtensible waveFormatExtensible)
- : base(waveFormatExtensible)
- {
- }
-
- ///
- /// Gets or sets the the AAC payload type.
- ///
- public short PayloadType { get; set; }
-
- ///
- /// Gets or sets the audio profile indication (as defined in the MPEG-4 audio specification) required to process the audio.
- ///
- public short AudioProfileLevelIndication { get; set; }
-
- ///
- /// Gets or sets the structure type that describes the data that follows this structure (per MPEG-4 audio specification).
- ///
- public short StructType { get; set; }
-
- ///
- /// Returns a string representing the structure in little-endian
- /// hexadecimal format.
- ///
- ///
- /// The string generated here is intended to be passed as
- /// CodecPrivateData for Silverlight's MediaStreamSource
- ///
- ///
- /// A string representing the structure in little-endia hexadecimal
- /// format.
- ///
- public override string ToHexString()
- {
- string s = this.WaveFormatExtensible.ToHexString();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.PayloadType).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.AudioProfileLevelIndication).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.StructType).ToLittleEndian();
- return s;
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/MpegFrame.cs b/Src/Backup/Silverlight.Media.Shoutcast/Parsers/MpegFrame.cs
deleted file mode 100644
index a6e3c3c..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/MpegFrame.cs
+++ /dev/null
@@ -1,518 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// (c) Copyright Larry Olson.
-// This source is subject to the Microsoft Public License (Ms-PL)
-// See http://code.msdn.microsoft.com/ManagedMediaHelpers/Project/License.aspx
-// All other rights reserved.
-//
-//-----------------------------------------------------------------------
-
-// Supressing Code Analysis rule(s)
-
-[module: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional",
- Scope = "member",
- Target = "Silverlight.Media.Parsers.MpegFrame.#bitrateTable",
- MessageId = "Member",
- Justification = "Array is not Jagged and does not waste space.")]
-
-[module: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional",
- Scope = "member",
- Target = "Silverlight.Media.Parsers.MpegFrame.#samplingRateTable",
- MessageId = "Member",
- Justification = "Array is not Jagged and does not waste space.")]
-
-namespace Silverlight.Media.Parsers
-{
- using System;
- using System.IO;
-
- ///
- /// Reproduction mode of given audio data. Typically maps to the number of
- /// output devices used to reproduce it.
- ///
- public enum Channel
- {
- ///
- /// Stereo: independent audio typically output to 2 speakers and is intended
- /// to create a more realistic or pleasing representation of audio by
- /// representing sound coming from multiple directons.
- ///
- Stereo = 0,
-
- ///
- /// Joint Stereo: The joining of multiple channels of audio to create another separate
- /// one, to reduce the size of the file, or to increase the quality.
- ///
- JointStereo,
-
- ///
- /// Dual Channel: Two independent Mono channels. May overlap with stereo or may
- /// be completely independent as in the case of foreign language audio dubbing.
- ///
- DualChannel,
-
- ///
- /// Single Channel: Also known as Mono. Typically the reproduction of a single
- /// independent audio stream in one device or of the same independent audio stream
- /// in multiple devices.
- ///
- SingleChannel,
- }
-
- ///
- /// A partial implementation of an MPEG audio frame
- ///
- ///
- ///
- /// The primary purpose of this class is to represent an Mpeg 1 Layer 3
- /// file or MP3 file for short. Many of the features not explicitly needed
- /// for audio rendering are omitted from the implementation.
- ///
- ///
- /// Data on this format is readily discoverable in many books as well as by
- /// searching for "MP3 Frame" in your favorite search engine. As always,
- /// Wikipedia is well stocked in all of these areas as well.
- ///
- ///
- public class MpegFrame : AudioFrame
- {
- ///
- /// MP3 Headers are 4 Bytes long
- ///
- public const int FrameHeaderSize = 4;
-
- ///
- /// MP3 frame synchronization bytes.
- ///
- public static readonly byte[] SyncBytes = new byte[] { 0xFF, 0xE0 };
-
- ///
- /// Frame Sync is 11 1s
- ///
- private const int SyncValue = 2047;
-
- ///
- /// A table of bitrates / 1000. These are all of the possible bitrates for Mpeg 1 - 2.5 audio. -1 encodes an error lookup.
- ///
- private static int[,] bitrateTable = new int[,]
- {
- { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 },
- { 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 },
- { 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 },
- { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256 },
- { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 }
- };
-
- ///
- /// A table of all of the possible sampling rates of Mpeg 1 - 2.5 audio.
- ///
- private static int[,] samplingRateTable = new int[,]
- {
- { 44100, 48000, 32000 },
- { 22050, 24000, 16000 },
- { 11025, 12000, 8000 }
- };
-
- ///
- /// Initializes a new instance of the MpegFrame class.
- ///
- ///
- ///
- /// This class is a partial implementation of an MPEG audio frame. The primary purpose of this class is to represent an Mpeg 1 Layer 3
- /// file or MP3 file for short. Many of the features not explicitly needed
- /// for audio rendering are omitted from the implementation.
- ///
- ///
- /// Data on this format is readily discoverable in many books as well as by
- /// searching for "MP3 Frame" in your favorite search engine. As always,
- /// Wikipedia is well stocked in all of these areas as well.
- ///
- ///
- /// Byte array containing 4 bytes representing an MPEG Layer 3 header.
- public MpegFrame(byte[] frameHeader)
- {
- if (frameHeader == null)
- {
- throw new ArgumentNullException("frameHeader");
- }
-
- if (frameHeader.Length != 4)
- {
- throw new ArgumentException("Invalid frame header length.");
- }
-
- // Sync
- int value = BitTools.MaskBits(frameHeader, 0, 11);
- if (value != SyncValue)
- {
- throw new ArgumentException("Invalid sync value.");
- }
-
- this.Version = ParseVersion(frameHeader);
- this.Layer = ParseLayer(frameHeader);
- this.IsProtected = BitTools.MaskBits(frameHeader, 15, 1) == 1 ? false : true;
- this.BitrateIndex = BitTools.MaskBits(frameHeader, 16, 4);
- this.SamplingRateIndex = BitTools.MaskBits(frameHeader, 20, 2);
- this.Padding = BitTools.MaskBits(frameHeader, 22, 1);
- //// Private Bit = BitTools.MaskBits(_mp3FrameHeader,8,1); //USELESS
- this.Channels = ParseChannel(frameHeader);
- //// Joint Mode = ParseJoitMode(_mp3FrameHeader); //Not used by Mp3MSS
- //// CopyRight = BitTools.MaskBits(_mp3FrameHeader,3,1); //Not used by Mp3MSS
- //// Original = BitTools.MaskBits(_mp3FrameHeader,2,1); //Not used by Mp3MSS
- //// Emphasis = ParseEmphasis(_mp3FrameHeader); //Not used by Mp3MSS
-
- this.BitRate = MpegFrame.CalculateBitRate(this.Version, this.Layer, this.BitrateIndex);
- this.SamplingRate = MpegFrame.LookupSamplingRate(this.Version, this.SamplingRateIndex);
- this.FrameSize = MpegFrame.CalculateFrameSize(this.Version, this.Layer, this.BitRate, this.SamplingRate, this.Padding);
- this.NumberOfChannels = (this.Channels == Channel.SingleChannel) ? 1 : 2;
-
- if ((this.Version == -1) || (this.Layer == -1) ||
- (this.BitrateIndex < 0) || (this.BitrateIndex >= 15) ||
- (this.SamplingRateIndex < 0) || (this.SamplingRateIndex >= 3))
- {
- throw new ArgumentException("Invalid header values");
- }
-
- // Add in the bytes we already read
- if (this.FrameSize <= 0)
- {
- throw new InvalidOperationException("MpegFrame's FrameSize must be greater than zero.");
- }
- }
-
- /**********************************************************************
- * FILE DATA- data which comes directly from the MP3 header.
- *********************************************************************/
- #region File Data
-
- ///
- /// Gets the Version of the MPEG standard this frame conforms to.
- /// MPEG 1, MPEG 2, or MPEG 2.5
- ///
- public int Version { get; private set; }
-
- ///
- /// Gets the layer of complexity used in this frame.
- /// Layer 1, 2, or 3.
- ///
- public int Layer { get; private set; }
-
- ///
- /// Gets a value indicating whether or not the frame is protected by a
- /// Cyclic Redundancy Check (CRC). If true, then a 16 bit
- /// CRC follows the header.
- ///
- public bool IsProtected { get; private set; }
-
- ///
- /// Gets the Index into the bitrate table as defined in the MPEG spec.
- ///
- public int BitrateIndex { get; private set; }
-
- ///
- /// Gets the Index into the samplingrate table as defined in the MPEG spec.
- ///
- public int SamplingRateIndex { get; private set; }
-
- ///
- /// Gets the number of additional bytes of padding in this frame.
- ///
- public int Padding { get; private set; }
-
- ///
- /// Gets the output channel used to playback this frame.
- ///
- public Channel Channels { get; private set; }
-
- #endregion
-
- ///
- /// Quickly checks an array of bytes to see if it represents a valid MP3 frame header.
- ///
- /// Bytes representing an MP3 frame header.
- /// true if the supplied bytes are a valid frame header, otherwise, false.
- public static bool IsValidFrame(byte[] frameHeader)
- {
- if (frameHeader == null)
- {
- throw new ArgumentNullException("frameHeader");
- }
-
- if (frameHeader.Length != 4)
- {
- throw new ArgumentException("frameHeader must be of length 4.");
- }
-
- int value = BitTools.MaskBits(frameHeader, 0, 11);
- if (value != SyncValue)
- {
- return false;
- }
-
- int version = ParseVersion(frameHeader);
- int layer = ParseLayer(frameHeader);
- int bitrateIndex = BitTools.MaskBits(frameHeader, 16, 4);
- int samplingRateIndex = BitTools.MaskBits(frameHeader, 20, 2);
- if ((version == -1) || (layer == -1) ||
- (bitrateIndex < 0) || (bitrateIndex >= 15) ||
- (samplingRateIndex < 0) || (samplingRateIndex >= 3))
- {
- return false;
- }
-
- return true;
- }
-
- ///
- /// Determines whether the specified Object is equal to the current Object
- ///
- /// The object to compare with the current object.
- /// true if the specified Object is equal to the current Object; otherwise, false.
- public override bool Equals(object obj)
- {
- MpegFrame other = obj as MpegFrame;
-
- if (other == null)
- {
- return false;
- }
-
- return (this.Version == other.Version) &&
- (this.Layer == other.Layer) &&
- (this.SamplingRate == other.SamplingRate) &&
- (this.Channels == other.Channels);
- }
-
- ///
- /// Generates a hash code for the current Object.
- ///
- /// A hash code for the current Object.
- public override int GetHashCode()
- {
- // Pick a Prime!
- const int Prime = 17;
- int hash = Prime;
- hash = (hash * Prime) + this.Version;
- hash = (hash * Prime) + this.Layer;
- hash = (hash * Prime) + this.SamplingRate;
- hash = (hash * Prime) + (int)this.Channels;
- return hash;
- }
-
- ///
- /// Converts the MpegFrame into a human readable form.
- ///
- ///
- /// A textual representation of the MpegFrame.
- ///
- public override string ToString()
- {
- string s = string.Empty;
- s += "FrameSize\t" + this.FrameSize + "\n";
- s += "BitRate\t" + this.BitRate + "\n";
- s += "SamplingRate" + this.SamplingRate + "\n";
- return s;
- }
-
- /**********************************************************************
- * DERIVED DATA - data which is calculated from data in the header.
- *********************************************************************/
- #region Derived Data
-
- ///
- /// Calculates the bit rate of the Mp3 audio from the data in the frame header.
- ///
- /// Mp3 version parsed out of the audio frame header.
- /// Mp3 layer parsed out of the audio frame header.
- /// Mp3 Bit rate index parsed out of the audio frame header.
- /// Mp3 bit rate calculated from the provided values, if valid. Otherwise, -2 is returned.
- private static int CalculateBitRate(int version, int layer, int bitRateIndex)
- {
- switch (version)
- {
- case 1: // Version 1.0
- switch (layer)
- {
- case 1: // MPEG 1 Layer 1
- return bitrateTable[0, bitRateIndex] * 1000;
- case 2: // MPEG 1 Layer 2
- return bitrateTable[1, bitRateIndex] * 1000;
- case 3: // MPEG 1 Layer 3 (MP3)
- return bitrateTable[2, bitRateIndex] * 1000;
- default: // MPEG 1 LAYER ERROR
- return -2;
- }
-
- case 2: // Version 2.0
- case 3: // Version 2.5 in reality
- switch (layer)
- {
- case 1: // MPEG 2 or 2.5 Layer 1
- return bitrateTable[3, bitRateIndex] * 1000;
- case 2: // MPEG 2 or 2.5 Layer 2
- case 3: // MPEG 2 or 2.5 Layer 3
- return bitrateTable[4, bitRateIndex] * 1000;
- default: // Mpeg 2 LAYER ERROR
- return -2;
- }
-
- default: // VERSION ERROR
- return -2;
- }
- }
-
- ///
- /// Looks up the sampling rate of the Mp3 audio from the data in the frame header.
- ///
- /// Mp3 version parsed out of the audio frame header.
- /// Mp3 sampling rate index parsed out of the audio frame header.
- /// Mp3 sampling rate for the provided version and sampling rate index, if valid. Otherwise, -1 is returned.
- private static int LookupSamplingRate(int version, int samplingRateIndex)
- {
- switch (version)
- {
- case 1: // MPEG 1
- return samplingRateTable[0, samplingRateIndex];
- case 2: // MPEG 2
- return samplingRateTable[1, samplingRateIndex];
- case 3: // MPEG 2.5
- return samplingRateTable[2, samplingRateIndex];
- default:
- return -1; // RESERVED
- }
- }
-
- ///
- /// Calculates the frame size given the header information from the Mp3 frame.
- ///
- /// Mp3 version.
- /// Mp3 layer.
- /// Mp3 bit rate.
- /// Mp3 sampling rate.
- /// Mp3 padding.
- /// Mp3 frame size calculated from the provided values, if valid. Otherwise, -1 is returned.
- private static int CalculateFrameSize(int version, int layer, int bitRate, int samplingRate, int padding)
- {
- switch (layer)
- {
- case 1:
- return ((12 * bitRate / samplingRate) + padding) * 4;
- case 2:
- case 3:
- // MPEG2 is a special case here.
- switch (version)
- {
- case 1:
- return (144 * bitRate / samplingRate) + padding;
- case 2:
- case 3:
- return (72 * bitRate / samplingRate) + padding;
- default:
- return -1;
- }
-
- default:
- return -1;
- }
- }
-
- #endregion
-
- ///
- /// Parses the version of the MPEG standard this frame header conforms to from the frame header.
- ///
- /// The 4 byte header for this frame.
- ///
- /// The version of the MPEG standard this frame conforms to.
- /// 1 = Mpeg 1
- /// 2 = Mpeg 2
- /// 3 = Mpeg 2.5
- ///
- private static int ParseVersion(byte[] frameHeader)
- {
- int version;
- int versionValue = BitTools.MaskBits(frameHeader, 11, 2);
-
- switch (versionValue)
- {
- case 3:
- version = 1;
- break;
- case 2:
- version = 2;
- break;
- case 0:
- version = 3;
- break;
- default:
- // This indicates an invalid version.
- version = -1;
- break;
- }
-
- return version;
- }
-
- ///
- /// Parses which complexity layer of the MPEG standard this frame conforms to from the frame header.
- ///
- /// The 4 byte header for this frame.
- /// The complexity layer this frame conforms to.
- private static int ParseLayer(byte[] frameHeader)
- {
- int layer;
- int layerValue = BitTools.MaskBits(frameHeader, 13, 2);
-
- switch (layerValue)
- {
- case 3:
- layer = 1;
- break;
- case 2:
- layer = 2;
- break;
- case 1:
- layer = 3;
- break;
- default:
- // This indicates an invalid layer.
- layer = -1;
- break;
- }
-
- return layer;
- }
-
- ///
- /// Parses the audio output mode of this frame's audio data.
- ///
- /// The 4 byte header for this frame.
- /// The audio output mode of this frame's audio data.
- private static Channel ParseChannel(byte[] frameHeader)
- {
- Channel channel;
- int channelValue = BitTools.MaskBits(frameHeader, 24, 2);
-
- switch (channelValue)
- {
- case 3:
- channel = Channel.SingleChannel;
- break;
- case 2:
- channel = Channel.DualChannel;
- break;
- case 1:
- channel = Channel.JointStereo;
- break;
- case 0:
- channel = Channel.Stereo;
- break;
- default:
- channel = Channel.SingleChannel; // ERROR CASE
- break;
- }
-
- return channel;
- }
- }
-}
\ No newline at end of file
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/MpegLayer3WaveFormat.cs b/Src/Backup/Silverlight.Media.Shoutcast/Parsers/MpegLayer3WaveFormat.cs
deleted file mode 100644
index 03df0cf..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/MpegLayer3WaveFormat.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// (c) Copyright Larry Olson.
-// This source is subject to the Microsoft Public License (Ms-PL)
-// See http://code.msdn.microsoft.com/ManagedMediaHelpers/Project/License.aspx
-// All other rights reserved.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Parsers
-{
- using System;
- using System.Globalization;
-
- ///
- /// A managed representation of the multimedia MPEGLAYER3WAVEFORMATEX
- /// structure declared in mmreg.h.
- ///
- ///
- /// This was designed for usage in an environment where PInvokes are not
- /// allowed.
- ///
- public class MpegLayer3WaveFormat : WaveFormat
- {
- ///
- /// Initializes a new instance of the MpegLayer3WaveFormat class.
- ///
- /// WaveFormatExtensible instance representing this audio format.
- public MpegLayer3WaveFormat(WaveFormatExtensible waveFormatExtensible)
- : base(waveFormatExtensible)
- {
- }
-
- ///
- /// Gets or sets the FormatTag that defines what type of waveform audio this is.
- ///
- ///
- /// Set this to
- /// MPEGLAYER3_ID_MPEG = 1
- ///
- public short Id { get; set; }
-
- ///
- /// Gets or sets the bitrate padding mode.
- /// This value is set in an Mp3 file to determine if padding is needed to adjust the average bitrate
- /// to meet the sampling rate.
- /// 0 = adjust as needed
- /// 1 = always pad
- /// 2 = never pad
- ///
- ///
- /// This is different than the unmanaged version of MpegLayer3WaveFormat
- /// which has the field Flags instead of this name.
- ///
- public int BitratePaddingMode { get; set; }
-
- ///
- /// Gets or sets the Block Size in bytes. For MP3 audio this is
- /// 144 * bitrate / samplingRate + padding
- ///
- public short BlockSize { get; set; }
-
- ///
- /// Gets or sets the number of frames per block.
- ///
- public short FramesPerBlock { get; set; }
-
- ///
- /// Gets or sets the encoder delay in samples.
- ///
- public short CodecDelay { get; set; }
-
- ///
- /// Returns a string representing the structure in little-endian
- /// hexadecimal format.
- ///
- ///
- /// The string generated here is intended to be passed as
- /// CodecPrivateData for Silverlight 2's MediaStreamSource
- ///
- ///
- /// A string representing the structure in little-endia hexadecimal
- /// format.
- ///
- public override string ToHexString()
- {
- string s = WaveFormatExtensible.ToHexString();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.Id).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X8}", this.BitratePaddingMode).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.BlockSize).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.FramesPerBlock).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.CodecDelay).ToLittleEndian();
- return s;
- }
-
- ///
- /// Returns a string representing all of the fields in the object.
- ///
- ///
- /// A string representing all of the fields in the object.
- ///
- public override string ToString()
- {
- return "MPEGLAYER3 "
- + WaveFormatExtensible.ToString()
- + string.Format(
- CultureInfo.InvariantCulture,
- "ID: {0}, Flags: {1}, BlockSize: {2}, FramesPerBlock {3}, CodecDelay {4}",
- this.Id,
- this.BitratePaddingMode,
- this.BlockSize,
- this.FramesPerBlock,
- this.CodecDelay);
- }
- }
-}
\ No newline at end of file
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/StringExtensions.cs b/Src/Backup/Silverlight.Media.Shoutcast/Parsers/StringExtensions.cs
deleted file mode 100644
index 03128c1..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/StringExtensions.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// (c) Copyright Larry Olson.
-// This source is subject to the Microsoft Public License (Ms-PL)
-// See http://code.msdn.microsoft.com/ManagedMediaHelpers/Project/License.aspx
-// All other rights reserved.
-//
-//-----------------------------------------------------------------------
-
-// Supressing Code Analysis rule(s)
-[module: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes",
- Scope = "namespace",
- Target = "ExtensionMethods",
- Justification = "This is appropriate as a separate namespace because it logically is separate from the ManagedMediaParsers namespace.")]
-
-[module: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes",
- Scope = "member",
- Target = "ExtensionMethods.StringExtensions.#ToLittleEndian(System.String)",
- Justification = "This is appropriate to make this method look like a first class member of string.")]
-
-namespace Silverlight.Media.Parsers
-{
- using System;
-
- ///
- /// Extensions for the standard string class.
- ///
- public static class StringExtensions
- {
- ///
- ///
- /// Converts a string of characters from Big Endian byte order to
- /// Little Endian byte order.
- ///
- ///
- /// Assumptions this makes about the string. Every two characters
- /// make up the smallest data unit (analogous to byte). The entire
- /// string is the size of the systems natural unit of data (analogous
- /// to a word).
- ///
- ///
- ///
- /// A string in Big Endian Byte order.
- ///
- ///
- /// A string in Little Endian Byte order.
- ///
- ///
- /// This function was designed to take in a Big Endian string of
- /// hexadecimal digits.
- ///
- /// input:
- /// DEADBEEF
- /// output:
- /// EFBEADDE
- ///
- ///
- public static string ToLittleEndian(this string value)
- {
- // Guard
- if (value == null)
- {
- throw new NullReferenceException();
- }
-
- char[] bigEndianChars = value.ToCharArray();
-
- // Guard
- if (bigEndianChars.Length % 2 != 0)
- {
- return string.Empty;
- }
-
- int i, ai, bi, ci, di;
- char a, b, c, d;
-
- for (i = 0; i < bigEndianChars.Length / 2; i += 2)
- {
- // front byte ( in hex )
- ai = i;
- bi = i + 1;
-
- // back byte ( in hex )
- ci = bigEndianChars.Length - 2 - i;
- di = bigEndianChars.Length - 1 - i;
-
- a = bigEndianChars[ai];
- b = bigEndianChars[bi];
- c = bigEndianChars[ci];
- d = bigEndianChars[di];
-
- bigEndianChars[ci] = a;
- bigEndianChars[di] = b;
- bigEndianChars[ai] = c;
- bigEndianChars[bi] = d;
- }
-
- return new string(bigEndianChars);
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/WaveFormat.cs b/Src/Backup/Silverlight.Media.Shoutcast/Parsers/WaveFormat.cs
deleted file mode 100644
index d7ad6ce..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/WaveFormat.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Parsers
-{
- using System;
-
- ///
- /// Base class for wave format support.
- ///
- public abstract class WaveFormat
- {
- ///
- /// Initializes a new instance of the WaveFormat class.
- ///
- /// WaveFormatExtensible instance representing an audio format.
- public WaveFormat(WaveFormatExtensible waveFormatExtensible)
- {
- if (waveFormatExtensible == null)
- {
- throw new ArgumentNullException("waveFormatExtensible");
- }
-
- this.WaveFormatExtensible = waveFormatExtensible;
- }
-
- ///
- /// Gets the core WaveFormatExtensible strucutre representing the Mp3 audio data's
- /// core attributes.
- ///
- ///
- /// wfx.FormatTag must be WAVE_FORMAT_MPEGLAYER3 = 0x0055 = (85)
- /// wfx.Size must be >= 12
- ///
- public WaveFormatExtensible WaveFormatExtensible { get; private set; }
-
- ///
- /// Returns a string representing the structure in little-endian
- /// hexadecimal format.
- ///
- ///
- /// The string generated here is intended to be passed as
- /// CodecPrivateData for Silverlight's MediaStreamSource
- ///
- ///
- /// A string representing the structure in little-endia hexadecimal
- /// format.
- ///
- public abstract string ToHexString();
-
- ///
- /// Calculate the duration of audio based on the size of the buffer
- ///
- /// the buffer size in bytes
- /// The duration of that buffer
- public long AudioDurationFromBufferSize(uint audioDataSize)
- {
- if (this.WaveFormatExtensible.AverageBytesPerSecond == 0)
- {
- return 0;
- }
-
- return (long)audioDataSize * 10000000 / this.WaveFormatExtensible.AverageBytesPerSecond;
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/WaveFormatExtensible.cs b/Src/Backup/Silverlight.Media.Shoutcast/Parsers/WaveFormatExtensible.cs
deleted file mode 100644
index 04bbbdd..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Parsers/WaveFormatExtensible.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// (c) Copyright Larry Olson.
-// This source is subject to the Microsoft Public License (Ms-PL)
-// See http://code.msdn.microsoft.com/ManagedMediaHelpers/Project/License.aspx
-// All other rights reserved.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Parsers
-{
- using System;
- using System.Globalization;
-
- ///
- /// A managed representation of the multimedia WAVEFORMATEX structure
- /// declared in mmreg.h.
- ///
- ///
- /// This was designed for usage in an environment where PInvokes are not
- /// allowed.
- ///
- public class WaveFormatExtensible
- {
- ///
- /// Gets or sets the audio format type. A complete list of format tags can be
- /// found in the Mmreg.h header file.
- ///
- ///
- /// Silverlight 2 supports:
- /// WMA 7,8,9
- /// WMA 10 Pro
- /// Mp3
- /// WAVE_FORMAT_MPEGLAYER3 = 0x0055
- ///
- public short FormatTag { get; set; }
-
- ///
- /// Gets or sets the number of channels in the data.
- /// Mono 1
- /// Stereo 2
- /// Dual 2 (2 Mono channels)
- ///
- ///
- /// Silverlight 2 only supports stereo output and folds down higher
- /// numbers of channels to stereo.
- ///
- public short Channels { get; set; }
-
- ///
- /// Gets or sets the sampling rate in hertz (samples per second)
- ///
- public int SamplesPerSec { get; set; }
-
- ///
- /// Gets or sets the average data-transfer rate, in bytes per second, for the format.
- ///
- public int AverageBytesPerSecond { get; set; }
-
- ///
- /// Gets or sets the minimum size of a unit of data for the given format in Bytes.
- ///
- public short BlockAlign { get; set; }
-
- ///
- /// Gets or sets the number of bits in a single sample of the format's data.
- ///
- public short BitsPerSample { get; set; }
-
- ///
- /// Gets or sets the size in bytes of any extra format data added to the end of the
- /// WAVEFORMATEX structure.
- ///
- public short Size { get; set; }
-
- ///
- /// Returns a string representing the structure in little-endian
- /// hexadecimal format.
- ///
- ///
- /// The string generated here is intended to be passed as
- /// CodecPrivateData for Silverlight 2's MediaStreamSource
- ///
- ///
- /// A string representing the structure in little-endia hexadecimal
- /// format.
- ///
- public string ToHexString()
- {
- string s = string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.FormatTag).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.Channels).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X8}", this.SamplesPerSec).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X8}", this.AverageBytesPerSecond).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.BlockAlign).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.BitsPerSample).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.Size).ToLittleEndian();
- return s;
- }
-
- ///
- /// Returns a string representing all of the fields in the object.
- ///
- ///
- /// A string representing all of the fields in the object.
- ///
- public override string ToString()
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "WAVEFORMATEX FormatTag: {0}, Channels: {1}, SamplesPerSec: {2}, AvgBytesPerSec: {3}, BlockAlign: {4}, BitsPerSample: {5}, Size: {6} ",
- this.FormatTag,
- this.Channels,
- this.SamplesPerSec,
- this.AverageBytesPerSecond,
- this.BlockAlign,
- this.BitsPerSample,
- this.Size);
- }
- }
-}
\ No newline at end of file
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/DuplicateNameHandling.cs b/Src/Backup/Silverlight.Media.Shoutcast/Playlist/DuplicateNameHandling.cs
deleted file mode 100644
index 9f79f60..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/DuplicateNameHandling.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
-
- ///
- /// Describes how IniParser will handle duplicate names within a section.
- ///
- public enum DuplicateNameHandling
- {
- ///
- /// Throw an InvalidOperationException when a duplicate name within a section is encountered.
- ///
- Abort,
-
- ///
- /// Ignore the value when a dupliate name within a section is encountered.
- ///
- Discard,
-
- ///
- /// Overwrite the existing value when a duplicate name within a section is encountered.
- ///
- Overwrite
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/IPlaylist.cs b/Src/Backup/Silverlight.Media.Shoutcast/Playlist/IPlaylist.cs
deleted file mode 100644
index 0f5b7f1..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/IPlaylist.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System.Collections.Generic;
-
- ///
- /// Interface representing an audio stream playlist.
- ///
- public interface IPlaylist
- {
- ///
- /// Gets an ICollection of IPlaylist entries.
- ///
- ICollection Items { get; }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/IPlaylistItem.cs b/Src/Backup/Silverlight.Media.Shoutcast/Playlist/IPlaylistItem.cs
deleted file mode 100644
index 2d6cbcd..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/IPlaylistItem.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
-
- ///
- /// Interface representing an audio stream playlist entry.
- ///
- public interface IPlaylistItem
- {
- ///
- /// Gets or sets the display name of the playlist entry.
- ///
- string DisplayName { get; set; }
-
- ///
- /// Gets or sets the length, in seconds, of the playlist entry.
- ///
- TimeSpan Length { get; set; }
-
- ///
- /// Gets or sets the path of the playlist entry. This is usually a Uri, but can be a file path as well.
- ///
- string Path { get; set; }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/IPlaylistParser.cs b/Src/Backup/Silverlight.Media.Shoutcast/Playlist/IPlaylistParser.cs
deleted file mode 100644
index b555399..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/IPlaylistParser.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
- using System.Collections.Generic;
- using System.IO;
-
- ///
- /// Interface representing a audio stream playlist parser.
- ///
- public interface IPlaylistParser
- {
- ///
- /// Gets the Internet content type supported by this playlist parser.
- ///
- string ContentType { get; }
-
- ///
- /// Parses the supplied Stream into an IPlaylist instance.
- ///
- /// Stream representing the playlist data.
- /// Successfully parsed IPlaylist instance.
- IPlaylist Parse(Stream stream);
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/IniParser.cs b/Src/Backup/Silverlight.Media.Shoutcast/Playlist/IniParser.cs
deleted file mode 100644
index e143385..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/IniParser.cs
+++ /dev/null
@@ -1,166 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.IO;
- using System.Text.RegularExpressions;
-
- ///
- /// Parses INI file format.
- ///
- public class IniParser
- {
- ///
- /// Regex to parse comment lines.
- ///
- private static Regex iniComment = new Regex(@"^\s*;.");
-
- ///
- /// Regex to parse section names.
- ///
- private static Regex iniSectionName = new Regex(@"^\[(?[\w\s]*)\]$");
-
- ///
- /// Regex to parse key/value pairs.
- ///
- private static Regex iniKeyValue = new Regex(@"^(?[\w\s]*)=(?.*)");
-
- ///
- /// Field to store duplicate name handling enumeration.
- ///
- private DuplicateNameHandling duplicateNameHandling;
-
- ///
- /// Dictionary to store ini file sections and their associated key/value pairs.
- ///
- private Dictionary> sections = new Dictionary>(StringComparer.CurrentCultureIgnoreCase);
-
- ///
- /// Initializes a new instance of the IniParser class.
- ///
- /// TextReader representing an ini file.
- public IniParser(TextReader textReader)
- : this(textReader, DuplicateNameHandling.Abort)
- {
- }
-
- ///
- /// Initializes a new instance of the IniParser class.
- ///
- /// TextReader representing an ini file.
- /// Specifies how IniParser will handle duplicate names.
- public IniParser(TextReader textReader, DuplicateNameHandling duplicateNameHandling)
- {
- if (textReader == null)
- {
- throw new ArgumentNullException("textReader");
- }
-
- this.duplicateNameHandling = duplicateNameHandling;
- this.Parse(textReader);
- }
-
- ///
- /// Gets the sections from the ini file containing name/value pairs.
- ///
- public Dictionary> Sections
- {
- get { return this.sections; }
- }
-
- ///
- /// Parses the ini file.
- ///
- /// TextReader representing an ini file.
- private void Parse(TextReader textReader)
- {
- if (textReader == null)
- {
- throw new ArgumentNullException("textReader");
- }
-
- int lineNumber = 0;
- string line = null;
- Dictionary currentSection = null;
-
- while ((line = textReader.ReadLine()) != null)
- {
- lineNumber++;
-
- // Skip blank lines and comments
- if (string.IsNullOrEmpty(line) || IniParser.iniComment.IsMatch(line))
- {
- continue;
- }
-
- Match match = IniParser.iniSectionName.Match(line);
- if (match.Success)
- {
- if (this.sections.ContainsKey(match.Groups["name"].Value))
- {
- throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Section name already exists: {0}", match.Groups["name"].Value));
- }
-
- currentSection = new Dictionary(StringComparer.CurrentCultureIgnoreCase);
- this.sections.Add(match.Groups["name"].Value, currentSection);
- }
- else
- {
- // Not a section, so maybe a key/value
- match = IniParser.iniKeyValue.Match(line);
- if (match.Success)
- {
- // If we have a null current section, the file format is invalid
- if (currentSection == null)
- {
- throw new InvalidOperationException("No current section");
- }
-
- if (currentSection.ContainsKey(match.Groups["key"].Value))
- {
- if (this.duplicateNameHandling == DuplicateNameHandling.Abort)
- {
- throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Duplicate key: {0}", match.Groups["key"].Value));
- }
- else if (this.duplicateNameHandling == DuplicateNameHandling.Overwrite)
- {
- currentSection[match.Groups["key"].Value] = match.Groups["value"].Value;
- }
- else if (this.duplicateNameHandling == DuplicateNameHandling.Discard)
- {
- // Just in case we need to add something in this case.
- continue;
- }
- }
-
- currentSection.Add(match.Groups["key"].Value, match.Groups["value"].Value);
- }
- else
- {
- // Invalid format
- throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Invalid line #: {0}", lineNumber));
- }
- }
- }
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/M3uParser.cs b/Src/Backup/Silverlight.Media.Shoutcast/Playlist/M3uParser.cs
deleted file mode 100644
index a75e039..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/M3uParser.cs
+++ /dev/null
@@ -1,176 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text.RegularExpressions;
-
- ///
- /// Parses M3U playlist.
- ///
- public class M3uParser : IPlaylistParser
- {
- ///
- /// Content type of the m3u playlist format.
- ///
- internal const string M3uContentType = "audio/x-mpegurl";
-
- ///
- /// M3U Extended Header tag.
- ///
- private const string M3uExtendedHeader = "#EXTM3U";
-
- ///
- /// M3U Extended Detail tag.
- ///
- private const string M3uExtendedDetail = "#EXTINF";
-
- ///
- /// Regex to parse M3U Extended Detail.
- ///
- private static Regex extendedDetailRegex = new Regex(M3uParser.M3uExtendedDetail + @":(?[\+-]?\d+),(?.*)");
-
- ///
- /// Initializes a new instance of the M3uParser class.
- ///
- public M3uParser()
- {
- }
-
- ///
- /// Initializes a new instance of the M3uParser class.
- ///
- /// TextReader representing an M3U file.
- public M3uParser(TextReader textReader)
- {
- if (textReader == null)
- {
- throw new ArgumentNullException("textReader");
- }
-
- this.Parse(textReader);
- }
-
- ///
- /// Gets the supported content type of the M3U playlist format.
- ///
- public string ContentType
- {
- get { return M3uParser.M3uContentType; }
- }
-
- ///
- /// Parses the M3U file.
- ///
- /// Stream representing a M3U file.
- /// Parsed M3U playlist.
- public IPlaylist Parse(Stream stream)
- {
- if (stream == null)
- {
- throw new ArgumentNullException("stream");
- }
-
- return this.Parse(new StreamReader(stream));
- }
-
- ///
- /// Parses the M3U playlist.
- ///
- /// TextReader representing the M3U playlist.
- /// Parsed M3U playlist.
- private IPlaylist Parse(TextReader textReader)
- {
- if (textReader == null)
- {
- throw new ArgumentNullException("textReader");
- }
-
- string line = textReader.ReadLine();
-
- if (line == null)
- {
- throw new ArgumentException("Invalid M3U playlist.");
- }
-
- M3uPlaylist playlist = new M3uPlaylist();
- ICollection items = playlist.Items;
-
- bool isExtended = line.Equals(M3uParser.M3uExtendedHeader);
-
- if (isExtended)
- {
- while ((line = textReader.ReadLine()) != null)
- {
- string extendedDetail = line;
- string detail = textReader.ReadLine();
-
- if ((extendedDetail == null) || (detail == null))
- {
- throw new Exception("File is malformed");
- }
-
- Match match = M3uParser.extendedDetailRegex.Match(extendedDetail);
- if (!match.Success)
- {
- throw new Exception("Invalid m3u extended detail line");
- }
-
- items.Add(new M3uPlaylistItem()
- {
- DisplayName = match.Groups["file"].Value,
- Path = detail,
- Length = new TimeSpan(0, 0, int.Parse(match.Groups["seconds"].Value))
- });
- }
- }
- else
- {
- if (!string.IsNullOrEmpty(line))
- {
- items.Add(new M3uPlaylistItem()
- {
- DisplayName = line,
- Path = line,
- Length = new TimeSpan(0, 0, -1)
- });
- }
-
- while ((line = textReader.ReadLine()) != null)
- {
- if (string.IsNullOrEmpty(line))
- {
- continue;
- }
-
- items.Add(new M3uPlaylistItem()
- {
- DisplayName = line,
- Path = line,
- Length = new TimeSpan(0, 0, -1)
- });
- }
- }
-
- return playlist;
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/M3uPlaylist.cs b/Src/Backup/Silverlight.Media.Shoutcast/Playlist/M3uPlaylist.cs
deleted file mode 100644
index 92f243f..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/M3uPlaylist.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System.Collections.Generic;
-
- ///
- /// Represents an M3U playlist.
- ///
- public class M3uPlaylist : IPlaylist
- {
- ///
- /// M3U playlist items.
- ///
- private List items = new List();
-
- ///
- /// Gets a collection of the M3U playlist items.
- ///
- public ICollection Items
- {
- get { return this.items; }
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/M3uPlaylistItem.cs b/Src/Backup/Silverlight.Media.Shoutcast/Playlist/M3uPlaylistItem.cs
deleted file mode 100644
index 40ad2be..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/M3uPlaylistItem.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
-
- ///
- /// Represents an M3U playlist entry.
- ///
- public class M3uPlaylistItem : PlaylistItem
- {
- ///
- /// Initializes a new instance of the M3uPlaylistItem class.
- ///
- public M3uPlaylistItem()
- : base()
- {
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/PlaylistFactory.cs b/Src/Backup/Silverlight.Media.Shoutcast/Playlist/PlaylistFactory.cs
deleted file mode 100644
index ad74b59..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/PlaylistFactory.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
- using System.Globalization;
- using System.IO;
-
- ///
- /// Factory to parse different playlist types.
- ///
- public static class PlaylistFactory
- {
- ///
- /// Factory method that parses a given Stream with the appropriate playlist type, based on the supplied content type.
- ///
- /// Internet content type representing the playlist type of the Stream.
- /// Stream representing the playlist data.
- /// Successfully parsed playlist.
- public static IPlaylist Parse(string contentType, Stream stream)
- {
- if (string.IsNullOrEmpty(contentType))
- {
- throw new ArgumentException("contentType cannot be null or empty.");
- }
-
- if (stream == null)
- {
- throw new ArgumentNullException("stream");
- }
-
- IPlaylistParser result;
- switch (contentType)
- {
- case M3uParser.M3uContentType:
- result = new M3uParser();
- break;
- case PlsParser.PlsContentType:
- result = new PlsParser();
- break;
- default:
- throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid content type: {0}", contentType));
- }
-
- return result.Parse(stream);
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/PlaylistItem.cs b/Src/Backup/Silverlight.Media.Shoutcast/Playlist/PlaylistItem.cs
deleted file mode 100644
index a624fb0..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/PlaylistItem.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
-
- ///
- /// Represents a playlist entry.
- ///
- public class PlaylistItem : IPlaylistItem
- {
- ///
- /// Initializes a new instance of the PlaylistItem class.
- ///
- public PlaylistItem()
- {
- }
-
- ///
- /// Gets or sets the display name of the playlist entry.
- ///
- public string DisplayName { get; set; }
-
- ///
- /// Gets or sets the path of the playlist entry.
- ///
- public string Path { get; set; }
-
- ///
- /// Gets or sets the length of the media represented by this playlist entry.
- ///
- public TimeSpan Length { get; set; }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/PlsParser.cs b/Src/Backup/Silverlight.Media.Shoutcast/Playlist/PlsParser.cs
deleted file mode 100644
index f9952e7..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/PlsParser.cs
+++ /dev/null
@@ -1,143 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.IO;
- using System.Linq;
-
- ///
- /// Parses the PLS playlist format.
- ///
- public class PlsParser : IPlaylistParser
- {
- ///
- /// Content type of the PLS playlist format.
- ///
- internal const string PlsContentType = "audio/x-scpls";
-
- ///
- /// Initializes a new instance of the PlsParser class.
- ///
- public PlsParser()
- {
- }
-
- ///
- /// Initializes a new instance of the PlsParser class.
- ///
- /// TextReader representing a PLS playlist file.
- public PlsParser(TextReader textReader)
- {
- if (textReader == null)
- {
- throw new ArgumentNullException("textReader");
- }
-
- this.Parse(textReader);
- }
-
- ///
- /// Gets the supported content type of the PLS playlist format.
- ///
- public string ContentType
- {
- get { return PlsParser.PlsContentType; }
- }
-
- ///
- /// Parses the PLS file.
- ///
- /// Stream representing a PLS file.
- /// A successfully parsed playlist.
- public IPlaylist Parse(Stream stream)
- {
- if (stream == null)
- {
- throw new ArgumentNullException("stream");
- }
-
- return this.Parse(new StreamReader(stream));
- }
-
- ///
- /// Parses the PLS file.
- ///
- /// TextReader representing a PLS playlist file.
- /// A successfully parsed playlist.
- private IPlaylist Parse(TextReader textReader)
- {
- if (textReader == null)
- {
- throw new ArgumentNullException("textReader");
- }
-
- // Shoutcast.com PLS files are messed up. The LengthX values are all Length1=-1 instead of LengthX=-1.
- IniParser iniFile = new IniParser(textReader, DuplicateNameHandling.Discard);
- Dictionary> sections = iniFile.Sections;
-
- if (!sections.ContainsKey("playlist"))
- {
- throw new InvalidOperationException("playlist section not found");
- }
-
- PlsPlaylist playlist = new PlsPlaylist();
- ICollection items = playlist.Items;
-
- Dictionary playlistEntries = sections["playlist"];
-
- int numberOfEntries;
- if ((!playlistEntries.ContainsKey("NumberOfEntries")) || (!int.TryParse(playlistEntries["NumberOfEntries"], out numberOfEntries)))
- {
- throw new InvalidOperationException("NumberOfEntries key missing or not a valid integer.");
- }
-
- for (int i = 1; i <= numberOfEntries; i++)
- {
- string fileKey = string.Format(CultureInfo.InvariantCulture, "File{0}", i);
- string titleKey = string.Format(CultureInfo.InvariantCulture, "Title{0}", i);
- string lengthKey = string.Format(CultureInfo.InvariantCulture, "Length{0}", i);
-
- if (!playlistEntries.ContainsKey(fileKey))
- {
- throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Missing file key: {0}", fileKey));
- }
-
- int lengthInSeconds = -1;
-
- if (playlistEntries.ContainsKey(lengthKey))
- {
- // We don't really care if this works or not
- int.TryParse(playlistEntries[lengthKey], out lengthInSeconds);
- }
-
- items.Add(new M3uPlaylistItem()
- {
- DisplayName = playlistEntries.ContainsKey(titleKey) ? playlistEntries[titleKey] : string.Empty,
- Length = new TimeSpan(0, 0, lengthInSeconds),
- Path = playlistEntries[fileKey]
- });
- }
-
- return playlist;
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/PlsPlaylist.cs b/Src/Backup/Silverlight.Media.Shoutcast/Playlist/PlsPlaylist.cs
deleted file mode 100644
index c4ac667..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/PlsPlaylist.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System.Collections.Generic;
-
- ///
- /// Represents a PLS playlist.
- ///
- public class PlsPlaylist : IPlaylist
- {
- ///
- /// PLS playlist items.
- ///
- private List items = new List();
-
- ///
- /// Gets a collection of the PLS playlist items.
- ///
- public ICollection Items
- {
- get { return this.items; }
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/PlsPlaylistItem.cs b/Src/Backup/Silverlight.Media.Shoutcast/Playlist/PlsPlaylistItem.cs
deleted file mode 100644
index bc5d0de..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Playlist/PlsPlaylistItem.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
-
- ///
- /// Represents a PLS playlist entry.
- ///
- public class PlsPlaylistItem : PlaylistItem
- {
- ///
- /// Initializes a new instance of the PlsPlaylistItem class.
- ///
- public PlsPlaylistItem()
- : base()
- {
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Properties/AssemblyInfo.cs b/Src/Backup/Silverlight.Media.Shoutcast/Properties/AssemblyInfo.cs
deleted file mode 100644
index 003f431..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Silverlight.Media")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Silverlight.Media")]
-[assembly: AssemblyCopyright("Copyright © 2010 Andrew Oakley")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("3b126eb4-809d-4f07-974e-13378788dcff")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Settings.StyleCop b/Src/Backup/Silverlight.Media.Shoutcast/Settings.StyleCop
deleted file mode 100644
index 7f55ce6..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Settings.StyleCop
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/ShoutcastMediaStreamSource.cs b/Src/Backup/Silverlight.Media.Shoutcast/ShoutcastMediaStreamSource.cs
deleted file mode 100644
index b2a2d35..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/ShoutcastMediaStreamSource.cs
+++ /dev/null
@@ -1,444 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-[module: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming",
- "CA1709:IdentifiersShouldBeCasedCorrectly",
- Scope = "type",
- Target = "Silverlight.Media.ShoutcastMediaStreamSource",
- MessageId = "Mp",
- Justification = "Mp is not a two letter acyonym but is instead part of Mp3")]
-
-namespace Silverlight.Media
-{
- using System;
- using System.Collections.Generic;
- using System.Net;
- using System.Windows;
- using System.Windows.Media;
- using Silverlight.Media.Metadata;
-
- ///
- /// A Simple MediaStreamSource which can play back MP3 streams from
- /// beginning to end.
- ///
- public class ShoutcastMediaStreamSource : MediaStreamSource, IDisposable
- {
- ///
- /// The current metadata for the Shoutcast stream.
- ///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter", Justification = "There is a public property representing the current metadata, which causes a naming conflict.")]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "This field is used in an Interlocked statement.")]
- internal ShoutcastMetadata currentMetadata = new ShoutcastMetadata();
-
- ///
- /// Exception set by the worker thread.
- ///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter", Justification = "This is an internal field only accessed by the private ShoutcastStream.")]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "This field is used in an Interlocked statement.")]
- internal Exception workerException;
-
- ///
- /// Empty dictionary of MediaSampleAttributeKeys, as they are unused in this MedaStreamSource.
- ///
- private static Dictionary emptyDict = new Dictionary();
-
- ///
- /// Current timestamp at which a sample should be rendered as measured in 100 nanosecond increments.
- ///
- private long currentTimestamp;
-
- ///
- /// MediaStreamDescription for the associated Mp3 stream.
- ///
- private MediaStreamDescription audioStreamDescription;
-
- ///
- /// The Mp3 stream being played back.
- ///
- private ShoutcastStream audioStream;
-
- ///
- /// Initializes a new instance of the ShoutcastMediaStreamSource class.
- ///
- /// Uri of the Mp3 stream.
- public ShoutcastMediaStreamSource(Uri uri)
- : this(uri, true)
- {
- }
-
- ///
- /// Initializes a new instance of the ShoutcastMediaStreamSource class.
- ///
- /// Uri of the Mp3 stream.
- /// true to include metadata, otherwise, false.
- public ShoutcastMediaStreamSource(Uri uri, bool includeMetadata)
- {
- if (uri == null)
- {
- throw new ArgumentNullException("uri");
- }
-
- this.StreamUri = uri;
- this.IncludeMetadata = includeMetadata;
- }
-
- ///
- /// Finalizes an instance of the ShoutcastMediaStreamSource class.
- ///
- ~ShoutcastMediaStreamSource()
- {
- this.Dispose(false);
- }
-
- ///
- /// Fired when the Mp3 metadata changed.
- ///
- public event RoutedEventHandler MetadataChanged;
-
- ///
- /// Fired when the ShoutcastStream is closed.
- ///
- public event EventHandler Closed;
-
- ///
- /// Gets the Uri of the audio stream.
- ///
- public Uri StreamUri { get; private set; }
-
- ///
- /// Gets a value representing the current Shoutcast metadata.
- ///
- public ShoutcastMetadata CurrentMetadata
- {
- get { return this.currentMetadata; }
- }
-
- ///
- /// Gets a value indicating whether or not metadata is included in this MSS.
- ///
- internal bool IncludeMetadata { get; private set; }
-
- ///
- /// Releases all resources used by the MediaStreamSource.
- ///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", Justification = "This mimics the System.IO.Stream Dispose() code")]
- public void Dispose()
- {
- // Like System.IO.Stream
- this.CloseMedia();
- }
-
- ///
- /// Fires the MetadataChanged event.
- ///
- internal void OnMetadataChanged()
- {
- RoutedEventHandler handler = this.MetadataChanged;
- if (handler != null)
- {
- handler(this, new RoutedEventArgs());
- }
- }
-
- ///
- /// Raises the Closed event.
- ///
- internal void OnClosed()
- {
- EventHandler handler = this.Closed;
- if (handler != null)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": OnClosed()");
- handler(this, EventArgs.Empty);
- }
- }
-
- ///
- /// Releases the unmanaged resources used by the MediaStreamSource and optionally releases the managed resources.
- ///
- /// true to release both managed and unmanaged resources; false to release only unmanaged resources.
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- this.CleanupAudioStream();
- }
- }
-
- ///
- /// Parses the passed in MediaStream to find the first frame and signals
- /// to its parent MediaElement that it is ready to begin playback by calling
- /// ReportOpenMediaCompleted.
- ///
- protected override void OpenMediaAsync()
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": OpenMediaAsync()");
-
- // So, here is why this is a little weird.
- // The Shoutcast server software has the ability to provide web pages. These pages just happen to be served from the SAME address as the media stream.
- // Putting a "/;" at the end of the Uri will tell the Shoutcast server that we aren't a web browser, so stream the data. The problem is that not ALL
- // Shoutcast servers are configured that way. So, we have to do a request to get the content type. If it is text/html, we append the "/;" and move on.
- // If it is an empty string, 99.9% of the time, this will be the media stream (If it's an ICY stream, the ICY "headers" don't parse properly). The ShoutcastStream
- // will handle this case, so we let it go through.
- HttpWebRequest contentTypeRequest = ShoutcastMediaStreamSource.CreateHttpWebRequest(this.StreamUri, this.IncludeMetadata);
- contentTypeRequest.BeginGetResponse(
- ia1 =>
- {
- HttpWebRequest req1 = ia1.AsyncState as HttpWebRequest;
- try
- {
- HttpWebResponse res1 = (HttpWebResponse)req1.EndGetResponse(ia1);
- string contentType = res1.ContentType;
- if ((contentType == string.Empty) || (contentType == "audio/mpeg"))
- {
- try
- {
- this.audioStream = new ShoutcastStream(this, res1);
- this.audioStreamDescription = this.audioStream.AudioStreamDescription;
- this.ReportOpenMediaCompleted(this.audioStream.AudioSourceAttributes, new MediaStreamDescription[] { this.audioStream.AudioStreamDescription });
- }
- catch (Exception ex)
- {
- this.CleanupAudioStream();
- this.ErrorOccurred(ex.Message);
- }
- }
- else
- {
- // Close the original response. We need another one.
- res1.Close();
- res1 = null;
- if (!this.StreamUri.OriginalString.EndsWith("/", StringComparison.Ordinal))
- {
- this.StreamUri = new Uri(this.StreamUri.OriginalString + "/;", UriKind.Absolute);
- }
- else
- {
- this.StreamUri = new Uri(this.StreamUri.OriginalString + ";", UriKind.Absolute);
- }
-
- HttpWebRequest streamRequest = ShoutcastMediaStreamSource.CreateHttpWebRequest(this.StreamUri, this.IncludeMetadata);
- streamRequest.BeginGetResponse(
- ia =>
- {
- HttpWebRequest req = ia.AsyncState as HttpWebRequest;
- try
- {
- HttpWebResponse res = (HttpWebResponse)req.EndGetResponse(ia);
- this.audioStream = new ShoutcastStream(this, res);
- this.audioStreamDescription = this.audioStream.AudioStreamDescription;
- this.ReportOpenMediaCompleted(this.audioStream.AudioSourceAttributes, new MediaStreamDescription[] { this.audioStream.AudioStreamDescription });
- }
- catch (Exception ex)
- {
- if (res1 != null)
- {
- res1.Close();
- }
-
- this.CleanupAudioStream();
- this.ErrorOccurred(ex.Message);
- }
- },
- streamRequest);
- }
- }
- catch (Exception ex)
- {
- this.CleanupAudioStream();
- this.ErrorOccurred(ex.Message);
- }
- },
- contentTypeRequest);
- }
-
- ///
- /// Parses the next sample from the requested stream and then calls ReportGetSampleCompleted
- /// to inform its parent MediaElement of the next sample.
- ///
- ///
- /// Should always be Audio for this MediaStreamSource.
- ///
- protected override void GetSampleAsync(MediaStreamType mediaStreamType)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": GetSampleAsync()");
-
- // If the MSS has been disposed, but the player has not been stopped, this will force a stop by returning an empty sample.
- if (this.audioStream == null)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Race condition #1 handled!");
- this.ReportGetSampleCompleted(new MediaStreamSample(this.audioStreamDescription, null, 0, 0, 0, ShoutcastMediaStreamSource.emptyDict));
- return;
- }
-
- if (this.workerException != null)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Error #1 handled!");
- this.CleanupAudioStream();
- this.ErrorOccurred(this.workerException.Message);
- return;
- }
-
- // See if we need to report buffering.
- int bufferingPercentage = this.audioStream.BufferingPercentage;
- while (bufferingPercentage < 100)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Buffering percentage less than 100");
- this.ReportGetSampleProgress(bufferingPercentage / 100.0d);
-
- // DANGER WILL ROBINSON!!! DANGER!!!
- // This line causes a race condition, as Thread.Sleep() causes the current thread to give up its time slice. If the next thread scheduled to run is a thread that
- // is calling Dispose, our audio stream can be null, so we need to check after we wake up. If so, we need to return an empty audio sample to shut everything down
- // properly.
- System.Threading.Thread.Sleep(10);
-
- // If the MSS has been disposed, but the player has not been stopped, this will force a stop by returning an empty sample.
- if (this.audioStream == null)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Race condition #2 handled!");
- this.ReportGetSampleCompleted(new MediaStreamSample(this.audioStreamDescription, null, 0, 0, 0, ShoutcastMediaStreamSource.emptyDict));
- return;
- }
-
- if (this.workerException != null)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Error #2 handled!");
- this.ErrorOccurred(this.workerException.Message);
- return;
- }
-
- bufferingPercentage = this.audioStream.BufferingPercentage;
- }
-
- try
- {
- System.Diagnostics.Debug.WriteLine("ReportGetSampleCompleted()");
- MediaStreamSample audioSample = new MediaStreamSample(
- this.audioStreamDescription,
- this.audioStream,
- 0,
- this.audioStream.CurrentFrameSize,
- this.currentTimestamp,
- ShoutcastMediaStreamSource.emptyDict);
-
- this.currentTimestamp += this.audioStream.WaveFormat.AudioDurationFromBufferSize((uint)this.audioStream.CurrentFrameSize);
- this.ReportGetSampleCompleted(audioSample);
- }
- catch (Exception ex)
- {
- this.ErrorOccurred(ex.Message);
- }
- }
-
- ///
- /// Closes down the open media streams and otherwise cleans up the MediaStreamSource. The MediaElement can call this method when going through normal shutdown or as a result of an error.
- ///
- protected override void CloseMedia()
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": CloseMedia()");
- System.Diagnostics.Debug.WriteLine("StackTrace: {0}", new System.Diagnostics.StackTrace());
-
- // Call the dispose, the way System.IO.Stream works.
- this.Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- ///
- /// Gathers the diagnostic information requested.
- ///
- ///
- /// A member of the MediaStreamSourceDiagnosticKind enumeration describing what type of information is desired.
- ///
- protected override void GetDiagnosticAsync(MediaStreamSourceDiagnosticKind diagnosticKind)
- {
- throw new NotImplementedException();
- }
-
- ///
- ///
- /// Effectively a Null-Op for when a MediaElement requests a seek at the beginning
- /// of the stream. This makes the stream semi-unseekable.
- ///
- ///
- /// In a fuller MediaStreamSource, the logic here would be to actually seek to
- /// the correct mpeg frame matching the seekToTime passed in.
- ///
- ///
- ///
- /// The time to seek to in nanosecond ticks.
- ///
- protected override void SeekAsync(long seekToTime)
- {
- this.ReportSeekCompleted(seekToTime);
- }
-
- ///
- /// Called when a stream switch is requested on the MediaElement.
- ///
- ///
- /// The stream switched to.
- ///
- protected override void SwitchMediaStreamAsync(MediaStreamDescription mediaStreamDescription)
- {
- throw new NotImplementedException();
- }
-
- ///
- /// Creates an HttpWebRequest for streaming Shoutcast MP3 streams.
- ///
- /// The Uri of the Shoutcast MP3 stream.
- /// Indicates whether or not to include metadata with the Shoutcast Mp3 stream.
- /// An HttpWebRequest
- private static HttpWebRequest CreateHttpWebRequest(Uri uri, bool includeMetadata)
- {
- if (uri == null)
- {
- throw new ArgumentNullException("uri");
- }
-
- HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
- if (includeMetadata)
- {
- request.Headers["icy-metadata"] = "1";
- }
-
- // We have to turn off ReadStreamBuffering, as it will try to download the whole stream before we can do anything, which is BAD!
- request.AllowReadStreamBuffering = false;
-
- return request;
- }
-
- ///
- /// Cleans up all associated streaming resources.
- ///
- private void CleanupAudioStream()
- {
- var tempStream = this.audioStream;
- this.audioStream = null;
- if (tempStream != null)
- {
- tempStream.Closed += (s, e) =>
- {
- this.OnClosed();
- };
-
- tempStream.Dispose();
- }
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/ShoutcastStream.cs b/Src/Backup/Silverlight.Media.Shoutcast/ShoutcastStream.cs
deleted file mode 100644
index d7ba220..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/ShoutcastStream.cs
+++ /dev/null
@@ -1,1167 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media
-{
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Globalization;
- using System.IO;
- using System.Net;
- using System.Text;
- using System.Threading;
- using System.Windows;
- using System.Windows.Media;
- using Silverlight.Media.Extensions;
- using Silverlight.Media.Metadata;
- using Silverlight.Media.Parsers;
-
- ///
- /// Implements the Shoutcast streaming protocol.
- ///
- public class ShoutcastStream : Stream
- {
- ///
- /// The default initial buffer size.
- ///
- private const int DefaultInitialBufferSize = 8192;
-
- ///
- /// Number of milliseconds to sleep if a buffer read will overwrite our read buffer's pointer.
- ///
- private const int BufferOverwriteSleepTime = 10;
-
- ///
- /// Number of seconds per frame, per MP3 specification.
- ///
- private const double NumberOfSecondsPerMp3Frame = 0.026d;
-
- ///
- /// Default number of seconds to buffer.
- ///
- private const int DefaultSecondsToBuffer = 10;
-
- ///
- /// Number of times to retry reading from the initial buffer read.
- ///
- private const int NumberOfReadRetries = 10;
-
- ///
- /// Minimum number of bytes required to keep in the buffer.
- ///
- private int minimumBufferedBytes;
-
- ///
- /// Number of seconds to buffer.
- ///
- private int numberOfSecondsToBuffer;
-
- ///
- /// Background worker to fill circular buffer from network stream.
- ///
- private BackgroundWorker backgroundWorker;
-
- ///
- /// Shoutcast metadata interval byte count.
- ///
- private int icyMetadata;
-
- ///
- /// Inner stream providing MP3 bytes.
- ///
- private Stream innerStream;
-
- ///
- /// Current stream metadata.
- ///
- private string currentMetadata;
-
- ///
- /// Current parsed stream metadata.
- ///
- private ShoutcastMetadata currentMpegMetadata = new ShoutcastMetadata();
-
- ///
- /// Circular buffer synchronization object.
- ///
- private object syncRoot = new object();
-
- ///
- /// Number of bytes left in stream until metadata.
- ///
- private int metadataCount;
-
- ///
- /// Audio stream description.
- ///
- private MediaStreamDescription audioStreamDescription;
-
- ///
- /// Audio source attributes.
- ///
- private Dictionary audioSourceAttributes;
-
- ///
- /// Current frame size.
- ///
- private int currentFrameSize;
-
- ///
- /// Circular buffer for audio stream data.
- ///
- private CircularBuffer circularBuffer;
-
- ///
- /// Number of bytes left in current frame.
- ///
- private int bytesLeftInFrame;
-
- ///
- /// MpegFrame representing the next MP3 frame.
- ///
- private AudioFrame nextFrame;
-
- ///
- /// MpegLayer3WaveFormat representing MP3 format.
- ///
- private WaveFormat mpegLayer3WaveFormat;
-
- ///
- /// Current percentage of the minimum required bytes in the circular buffer.
- ///
- private int bufferingPercentage;
-
- ///
- /// MediaStreamSource associated with this stream.
- ///
- private ShoutcastMediaStreamSource mediaStreamSource;
-
- ///
- /// Represents whether or not this stream should request to receive metadata.
- ///
- private bool includeMetadata;
-
- ///
- /// Text encoding used to decode metadata bytes.
- ///
- private Encoding metadataEncoding;
-
- ///
- /// Initializes a new instance of the ShoutcastStream class.
- ///
- /// ShoutcastMediaStreamSource containing this ShoutcastStream.
- /// HttpWebResponse for MP3 stream request.
- public ShoutcastStream(ShoutcastMediaStreamSource mediaStreamSource, HttpWebResponse httpWebResponse)
- : this(mediaStreamSource, httpWebResponse, ShoutcastStream.DefaultSecondsToBuffer)
- {
- }
-
- ///
- /// Initializes a new instance of the ShoutcastStream class.
- ///
- /// ShoutcastMediaStreamSource containing this ShoutcastStream.
- /// HttpWebResponse for MP3 stream request.
- /// Number of seconds of audio data to buffer.
- public ShoutcastStream(ShoutcastMediaStreamSource mediaStreamSource, HttpWebResponse httpWebResponse, int numberOfSecondsToBuffer)
- : this(mediaStreamSource, httpWebResponse, numberOfSecondsToBuffer, Encoding.UTF8)
- {
- }
-
- ///
- /// Initializes a new instance of the ShoutcastStream class.
- ///
- /// ShoutcastMediaStreamSource containing this ShoutcastStream.
- /// HttpWebResponse for MP3 stream request.
- /// Number of seconds of audio data to buffer.
- /// Text encoding used to decode the Shoutcast metadata.
- public ShoutcastStream(ShoutcastMediaStreamSource mediaStreamSource, HttpWebResponse httpWebResponse, int numberOfSecondsToBuffer, Encoding metadataEncoding)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": ShoutcastStream() ctor");
- if (mediaStreamSource == null)
- {
- throw new ArgumentNullException("mediaStreamSource");
- }
-
- if (httpWebResponse == null)
- {
- throw new ArgumentNullException("httpWebResponse");
- }
-
- if (metadataEncoding == null)
- {
- throw new ArgumentNullException("encoding");
- }
-
- this.mediaStreamSource = mediaStreamSource;
- this.includeMetadata = this.mediaStreamSource.IncludeMetadata;
- this.numberOfSecondsToBuffer = numberOfSecondsToBuffer;
- this.metadataEncoding = metadataEncoding;
-
- // If the request is bad, this will die first, so we can just not worry about it.
- this.innerStream = httpWebResponse.GetResponseStream();
- try
- {
- // Read a chunk of data, but likely one smaller than the circular buffer size.
- byte[] initialBuffer = new byte[ShoutcastStream.DefaultInitialBufferSize];
-
- // Make sure we have enough data to work with initially
- int bytesRead = this.ForceReadFromStream(initialBuffer, 0, initialBuffer.Length);
-
- if (bytesRead == 0)
- {
- // Should this be -1?
- // This means there was something wrong with the stream.
- throw new InvalidOperationException("Zero initial bytes read from stream.");
- }
-
- this.MediaInformation = this.FindStreamInformation(httpWebResponse, ref initialBuffer);
-
- if (this.MediaInformation == null)
- {
- throw new ArgumentException("Invalid MediaInformation");
- }
-
- this.icyMetadata = this.MediaInformation.MetadataInterval;
- this.ParseInitialBuffer(initialBuffer);
- }
- catch (Exception)
- {
- // No matter what, we need to shut down!
- if (this.innerStream != null)
- {
- this.innerStream.Dispose();
- this.innerStream = null;
- }
-
- // Rethrow
- throw;
- }
-
- this.backgroundWorker = new BackgroundWorker()
- {
- WorkerReportsProgress = false,
- WorkerSupportsCancellation = true
- };
-
- this.backgroundWorker.DoWork += new DoWorkEventHandler(this.DoWork);
- this.backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.RunWorkerCompleted);
- this.backgroundWorker.RunWorkerAsync(this.innerStream);
- }
-
- ///
- /// Called after the ShoutcastStream has been completely shut down.
- ///
- public event EventHandler Closed;
-
- ///
- /// Gets a value indicating whether the current stream supports reading.
- ///
- public override bool CanRead
- {
- get { return true; }
- }
-
- ///
- /// Gets a value indicating whether the current stream supports seeking.
- ///
- public override bool CanSeek
- {
- get { return false; }
- }
-
- ///
- /// Gets a value indicating whether the current stream supports writing.
- ///
- public override bool CanWrite
- {
- get { return false; }
- }
-
- ///
- /// Gets the value containing the current stream information.
- ///
- public ShoutcastStreamInformation MediaInformation { get; private set; }
-
- ///
- /// Gets the length in bytes of the stream.
- ///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Justification = "This property is overridden from the base class, so we have to throw this exception.")]
- public override long Length
- {
- get { throw new NotImplementedException(); }
- }
-
- ///
- /// Gets or sets the position within the current stream.
- ///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Justification = "This property is overridden from the base class, so we have to throw this exception.")]
- public override long Position
- {
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
- }
-
- ///
- /// Gets a value containing the audio stream description.
- ///
- public MediaStreamDescription AudioStreamDescription
- {
- get { return this.audioStreamDescription; }
- }
-
- ///
- /// Gets a value containing the audio source attributes.
- ///
- public Dictionary AudioSourceAttributes
- {
- get { return this.audioSourceAttributes; }
- }
-
- ///
- /// Gets a value representing the current MP3 frame size.
- ///
- public int CurrentFrameSize
- {
- get { return this.currentFrameSize; }
- }
-
- ///
- /// Gets a value representing the current MP3 wave format.
- ///
- public WaveFormat WaveFormat
- {
- get { return this.mpegLayer3WaveFormat; }
- }
-
- ///
- /// Gets a value representing the current percentage of the minimum required bytes in the circular buffer.
- ///
- public int BufferingPercentage
- {
- get { return this.bufferingPercentage; }
- }
-
- ///
- /// Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
- ///
- /// An array of bytes. This method copies count bytes from buffer to the current stream.
- /// The zero-based byte offset in buffer at which to begin copying bytes to the current stream.
- /// The number of bytes to be written to the current stream.
- public override void Write(byte[] buffer, int offset, int count)
- {
- throw new NotImplementedException();
- }
-
- ///
- /// Writes a byte to the current position in the stream and advances the position within the stream by one byte.
- ///
- /// The byte to write to the stream.
- public override void WriteByte(byte value)
- {
- throw new NotImplementedException();
- }
-
- ///
- /// Sets the position within the current stream.
- ///
- /// A byte offset relative to the origin parameter.
- /// A value of type SeekOrigin indicating the reference point used to obtain the new position.
- /// The new position within the current stream.
- public override long Seek(long offset, SeekOrigin origin)
- {
- throw new NotImplementedException();
- }
-
- ///
- /// Sets the length of the current stream.
- ///
- /// The desired length of the current stream in bytes.
- public override void SetLength(long value)
- {
- throw new NotImplementedException();
- }
-
- ///
- /// Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
- ///
- /// The unsigned byte cast to an Int32, or -1 if at the end of the stream.
- public override int ReadByte()
- {
- // Nobody should use this, as it complicates the metadata stuff, so let's just throw for now.
- throw new NotImplementedException();
- }
-
- ///
- /// Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
- ///
- /// An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.
- /// The zero-based byte offset in buffer at which to begin storing the data read from the current stream.
- /// The maximum number of bytes to be read from the current stream.
- /// The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.
- public override int Read(byte[] buffer, int offset, int count)
- {
- this.bytesLeftInFrame -= count;
-
- this.ReadOrPeekBuffer(buffer, count, false);
- if (this.bytesLeftInFrame == 0)
- {
- this.SetupNextFrame();
- }
-
- return count;
- }
-
- ///
- /// Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
- ///
- public override void Flush()
- {
- throw new NotImplementedException();
- }
-
- ///
- /// Releases the unmanaged resources used by the Stream and optionally releases the managed resources.
- ///
- /// true to release both managed and unmanaged resources; false to release only unmanaged resources.
- protected override void Dispose(bool disposing)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Dispose(bool)");
- if (disposing)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Dispose(true)");
- this.backgroundWorker.CancelAsync();
- }
-
- base.Dispose(disposing);
- }
-
- ///
- /// Initializes a WaveFormatExtensible instance representing an AAC+ frame.
- ///
- /// Audio frame representing an AAC+ frame.
- /// A WaveFormatExtensible for the supplied audio frame.
- private static HeAacWaveFormat CreateAacPlusFormat(AudioFrame audioFrame)
- {
- if (audioFrame == null)
- {
- throw new ArgumentNullException("audioFrame");
- }
-
- WaveFormatExtensible wfx = new WaveFormatExtensible();
-
- wfx.FormatTag = 0x1610;
- wfx.Channels = (short)audioFrame.NumberOfChannels;
- wfx.SamplesPerSec = audioFrame.SamplingRate;
- wfx.AverageBytesPerSecond = audioFrame.BitRate / 8;
- wfx.BlockAlign = 1;
- wfx.BitsPerSample = 0;
- wfx.Size = 12;
-
- HeAacWaveFormat aacf = new HeAacWaveFormat(wfx);
-
- // Extra 3 words in WAVEFORMATEX
- aacf.PayloadType = 0x1; // Audio Data Transport Stream (ADTS). The stream contains an adts_sequence, as defined by MPEG-2.
- aacf.AudioProfileLevelIndication = 0xFE;
- aacf.StructType = 0;
-
- return aacf;
- }
-
- ///
- /// Initializes a WaveFormatExtensible instance representing an MP3 frame.
- ///
- /// Audio frame representing an MP3 frame.
- /// A WaveFormatExtensible for the supplied audio frame.
- private static MpegLayer3WaveFormat CreateMp3WaveFormat(AudioFrame audioFrame)
- {
- if (audioFrame == null)
- {
- throw new ArgumentNullException("audioFrame");
- }
-
- WaveFormatExtensible waveFormatExtensible = new WaveFormatExtensible()
- {
- AverageBytesPerSecond = audioFrame.BitRate / 8,
- BitsPerSample = 0,
- BlockAlign = 1,
- Channels = (short)audioFrame.NumberOfChannels,
- FormatTag = 85,
- SamplesPerSec = audioFrame.SamplingRate,
- Size = 12
- };
-
- MpegLayer3WaveFormat waveFormat = new MpegLayer3WaveFormat(waveFormatExtensible);
- waveFormat.Id = 1;
- waveFormat.BitratePaddingMode = 0;
- waveFormat.FramesPerBlock = 1;
- waveFormat.BlockSize = (short)audioFrame.FrameSize;
- waveFormat.CodecDelay = 0;
-
- return waveFormat;
- }
-
- ///
- /// Reads or Peeks data from the circular buffer.
- ///
- /// Buffer in which to put the read or peeked data.
- /// Number of bytes to read or peek.
- /// true if the data should be peeked from the circular buffer, otherwise the data is read from the circular buffer.
- private void ReadOrPeekBuffer(byte[] buffer, int count, bool shouldPeek)
- {
- if (buffer == null)
- {
- throw new ArgumentNullException("buffer");
- }
-
- if (this.ReadIncludesMetadata(count))
- {
- // Read to metadata chunk
- int metadataOffset = this.icyMetadata - this.metadataCount;
- byte[] metadataSizeBuffer = new byte[metadataOffset + 1];
- int bytesRead = 0;
- int metadataSize = 0;
- lock (this.syncRoot)
- {
- bytesRead = this.circularBuffer.Peek(metadataSizeBuffer, 0, metadataOffset + 1);
- }
-
- if (bytesRead != (metadataOffset + 1))
- {
- // We didn't read enough.
- throw new IndexOutOfRangeException("metadataSize buffer not filled.");
- }
-
- metadataSize = metadataSizeBuffer[metadataOffset];
- int metadataByteCount = metadataSize * 16;
- int numberOfBytesAfterMetadata = count - metadataOffset;
-
- // We need the size of the pre-metadata bytes + metadata size byte + metadata byte count + remaining data bytes.
- byte[] metadataBuffer = new byte[metadataOffset + 1 + metadataByteCount + numberOfBytesAfterMetadata];
-
- lock (this.syncRoot)
- {
- // Here is where we either Get() or Peek(). The work before is just to get the right size.
- if (shouldPeek)
- {
- bytesRead = this.circularBuffer.Peek(metadataBuffer, 0, metadataBuffer.Length);
- }
- else
- {
- bytesRead = this.circularBuffer.Get(metadataBuffer, 0, metadataBuffer.Length);
- this.metadataCount = numberOfBytesAfterMetadata;
- }
- }
-
- // We are going to throw the metadata away here, as it will be read again.
- // Copy from beginning to metadata offset
- Array.Copy(metadataBuffer, 0, buffer, 0, metadataOffset);
-
- // Copy after metadata
- Array.Copy(metadataBuffer, metadataOffset + 1 + metadataByteCount, buffer, metadataOffset, numberOfBytesAfterMetadata);
-
- // Only change the metadata when we ACTUALLY read.
- if ((!shouldPeek) && (metadataSize != 0))
- {
- string newMetadata = this.metadataEncoding.GetString(metadataBuffer, metadataOffset + 1, metadataByteCount) ?? string.Empty;
-
- // TODO - Should we fire this every time the metadata changes, or whenever it is parsed.
- // See if we need to fire the metadata changed event
- if (string.Compare(this.currentMetadata, newMetadata) != 0)
- {
- this.currentMetadata = newMetadata;
-
- // We need to set the current metadata on the MSS so it is always available.
- ShoutcastMetadata metadata = new ShoutcastMetadata(this.currentMetadata);
- Interlocked.Exchange(ref this.mediaStreamSource.currentMetadata, metadata);
-
- // Since MediaElement can only be created on the UI thread, we will marshal this event over to the UI thread, plus this keeps us from blocking.
- Deployment.Current.Dispatcher.BeginInvoke(() => this.mediaStreamSource.OnMetadataChanged());
- }
- }
- }
- else
- {
- int bytesRead;
- lock (this.syncRoot)
- {
- // Here is where we either Get() or Peek(). The work before is just to get the right size.
- if (shouldPeek)
- {
- bytesRead = this.circularBuffer.Peek(buffer, 0, count);
- }
- else
- {
- bytesRead = this.circularBuffer.Get(buffer, 0, count);
- this.metadataCount += bytesRead;
- }
- }
- }
- }
-
- ///
- /// Parses initial audio stream byte buffer.
- ///
- /// Initial bytes from the audio stream.
- private void ParseInitialBuffer(byte[] initialBuffer)
- {
- // Initialize data structures to pass to the Media pipeline via the MediaStreamSource
- Dictionary mediaSourceAttributes = new Dictionary();
- Dictionary mediaStreamAttributes = new Dictionary();
-
- byte[] audioData = initialBuffer;
- int bytesRead = initialBuffer.Length;
-
- AudioFrame mpegLayer3Frame;
- int result = this.SyncStream(audioData, out mpegLayer3Frame);
- this.metadataCount = result;
-
- if (this.MediaInformation.ContentType == "audio/mpeg")
- {
- this.mpegLayer3WaveFormat = ShoutcastStream.CreateMp3WaveFormat(mpegLayer3Frame);
- }
- else if (this.MediaInformation.ContentType == "audio/aacp")
- {
- this.mpegLayer3WaveFormat = ShoutcastStream.CreateAacPlusFormat(mpegLayer3Frame);
- }
- else
- {
- throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Invalid content type: {0}", this.MediaInformation.ContentType));
- }
-
- mediaStreamAttributes[MediaStreamAttributeKeys.CodecPrivateData] = this.mpegLayer3WaveFormat.ToHexString();
-
- this.audioStreamDescription = new MediaStreamDescription(MediaStreamType.Audio, mediaStreamAttributes);
-
- // Setting a 0 duration, since we are a potentially infinite Mp3 stream.
- mediaSourceAttributes[MediaSourceAttributesKeys.Duration] = TimeSpan.FromMinutes(0).Ticks.ToString(CultureInfo.InvariantCulture);
-
- // No seeking within the stream!
- mediaSourceAttributes[MediaSourceAttributesKeys.CanSeek] = "0";
-
- this.audioSourceAttributes = mediaSourceAttributes;
-
- this.currentFrameSize = mpegLayer3Frame.FrameSize;
-
- // Set up bytes left in frame so we can support non-frame size counts
- this.bytesLeftInFrame = this.currentFrameSize;
- this.nextFrame = mpegLayer3Frame;
-
- int bufferByteSize = this.CalculateCircularBufferSize(mpegLayer3Frame.FrameSize);
- this.circularBuffer = new CircularBuffer(bufferByteSize, true);
- this.circularBuffer.Put(audioData, result, bytesRead - result);
-
- // Read some more to fill out the buffer
- // audioData = new byte[this.minimumBufferedBytes - this.circularBuffer.Size];
-
- // We have to force reading from the stream at first. This is because when we read from the NetworkStream, it will return all of the available data in its buffer.
- // If there is less data than we ask for, it only returns what it has. It does not block until it has enough. So, we will force a loop until we have read what we need.
- // bytesRead = this.ForceReadFromStream(audioData, 0, audioData.Length);
- // this.circularBuffer.Put(audioData, 0, bytesRead);
- }
-
- ///
- /// Forces the specified number of bytes to be read from the inner stream.
- ///
- /// An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.
- /// The zero-based byte offset in buffer at which to begin storing the data read from the current stream.
- /// The maximum number of bytes to be read from the current stream.
- /// The total number of bytes read into the buffer. This should be the same as the count parameter.
- private int ForceReadFromStream(byte[] buffer, int offset, int count)
- {
- // NOTE - We aren't locking the inner NetworkStream here. This is because we don't need to yet, as the thread loop hasn't started.
- int bytesRead = 0;
- int loopCount = 0;
- int zeroReadCount = 0;
- int tempBytesRead = 0;
-
- // We need to be careful here. If for some reason the stream stops, this will be stuck in an infinite loop. So we'll put some insurance in here so we can't get stuck.
- while (bytesRead != count)
- {
- tempBytesRead = this.innerStream.Read(buffer, offset + bytesRead, count - bytesRead);
- if (tempBytesRead == 0)
- {
- // Rest for a tenth of a second and try again. If we do this ten times, bail so we don't get stuck.
- zeroReadCount++;
- if (zeroReadCount == ShoutcastStream.NumberOfReadRetries)
- {
- return 0;
- }
-
- Thread.Sleep(100);
- }
- else
- {
- // Reset zeroReadCount as we have SOME data.
- zeroReadCount = 0;
- bytesRead += tempBytesRead;
- }
-
- loopCount++;
- }
-
- return bytesRead;
- }
-
- ///
- /// Calculates the buffer size required for this audio stream.
- ///
- /// Size, in bytes, of the initial MP3 frame.
- /// The required size of the circular buffer.
- private int CalculateCircularBufferSize(int initialFrameSize)
- {
- // Number of frames per second, rounded up to whole number
- int numberOfFramesPerSecond = (int)Math.Ceiling(1.0 / ShoutcastStream.NumberOfSecondsPerMp3Frame);
-
- // Number of bytes needed to buffer n seconds, rounded up to the nearest power of 2. This defaults to 10 seconds.
- this.minimumBufferedBytes = (int)Math.Pow(2, Math.Ceiling(Math.Log(this.numberOfSecondsToBuffer * numberOfFramesPerSecond * initialFrameSize) / Math.Log(2)));
-
- // Return the circular buffer size, which is our minimum buffered bytes * 2, so we have the capacity of n * 2 number of seconds in our buffer
- return this.minimumBufferedBytes * 2;
- }
-
- ///
- /// Method used by the BackgroundWorker to read audio data from the inner stream.
- ///
- /// The source of the event.
- /// A DoWorkEventArgs that contains the event data.
- private void DoWork(object sender, DoWorkEventArgs e)
- {
- try
- {
- BackgroundWorker worker = sender as BackgroundWorker;
- Stream stream = (Stream)e.Argument;
- int bufferLength = this.icyMetadata > 0 ? this.icyMetadata : ShoutcastStream.DefaultInitialBufferSize;
- byte[] buffer = new byte[bufferLength];
- int bytesRead = 0;
- int availableBytes;
- int bufferingPercent;
- using (ManualResetEvent shutdownEvent = new ManualResetEvent(false))
- {
- while (true)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Work loop start");
- if (worker.CancellationPending)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Cancellation");
- e.Cancel = true;
- shutdownEvent.Set();
- break;
- }
-
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": No cancellation pending");
- lock (this.syncRoot)
- {
- availableBytes = this.circularBuffer.Capacity - this.circularBuffer.Size;
-
- // This is for reporting buffer progress, if needed.
- bufferingPercent = Math.Min((int)(((double)this.circularBuffer.Size / (double)this.minimumBufferedBytes) * 100), 100);
- }
-
- // Update the buffering percentage, if needed.
- if (bufferingPercent != this.bufferingPercentage)
- {
- // The current buffering percent has fallen below the previous percentage, so replace.
- // We have to do a little math voodoo since Silverlight doesn't support exchanging doubles.
- Interlocked.Exchange(ref this.bufferingPercentage, bufferingPercent);
- }
-
- if (availableBytes < bufferLength)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Not enough bytes available. Sleeping.");
-
- // We'll overwrite the head pointer, so sleep, and reloop.
- shutdownEvent.WaitOne(ShoutcastStream.BufferOverwriteSleepTime);
- }
- else
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Reading from stream.");
- bytesRead = stream.Read(buffer, 0, bufferLength);
- if (bytesRead > 0)
- {
- lock (this.syncRoot)
- {
- this.circularBuffer.Put(buffer, 0, bytesRead);
- }
- }
-
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Done reading from stream.");
- }
- }
- }
- }
- catch (Exception ex)
- {
- // Normally, this is going to be the ThreadAbortException, which happens if the CLR is shutdown before we are closed.
- // Call the completed method ourselves.
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": DoWork() - Exception: {0}", ex);
- throw;
- }
- }
-
- ///
- /// Parses the Shoutcast specific headers. This method is different because of how Shoutcast responds to an HttpWebRequest. The headers need to be parsed, then removed from the initialBuffer.
- ///
- /// Initial data buffer from the audio stream.
- /// ShoutcastStreamInformation containing information about the audio stream.
- private ShoutcastStreamInformation ParseShoutcastHeaders(ref byte[] initialBuffer)
- {
- ShoutcastStreamInformation result = null;
- int byteCount = 0;
- Dictionary responseHeaders = new Dictionary(StringComparer.OrdinalIgnoreCase);
-
- // We may have a REAL ICY stream
- MemoryStream stream = null;
- try
- {
- stream = new MemoryStream(initialBuffer, false);
- using (StreamReader reader = new StreamReader(stream, this.metadataEncoding, true))
- {
- // This is to resolve CA2202.
- stream = null;
-
- // Read until we get a blank line. This is SUCH a bad and unsafe way to parse "http" headers.
- List headerLines = new List();
- string line;
- string responseHeader;
- HttpStatusCode status = HttpStatusCode.NotFound;
- string statusDescription = string.Empty;
-
- // Get the ICY header
- responseHeader = reader.ReadLine();
- string[] headerParts = responseHeader.Split(' ');
- if (headerParts.Length >= 2)
- {
- string s = headerParts[1];
- status = (HttpStatusCode)int.Parse(s);
- if (headerParts.Length >= 3)
- {
- string str3 = headerParts[2];
- for (int i = 3; i < headerParts.Length; i++)
- {
- str3 = str3 + " " + headerParts[i];
- }
-
- statusDescription = str3;
- }
- }
-
- if (status != HttpStatusCode.OK)
- {
- // Bail!
- return result;
- }
-
- byteCount = responseHeader.Length + 2;
- while (!string.IsNullOrEmpty((line = reader.ReadLine())))
- {
- headerLines.Add(line);
- }
-
- // We should be pointing right at the data now! :)
- // Parse the headers
- foreach (string headerLine in headerLines)
- {
- byteCount += this.metadataEncoding.GetByteCount(headerLine) + 2;
- int colonIndex = headerLine.IndexOf(':');
- string key = headerLine.Substring(0, colonIndex);
- string value = headerLine.Substring(colonIndex + 1).Trim();
-
- // We are going to not duplicate headers for now, as this requires order parsing, comma appending, etc.
- // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
- if (!responseHeaders.ContainsKey(key))
- {
- responseHeaders.Add(key, value);
- }
- }
-
- // Add the last CRLF
- byteCount += 2;
- }
- }
- finally
- {
- if (stream != null)
- {
- stream.Dispose();
- }
- }
-
- // Resize the initialBuffer to reflect the headers we've read.
- int newBufferLength = initialBuffer.Length - byteCount;
- byte[] tempBuffer = initialBuffer;
- initialBuffer = new byte[newBufferLength];
- Array.Copy(tempBuffer, byteCount, initialBuffer, 0, newBufferLength);
-
- result = new ShoutcastStreamInformation(responseHeaders);
-
- if (result.MetadataInterval == -1)
- {
- // TODO - Fix this!!!
- return null;
- }
-
- return result;
- }
-
- ///
- /// Parses the headers from the audio stream.
- ///
- /// HttpWebResponse from the server sending the audio stream.
- /// Initial data buffer from the audio stream.
- /// ShoutcastStreamInformation containing information about the audio stream.
- private ShoutcastStreamInformation FindStreamInformation(HttpWebResponse httpWebResponse, ref byte[] initialBuffer)
- {
- if (httpWebResponse == null)
- {
- throw new ArgumentNullException("httpWebResponse");
- }
-
- if (initialBuffer == null)
- {
- throw new ArgumentNullException("initialBuffer");
- }
-
- ShoutcastStreamInformation result = null;
-
- // See if we are a Shoutcast stream.
- if (string.IsNullOrEmpty(httpWebResponse.Headers[HttpRequestHeader.ContentType]))
- {
- // We may have a REAL ICY stream
- result = this.ParseShoutcastHeaders(ref initialBuffer);
- }
- else
- {
- // We are a non-Shoutcast server stream, so we can assign the information here.
- result = new ShoutcastStreamInformation(httpWebResponse.Headers.ToDictionary());
- }
-
- return result;
- }
-
- ///
- /// Handles the RunWorkerCompleted event of the background worker.
- ///
- /// The source of the event.
- /// A RunWorkerCompletedEventArgs that contains the event data.
- private void RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": RunWorkerCompleted()");
- this.innerStream.Close();
- if (e.Error != null)
- {
- Interlocked.Exchange(ref this.mediaStreamSource.workerException, e.Error);
- }
-
- var handler = this.Closed;
- if (handler != null)
- {
- handler(this, EventArgs.Empty);
- }
- }
-
- ///
- /// Indicates if reading the specified number of bytes from the circular buffer contains MP3 metadata.
- ///
- /// Number of bytes to read from the circular buffer.
- /// true if reading the specified number of bytes from the circular buffer contains MP3 metadata, otherwise, false.
- private bool ReadIncludesMetadata(int count)
- {
- return this.includeMetadata && ((this.metadataCount + count) >= this.icyMetadata);
- }
-
- ///
- /// Synchronizes the MP3 data on a frame header.
- ///
- /// Byte array representing a chunk of MP3 data.
- /// Assigned to the resultant, parsed MpegFrame pointed to by the return value.
- /// Offset into the audioData parameters representing the next, valid MpegFrame
- private int SyncStream(byte[] audioData, out AudioFrame mpegFrame)
- {
- if (audioData == null)
- {
- throw new ArgumentNullException("audioData");
- }
-
- if (audioData.Length == 0)
- {
- throw new ArgumentException("audioData cannot have a Length of 0.");
- }
-
- int frameHeaderSize;
- byte[] syncBytes;
- Func isValidFrame;
- Func createFrame;
-
- if (this.MediaInformation.ContentType == "audio/mpeg")
- {
- frameHeaderSize = MpegFrame.FrameHeaderSize;
- syncBytes = MpegFrame.SyncBytes;
- isValidFrame = MpegFrame.IsValidFrame;
- createFrame = b => new MpegFrame(b);
- }
- else if (this.MediaInformation.ContentType == "audio/aacp")
- {
- frameHeaderSize = AacpFrame.FrameHeaderSize;
- syncBytes = AacpFrame.SyncBytes;
- isValidFrame = AacpFrame.IsValidFrame;
- createFrame = b => new AacpFrame(b);
- }
- else
- {
- throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Invalid content type: {0}", this.MediaInformation.ContentType));
- }
-
- // We need to restructure this whole thing!!!
- // This is PROBABLY due to an intro file, so resync and hope for the best. :D
- int bytesRead = audioData.Length;
-
- // Find the syncpoint
- int result = BitTools.FindBitPattern(audioData, syncBytes, syncBytes);
- AudioFrame mpegLayer3Frame = null;
- byte[] frameHeader = new byte[frameHeaderSize];
-
- // TODO - Make sure we have enough left in the array, otherwise, we'll get an exception!
- while (mpegLayer3Frame == null)
- {
- if (result == -1)
- {
- // Something is wrong. Likely due to the the socket returning no data.
- // We'll throw for now.
- throw new InvalidOperationException("Sync bit pattern not found");
- }
-
- Array.Copy(audioData, result, frameHeader, 0, frameHeaderSize);
-
- if (isValidFrame(frameHeader))
- {
- mpegLayer3Frame = createFrame(frameHeader);
-
- // If this works, we need to take the frame size, index into the buffer, and pull out another frame header. If the sample rate and such match, then we are good.
- // Otherwise, we need to find the next set of sync bytes starting at the first index and do it again. This is to reduce the false positives.
- byte[] nextFrameHeader = new byte[frameHeaderSize];
- Array.Copy(audioData, result + mpegLayer3Frame.FrameSize, nextFrameHeader, 0, frameHeaderSize);
- if (isValidFrame(nextFrameHeader))
- {
- // Both are valid frame, so compare.
- AudioFrame nextMpegLayer3Frame = createFrame(nextFrameHeader);
-
- // Check the version, layer, sampling frequency, and number of channels. If they match, we should be good.
- if (!mpegLayer3Frame.Equals(nextMpegLayer3Frame))
- {
- mpegLayer3Frame = null;
- result = BitTools.FindBitPattern(audioData, syncBytes, syncBytes, result + 1);
- }
- }
- else
- {
- // The second frame header was not valid, so we need to reset.
- mpegLayer3Frame = null;
- result = BitTools.FindBitPattern(audioData, syncBytes, syncBytes, result + 1);
- }
- }
- else
- {
- // The second frame header was not valid, so we need to reset.
- mpegLayer3Frame = null;
- result = BitTools.FindBitPattern(audioData, syncBytes, syncBytes, result + 1);
- }
- }
-
- mpegFrame = mpegLayer3Frame;
- return result;
- }
-
- ///
- /// Resynchronizes the audio stream to the next valid Mp3 frame.
- ///
- private void ResyncStream()
- {
- // We need to restructure this whole thing!!!
- // This is PROBABLY due to an intro file, so resync and hope for the best. :D
- byte[] audioData = new byte[ShoutcastStream.DefaultInitialBufferSize];
- int bytesRead;
- lock (this.syncRoot)
- {
- bytesRead = this.circularBuffer.Peek(audioData, 0, audioData.Length);
- }
-
- AudioFrame mpegLayer3Frame;
- int result = this.SyncStream(audioData, out mpegLayer3Frame);
-
- // Throw away X bytes
- byte[] garbage = new byte[result];
- bytesRead = this.circularBuffer.Get(garbage, 0, result);
-
- // Fix the metadata
- this.metadataCount += bytesRead;
- this.currentFrameSize = mpegLayer3Frame.FrameSize;
- this.bytesLeftInFrame = this.currentFrameSize;
- this.nextFrame = mpegLayer3Frame;
- }
-
- ///
- /// Reads the next MP3 frame header.
- ///
- private void SetupNextFrame()
- {
- int frameHeaderSize;
- byte[] frameHeader;
- Func isValidFrame;
- Func createFrame;
-
- if (this.MediaInformation.ContentType == "audio/mpeg")
- {
- frameHeaderSize = MpegFrame.FrameHeaderSize;
- frameHeader = new byte[frameHeaderSize];
- isValidFrame = MpegFrame.IsValidFrame;
- createFrame = b => new MpegFrame(b);
- }
- else if (this.MediaInformation.ContentType == "audio/aacp")
- {
- frameHeaderSize = AacpFrame.FrameHeaderSize;
- frameHeader = new byte[frameHeaderSize];
- isValidFrame = AacpFrame.IsValidFrame;
- createFrame = b => new AacpFrame(b);
- }
- else
- {
- throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Invalid content type: {0}", this.MediaInformation.ContentType));
- }
-
- // If bytesLeftInFrame == 0, then we need to read the next frame header
- if (this.bytesLeftInFrame == 0)
- {
- this.ReadOrPeekBuffer(frameHeader, frameHeaderSize, true);
-
- if (isValidFrame(frameHeader))
- {
- AudioFrame mpegFrame = createFrame(frameHeader);
- this.currentFrameSize = mpegFrame.FrameSize;
- this.bytesLeftInFrame = this.currentFrameSize;
- this.nextFrame = mpegFrame;
- }
- else
- {
- // We are out of sync, probably due to an intro
- this.ResyncStream();
- }
- }
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/ShoutcastStreamInformation.cs b/Src/Backup/Silverlight.Media.Shoutcast/ShoutcastStreamInformation.cs
deleted file mode 100644
index 53d34ae..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/ShoutcastStreamInformation.cs
+++ /dev/null
@@ -1,198 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media
-{
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Globalization;
-
- ///
- /// Represents the metadata information about an MP3 stream.
- ///
- public class ShoutcastStreamInformation
- {
- ///
- /// Base name of the ICY Notice header tag.
- ///
- private const string IcyNoticeBase = "icy-notice";
-
- ///
- /// ICY Name header tag.
- ///
- private const string IcyName = "icy-name";
-
- ///
- /// ICY Genre header tag.
- ///
- private const string IcyGenre = "icy-genre";
-
- ///
- /// ICY Url header tag.
- ///
- private const string IcyUrl = "icy-url";
-
- ///
- /// ICY Public header tag.
- ///
- private const string IcyPublic = "icy-pub";
-
- ///
- /// ICY Bitrate headter tag.
- ///
- private const string IcyBitrate = "icy-br";
-
- ///
- /// ICY Metadata Interval header tag.
- ///
- private const string IcyMetadataInterval = "icy-metaint";
-
- ///
- /// List of ICY Notice header tags.
- ///
- private List notices = new List();
-
- ///
- /// Initializes a new instance of the ShoutcastStreamInformation class.
- ///
- /// IDictionary<string, string> of HTTP headers.
- public ShoutcastStreamInformation(IDictionary headers)
- {
- if (headers == null)
- {
- throw new ArgumentNullException("headers");
- }
-
- this.ParseHeaders(headers);
- }
-
- ///
- /// Gets the name of the MP3 stream.
- ///
- public string Name { get; private set; }
-
- ///
- /// Gets the genre of the MP3 stream.
- ///
- public string Genre { get; private set; }
-
- ///
- /// Gets the url of the MP3 stream.
- ///
- public Uri Url { get; private set; }
-
- ///
- /// Gets a value indicating whether or not this MP3 stream is public.
- ///
- public bool IsPublic { get; private set; }
-
- ///
- /// Gets the bitrate of the MP3 stream.
- ///
- public int BitRate { get; private set; }
-
- ///
- /// Gets the metadata interval of the MP3 stream.
- ///
- public int MetadataInterval { get; private set; }
-
- ///
- /// Gets the notices of the MP3 stream..
- ///
- public ReadOnlyCollection Notices
- {
- get { return new ReadOnlyCollection(this.notices); }
- }
-
- ///
- /// Gets the HTTP content type.
- ///
- public string ContentType { get; private set; }
-
- ///
- /// Parses the supplied HTTP headers.
- ///
- /// IDictionary<string, string> of HTTP headers.
- private void ParseHeaders(IDictionary headers)
- {
- if (headers == null)
- {
- throw new ArgumentNullException("headers");
- }
-
- // Get the notice headers. While the normal number is 2, we'll support more, just in case.
- int i = 1;
- string value = null;
- while (headers.TryGetValue(string.Format(CultureInfo.InvariantCulture, "{0}{1}", ShoutcastStreamInformation.IcyNoticeBase, i), out value))
- {
- this.notices.Add(value);
- i++;
- }
-
- if (headers.TryGetValue(ShoutcastStreamInformation.IcyName, out value))
- {
- this.Name = value;
- }
-
- if (headers.TryGetValue(ShoutcastStreamInformation.IcyGenre, out value))
- {
- this.Genre = value;
- }
-
- if (headers.TryGetValue(ShoutcastStreamInformation.IcyUrl, out value))
- {
- this.Url = new Uri(value);
- }
-
- if (headers.TryGetValue(ShoutcastStreamInformation.IcyPublic, out value))
- {
- this.IsPublic = value == "1";
- }
-
- if (headers.TryGetValue(ShoutcastStreamInformation.IcyBitrate, out value))
- {
- int bitRate = -1;
- if (int.TryParse(value, out bitRate))
- {
- // Per Mp3 specs
- bitRate *= 1000;
- }
-
- this.BitRate = bitRate;
- }
-
- if (headers.TryGetValue(ShoutcastStreamInformation.IcyMetadataInterval, out value))
- {
- int metadataInterval = -1;
- if (!int.TryParse(value, out metadataInterval))
- {
- // TODO - Should this be an error?
- // throw new ArgumentException("icy-metaint must be a valid integer");
- }
-
- this.MetadataInterval = metadataInterval;
- }
-
- if (headers.TryGetValue("Content-Type", out value))
- {
- this.ContentType = value;
- }
- }
- }
-}
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.Phone.csproj b/Src/Backup/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.Phone.csproj
deleted file mode 100644
index bf8a9fc..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.Phone.csproj
+++ /dev/null
@@ -1,108 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 10.0.20506
- 2.0
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}
- {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
- Library
- Properties
- Silverlight.Media.Phone
- Silverlight.Media.Phone
- v4.0
- $(TargetFrameworkVersion)
- WindowsPhone71
- Silverlight
- false
- true
- true
-
-
-
-
-
-
-
-
-
-
- true
- full
- false
- Bin\Debug
- DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
- Bin\Debug\Silverlight.Media.Phone.xml
-
-
- pdbonly
- true
- Bin\Release
- TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
- Bin\Release\Silverlight.Media.Phone.xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Backup/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.Phone.csproj.user b/Src/Backup/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.Phone.csproj.user
deleted file mode 100644
index ac8712b..0000000
--- a/Src/Backup/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.Phone.csproj.user
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
- True
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/GPL.txt b/Src/GPL.txt
deleted file mode 100644
index 94a9ed0..0000000
--- a/Src/GPL.txt
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/Src/LICENSE.txt b/Src/LICENSE.txt
deleted file mode 100644
index 65c5ca8..0000000
--- a/Src/LICENSE.txt
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/AudioPlayer.cs b/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/AudioPlayer.cs
deleted file mode 100644
index c64360b..0000000
--- a/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/AudioPlayer.cs
+++ /dev/null
@@ -1,203 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Shoutcast.Sample.Phone.Background.Playback
-{
- using System;
- using System.Windows;
- using Microsoft.Phone.BackgroundAudio;
-
- ///
- /// Shoutcast audio player for background audio.
- ///
- public class AudioPlayer : AudioPlayerAgent
- {
- ///
- /// Static field that denotes if this class has been initialized.
- ///
- private static volatile bool classInitialized;
-
- ///
- /// Initializes a new instance of the AudioPlayer class.
- ///
- ///
- /// AudioPlayer instances can share the same process.
- /// Static fields can be used to share state between AudioPlayer instances
- /// or to communicate with the Audio Streaming agent.
- ///
- public AudioPlayer()
- {
- if (!AudioPlayer.classInitialized)
- {
- AudioPlayer.classInitialized = true;
-
- // Subscribe to the managed exception handler
- Deployment.Current.Dispatcher.BeginInvoke(delegate
- {
- Application.Current.UnhandledException += this.AudioPlayer_UnhandledException;
- });
- }
- }
-
- ///
- /// Called when the playstate changes, except for the Error state (see OnError)
- ///
- /// The BackgroundAudioPlayer
- /// The track playing at the time the playstate changed
- /// The new playstate of the player
- ///
- ///
- /// Play State changes cannot be cancelled. They are raised even if the application
- /// caused the state change itself, assuming the application has opted-in to the callback.
- ///
- ///
- /// Notable playstate events:
- /// (a) TrackEnded: invoked when the player has no current track. The agent can set the next track.
- /// (b) TrackReady: an audio track has been set and it is now ready for playack.
- ///
- ///
- /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
- ///
- ///
- protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": OnPlayStateChanged() - {0}", playState);
- switch (playState)
- {
- case PlayState.TrackEnded:
- break;
- case PlayState.TrackReady:
- player.Play();
- break;
- case PlayState.Shutdown:
- // TODO: Handle the shutdown state here (e.g. save state)
- break;
- case PlayState.Unknown:
- break;
- case PlayState.Stopped:
- break;
- case PlayState.Paused:
- break;
- case PlayState.Playing:
- break;
- case PlayState.BufferingStarted:
- break;
- case PlayState.BufferingStopped:
- break;
- case PlayState.Rewinding:
- break;
- case PlayState.FastForwarding:
- break;
- }
-
- NotifyComplete();
- }
-
- ///
- /// Called when the user requests an action using application/system provided UI
- ///
- /// The BackgroundAudioPlayer
- /// The track playing at the time of the user action
- /// The action the user has requested
- /// The data associated with the requested action.
- /// In the current version this parameter is only for use with the Seek action,
- /// to indicate the requested position of an audio track
- ///
- /// User actions do not automatically make any changes in system state; the agent is responsible
- /// for carrying out the user actions if they are supported.
- /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
- ///
- protected override void OnUserAction(BackgroundAudioPlayer player, AudioTrack track, UserAction action, object param)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": OnUserAction() - {0}", action);
- switch (action)
- {
- case UserAction.Play:
- // Since we are just restarting the same stream, this should be fine.
- player.Track = track;
- break;
- case UserAction.Stop:
- case UserAction.Pause:
- player.Stop();
-
- // Stop the background streaming agent.
- Shoutcast.Sample.Phone.Background.Playback.AudioTrackStreamer.ShutdownMediaStreamSource();
- break;
- case UserAction.FastForward:
- break;
- case UserAction.Rewind:
- break;
- case UserAction.Seek:
- break;
- case UserAction.SkipNext:
- break;
- case UserAction.SkipPrevious:
- break;
- }
-
- NotifyComplete();
- }
-
- ///
- /// Called whenever there is an error with playback, such as an AudioTrack not downloading correctly
- ///
- /// The BackgroundAudioPlayer
- /// The track that had the error
- /// The error that occured
- /// If true, playback cannot continue and playback of the track will stop
- ///
- /// This method is not guaranteed to be called in all cases. For example, if the background agent
- /// itself has an unhandled exception, it won't get called back to handle its own errors.
- ///
- protected override void OnError(BackgroundAudioPlayer player, AudioTrack track, Exception error, bool isFatal)
- {
- if (isFatal)
- {
- Abort();
- }
- else
- {
- player.Track = null;
- NotifyComplete();
- }
- }
-
- ///
- /// Called by the operating system to alert a background agent that it is going to be put into a dormant state or terminated.
- ///
- protected override void OnCancel()
- {
- base.OnCancel();
- this.NotifyComplete();
- }
-
- ///
- /// Code to execute unhandled exceptions.
- ///
- /// Sender of the event.
- /// ApplicationUnhandledExceptionEventArgs associated with this event.
- private void AudioPlayer_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
- {
- if (System.Diagnostics.Debugger.IsAttached)
- {
- // An unhandled exception has occurred; break into the debugger
- System.Diagnostics.Debugger.Break();
- }
- }
- }
-}
diff --git a/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/AudioTrackStreamer.cs b/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/AudioTrackStreamer.cs
deleted file mode 100644
index 32587eb..0000000
--- a/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/AudioTrackStreamer.cs
+++ /dev/null
@@ -1,130 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Shoutcast.Sample.Phone.Background.Playback
-{
- using System;
- using System.Windows;
- using Microsoft.Phone.BackgroundAudio;
- using Silverlight.Media;
-
- ///
- /// A background agent that performs per-track streaming for playback
- ///
- public class AudioTrackStreamer : AudioStreamingAgent
- {
- ///
- /// Static field that contains the ShoutcastMediaStreamSource associated with this AudioStreamingAgent.
- ///
- private static ShoutcastMediaStreamSource mss;
-
- ///
- /// Static field used to synchronize access to the ShoutcastMediaStreamSource associated with this AudioStreamingAgent.
- ///
- private static object syncRoot = new object();
-
- ///
- /// Initializes a new instance of the AudioTrackStreamer class.
- ///
- public AudioTrackStreamer()
- : base()
- {
- }
-
- ///
- /// Completely shuts down the AudioTrackStreamer.
- ///
- public static void ShutdownMediaStreamSource()
- {
- if (AudioTrackStreamer.mss != null)
- {
- lock (AudioTrackStreamer.syncRoot)
- {
- if (AudioTrackStreamer.mss != null)
- {
- // Because of the NotifyComplete(), we need to set this BEFORE the MSS ends.
- ShoutcastMediaStreamSource temp = AudioTrackStreamer.mss;
- AudioTrackStreamer.mss = null;
- temp.MetadataChanged -= new System.Windows.RoutedEventHandler(AudioTrackStreamer.MetadataChanged);
- temp.Dispose();
- }
- }
- }
- }
-
- ///
- /// Called when a new track requires audio decoding
- /// (typically because it is about to start playing)
- ///
- ///
- /// The track that needs audio streaming
- ///
- ///
- /// The AudioStreamer object to which a MediaStreamSource should be
- /// attached to commence playback
- ///
- ///
- /// To invoke this method for a track set the Source parameter of the AudioTrack to null
- /// before setting into the Track property of the BackgroundAudioPlayer instance
- /// property set to true;
- /// otherwise it is assumed that the system will perform all streaming
- /// and decoding
- ///
- protected override void OnBeginStreaming(AudioTrack track, AudioStreamer streamer)
- {
- lock (AudioTrackStreamer.syncRoot)
- {
- AudioTrackStreamer.mss = new ShoutcastMediaStreamSource(new Uri(track.Tag));
- AudioTrackStreamer.mss.MetadataChanged += new RoutedEventHandler(AudioTrackStreamer.MetadataChanged);
- AudioTrackStreamer.mss.Closed += (s, e) =>
- {
- this.NotifyComplete();
- };
- streamer.SetSource(AudioTrackStreamer.mss);
- }
- }
-
- ///
- /// Called when the agent request is getting cancelled
- /// The call to base.OnCancel() is necessary to release the background streaming resources
- ///
- protected override void OnCancel()
- {
- base.OnCancel();
-
- // The shutdown calls NotifyComplete(), so we don't have to call it here.
- AudioTrackStreamer.ShutdownMediaStreamSource();
- }
-
- ///
- /// Code to execute when the Shoutcast stream metadata changes.
- ///
- /// Send of the event.
- /// RoutedEventArgs associated with this event.
- private static void MetadataChanged(object sender, RoutedEventArgs e)
- {
- var track = BackgroundAudioPlayer.Instance.Track;
- if (track != null)
- {
- track.BeginEdit();
- track.Artist = AudioTrackStreamer.mss.CurrentMetadata.Title;
- track.EndEdit();
- }
- }
- }
-}
diff --git a/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/Properties/AssemblyInfo.cs b/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/Properties/AssemblyInfo.cs
deleted file mode 100644
index 5db5cb1..0000000
--- a/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Shoutcast.Sample.Phone.Background.PlaybackAgent")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Shoutcast.Sample.Phone.Background.PlaybackAgent")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("3903187c-bc99-40ff-a64c-750a0e462243")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
-[assembly: NeutralResourcesLanguageAttribute("en-US")]
diff --git a/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/Shoutcast.Sample.Phone.Background.Playback.csproj.user b/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/Shoutcast.Sample.Phone.Background.Playback.csproj.user
deleted file mode 100644
index 5a95376..0000000
--- a/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/Shoutcast.Sample.Phone.Background.Playback.csproj.user
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- it-IT
- false
-
-
-
-
-
- True
- Managed
- Managed
- False
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
deleted file mode 100644
index f26d877..0000000
Binary files a/Src/Shoutcast.Sample.Phone.Background.PlaybackAgent/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and /dev/null differ
diff --git a/Src/Shoutcast.Sample.Phone.Background/App.xaml b/Src/Shoutcast.Sample.Phone.Background/App.xaml
deleted file mode 100644
index 4047f50..0000000
--- a/Src/Shoutcast.Sample.Phone.Background/App.xaml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample.Phone.Background/App.xaml.cs b/Src/Shoutcast.Sample.Phone.Background/App.xaml.cs
deleted file mode 100644
index 12466d7..0000000
--- a/Src/Shoutcast.Sample.Phone.Background/App.xaml.cs
+++ /dev/null
@@ -1,192 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Shoutcast.Sample.Phone.Background
-{
- using System.Windows;
- using System.Windows.Navigation;
- using Microsoft.Phone.BackgroundAudio;
- using Microsoft.Phone.Controls;
- using Microsoft.Phone.Shell;
-
- ///
- /// This class represents our Windows Phone application.
- ///
- public partial class App : Application
- {
- ///
- /// Field used to avoid double-initialization.
- ///
- private bool phoneApplicationInitialized = false;
-
- ///
- /// Initializes a new instance of the App class.
- ///
- public App()
- {
- // Global handler for uncaught exceptions.
- UnhandledException += this.Application_UnhandledException;
-
- // Standard Silverlight initialization
- InitializeComponent();
-
- // Phone-specific initialization
- this.InitializePhoneApplication();
-
- // Show graphics profiling information while debugging.
- if (System.Diagnostics.Debugger.IsAttached)
- {
- // Display the current frame rate counters.
- Application.Current.Host.Settings.EnableFrameRateCounter = true;
-
- // Show the areas of the app that are being redrawn in each frame.
- // Application.Current.Host.Settings.EnableRedrawRegions = true;
-
- // Enable non-production analysis visualization mode,
- // which shows areas of a page that are handed off to GPU with a colored overlay.
- // Application.Current.Host.Settings.EnableCacheVisualization = true;
-
- // Disable the application idle detection by setting the UserIdleDetectionMode property of the
- // application's PhoneApplicationService object to Disabled.
- // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
- // and consume battery power when the user is not using the phone.
- PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
-
- // Make sure we aren't attached to the background agent
- BackgroundAudioPlayer.Instance.Close();
- }
- }
-
- ///
- /// Gets the root frame of the Phone Application.
- ///
- /// The root frame of the Phone Application.
- public PhoneApplicationFrame RootFrame { get; private set; }
-
- ///
- /// Method that is called when the application is launching (eg, from Start).
- /// This code will not execute when the application is reactivated.
- ///
- /// Sender of the event.
- /// LaunchingEventArgs associated with this event.
- private void Application_Launching(object sender, LaunchingEventArgs e)
- {
- }
-
- ///
- /// Method that is called when the application is activated (brought to foreground).
- /// This code will not execute when the application is first launched.
- ///
- /// Sender of the event.
- /// ActivatedEventArgs associated with this event.
- private void Application_Activated(object sender, ActivatedEventArgs e)
- {
- }
-
- ///
- /// Method that is called when the application is deactivated (sent to background).
- /// This code will not execute when the application is closing.
- ///
- /// Sender of the event.
- /// DeactivatedEventArgs associated with this event.
- private void Application_Deactivated(object sender, DeactivatedEventArgs e)
- {
- }
-
- ///
- /// Method that is called when the application is closing (eg, user hit Back).
- /// This code will not execute when the application is deactivated.
- ///
- /// Sender of the event.
- /// ClosingEventArgs associated with this event.
- private void Application_Closing(object sender, ClosingEventArgs e)
- {
- }
-
- ///
- /// Method that is called if a navigation fails.
- ///
- /// Sender of the event.
- /// NavigationFailedEventArgs associated with this event.
- private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
- {
- if (System.Diagnostics.Debugger.IsAttached)
- {
- // A navigation has failed; break into the debugger
- System.Diagnostics.Debugger.Break();
- }
- }
-
- ///
- /// Method that is called on Unhandled Exceptions.
- ///
- /// Sender of the event.
- /// ApplicationUnhandledExceptionEventArgs associated with this event.
- private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
- {
- if (System.Diagnostics.Debugger.IsAttached)
- {
- // An unhandled exception has occurred; break into the debugger
- System.Diagnostics.Debugger.Break();
- }
- }
-
- #region Phone application initialization
-
- ///
- /// Initializes the Windows Phone application. Do not add any additional code to this method!
- ///
- private void InitializePhoneApplication()
- {
- if (this.phoneApplicationInitialized)
- {
- return;
- }
-
- // Create the frame but don't set it as RootVisual yet; this allows the splash
- // screen to remain active until the application is ready to render.
- this.RootFrame = new PhoneApplicationFrame();
- this.RootFrame.Navigated += this.CompleteInitializePhoneApplication;
-
- // Handle navigation failures
- this.RootFrame.NavigationFailed += this.RootFrame_NavigationFailed;
-
- // Ensure we don't initialize again
- this.phoneApplicationInitialized = true;
- }
-
- ///
- /// Finalizes the initialization of the Windows Phone application. Do not add any additional code to this method!
- ///
- /// Sender of the event.
- /// NavigationEventArgs associated with this event.
- private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
- {
- // Set the root visual to allow the application to render
- if (RootVisual != this.RootFrame)
- {
- RootVisual = this.RootFrame;
- }
-
- // Remove this handler since it is no longer needed
- this.RootFrame.Navigated -= this.CompleteInitializePhoneApplication;
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample.Phone.Background/ApplicationIcon.png b/Src/Shoutcast.Sample.Phone.Background/ApplicationIcon.png
deleted file mode 100644
index 5859393..0000000
Binary files a/Src/Shoutcast.Sample.Phone.Background/ApplicationIcon.png and /dev/null differ
diff --git a/Src/Shoutcast.Sample.Phone.Background/Background.png b/Src/Shoutcast.Sample.Phone.Background/Background.png
deleted file mode 100644
index e46f21d..0000000
Binary files a/Src/Shoutcast.Sample.Phone.Background/Background.png and /dev/null differ
diff --git a/Src/Shoutcast.Sample.Phone.Background/Images/appbar.transport.pause.rest.png b/Src/Shoutcast.Sample.Phone.Background/Images/appbar.transport.pause.rest.png
deleted file mode 100644
index 1df8283..0000000
Binary files a/Src/Shoutcast.Sample.Phone.Background/Images/appbar.transport.pause.rest.png and /dev/null differ
diff --git a/Src/Shoutcast.Sample.Phone.Background/Images/appbar.transport.play.rest.png b/Src/Shoutcast.Sample.Phone.Background/Images/appbar.transport.play.rest.png
deleted file mode 100644
index 5cf7d9c..0000000
Binary files a/Src/Shoutcast.Sample.Phone.Background/Images/appbar.transport.play.rest.png and /dev/null differ
diff --git a/Src/Shoutcast.Sample.Phone.Background/MainPage.xaml b/Src/Shoutcast.Sample.Phone.Background/MainPage.xaml
deleted file mode 100644
index de4be19..0000000
--- a/Src/Shoutcast.Sample.Phone.Background/MainPage.xaml
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample.Phone.Background/MainPage.xaml.cs b/Src/Shoutcast.Sample.Phone.Background/MainPage.xaml.cs
deleted file mode 100644
index 975b8cd..0000000
--- a/Src/Shoutcast.Sample.Phone.Background/MainPage.xaml.cs
+++ /dev/null
@@ -1,203 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Shoutcast.Sample.Phone.Background
-{
- using System;
- using System.Windows;
- using System.Windows.Threading;
- using Microsoft.Phone.BackgroundAudio;
- using Microsoft.Phone.Controls;
- using Microsoft.Phone.Shell;
-
- ///
- /// This class represents the main page of our Windows Phone application.
- ///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "When the page is unloaded, the ShoutcastMediaStreamSource is disposed.")]
- public partial class MainPage : PhoneApplicationPage
- {
- ///
- /// Index for the play button in the ApplicationBar.Buttons.
- ///
- private const int PlayButtonIndex = 0;
-
- ///
- /// Index for the pause button in the ApplicationBar.Buttons.
- ///
- private const int PauseButtonIndex = 1;
-
- ///
- /// Private field that stores the timer for updating the UI
- ///
- private DispatcherTimer timer;
-
- ///
- /// Initializes a new instance of the MainPage class.
- ///
- public MainPage()
- {
- InitializeComponent();
- Loaded += new RoutedEventHandler(this.MainPage_Loaded);
- }
-
- ///
- /// Method called when the main page is loaded.
- ///
- /// Sender of the event.
- /// The RoutedEventArgs instance associated with this event.
- private void MainPage_Loaded(object sender, RoutedEventArgs e)
- {
- // Initialize a timer to update the UI every half-second.
- this.timer = new DispatcherTimer();
- this.timer.Interval = TimeSpan.FromSeconds(0.5);
- this.timer.Tick += new EventHandler(this.UpdateState);
-
- BackgroundAudioPlayer.Instance.PlayStateChanged += new EventHandler(this.Instance_PlayStateChanged);
-
- if (BackgroundAudioPlayer.Instance.PlayerState == PlayState.Playing)
- {
- // If audio was already playing when the app was launched, update the UI.
- // positionIndicator.IsIndeterminate = false;
- // positionIndicator.Maximum = BackgroundAudioPlayer.Instance.Track.Duration.TotalSeconds;
- this.UpdateButtons(false, true);
- this.UpdateState(null, null);
- }
- }
-
- ///
- /// PlayStateChanged event handler.
- ///
- /// Sender of the event.
- /// The EventArgs instance associated with this event.
- private void Instance_PlayStateChanged(object sender, EventArgs e)
- {
- // This is wonky
- PlayState playState = PlayState.Unknown;
- try
- {
- playState = BackgroundAudioPlayer.Instance.PlayerState;
- }
- catch (InvalidOperationException)
- {
- playState = PlayState.Stopped;
- }
-
- switch (playState)
- {
- case PlayState.Playing:
- // Update the UI.
- // positionIndicator.IsIndeterminate = false;
- // positionIndicator.Maximum = BackgroundAudioPlayer.Instance.Track.Duration.TotalSeconds;
- this.UpdateButtons(false, true);
- this.UpdateState(null, null);
-
- // Start the timer for updating the UI.
- this.timer.Start();
- break;
-
- case PlayState.Paused:
- // Stop the timer for updating the UI.
- this.timer.Stop();
-
- // Update the UI.
- this.UpdateButtons(true, false);
- this.UpdateState(null, null);
- break;
- case PlayState.Stopped:
- // Stop the timer for updating the UI.
- this.timer.Stop();
-
- // Update the UI.
- this.UpdateButtons(true, false);
- this.UpdateState(null, null);
- break;
- default:
- break;
- }
- }
-
- ///
- /// Helper method to update the state of the ApplicationBar.Buttons
- ///
- /// true if the Play button should be enabled, otherwise, false.
- /// true if the Pause button should be enabled, otherwise, false.
- private void UpdateButtons(bool playBtnEnabled, bool pauseBtnEnabled)
- {
- // Set the IsEnabled state of the ApplicationBar.Buttons array
- ((ApplicationBarIconButton)ApplicationBar.Buttons[PlayButtonIndex]).IsEnabled = playBtnEnabled;
- ((ApplicationBarIconButton)ApplicationBar.Buttons[PauseButtonIndex]).IsEnabled = pauseBtnEnabled;
- }
-
- ///
- /// Updates the status indicators including the State, Track title,
- ///
- /// Sender of the event.
- /// The EventArgs instance associated with this event.
- private void UpdateState(object sender, EventArgs e)
- {
- txtState.Text = string.Format("State: {0}", BackgroundAudioPlayer.Instance.PlayerState);
-
- AudioTrack audioTrack = BackgroundAudioPlayer.Instance.Track;
-
- if (audioTrack != null)
- {
- txtTitle.Text = string.Format("Title: {0}", audioTrack.Title);
- txtArtist.Text = string.Format("Artist: {0}", audioTrack.Artist);
-
- // Set the current position on the ProgressBar.
- // positionIndicator.Value = BackgroundAudioPlayer.Instance.Position.TotalSeconds;
-
- // Update the current playback position.
- TimeSpan position = new TimeSpan();
- position = BackgroundAudioPlayer.Instance.Position;
- textPosition.Text = String.Format("{0:d2}:{1:d2}:{2:d2}", position.Hours, position.Minutes, position.Seconds);
-
- // Update the time remaining digits.
- // TimeSpan timeRemaining = new TimeSpan();
- // timeRemaining = audioTrack.Duration - position;
- // textRemaining.Text = String.Format("-{0:d2}:{1:d2}:{2:d2}", timeRemaining.Hours, timeRemaining.Minutes, timeRemaining.Seconds);
- }
- }
-
- ///
- /// Click handler for the Play button
- ///
- /// Sender of the event.
- /// The EventArgs instance associated with this event.
- private void PlayButtonClick(object sender, EventArgs e)
- {
- // Tell the backgound audio agent to play the current track.
- BackgroundAudioPlayer.Instance.Track = new AudioTrack(null, "SKY.FM", null, null, null, "http://scfire-ntc-aa05.stream.aol.com:80/stream/1006", EnabledPlayerControls.Pause);
- BackgroundAudioPlayer.Instance.Volume = 1.0d;
- }
-
- ///
- /// Click handler for the Pause button
- ///
- /// Sender of the event.
- /// The EventArgs instance associated with this event.
- private void PauseButtonClick(object sender, EventArgs e)
- {
- // Tell the backgound audio agent to pause the current track.
- // We need to stop the timer before anything
- this.timer.Stop();
- BackgroundAudioPlayer.Instance.Stop();
- this.UpdateState(null, null);
- }
- }
-}
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample.Phone.Background/Properties/AppManifest.xml b/Src/Shoutcast.Sample.Phone.Background/Properties/AppManifest.xml
deleted file mode 100644
index 6712a11..0000000
--- a/Src/Shoutcast.Sample.Phone.Background/Properties/AppManifest.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
diff --git a/Src/Shoutcast.Sample.Phone.Background/Properties/AssemblyInfo.cs b/Src/Shoutcast.Sample.Phone.Background/Properties/AssemblyInfo.cs
deleted file mode 100644
index 72a9fca..0000000
--- a/Src/Shoutcast.Sample.Phone.Background/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Shoutcast.Sample.Phone.Background")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Shoutcast.Sample.Phone.Background")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("cfe4a6f4-f696-41a2-875a-fdca146921dd")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
-[assembly: NeutralResourcesLanguageAttribute("en-US")]
diff --git a/Src/Shoutcast.Sample.Phone.Background/Properties/WMAppManifest.xml b/Src/Shoutcast.Sample.Phone.Background/Properties/WMAppManifest.xml
deleted file mode 100644
index 25dbc6e..0000000
--- a/Src/Shoutcast.Sample.Phone.Background/Properties/WMAppManifest.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
- ApplicationIcon.png
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Background.png
- 0
- Background.png
- Shoutcast.Sample.Phone.Background
-
-
-
-
- false
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample.Phone.Background/Shoutcast.Sample.Phone.Background.csproj b/Src/Shoutcast.Sample.Phone.Background/Shoutcast.Sample.Phone.Background.csproj
deleted file mode 100644
index a81664b..0000000
--- a/Src/Shoutcast.Sample.Phone.Background/Shoutcast.Sample.Phone.Background.csproj
+++ /dev/null
@@ -1,152 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 10.0.20506
- 2.0
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}
- {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
- Library
- Properties
- Shoutcast.Sample.Phone.Background
- Shoutcast.Sample.Phone.Background
- v8.0
-
-
-
-
- WindowsPhone
- true
-
-
- true
- true
- Shoutcast.Sample.Phone.Background_$(Configuration)_$(Platform).xap
- Properties\AppManifest.xml
- Shoutcast.Sample.Phone.Background.App
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
- 4.0
- 11.0
-
-
- true
- full
- false
- Bin\Debug
- DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
-
-
- pdbonly
- true
- Bin\Release
- TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
-
-
-
- Bin\x86\Debug
- true
- full
- false
-
-
-
- Bin\x86\Release
- pdbonly
- true
-
-
-
- Bin\ARM\Debug
- true
- full
- false
-
-
-
- Bin\ARM\Release
- pdbonly
- true
-
-
-
- App.xaml
-
-
- MainPage.xaml
-
-
-
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
-
-
-
- Designer
-
-
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
-
-
-
- {12F8E56D-728C-4073-BDA5-058E6222DE51}
- Shoutcast.Sample.Phone.Background.Playback
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample.Phone.Background/Shoutcast.Sample.Phone.Background.csproj.user b/Src/Shoutcast.Sample.Phone.Background/Shoutcast.Sample.Phone.Background.csproj.user
deleted file mode 100644
index 5a95376..0000000
--- a/Src/Shoutcast.Sample.Phone.Background/Shoutcast.Sample.Phone.Background.csproj.user
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- it-IT
- false
-
-
-
-
-
- True
- Managed
- Managed
- False
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample.Phone.Background/SplashScreenImage.jpg b/Src/Shoutcast.Sample.Phone.Background/SplashScreenImage.jpg
deleted file mode 100644
index 353b192..0000000
Binary files a/Src/Shoutcast.Sample.Phone.Background/SplashScreenImage.jpg and /dev/null differ
diff --git a/Src/Shoutcast.Sample.Phone.Background/obj/Debug/App.g.i.cs b/Src/Shoutcast.Sample.Phone.Background/obj/Debug/App.g.i.cs
deleted file mode 100644
index 3a04338..0000000
--- a/Src/Shoutcast.Sample.Phone.Background/obj/Debug/App.g.i.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-#pragma checksum "C:\Users\Francesco\Desktop\Src\Shoutcast.Sample.Phone.Background\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "52B421917C74A70664EC403C8146F4B6"
-//------------------------------------------------------------------------------
-//
-// Il codice è stato generato da uno strumento.
-// Versione runtime:4.0.30319.34014
-//
-// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
-// il codice viene rigenerato.
-//
-//------------------------------------------------------------------------------
-
-using System;
-using System.Windows;
-using System.Windows.Automation;
-using System.Windows.Automation.Peers;
-using System.Windows.Automation.Provider;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Ink;
-using System.Windows.Input;
-using System.Windows.Interop;
-using System.Windows.Markup;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Media.Imaging;
-using System.Windows.Resources;
-using System.Windows.Shapes;
-using System.Windows.Threading;
-
-
-namespace Shoutcast.Sample.Phone.Background {
-
-
- public partial class App : System.Windows.Application {
-
- private bool _contentLoaded;
-
- ///
- /// InitializeComponent
- ///
- [System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public void InitializeComponent() {
- if (_contentLoaded) {
- return;
- }
- _contentLoaded = true;
- System.Windows.Application.LoadComponent(this, new System.Uri("/Shoutcast.Sample.Phone.Background;component/App.xaml", System.UriKind.Relative));
- }
- }
-}
-
diff --git a/Src/Shoutcast.Sample.Phone.Background/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/Src/Shoutcast.Sample.Phone.Background/obj/Debug/DesignTimeResolveAssemblyReferences.cache
deleted file mode 100644
index f359e02..0000000
Binary files a/Src/Shoutcast.Sample.Phone.Background/obj/Debug/DesignTimeResolveAssemblyReferences.cache and /dev/null differ
diff --git a/Src/Shoutcast.Sample.Phone.Background/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Src/Shoutcast.Sample.Phone.Background/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
deleted file mode 100644
index 2b8ee04..0000000
Binary files a/Src/Shoutcast.Sample.Phone.Background/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and /dev/null differ
diff --git a/Src/Shoutcast.Sample.Phone.Background/obj/Debug/MainPage.g.i.cs b/Src/Shoutcast.Sample.Phone.Background/obj/Debug/MainPage.g.i.cs
deleted file mode 100644
index ace5cc8..0000000
--- a/Src/Shoutcast.Sample.Phone.Background/obj/Debug/MainPage.g.i.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-#pragma checksum "C:\Users\Francesco\Desktop\Src\Shoutcast.Sample.Phone.Background\MainPage.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "88FB5FE8CD8D36AB1CDB55D3C60EE998"
-//------------------------------------------------------------------------------
-//
-// Il codice è stato generato da uno strumento.
-// Versione runtime:4.0.30319.34014
-//
-// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
-// il codice viene rigenerato.
-//
-//------------------------------------------------------------------------------
-
-using Microsoft.Phone.Controls;
-using Microsoft.Phone.Shell;
-using System;
-using System.Windows;
-using System.Windows.Automation;
-using System.Windows.Automation.Peers;
-using System.Windows.Automation.Provider;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Ink;
-using System.Windows.Input;
-using System.Windows.Interop;
-using System.Windows.Markup;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Media.Imaging;
-using System.Windows.Resources;
-using System.Windows.Shapes;
-using System.Windows.Threading;
-
-
-namespace Shoutcast.Sample.Phone.Background {
-
-
- public partial class MainPage : Microsoft.Phone.Controls.PhoneApplicationPage {
-
- internal System.Windows.Controls.Grid LayoutRoot;
-
- internal System.Windows.Controls.StackPanel TitlePanel;
-
- internal System.Windows.Controls.TextBlock ApplicationTitle;
-
- internal System.Windows.Controls.TextBlock PageTitle;
-
- internal System.Windows.Controls.Grid ContentPanel;
-
- internal System.Windows.Controls.TextBlock txtTitle;
-
- internal System.Windows.Controls.TextBlock txtArtist;
-
- internal System.Windows.Controls.TextBlock textPosition;
-
- internal System.Windows.Controls.TextBlock txtState;
-
- internal Microsoft.Phone.Shell.ApplicationBar AppBar;
-
- private bool _contentLoaded;
-
- ///
- /// InitializeComponent
- ///
- [System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public void InitializeComponent() {
- if (_contentLoaded) {
- return;
- }
- _contentLoaded = true;
- System.Windows.Application.LoadComponent(this, new System.Uri("/Shoutcast.Sample.Phone.Background;component/MainPage.xaml", System.UriKind.Relative));
- this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
- this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel")));
- this.ApplicationTitle = ((System.Windows.Controls.TextBlock)(this.FindName("ApplicationTitle")));
- this.PageTitle = ((System.Windows.Controls.TextBlock)(this.FindName("PageTitle")));
- this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
- this.txtTitle = ((System.Windows.Controls.TextBlock)(this.FindName("txtTitle")));
- this.txtArtist = ((System.Windows.Controls.TextBlock)(this.FindName("txtArtist")));
- this.textPosition = ((System.Windows.Controls.TextBlock)(this.FindName("textPosition")));
- this.txtState = ((System.Windows.Controls.TextBlock)(this.FindName("txtState")));
- this.AppBar = ((Microsoft.Phone.Shell.ApplicationBar)(this.FindName("AppBar")));
- }
- }
-}
-
diff --git a/Src/Shoutcast.Sample.Phone.Background/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/Src/Shoutcast.Sample.Phone.Background/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
deleted file mode 100644
index e69de29..0000000
diff --git a/Src/Shoutcast.Sample.Phone.Background/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/Src/Shoutcast.Sample.Phone.Background/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
deleted file mode 100644
index e69de29..0000000
diff --git a/Src/Shoutcast.Sample.Phone.Background/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/Src/Shoutcast.Sample.Phone.Background/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
deleted file mode 100644
index e69de29..0000000
diff --git a/Src/Shoutcast.Sample.Phone/App.xaml b/Src/Shoutcast.Sample.Phone/App.xaml
deleted file mode 100644
index 34e443f..0000000
--- a/Src/Shoutcast.Sample.Phone/App.xaml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample.Phone/App.xaml.cs b/Src/Shoutcast.Sample.Phone/App.xaml.cs
deleted file mode 100644
index 03d603c..0000000
--- a/Src/Shoutcast.Sample.Phone/App.xaml.cs
+++ /dev/null
@@ -1,188 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Shoutcast.Sample.Phone
-{
- using System.Windows;
- using System.Windows.Navigation;
- using Microsoft.Phone.Controls;
- using Microsoft.Phone.Shell;
-
- ///
- /// This class represents our Windows Phone application.
- ///
- public partial class App : Application
- {
- ///
- /// Field used to avoid double-initialization.
- ///
- private bool phoneApplicationInitialized = false;
-
- ///
- /// Initializes a new instance of the App class.
- ///
- public App()
- {
- // Global handler for uncaught exceptions.
- UnhandledException += this.Application_UnhandledException;
-
- // Standard Silverlight initialization
- InitializeComponent();
-
- // Phone-specific initialization
- this.InitializePhoneApplication();
-
- // Show graphics profiling information while debugging.
- if (System.Diagnostics.Debugger.IsAttached)
- {
- // Display the current frame rate counters.
- Application.Current.Host.Settings.EnableFrameRateCounter = true;
-
- // Show the areas of the app that are being redrawn in each frame.
- // Application.Current.Host.Settings.EnableRedrawRegions = true;
-
- // Enable non-production analysis visualization mode,
- // which shows areas of a page that are handed off to GPU with a colored overlay.
- // Application.Current.Host.Settings.EnableCacheVisualization = true;
-
- // Disable the application idle detection by setting the UserIdleDetectionMode property of the
- // application's PhoneApplicationService object to Disabled.
- // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
- // and consume battery power when the user is not using the phone.
- PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
- }
- }
-
- ///
- /// Gets the root frame of the Phone Application.
- ///
- /// The root frame of the Phone Application.
- public PhoneApplicationFrame RootFrame { get; private set; }
-
- ///
- /// Method that is called when the application is launching (eg, from Start).
- /// This code will not execute when the application is reactivated.
- ///
- /// Sender of the event.
- /// LaunchingEventArgs associated with this event.
- private void Application_Launching(object sender, LaunchingEventArgs e)
- {
- }
-
- ///
- /// Method that is called when the application is activated (brought to foreground).
- /// This code will not execute when the application is first launched.
- ///
- /// Sender of the event.
- /// ActivatedEventArgs associated with this event.
- private void Application_Activated(object sender, ActivatedEventArgs e)
- {
- }
-
- ///
- /// Method that is called when the application is deactivated (sent to background).
- /// This code will not execute when the application is closing.
- ///
- /// Sender of the event.
- /// DeactivatedEventArgs associated with this event.
- private void Application_Deactivated(object sender, DeactivatedEventArgs e)
- {
- }
-
- ///
- /// Method that is called when the application is closing (eg, user hit Back).
- /// This code will not execute when the application is deactivated.
- ///
- /// Sender of the event.
- /// ClosingEventArgs associated with this event.
- private void Application_Closing(object sender, ClosingEventArgs e)
- {
- }
-
- ///
- /// Method that is called if a navigation fails.
- ///
- /// Sender of the event.
- /// NavigationFailedEventArgs associated with this event.
- private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
- {
- if (System.Diagnostics.Debugger.IsAttached)
- {
- // A navigation has failed; break into the debugger
- System.Diagnostics.Debugger.Break();
- }
- }
-
- ///
- /// Method that is called on Unhandled Exceptions.
- ///
- /// Sender of the event.
- /// ApplicationUnhandledExceptionEventArgs associated with this event.
- private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
- {
- if (System.Diagnostics.Debugger.IsAttached)
- {
- // An unhandled exception has occurred; break into the debugger
- System.Diagnostics.Debugger.Break();
- }
- }
-
- #region Phone application initialization
-
- ///
- /// Initializes the Windows Phone application. Do not add any additional code to this method!
- ///
- private void InitializePhoneApplication()
- {
- if (this.phoneApplicationInitialized)
- {
- return;
- }
-
- // Create the frame but don't set it as RootVisual yet; this allows the splash
- // screen to remain active until the application is ready to render.
- this.RootFrame = new PhoneApplicationFrame();
- this.RootFrame.Navigated += this.CompleteInitializePhoneApplication;
-
- // Handle navigation failures
- this.RootFrame.NavigationFailed += this.RootFrame_NavigationFailed;
-
- // Ensure we don't initialize again
- this.phoneApplicationInitialized = true;
- }
-
- ///
- /// Finalizes the initialization of the Windows Phone application. Do not add any additional code to this method!
- ///
- /// Sender of the event.
- /// NavigationEventArgs associated with this event.
- private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
- {
- // Set the root visual to allow the application to render
- if (RootVisual != this.RootFrame)
- {
- RootVisual = this.RootFrame;
- }
-
- // Remove this handler since it is no longer needed
- this.RootFrame.Navigated -= this.CompleteInitializePhoneApplication;
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample.Phone/ApplicationIcon.png b/Src/Shoutcast.Sample.Phone/ApplicationIcon.png
deleted file mode 100644
index 5859393..0000000
Binary files a/Src/Shoutcast.Sample.Phone/ApplicationIcon.png and /dev/null differ
diff --git a/Src/Shoutcast.Sample.Phone/Background.png b/Src/Shoutcast.Sample.Phone/Background.png
deleted file mode 100644
index e46f21d..0000000
Binary files a/Src/Shoutcast.Sample.Phone/Background.png and /dev/null differ
diff --git a/Src/Shoutcast.Sample.Phone/MainPage.xaml b/Src/Shoutcast.Sample.Phone/MainPage.xaml
deleted file mode 100644
index e0faa8b..0000000
--- a/Src/Shoutcast.Sample.Phone/MainPage.xaml
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample.Phone/MainPage.xaml.cs b/Src/Shoutcast.Sample.Phone/MainPage.xaml.cs
deleted file mode 100644
index 259a9c4..0000000
--- a/Src/Shoutcast.Sample.Phone/MainPage.xaml.cs
+++ /dev/null
@@ -1,175 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Shoutcast.Sample.Phone
-{
- using System;
- using System.Globalization;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media;
- using Microsoft.Phone.Controls;
- using Silverlight.Media;
-
- ///
- /// This class represents the main page of our Windows Phone application.
- ///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "When the page is unloaded, the ShoutcastMediaStreamSource is disposed.")]
- public partial class MainPage : PhoneApplicationPage
- {
- ///
- /// ShoutcastMediaStreamSource representing a Shoutcast stream.
- ///
- private ShoutcastMediaStreamSource source;
-
- ///
- /// Boolean to stop the status update if an error has occured.
- ///
- private bool errorOccured;
-
- ///
- /// Initializes a new instance of the MainPage class.
- ///
- public MainPage()
- {
- InitializeComponent();
- }
-
- ///
- /// Gets the media element resource of the page.
- ///
- private MediaElement MediaPlayer
- {
- get { return this.Resources["mediaPlayer"] as MediaElement; }
- }
-
- ///
- /// Event handler called when the buffering progress of the media element has changed.
- ///
- /// Sender of the event.
- /// RoutedEventArgs associated with this event.
- private void BufferingProgressChanged(object sender, RoutedEventArgs e)
- {
- this.UpdateStatus();
- }
-
- ///
- /// Event handler called when the an exception is thrown parsing the streaming media.
- ///
- /// Sender of the event.
- /// ExceptionRoutedEventArgs associated with this event.
- private void MediaFailed(object sender, ExceptionRoutedEventArgs e)
- {
- this.errorOccured = true;
- this.statusTextBlock.Text = string.Format(CultureInfo.InvariantCulture, "Error: {0}", e.ErrorException.Message);
- }
-
- ///
- /// Event handler called when the play button is clicked.
- ///
- /// Sender of the event.
- /// RoutedEventArgs associated with this event.
- private void PlayClick(object sender, RoutedEventArgs e)
- {
- this.ResetMediaPlayer();
-
- Uri uri = new Uri(this.mp3StreamRadioButton.IsChecked.Value ?
- "http://scfire-ntc-aa05.stream.aol.com:80/stream/1006" : // MP3
- "http://72.26.204.18:6116"); // AAC+
- this.source = new ShoutcastMediaStreamSource(uri);
- this.source.MetadataChanged += this.MetadataChanged;
- this.MediaPlayer.SetSource(this.source);
- this.MediaPlayer.Play();
- }
-
- ///
- /// Event handler called when the metadata of the Shoutcast stream source changes.
- ///
- /// Sender of the event.
- /// MpegMetadataEventArgs associated with this event.
- private void MetadataChanged(object sender, RoutedEventArgs e)
- {
- this.UpdateStatus();
- }
-
- ///
- /// Updates the text block to show the MediaStreamSource's status in the UI.
- ///
- private void UpdateStatus()
- {
- // If we have an error, we don't want to overwrite the error status.
- if (this.errorOccured)
- {
- return;
- }
-
- MediaElementState state = this.MediaPlayer.CurrentState;
- string status = string.Empty;
- switch (state)
- {
- case MediaElementState.Buffering:
- status = string.Format(CultureInfo.InvariantCulture, "Buffering...{0:0%}", this.MediaPlayer.BufferingProgress);
- break;
- case MediaElementState.Playing:
- status = string.Format(CultureInfo.InvariantCulture, "Title: {0}", this.source.CurrentMetadata.Title);
- break;
- default:
- status = state.ToString();
- break;
- }
-
- this.statusTextBlock.Text = status;
- }
-
- ///
- /// Event handler called when the media element state changes.
- ///
- /// Sender of the event.
- /// RoutedEventArgs associated with this event.
- private void CurrentStateChanged(object sender, RoutedEventArgs e)
- {
- this.UpdateStatus();
- }
-
- ///
- /// Resets the media player.
- ///
- private void ResetMediaPlayer()
- {
- if ((this.MediaPlayer.CurrentState != MediaElementState.Stopped) && (this.MediaPlayer.CurrentState != MediaElementState.Closed))
- {
- this.MediaPlayer.Stop();
- this.MediaPlayer.Source = null;
- this.source.Dispose();
- this.source = null;
- }
-
- this.errorOccured = false;
- }
-
- ///
- /// Event handler called when this page is unloaded.
- ///
- /// Sender of the event.
- /// RoutedEventArgs associated with this event.
- private void PageUnloaded(object sender, RoutedEventArgs e)
- {
- this.ResetMediaPlayer();
- }
- }
-}
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample.Phone/Properties/AppManifest.xml b/Src/Shoutcast.Sample.Phone/Properties/AppManifest.xml
deleted file mode 100644
index 6712a11..0000000
--- a/Src/Shoutcast.Sample.Phone/Properties/AppManifest.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
diff --git a/Src/Shoutcast.Sample.Phone/Properties/AssemblyInfo.cs b/Src/Shoutcast.Sample.Phone/Properties/AssemblyInfo.cs
deleted file mode 100644
index 8a9385a..0000000
--- a/Src/Shoutcast.Sample.Phone/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Shoutcast.Sample.Phone")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Shoutcast.Sample.Phone")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("6d9cc826-af3f-4e3c-9307-3568a0c1055e")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
-[assembly: NeutralResourcesLanguageAttribute("en-US")]
diff --git a/Src/Shoutcast.Sample.Phone/Properties/WMAppManifest.xml b/Src/Shoutcast.Sample.Phone/Properties/WMAppManifest.xml
deleted file mode 100644
index 8a59b03..0000000
--- a/Src/Shoutcast.Sample.Phone/Properties/WMAppManifest.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
- ApplicationIcon.png
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Background.png
- 0
- Background.png
- Shoutcast.Sample.Phone
-
-
-
-
- false
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample.Phone/Shoutcast.Sample.Phone.csproj b/Src/Shoutcast.Sample.Phone/Shoutcast.Sample.Phone.csproj
deleted file mode 100644
index 5eccaec..0000000
--- a/Src/Shoutcast.Sample.Phone/Shoutcast.Sample.Phone.csproj
+++ /dev/null
@@ -1,146 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 10.0.20506
- 2.0
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}
- {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
- Library
- Properties
- Shoutcast.Sample.Phone
- Shoutcast.Sample.Phone
- v8.0
-
-
-
-
- WindowsPhone
- true
-
-
- true
- true
- Shoutcast.Sample.Phone_$(Configuration)_$(Platform).xap
- Properties\AppManifest.xml
- Shoutcast.Sample.Phone.App
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
- 4.0
- 11.0
-
-
- true
- full
- false
- Bin\Debug
- DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
-
-
- pdbonly
- true
- Bin\Release
- TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
-
-
-
- Bin\x86\Debug
- true
- full
- false
-
-
-
- Bin\x86\Release
- pdbonly
- true
-
-
-
- Bin\ARM\Debug
- true
- full
- false
-
-
-
- Bin\ARM\Release
- pdbonly
- true
-
-
-
- App.xaml
-
-
- MainPage.xaml
-
-
-
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
- MSBuild:Compile
- Designer
-
-
-
-
-
- Designer
-
-
-
-
- PreserveNewest
-
-
- PreserveNewest
-
-
-
-
-
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}
- Silverlight.Media.Shoutcast.Phone
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample.Phone/Shoutcast.Sample.Phone.csproj.user b/Src/Shoutcast.Sample.Phone/Shoutcast.Sample.Phone.csproj.user
deleted file mode 100644
index 5a95376..0000000
--- a/Src/Shoutcast.Sample.Phone/Shoutcast.Sample.Phone.csproj.user
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- it-IT
- false
-
-
-
-
-
- True
- Managed
- Managed
- False
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample.Phone/SplashScreenImage.jpg b/Src/Shoutcast.Sample.Phone/SplashScreenImage.jpg
deleted file mode 100644
index 353b192..0000000
Binary files a/Src/Shoutcast.Sample.Phone/SplashScreenImage.jpg and /dev/null differ
diff --git a/Src/Shoutcast.Sample.Phone/obj/Debug/App.g.i.cs b/Src/Shoutcast.Sample.Phone/obj/Debug/App.g.i.cs
deleted file mode 100644
index 827728b..0000000
--- a/Src/Shoutcast.Sample.Phone/obj/Debug/App.g.i.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-#pragma checksum "C:\Users\Francesco\Desktop\Src\Shoutcast.Sample.Phone\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "2760E9BC9460047DE6DF7D69D4281911"
-//------------------------------------------------------------------------------
-//
-// Il codice è stato generato da uno strumento.
-// Versione runtime:4.0.30319.34014
-//
-// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
-// il codice viene rigenerato.
-//
-//------------------------------------------------------------------------------
-
-using System;
-using System.Windows;
-using System.Windows.Automation;
-using System.Windows.Automation.Peers;
-using System.Windows.Automation.Provider;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Ink;
-using System.Windows.Input;
-using System.Windows.Interop;
-using System.Windows.Markup;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Media.Imaging;
-using System.Windows.Resources;
-using System.Windows.Shapes;
-using System.Windows.Threading;
-
-
-namespace Shoutcast.Sample.Phone {
-
-
- public partial class App : System.Windows.Application {
-
- private bool _contentLoaded;
-
- ///
- /// InitializeComponent
- ///
- [System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public void InitializeComponent() {
- if (_contentLoaded) {
- return;
- }
- _contentLoaded = true;
- System.Windows.Application.LoadComponent(this, new System.Uri("/Shoutcast.Sample.Phone;component/App.xaml", System.UriKind.Relative));
- }
- }
-}
-
diff --git a/Src/Shoutcast.Sample.Phone/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Src/Shoutcast.Sample.Phone/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
deleted file mode 100644
index 6ef65e9..0000000
Binary files a/Src/Shoutcast.Sample.Phone/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and /dev/null differ
diff --git a/Src/Shoutcast.Sample.Phone/obj/Debug/MainPage.g.i.cs b/Src/Shoutcast.Sample.Phone/obj/Debug/MainPage.g.i.cs
deleted file mode 100644
index 032f4f1..0000000
--- a/Src/Shoutcast.Sample.Phone/obj/Debug/MainPage.g.i.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-#pragma checksum "C:\Users\Francesco\Desktop\Src\Shoutcast.Sample.Phone\MainPage.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "7FA3C50DCDA8FD9D160FE52F47CCDC3B"
-//------------------------------------------------------------------------------
-//
-// Il codice è stato generato da uno strumento.
-// Versione runtime:4.0.30319.34014
-//
-// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
-// il codice viene rigenerato.
-//
-//------------------------------------------------------------------------------
-
-using Microsoft.Phone.Controls;
-using System;
-using System.Windows;
-using System.Windows.Automation;
-using System.Windows.Automation.Peers;
-using System.Windows.Automation.Provider;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Ink;
-using System.Windows.Input;
-using System.Windows.Interop;
-using System.Windows.Markup;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Media.Imaging;
-using System.Windows.Resources;
-using System.Windows.Shapes;
-using System.Windows.Threading;
-
-
-namespace Shoutcast.Sample.Phone {
-
-
- public partial class MainPage : Microsoft.Phone.Controls.PhoneApplicationPage {
-
- internal System.Windows.Controls.Grid LayoutRoot;
-
- internal System.Windows.Controls.StackPanel TitlePanel;
-
- internal System.Windows.Controls.TextBlock ApplicationTitle;
-
- internal System.Windows.Controls.TextBlock PageTitle;
-
- internal System.Windows.Controls.Grid ContentPanel;
-
- internal System.Windows.Controls.TextBlock statusTextBlock;
-
- internal System.Windows.Controls.RadioButton mp3StreamRadioButton;
-
- internal System.Windows.Controls.RadioButton aacStreamRadioButton;
-
- private bool _contentLoaded;
-
- ///
- /// InitializeComponent
- ///
- [System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public void InitializeComponent() {
- if (_contentLoaded) {
- return;
- }
- _contentLoaded = true;
- System.Windows.Application.LoadComponent(this, new System.Uri("/Shoutcast.Sample.Phone;component/MainPage.xaml", System.UriKind.Relative));
- this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
- this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel")));
- this.ApplicationTitle = ((System.Windows.Controls.TextBlock)(this.FindName("ApplicationTitle")));
- this.PageTitle = ((System.Windows.Controls.TextBlock)(this.FindName("PageTitle")));
- this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
- this.statusTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("statusTextBlock")));
- this.mp3StreamRadioButton = ((System.Windows.Controls.RadioButton)(this.FindName("mp3StreamRadioButton")));
- this.aacStreamRadioButton = ((System.Windows.Controls.RadioButton)(this.FindName("aacStreamRadioButton")));
- }
- }
-}
-
diff --git a/Src/Shoutcast.Sample.Phone/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/Src/Shoutcast.Sample.Phone/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
deleted file mode 100644
index e69de29..0000000
diff --git a/Src/Shoutcast.Sample.Phone/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/Src/Shoutcast.Sample.Phone/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
deleted file mode 100644
index e69de29..0000000
diff --git a/Src/Shoutcast.Sample.Phone/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/Src/Shoutcast.Sample.Phone/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
deleted file mode 100644
index e69de29..0000000
diff --git a/Src/Shoutcast.Sample/App.xaml b/Src/Shoutcast.Sample/App.xaml
deleted file mode 100644
index b93582c..0000000
--- a/Src/Shoutcast.Sample/App.xaml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
diff --git a/Src/Shoutcast.Sample/App.xaml.cs b/Src/Shoutcast.Sample/App.xaml.cs
deleted file mode 100644
index 901d41c..0000000
--- a/Src/Shoutcast.Sample/App.xaml.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Shoutcast.Sample
-{
- using System;
- using System.Net;
- using System.Net.Browser;
- using System.Windows;
-
- ///
- /// This class represents our Silverlight application.
- ///
- public partial class App : Application
- {
- ///
- /// Initializes a new instance of the App class.
- ///
- public App()
- {
- HttpWebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
- HttpWebRequest.RegisterPrefix("https://", WebRequestCreator.ClientHttp);
-
- this.Startup += this.Application_Startup;
- this.Exit += this.Application_Exit;
- this.UnhandledException += this.Application_UnhandledException;
-
- InitializeComponent();
- }
-
- ///
- /// Method called on application startup.
- ///
- /// Sender of the event.
- /// EventArgs associated with this event.
- private void Application_Startup(object sender, StartupEventArgs e)
- {
- this.RootVisual = new MainPage();
- }
-
- ///
- /// Method called on application exit.
- ///
- /// Sender of the event.
- /// EventArgs associated with this event.
- private void Application_Exit(object sender, EventArgs e)
- {
- }
-
- ///
- /// Event handler called when an unhandled exception is thrown by a Silverlight application.
- ///
- /// Sender of the event.
- /// ApplicationUnhandledExceptionEventArgs associated with this event.
- private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
- {
- // If the app is running outside of the debugger then report the exception using
- // the browser's exception mechanism. On IE this will display it a yellow alert
- // icon in the status bar and Firefox will display a script error.
- if (!System.Diagnostics.Debugger.IsAttached)
- {
- // NOTE: This will allow the application to continue running after an exception has been thrown
- // but not handled.
- // For production applications this error handling should be replaced with something that will
- // report the error to the website and stop the application.
- e.Handled = true;
- Deployment.Current.Dispatcher.BeginInvoke(delegate { this.ReportErrorToDOM(e); });
- }
- }
-
- ///
- /// Reports the error to the DOM hosting the Silverlight control.
- ///
- /// ApplicationUnhandledExceptionEventArgs associated with this event.
- private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
- {
- try
- {
- string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
- errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
-
- System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
- }
- catch (Exception)
- {
- }
- }
- }
-}
diff --git a/Src/Shoutcast.Sample/MainPage.xaml b/Src/Shoutcast.Sample/MainPage.xaml
deleted file mode 100644
index ff823bb..0000000
--- a/Src/Shoutcast.Sample/MainPage.xaml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Src/Shoutcast.Sample/MainPage.xaml.cs b/Src/Shoutcast.Sample/MainPage.xaml.cs
deleted file mode 100644
index be52554..0000000
--- a/Src/Shoutcast.Sample/MainPage.xaml.cs
+++ /dev/null
@@ -1,175 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Shoutcast.Sample
-{
- using System;
- using System.Globalization;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media;
- using Silverlight.Media;
-
- ///
- /// This class represents the main page of our Silverlight application.
- ///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "When the page is unloaded, the ShoutcastMediaStreamSource is disposed.")]
- public partial class MainPage : UserControl
- {
- ///
- /// ShoutcastMediaStreamSource representing a Shoutcast stream.
- ///
- private ShoutcastMediaStreamSource source;
-
- ///
- /// Boolean to stop the status update if an error has occured.
- ///
- private bool errorOccured;
-
- ///
- /// Initializes a new instance of the MainPage class.
- ///
- public MainPage()
- {
- InitializeComponent();
- }
-
- ///
- /// Gets the media element resource of the page.
- ///
- private MediaElement MediaPlayer
- {
- get { return this.Resources["mediaPlayer"] as MediaElement; }
- }
-
- ///
- /// Event handler called when the buffering progress of the media element has changed.
- ///
- /// Sender of the event.
- /// RoutedEventArgs associated with this event.
- private void BufferingProgressChanged(object sender, RoutedEventArgs e)
- {
- this.UpdateStatus();
- }
-
- ///
- /// Event handler called when the an exception is thrown parsing the streaming media.
- ///
- /// Sender of the event.
- /// ExceptionRoutedEventArgs associated with this event.
- private void MediaFailed(object sender, ExceptionRoutedEventArgs e)
- {
- this.errorOccured = true;
- this.statusTextBlock.Text = string.Format(CultureInfo.InvariantCulture, "Error: {0}", e.ErrorException.Message);
- }
-
- ///
- /// Event handler called when the play button is clicked.
- ///
- /// Sender of the event.
- /// RoutedEventArgs associated with this event.
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "This would need to be handled in a real application.")]
- private void PlayClick(object sender, RoutedEventArgs e)
- {
- this.ResetMediaPlayer();
-
- Uri uri = new Uri(this.mp3StreamRadioButton.IsChecked.Value ?
- "http://scfire-ntc-aa05.stream.aol.com:80/stream/1006" : // MP3
- "http://72.26.204.18:6116"); // AAC+
- this.source = new ShoutcastMediaStreamSource(uri);
- this.source.MetadataChanged += this.MetadataChanged;
- this.MediaPlayer.SetSource(this.source);
- this.MediaPlayer.Play();
- }
-
- ///
- /// Event handler called when the metadata of the Shoutcast stream source changes.
- ///
- /// Sender of the event.
- /// MpegMetadataEventArgs associated with this event.
- private void MetadataChanged(object sender, RoutedEventArgs e)
- {
- this.UpdateStatus();
- }
-
- ///
- /// Updates the text block to show the MediaStreamSource's status in the UI.
- ///
- private void UpdateStatus()
- {
- // If we have an error, we don't want to overwrite the error status.
- if (this.errorOccured)
- {
- return;
- }
-
- MediaElementState state = this.MediaPlayer.CurrentState;
- string status = string.Empty;
- switch (state)
- {
- case MediaElementState.Buffering:
- status = string.Format(CultureInfo.InvariantCulture, "Buffering...{0:0%}", this.MediaPlayer.BufferingProgress);
- break;
- case MediaElementState.Playing:
- status = string.Format(CultureInfo.InvariantCulture, "Title: {0}", this.source.CurrentMetadata.Title);
- break;
- default:
- status = state.ToString();
- break;
- }
-
- this.statusTextBlock.Text = status;
- }
-
- ///
- /// Event handler called when the media element state changes.
- ///
- /// Sender of the event.
- /// RoutedEventArgs associated with this event.
- private void CurrentStateChanged(object sender, RoutedEventArgs e)
- {
- this.UpdateStatus();
- }
-
- ///
- /// Resets the media player.
- ///
- private void ResetMediaPlayer()
- {
- if ((this.MediaPlayer.CurrentState != MediaElementState.Stopped) && (this.MediaPlayer.CurrentState != MediaElementState.Closed))
- {
- this.MediaPlayer.Stop();
- this.MediaPlayer.Source = null;
- this.source.Dispose();
- this.source = null;
- }
-
- this.errorOccured = false;
- }
-
- ///
- /// Event handler called when this page is unloaded.
- ///
- /// Sender of the event.
- /// RoutedEventArgs associated with this event.
- private void PageUnloaded(object sender, RoutedEventArgs e)
- {
- this.ResetMediaPlayer();
- }
- }
-}
diff --git a/Src/Shoutcast.Sample/Properties/AppManifest.xml b/Src/Shoutcast.Sample/Properties/AppManifest.xml
deleted file mode 100644
index 6712a11..0000000
--- a/Src/Shoutcast.Sample/Properties/AppManifest.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
diff --git a/Src/Shoutcast.Sample/Properties/AssemblyInfo.cs b/Src/Shoutcast.Sample/Properties/AssemblyInfo.cs
deleted file mode 100644
index 36e88e7..0000000
--- a/Src/Shoutcast.Sample/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Shoutcast.Sample")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Shoutcast.Sample")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("152df3ae-efb8-4430-b1c9-98df1cec4f01")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Src/Shoutcast.Sample/Properties/InBrowserSettings.xml b/Src/Shoutcast.Sample/Properties/InBrowserSettings.xml
deleted file mode 100644
index 0c41b07..0000000
--- a/Src/Shoutcast.Sample/Properties/InBrowserSettings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample/Properties/OutOfBrowserSettings.xml b/Src/Shoutcast.Sample/Properties/OutOfBrowserSettings.xml
deleted file mode 100644
index f8f682e..0000000
--- a/Src/Shoutcast.Sample/Properties/OutOfBrowserSettings.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
- Shoutcast.Sample Application on your desktop; at home, at work or on the go.
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample/Shoutcast.Sample.csproj b/Src/Shoutcast.Sample/Shoutcast.Sample.csproj
deleted file mode 100644
index b88d841..0000000
--- a/Src/Shoutcast.Sample/Shoutcast.Sample.csproj
+++ /dev/null
@@ -1,130 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 8.0.50727
- 2.0
- {39F4E0A0-DDF1-4476-9C93-2D8301B955D9}
- {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
- Library
- Properties
- Shoutcast.Sample
- Shoutcast.Sample
- Silverlight
- v5.0
- $(TargetFrameworkVersion)
- true
-
-
- true
- true
- Shoutcast.Sample.xap
- Properties\AppManifest.xml
- Shoutcast.Sample.App
- Shoutcast.SampleTestPage.html
- true
- true
- true
- Properties\OutOfBrowserSettings.xml
- false
- true
-
-
-
-
-
-
-
-
-
-
- Properties\InBrowserSettings.xml
- false
-
-
-
- v3.5
-
-
- true
- full
- false
- Bin\Debug
- DEBUG;TRACE;SILVERLIGHT
- true
- true
- prompt
- 4
-
-
- pdbonly
- true
- Bin\Release
- TRACE;SILVERLIGHT
- true
- true
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
- App.xaml
-
-
- MainPage.xaml
-
-
-
-
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
-
-
-
-
-
-
-
-
-
- {65DD033A-AA4C-414F-8D23-F8642A74CC3F}
- Silverlight.Media.Shoutcast
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample/Shoutcast.Sample.csproj.user b/Src/Shoutcast.Sample/Shoutcast.Sample.csproj.user
deleted file mode 100644
index 8b80b1f..0000000
--- a/Src/Shoutcast.Sample/Shoutcast.Sample.csproj.user
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
- DynamicPage
- True
- False
- False
-
-
-
-
-
-
-
-
- True
-
-
- True
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Shoutcast.Sample/obj/Debug/App.g.i.cs b/Src/Shoutcast.Sample/obj/Debug/App.g.i.cs
deleted file mode 100644
index 6e5b5d3..0000000
--- a/Src/Shoutcast.Sample/obj/Debug/App.g.i.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-#pragma checksum "C:\Users\Francesco\Desktop\Src\Shoutcast.Sample\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "C2B979D73DC309F802F700A42278763C"
-//------------------------------------------------------------------------------
-//
-// Il codice è stato generato da uno strumento.
-// Versione runtime:4.0.30319.34014
-//
-// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
-// il codice viene rigenerato.
-//
-//------------------------------------------------------------------------------
-
-using System;
-using System.Windows;
-using System.Windows.Automation;
-using System.Windows.Automation.Peers;
-using System.Windows.Automation.Provider;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Ink;
-using System.Windows.Input;
-using System.Windows.Interop;
-using System.Windows.Markup;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Media.Imaging;
-using System.Windows.Resources;
-using System.Windows.Shapes;
-using System.Windows.Threading;
-
-
-namespace Shoutcast.Sample {
-
-
- public partial class App : System.Windows.Application {
-
- private bool _contentLoaded;
-
- ///
- /// InitializeComponent
- ///
- [System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public void InitializeComponent() {
- if (_contentLoaded) {
- return;
- }
- _contentLoaded = true;
- System.Windows.Application.LoadComponent(this, new System.Uri("/Shoutcast.Sample;component/App.xaml", System.UriKind.Relative));
- }
- }
-}
-
diff --git a/Src/Shoutcast.Sample/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Src/Shoutcast.Sample/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
deleted file mode 100644
index b87d5e1..0000000
Binary files a/Src/Shoutcast.Sample/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and /dev/null differ
diff --git a/Src/Shoutcast.Sample/obj/Debug/MainPage.g.i.cs b/Src/Shoutcast.Sample/obj/Debug/MainPage.g.i.cs
deleted file mode 100644
index dea43c5..0000000
--- a/Src/Shoutcast.Sample/obj/Debug/MainPage.g.i.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-#pragma checksum "C:\Users\Francesco\Desktop\Src\Shoutcast.Sample\MainPage.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "28A921BFF6814523B99E9B7A2E1F570A"
-//------------------------------------------------------------------------------
-//
-// Il codice è stato generato da uno strumento.
-// Versione runtime:4.0.30319.34014
-//
-// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
-// il codice viene rigenerato.
-//
-//------------------------------------------------------------------------------
-
-using System;
-using System.Windows;
-using System.Windows.Automation;
-using System.Windows.Automation.Peers;
-using System.Windows.Automation.Provider;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Ink;
-using System.Windows.Input;
-using System.Windows.Interop;
-using System.Windows.Markup;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Media.Imaging;
-using System.Windows.Resources;
-using System.Windows.Shapes;
-using System.Windows.Threading;
-
-
-namespace Shoutcast.Sample {
-
-
- public partial class MainPage : System.Windows.Controls.UserControl {
-
- internal System.Windows.Controls.Grid LayoutRoot;
-
- internal System.Windows.Controls.TextBlock statusTextBlock;
-
- internal System.Windows.Controls.RadioButton mp3StreamRadioButton;
-
- internal System.Windows.Controls.RadioButton aacStreamRadioButton;
-
- private bool _contentLoaded;
-
- ///
- /// InitializeComponent
- ///
- [System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public void InitializeComponent() {
- if (_contentLoaded) {
- return;
- }
- _contentLoaded = true;
- System.Windows.Application.LoadComponent(this, new System.Uri("/Shoutcast.Sample;component/MainPage.xaml", System.UriKind.Relative));
- this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
- this.statusTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("statusTextBlock")));
- this.mp3StreamRadioButton = ((System.Windows.Controls.RadioButton)(this.FindName("mp3StreamRadioButton")));
- this.aacStreamRadioButton = ((System.Windows.Controls.RadioButton)(this.FindName("aacStreamRadioButton")));
- }
- }
-}
-
diff --git a/Src/Shoutcast.Sample/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/Src/Shoutcast.Sample/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
deleted file mode 100644
index e69de29..0000000
diff --git a/Src/Shoutcast.Sample/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/Src/Shoutcast.Sample/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
deleted file mode 100644
index e69de29..0000000
diff --git a/Src/Shoutcast.Sample/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/Src/Shoutcast.Sample/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
deleted file mode 100644
index e69de29..0000000
diff --git a/Src/Silverlight.Media.Shoutcast.sln b/Src/Silverlight.Media.Shoutcast.sln
deleted file mode 100644
index 6dd0fc5..0000000
--- a/Src/Silverlight.Media.Shoutcast.sln
+++ /dev/null
@@ -1,108 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.31101.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silverlight.Media.Shoutcast", "Silverlight.Media.Shoutcast\Silverlight.Media.Shoutcast.csproj", "{65DD033A-AA4C-414F-8D23-F8642A74CC3F}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silverlight.Media.Shoutcast.Phone", "Silverlight.Media.Shoutcast\Silverlight.Media.Shoutcast.Phone.csproj", "{05CC4102-451C-4EB5-8FEA-614F5B49AB2D}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shoutcast.Sample.Phone", "Shoutcast.Sample.Phone\Shoutcast.Sample.Phone.csproj", "{EE25CCA0-8001-4420-B724-798E6FE7A46D}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shoutcast.Sample", "Shoutcast.Sample\Shoutcast.Sample.csproj", "{39F4E0A0-DDF1-4476-9C93-2D8301B955D9}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shoutcast.Sample.Phone.Background", "Shoutcast.Sample.Phone.Background\Shoutcast.Sample.Phone.Background.csproj", "{A80155C6-79E1-4EFE-B473-D6F9E0A49609}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shoutcast.Sample.Phone.Background.Playback", "Shoutcast.Sample.Phone.Background.PlaybackAgent\Shoutcast.Sample.Phone.Background.Playback.csproj", "{12F8E56D-728C-4073-BDA5-058E6222DE51}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|ARM = Debug|ARM
- Debug|x86 = Debug|x86
- Release|Any CPU = Release|Any CPU
- Release|ARM = Release|ARM
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {65DD033A-AA4C-414F-8D23-F8642A74CC3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {65DD033A-AA4C-414F-8D23-F8642A74CC3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {65DD033A-AA4C-414F-8D23-F8642A74CC3F}.Debug|ARM.ActiveCfg = Debug|Any CPU
- {65DD033A-AA4C-414F-8D23-F8642A74CC3F}.Debug|x86.ActiveCfg = Debug|Any CPU
- {65DD033A-AA4C-414F-8D23-F8642A74CC3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {65DD033A-AA4C-414F-8D23-F8642A74CC3F}.Release|Any CPU.Build.0 = Release|Any CPU
- {65DD033A-AA4C-414F-8D23-F8642A74CC3F}.Release|ARM.ActiveCfg = Release|Any CPU
- {65DD033A-AA4C-414F-8D23-F8642A74CC3F}.Release|x86.ActiveCfg = Release|Any CPU
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Debug|ARM.ActiveCfg = Debug|ARM
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Debug|ARM.Build.0 = Debug|ARM
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Debug|x86.ActiveCfg = Debug|x86
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Debug|x86.Build.0 = Debug|x86
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Release|Any CPU.Build.0 = Release|Any CPU
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Release|ARM.ActiveCfg = Release|ARM
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Release|ARM.Build.0 = Release|ARM
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Release|x86.ActiveCfg = Release|x86
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Release|x86.Build.0 = Release|x86
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Debug|ARM.ActiveCfg = Debug|ARM
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Debug|ARM.Build.0 = Debug|ARM
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Debug|ARM.Deploy.0 = Debug|ARM
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Debug|x86.ActiveCfg = Debug|x86
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Debug|x86.Build.0 = Debug|x86
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Debug|x86.Deploy.0 = Debug|x86
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Release|Any CPU.Build.0 = Release|Any CPU
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Release|Any CPU.Deploy.0 = Release|Any CPU
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Release|ARM.ActiveCfg = Release|ARM
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Release|ARM.Build.0 = Release|ARM
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Release|ARM.Deploy.0 = Release|ARM
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Release|x86.ActiveCfg = Release|x86
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Release|x86.Build.0 = Release|x86
- {EE25CCA0-8001-4420-B724-798E6FE7A46D}.Release|x86.Deploy.0 = Release|x86
- {39F4E0A0-DDF1-4476-9C93-2D8301B955D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {39F4E0A0-DDF1-4476-9C93-2D8301B955D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {39F4E0A0-DDF1-4476-9C93-2D8301B955D9}.Debug|ARM.ActiveCfg = Debug|Any CPU
- {39F4E0A0-DDF1-4476-9C93-2D8301B955D9}.Debug|x86.ActiveCfg = Debug|Any CPU
- {39F4E0A0-DDF1-4476-9C93-2D8301B955D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {39F4E0A0-DDF1-4476-9C93-2D8301B955D9}.Release|Any CPU.Build.0 = Release|Any CPU
- {39F4E0A0-DDF1-4476-9C93-2D8301B955D9}.Release|ARM.ActiveCfg = Release|Any CPU
- {39F4E0A0-DDF1-4476-9C93-2D8301B955D9}.Release|x86.ActiveCfg = Release|Any CPU
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Debug|ARM.ActiveCfg = Debug|ARM
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Debug|ARM.Build.0 = Debug|ARM
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Debug|ARM.Deploy.0 = Debug|ARM
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Debug|x86.ActiveCfg = Debug|x86
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Debug|x86.Build.0 = Debug|x86
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Debug|x86.Deploy.0 = Debug|x86
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Release|Any CPU.Build.0 = Release|Any CPU
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Release|Any CPU.Deploy.0 = Release|Any CPU
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Release|ARM.ActiveCfg = Release|ARM
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Release|ARM.Build.0 = Release|ARM
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Release|ARM.Deploy.0 = Release|ARM
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Release|x86.ActiveCfg = Release|x86
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Release|x86.Build.0 = Release|x86
- {A80155C6-79E1-4EFE-B473-D6F9E0A49609}.Release|x86.Deploy.0 = Release|x86
- {12F8E56D-728C-4073-BDA5-058E6222DE51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {12F8E56D-728C-4073-BDA5-058E6222DE51}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {12F8E56D-728C-4073-BDA5-058E6222DE51}.Debug|ARM.ActiveCfg = Debug|ARM
- {12F8E56D-728C-4073-BDA5-058E6222DE51}.Debug|ARM.Build.0 = Debug|ARM
- {12F8E56D-728C-4073-BDA5-058E6222DE51}.Debug|x86.ActiveCfg = Debug|x86
- {12F8E56D-728C-4073-BDA5-058E6222DE51}.Debug|x86.Build.0 = Debug|x86
- {12F8E56D-728C-4073-BDA5-058E6222DE51}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {12F8E56D-728C-4073-BDA5-058E6222DE51}.Release|Any CPU.Build.0 = Release|Any CPU
- {12F8E56D-728C-4073-BDA5-058E6222DE51}.Release|ARM.ActiveCfg = Release|ARM
- {12F8E56D-728C-4073-BDA5-058E6222DE51}.Release|ARM.Build.0 = Release|ARM
- {12F8E56D-728C-4073-BDA5-058E6222DE51}.Release|x86.ActiveCfg = Release|x86
- {12F8E56D-728C-4073-BDA5-058E6222DE51}.Release|x86.Build.0 = Release|x86
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/Src/Silverlight.Media.Shoutcast.suo b/Src/Silverlight.Media.Shoutcast.suo
deleted file mode 100644
index 336563a..0000000
Binary files a/Src/Silverlight.Media.Shoutcast.suo and /dev/null differ
diff --git a/Src/Silverlight.Media.Shoutcast.v12.suo b/Src/Silverlight.Media.Shoutcast.v12.suo
deleted file mode 100644
index 8d8573b..0000000
Binary files a/Src/Silverlight.Media.Shoutcast.v12.suo and /dev/null differ
diff --git a/Src/Silverlight.Media.Shoutcast/Bin/Debug/Silverlight.Media.Phone.dll b/Src/Silverlight.Media.Shoutcast/Bin/Debug/Silverlight.Media.Phone.dll
deleted file mode 100644
index a63ef12..0000000
Binary files a/Src/Silverlight.Media.Shoutcast/Bin/Debug/Silverlight.Media.Phone.dll and /dev/null differ
diff --git a/Src/Silverlight.Media.Shoutcast/Bin/Debug/Silverlight.Media.Phone.pdb b/Src/Silverlight.Media.Shoutcast/Bin/Debug/Silverlight.Media.Phone.pdb
deleted file mode 100644
index a83698a..0000000
Binary files a/Src/Silverlight.Media.Shoutcast/Bin/Debug/Silverlight.Media.Phone.pdb and /dev/null differ
diff --git a/Src/Silverlight.Media.Shoutcast/Bin/Debug/Silverlight.Media.Phone.xml b/Src/Silverlight.Media.Shoutcast/Bin/Debug/Silverlight.Media.Phone.xml
deleted file mode 100644
index 50fe6b0..0000000
--- a/Src/Silverlight.Media.Shoutcast/Bin/Debug/Silverlight.Media.Phone.xml
+++ /dev/null
@@ -1,1953 +0,0 @@
-
-
-
- Silverlight.Media.Phone
-
-
-
-
- Implements a circular buffer data structure.
-
- Type of elements contained in the circular buffer.
-
-
-
- Maximum number of elements allowed in the circular buffer.
-
-
-
-
- Current number of elements in the circular buffer.
-
-
-
-
- Current reading index.
-
-
-
-
- Current writing index.
-
-
-
-
- Array containing the elements of the circular buffer.
-
-
-
-
- Initializes a new instance of the CircularBuffer class.
-
- Maximum number of elements allowed in the circular bufffer.
-
-
-
- Initializes a new instance of the CircularBuffer class.
-
- Maximum number of elements allowed in the circular bufffer.
- true if overflow is allowed, otherwise, false.
-
-
-
- Searches the circular buffer for a particular item.
-
- Item for which to search.
- true if the item is found, otherwise, false.
-
-
-
- Clears the circular buffer.
-
-
-
-
- Writes data to the circular buffer.
-
- data to write to the circular buffer.
- Number of bytes written to the cirular buffer.
-
-
-
- Writes data to the circular buffer.
-
- Data to write to the circular buffer.
- A 32-bit integer that represents the index in the src at which reading begins.
- Number of elements to write.
- Number of bytes written to the cirular buffer.
-
-
-
- Writes a single element to the circular buffer.
-
- Item to write to the circular buffer.
-
-
-
- Advances the read pointer a specified number of elements.
-
- A 32-bit integer that represents the number of elements to skip.
-
-
-
- Reads a specified number of elements from the circular buffer without advancing the current read position.
-
- A 32-bit integer that represents the number of elements to read.
- An array containing the elements read.
-
-
-
- Reads elements from the circular buffer without advancing the current read position.
-
- Buffer to receive the elements from the circular buffer.
- Number of bytes placed into the buffer.
-
-
-
- Reads elements from the circular buffer without advancing the current read position.
-
- Buffer to receive the elements from the circular buffer.
- A 32-bit integer that represents the index in the src at which writing begins.
- Number of elements to read.
- Number of bytes placed into the buffer.
-
-
-
- Reads a single element from the circular buffer without advancing the current read position.
-
- Element read from the circular buffer.
-
-
-
- Reads a specified number of elements from the circular buffer and advances the current read position.
-
- A 32-bit integer that represents the number of elements to read.
- An array containing the elements read.
-
-
-
- Reads elements from the circular buffer and advances the current read position.
-
- Buffer to receive the elements from the circular buffer.
- Number of bytes placed into the buffer.
-
-
-
- Reads elements from the circular buffer and advances the current read position.
-
- Buffer to receive the elements from the circular buffer.
- A 32-bit integer that represents the index in the src at which writing begins.
- Number of elements to read.
- Number of bytes placed into the buffer.
-
-
-
- Reads a single element from the circular buffer and advances the current read position.
-
- Element read from the circular buffer.
-
-
-
- Copies the elements from the circular buffer to an array.
-
- Destination array.
-
-
-
- Copies the elements from the circular buffer to an array.
-
- Destination array.
- A 32-bit integer that represents the index in the array at which writing begins.
-
-
-
- Copies the elements from the circular buffer to an array.
-
- Destination array.
- A 32-bit integer that represents the index in the array at which writing begins.
- Number of elements to copy.
-
-
-
- Gets or sets a value indicating whether the circular buffer allows overflow.
-
-
-
-
- Gets or sets the maximum number of elements allowed in the circular buffer.
-
-
-
-
- Gets the current number of elements in the circular buffer.
-
-
-
-
- Extension methods for the WebHeaderCollection class.
-
-
-
-
- Converts a WebHeaderCollection to an IDictionary<string, string>.
-
- WebHeaderCollection to convert to an IDictionary<string, string>.
- IDictionary<string, string> representing the provided WebHeaderCollection.
-
-
-
- Parses MP3 stream metadata.
-
-
-
-
- Key for the stream title.
-
-
-
-
- Key for the stream url.
-
-
-
-
- Dictionary<string, string> to store the parsed metadata key/value pairs.
-
-
-
-
- Initializes a new instance of the ShoutcastMetadata class.
-
-
-
-
- Initializes a new instance of the ShoutcastMetadata class.
-
- String representing the MP3 stream metadata.
-
-
-
- Determines whether the specified Object is equal to the current Object
-
- The object to compare with the current object.
- true if the specified Object is equal to the current Object; otherwise, false.
-
-
-
- Serves as a hash function for a particular type.
-
- A hash code for the current Object.
-
-
-
- Parses the metadata from the MP3 audio stream.
-
- String representing the MP3 stream metadata.
-
-
-
- Gets a value representing the title from the audio stream metadata.
-
-
-
-
- Gets a value representing the url from the audio stream metadata.
-
-
-
-
- A partial implementation of an AAC audio frame
-
-
-
- The primary purpose of this class is to represent an AAC audio file.
- Many of the features not explicitly needed for audio rendering are omitted from the implementation.
-
-
- Data on this format is readily discoverable in many books as well as by
- searching for "AAC Frame" in your favorite search engine. As always,
- Wikipedia is well stocked in all of these areas as well.
-
-
-
-
-
- Base class used to represent an audio frame.
-
-
-
-
- Initializes a new instance of the AudioFrame class.
-
-
-
-
- Gets or sets the number of channels of the audio frame.
-
-
-
-
- Gets or sets the bit rate of the audio frame.
-
-
-
-
- Gets or sets the sampling rate of the audio frame.
-
-
-
-
- Gets or sets the frame size of the audio frame.
-
-
-
-
- AAC headers are 7 bytes long.
-
-
-
-
- AAC frame synchronization bytes.
-
-
-
-
- Frame Sync is 12 1s
-
-
-
-
- A table of all of the possible sampling rates of AAC audio.
-
-
-
-
- A table of all of the possible number of channels for AAC audio.
-
-
-
-
- Number of bits per block for AAC audio.
-
-
-
-
- Number of samples per block for AAC audio.
-
-
-
-
- Initializes a new instance of the AacpFrame class.
-
-
-
- This class is a partial implementation of an AAC audio frame. The primary purpose of this class is to represent an AAC
- file. Many of the features not explicitly needed for audio rendering are omitted from the implementation.
-
-
- Data on this format is readily discoverable in many books as well as by
- searching for "AAC Frame" in your favorite search engine. As always,
- Wikipedia is well stocked in all of these areas as well.
-
-
- Byte array containing 4 bytes representing an AAC header.
-
-
-
- Quickly checks an array of bytes to see if it represents a valid AAC frame header.
-
- Bytes representing an AAC frame header.
- true if the supplied bytes are a valid frame header, otherwise, false.
-
-
-
- Determines whether the specified Object is equal to the current Object
-
- The object to compare with the current object.
- true if the specified Object is equal to the current Object; otherwise, false.
-
-
-
- Generates a hash code for the current Object.
-
- A hash code for the current Object.
-
-
-
- Calculates the bit rate for an AAC frame.
-
- Sample rate of the AAC frame.
- Number of channels of the AAC frame.
- Bit rate of an AAC frame with the given sample rate and number of channels.
-
-
-
- Parses the AAC frame header to find the actual size of the header.
-
- Byte array containing the AAC frame header.
- Actual size of the supplied AAC frame header.
-
-
-
- Parses the sample rate from the supplied AAC frame header.
-
- Byte array containing the AAC frame header.
- The sample rate of the supplied AAC frame header.
-
-
-
- Parses the number of channels from the supplied AAC frame header.
-
- Byte array containing the AAC frame header.
- The number of channels of the supplied AAC frame header.
-
-
-
- Helper methods for manipulating values at the byte and binary level.
-
-
-
-
- Defined by ID3v2 spec as 4 bytes
-
-
-
-
- 1 Byte is 8 bits
-
-
-
-
- Masks out up to an integer sized (4 bytes) set of bits from an
- array of bytes.
-
- An array of data in Little Endian Order
- The bit index of the first bit
- The length of the mask in bits
- An integer of the bits masked out
-
-
-
- Converts a Syncronization Safe integer from the ID3v2 spec into a
- standard integer.
-
-
- An array of bytes containing raw data in Syncronization Safe format
- as defined in the ID3v2 spec. This means that it is a 4 byte
- integer where the leading bit of each byte is a 0.
- For Example:
- 01111111 01111111 01111111 01111111
- Output would be:
- 00001111 11111111 11111111 11111111
- Assumes syncSafeData array is in Big Endiah Order.
-
-
- Where in the array of bytes, the syncsafe data starts. Note that
- data's size is assumed to be 4 bytes in length.
-
-
- A standard integer. Note that this integer can only have a data
- resolution of 28 bits (max value of this could only be 2^28 -1).
-
-
-
-
- Searches a byte array for a pattern of bits.
-
-
- The array of bytes to search for the pattern within.
-
-
- The pattern of bytes to match with undesired bits zeroed out.
-
-
- A mask to zero out bits that aren't part of the pattern.
-
-
- The byte to begin the search from.
-
-
- Returns the location of the first byte in the pattern or -1 if
- nothing was found or there was an error.
-
-
-
-
- Searches a byte array for a pattern of bits.
-
-
- The array of bytes to search for the pattern within.
-
-
- The pattern of bytes to match with undesired bits zeroed out.
-
-
- A mask to zero out bits that aren't part of the pattern.
-
-
- Returns the location of the first byte in the pattern or -1 if
- nothing was found or there was an error.
-
-
-
-
- Searches a byte array for a pattern of bytes.
-
-
- The array of bytes to search for the pattern within.
-
-
- The pattern of bytes to match.
-
-
- The byte to begin the search from.
-
-
- Returns the location of the first byte in the pattern or -1 if
- nothing was found or there was an error.
-
-
-
-
- Searches a byte array for a pattern of bytes.
-
-
- The array of bytes to search for the pattern within.
-
-
- The pattern of bytes to match.
-
-
- Returns the location of the first byte in the pattern or -1 if
- nothing was found or there was an error.
-
-
-
-
- A managed representation of the multimedia HEAACWAVEINFO
- structure declared in mmreg.h.
-
-
- This was designed for usage in an environment where PInvokes are not
- allowed.
-
-
-
-
- Base class for wave format support.
-
-
-
-
- Initializes a new instance of the WaveFormat class.
-
- WaveFormatExtensible instance representing an audio format.
-
-
-
- Returns a string representing the structure in little-endian
- hexadecimal format.
-
-
- The string generated here is intended to be passed as
- CodecPrivateData for Silverlight's MediaStreamSource
-
-
- A string representing the structure in little-endia hexadecimal
- format.
-
-
-
-
- Calculate the duration of audio based on the size of the buffer
-
- the buffer size in bytes
- The duration of that buffer
-
-
-
- Gets the core WaveFormatExtensible strucutre representing the Mp3 audio data's
- core attributes.
-
-
- wfx.FormatTag must be WAVE_FORMAT_MPEGLAYER3 = 0x0055 = (85)
- wfx.Size must be >= 12
-
-
-
-
- Initializes a new instance of the HeAacWaveFormat class.
-
- WaveFormatExtensible instance representing this audio format.
-
-
-
- Returns a string representing the structure in little-endian
- hexadecimal format.
-
-
- The string generated here is intended to be passed as
- CodecPrivateData for Silverlight's MediaStreamSource
-
-
- A string representing the structure in little-endia hexadecimal
- format.
-
-
-
-
- Gets or sets the the AAC payload type.
-
-
-
-
- Gets or sets the audio profile indication (as defined in the MPEG-4 audio specification) required to process the audio.
-
-
-
-
- Gets or sets the structure type that describes the data that follows this structure (per MPEG-4 audio specification).
-
-
-
-
- Reproduction mode of given audio data. Typically maps to the number of
- output devices used to reproduce it.
-
-
-
-
- Stereo: independent audio typically output to 2 speakers and is intended
- to create a more realistic or pleasing representation of audio by
- representing sound coming from multiple directons.
-
-
-
-
- Joint Stereo: The joining of multiple channels of audio to create another separate
- one, to reduce the size of the file, or to increase the quality.
-
-
-
-
- Dual Channel: Two independent Mono channels. May overlap with stereo or may
- be completely independent as in the case of foreign language audio dubbing.
-
-
-
-
- Single Channel: Also known as Mono. Typically the reproduction of a single
- independent audio stream in one device or of the same independent audio stream
- in multiple devices.
-
-
-
-
- A partial implementation of an MPEG audio frame
-
-
-
- The primary purpose of this class is to represent an Mpeg 1 Layer 3
- file or MP3 file for short. Many of the features not explicitly needed
- for audio rendering are omitted from the implementation.
-
-
- Data on this format is readily discoverable in many books as well as by
- searching for "MP3 Frame" in your favorite search engine. As always,
- Wikipedia is well stocked in all of these areas as well.
-
-
-
-
-
- MP3 Headers are 4 Bytes long
-
-
-
-
- Frame Sync is 11 1s
-
-
-
-
- MP3 frame synchronization bytes.
-
-
-
-
- A table of bitrates / 1000. These are all of the possible bitrates for Mpeg 1 - 2.5 audio. -1 encodes an error lookup.
-
-
-
-
- A table of all of the possible sampling rates of Mpeg 1 - 2.5 audio.
-
-
-
-
- Initializes a new instance of the MpegFrame class.
-
-
-
- This class is a partial implementation of an MPEG audio frame. The primary purpose of this class is to represent an Mpeg 1 Layer 3
- file or MP3 file for short. Many of the features not explicitly needed
- for audio rendering are omitted from the implementation.
-
-
- Data on this format is readily discoverable in many books as well as by
- searching for "MP3 Frame" in your favorite search engine. As always,
- Wikipedia is well stocked in all of these areas as well.
-
-
- Byte array containing 4 bytes representing an MPEG Layer 3 header.
-
-
-
- Quickly checks an array of bytes to see if it represents a valid MP3 frame header.
-
- Bytes representing an MP3 frame header.
- true if the supplied bytes are a valid frame header, otherwise, false.
-
-
-
- Determines whether the specified Object is equal to the current Object
-
- The object to compare with the current object.
- true if the specified Object is equal to the current Object; otherwise, false.
-
-
-
- Generates a hash code for the current Object.
-
- A hash code for the current Object.
-
-
-
- Converts the MpegFrame into a human readable form.
-
-
- A textual representation of the MpegFrame.
-
-
-
-
- Calculates the bit rate of the Mp3 audio from the data in the frame header.
-
- Mp3 version parsed out of the audio frame header.
- Mp3 layer parsed out of the audio frame header.
- Mp3 Bit rate index parsed out of the audio frame header.
- Mp3 bit rate calculated from the provided values, if valid. Otherwise, -2 is returned.
-
-
-
- Looks up the sampling rate of the Mp3 audio from the data in the frame header.
-
- Mp3 version parsed out of the audio frame header.
- Mp3 sampling rate index parsed out of the audio frame header.
- Mp3 sampling rate for the provided version and sampling rate index, if valid. Otherwise, -1 is returned.
-
-
-
- Calculates the frame size given the header information from the Mp3 frame.
-
- Mp3 version.
- Mp3 layer.
- Mp3 bit rate.
- Mp3 sampling rate.
- Mp3 padding.
- Mp3 frame size calculated from the provided values, if valid. Otherwise, -1 is returned.
-
-
-
- Parses the version of the MPEG standard this frame header conforms to from the frame header.
-
- The 4 byte header for this frame.
-
- The version of the MPEG standard this frame conforms to.
- 1 = Mpeg 1
- 2 = Mpeg 2
- 3 = Mpeg 2.5
-
-
-
-
- Parses which complexity layer of the MPEG standard this frame conforms to from the frame header.
-
- The 4 byte header for this frame.
- The complexity layer this frame conforms to.
-
-
-
- Parses the audio output mode of this frame's audio data.
-
- The 4 byte header for this frame.
- The audio output mode of this frame's audio data.
-
-
-
- Gets the Version of the MPEG standard this frame conforms to.
- MPEG 1, MPEG 2, or MPEG 2.5
-
-
-
-
- Gets the layer of complexity used in this frame.
- Layer 1, 2, or 3.
-
-
-
-
- Gets a value indicating whether or not the frame is protected by a
- Cyclic Redundancy Check (CRC). If true, then a 16 bit
- CRC follows the header.
-
-
-
-
- Gets the Index into the bitrate table as defined in the MPEG spec.
-
-
-
-
- Gets the Index into the samplingrate table as defined in the MPEG spec.
-
-
-
-
- Gets the number of additional bytes of padding in this frame.
-
-
-
-
- Gets the output channel used to playback this frame.
-
-
-
-
- A managed representation of the multimedia MPEGLAYER3WAVEFORMATEX
- structure declared in mmreg.h.
-
-
- This was designed for usage in an environment where PInvokes are not
- allowed.
-
-
-
-
- Initializes a new instance of the MpegLayer3WaveFormat class.
-
- WaveFormatExtensible instance representing this audio format.
-
-
-
- Returns a string representing the structure in little-endian
- hexadecimal format.
-
-
- The string generated here is intended to be passed as
- CodecPrivateData for Silverlight 2's MediaStreamSource
-
-
- A string representing the structure in little-endia hexadecimal
- format.
-
-
-
-
- Returns a string representing all of the fields in the object.
-
-
- A string representing all of the fields in the object.
-
-
-
-
- Gets or sets the FormatTag that defines what type of waveform audio this is.
-
-
- Set this to
- MPEGLAYER3_ID_MPEG = 1
-
-
-
-
- Gets or sets the bitrate padding mode.
- This value is set in an Mp3 file to determine if padding is needed to adjust the average bitrate
- to meet the sampling rate.
- 0 = adjust as needed
- 1 = always pad
- 2 = never pad
-
-
- This is different than the unmanaged version of MpegLayer3WaveFormat
- which has the field Flags instead of this name.
-
-
-
-
- Gets or sets the Block Size in bytes. For MP3 audio this is
- 144 * bitrate / samplingRate + padding
-
-
-
-
- Gets or sets the number of frames per block.
-
-
-
-
- Gets or sets the encoder delay in samples.
-
-
-
-
- Extensions for the standard string class.
-
-
-
-
-
- Converts a string of characters from Big Endian byte order to
- Little Endian byte order.
-
-
- Assumptions this makes about the string. Every two characters
- make up the smallest data unit (analogous to byte). The entire
- string is the size of the systems natural unit of data (analogous
- to a word).
-
-
-
- A string in Big Endian Byte order.
-
-
- A string in Little Endian Byte order.
-
-
- This function was designed to take in a Big Endian string of
- hexadecimal digits.
-
- input:
- DEADBEEF
- output:
- EFBEADDE
-
-
-
-
-
- A managed representation of the multimedia WAVEFORMATEX structure
- declared in mmreg.h.
-
-
- This was designed for usage in an environment where PInvokes are not
- allowed.
-
-
-
-
- Returns a string representing the structure in little-endian
- hexadecimal format.
-
-
- The string generated here is intended to be passed as
- CodecPrivateData for Silverlight 2's MediaStreamSource
-
-
- A string representing the structure in little-endia hexadecimal
- format.
-
-
-
-
- Returns a string representing all of the fields in the object.
-
-
- A string representing all of the fields in the object.
-
-
-
-
- Gets or sets the audio format type. A complete list of format tags can be
- found in the Mmreg.h header file.
-
-
- Silverlight 2 supports:
- WMA 7,8,9
- WMA 10 Pro
- Mp3
- WAVE_FORMAT_MPEGLAYER3 = 0x0055
-
-
-
-
- Gets or sets the number of channels in the data.
- Mono 1
- Stereo 2
- Dual 2 (2 Mono channels)
-
-
- Silverlight 2 only supports stereo output and folds down higher
- numbers of channels to stereo.
-
-
-
-
- Gets or sets the sampling rate in hertz (samples per second)
-
-
-
-
- Gets or sets the average data-transfer rate, in bytes per second, for the format.
-
-
-
-
- Gets or sets the minimum size of a unit of data for the given format in Bytes.
-
-
-
-
- Gets or sets the number of bits in a single sample of the format's data.
-
-
-
-
- Gets or sets the size in bytes of any extra format data added to the end of the
- WAVEFORMATEX structure.
-
-
-
-
- Describes how IniParser will handle duplicate names within a section.
-
-
-
-
- Throw an InvalidOperationException when a duplicate name within a section is encountered.
-
-
-
-
- Ignore the value when a dupliate name within a section is encountered.
-
-
-
-
- Overwrite the existing value when a duplicate name within a section is encountered.
-
-
-
-
- Parses INI file format.
-
-
-
-
- Regex to parse comment lines.
-
-
-
-
- Regex to parse section names.
-
-
-
-
- Regex to parse key/value pairs.
-
-
-
-
- Field to store duplicate name handling enumeration.
-
-
-
-
- Dictionary to store ini file sections and their associated key/value pairs.
-
-
-
-
- Initializes a new instance of the IniParser class.
-
- TextReader representing an ini file.
-
-
-
- Initializes a new instance of the IniParser class.
-
- TextReader representing an ini file.
- Specifies how IniParser will handle duplicate names.
-
-
-
- Parses the ini file.
-
- TextReader representing an ini file.
-
-
-
- Gets the sections from the ini file containing name/value pairs.
-
-
-
-
- Interface representing an audio stream playlist.
-
-
-
-
- Gets an ICollection of IPlaylist entries.
-
-
-
-
- Interface representing an audio stream playlist entry.
-
-
-
-
- Gets or sets the display name of the playlist entry.
-
-
-
-
- Gets or sets the length, in seconds, of the playlist entry.
-
-
-
-
- Gets or sets the path of the playlist entry. This is usually a Uri, but can be a file path as well.
-
-
-
-
- Interface representing a audio stream playlist parser.
-
-
-
-
- Parses the supplied Stream into an IPlaylist instance.
-
- Stream representing the playlist data.
- Successfully parsed IPlaylist instance.
-
-
-
- Gets the Internet content type supported by this playlist parser.
-
-
-
-
- Parses M3U playlist.
-
-
-
-
- Content type of the m3u playlist format.
-
-
-
-
- M3U Extended Header tag.
-
-
-
-
- M3U Extended Detail tag.
-
-
-
-
- Regex to parse M3U Extended Detail.
-
-
-
-
- Initializes a new instance of the M3uParser class.
-
-
-
-
- Initializes a new instance of the M3uParser class.
-
- TextReader representing an M3U file.
-
-
-
- Parses the M3U file.
-
- Stream representing a M3U file.
- Parsed M3U playlist.
-
-
-
- Parses the M3U playlist.
-
- TextReader representing the M3U playlist.
- Parsed M3U playlist.
-
-
-
- Gets the supported content type of the M3U playlist format.
-
-
-
-
- Represents an M3U playlist.
-
-
-
-
- M3U playlist items.
-
-
-
-
- Gets a collection of the M3U playlist items.
-
-
-
-
- Represents an M3U playlist entry.
-
-
-
-
- Represents a playlist entry.
-
-
-
-
- Initializes a new instance of the PlaylistItem class.
-
-
-
-
- Gets or sets the display name of the playlist entry.
-
-
-
-
- Gets or sets the path of the playlist entry.
-
-
-
-
- Gets or sets the length of the media represented by this playlist entry.
-
-
-
-
- Initializes a new instance of the M3uPlaylistItem class.
-
-
-
-
- Factory to parse different playlist types.
-
-
-
-
- Factory method that parses a given Stream with the appropriate playlist type, based on the supplied content type.
-
- Internet content type representing the playlist type of the Stream.
- Stream representing the playlist data.
- Successfully parsed playlist.
-
-
-
- Parses the PLS playlist format.
-
-
-
-
- Content type of the PLS playlist format.
-
-
-
-
- Initializes a new instance of the PlsParser class.
-
-
-
-
- Initializes a new instance of the PlsParser class.
-
- TextReader representing a PLS playlist file.
-
-
-
- Parses the PLS file.
-
- Stream representing a PLS file.
- A successfully parsed playlist.
-
-
-
- Parses the PLS file.
-
- TextReader representing a PLS playlist file.
- A successfully parsed playlist.
-
-
-
- Gets the supported content type of the PLS playlist format.
-
-
-
-
- Represents a PLS playlist.
-
-
-
-
- PLS playlist items.
-
-
-
-
- Gets a collection of the PLS playlist items.
-
-
-
-
- Represents a PLS playlist entry.
-
-
-
-
- Initializes a new instance of the PlsPlaylistItem class.
-
-
-
-
- A Simple MediaStreamSource which can play back MP3 streams from
- beginning to end.
-
-
-
-
- The current metadata for the Shoutcast stream.
-
-
-
-
- Exception set by the worker thread.
-
-
-
-
- Empty dictionary of MediaSampleAttributeKeys, as they are unused in this MedaStreamSource.
-
-
-
-
- Current timestamp at which a sample should be rendered as measured in 100 nanosecond increments.
-
-
-
-
- MediaStreamDescription for the associated Mp3 stream.
-
-
-
-
- The Mp3 stream being played back.
-
-
-
-
- Initializes a new instance of the ShoutcastMediaStreamSource class.
-
- Uri of the Mp3 stream.
-
-
-
- Initializes a new instance of the ShoutcastMediaStreamSource class.
-
- Uri of the Mp3 stream.
- true to include metadata, otherwise, false.
-
-
-
- Finalizes an instance of the ShoutcastMediaStreamSource class.
-
-
-
-
- Releases all resources used by the MediaStreamSource.
-
-
-
-
- Fires the MetadataChanged event.
-
-
-
-
- Raises the Closed event.
-
-
-
-
- Releases the unmanaged resources used by the MediaStreamSource and optionally releases the managed resources.
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Parses the passed in MediaStream to find the first frame and signals
- to its parent MediaElement that it is ready to begin playback by calling
- ReportOpenMediaCompleted.
-
-
-
-
- Parses the next sample from the requested stream and then calls ReportGetSampleCompleted
- to inform its parent MediaElement of the next sample.
-
-
- Should always be Audio for this MediaStreamSource.
-
-
-
-
- Closes down the open media streams and otherwise cleans up the MediaStreamSource. The MediaElement can call this method when going through normal shutdown or as a result of an error.
-
-
-
-
- Gathers the diagnostic information requested.
-
-
- A member of the MediaStreamSourceDiagnosticKind enumeration describing what type of information is desired.
-
-
-
-
-
- Effectively a Null-Op for when a MediaElement requests a seek at the beginning
- of the stream. This makes the stream semi-unseekable.
-
-
- In a fuller MediaStreamSource, the logic here would be to actually seek to
- the correct mpeg frame matching the seekToTime passed in.
-
-
-
- The time to seek to in nanosecond ticks.
-
-
-
-
- Called when a stream switch is requested on the MediaElement.
-
-
- The stream switched to.
-
-
-
-
- Creates an HttpWebRequest for streaming Shoutcast MP3 streams.
-
- The Uri of the Shoutcast MP3 stream.
- Indicates whether or not to include metadata with the Shoutcast Mp3 stream.
- An HttpWebRequest
-
-
-
- Cleans up all associated streaming resources.
-
-
-
-
- Fired when the Mp3 metadata changed.
-
-
-
-
- Fired when the ShoutcastStream is closed.
-
-
-
-
- Gets the Uri of the audio stream.
-
-
-
-
- Gets a value representing the current Shoutcast metadata.
-
-
-
-
- Gets a value indicating whether or not metadata is included in this MSS.
-
-
-
-
- Implements the Shoutcast streaming protocol.
-
-
-
-
- The default initial buffer size.
-
-
-
-
- Number of milliseconds to sleep if a buffer read will overwrite our read buffer's pointer.
-
-
-
-
- Number of seconds per frame, per MP3 specification.
-
-
-
-
- Default number of seconds to buffer.
-
-
-
-
- Number of times to retry reading from the initial buffer read.
-
-
-
-
- Minimum number of bytes required to keep in the buffer.
-
-
-
-
- Number of seconds to buffer.
-
-
-
-
- Background worker to fill circular buffer from network stream.
-
-
-
-
- Shoutcast metadata interval byte count.
-
-
-
-
- Inner stream providing MP3 bytes.
-
-
-
-
- Current stream metadata.
-
-
-
-
- Current parsed stream metadata.
-
-
-
-
- Circular buffer synchronization object.
-
-
-
-
- Number of bytes left in stream until metadata.
-
-
-
-
- Audio stream description.
-
-
-
-
- Audio source attributes.
-
-
-
-
- Current frame size.
-
-
-
-
- Circular buffer for audio stream data.
-
-
-
-
- Number of bytes left in current frame.
-
-
-
-
- MpegFrame representing the next MP3 frame.
-
-
-
-
- MpegLayer3WaveFormat representing MP3 format.
-
-
-
-
- Current percentage of the minimum required bytes in the circular buffer.
-
-
-
-
- MediaStreamSource associated with this stream.
-
-
-
-
- Represents whether or not this stream should request to receive metadata.
-
-
-
-
- Text encoding used to decode metadata bytes.
-
-
-
-
- Initializes a new instance of the ShoutcastStream class.
-
- ShoutcastMediaStreamSource containing this ShoutcastStream.
- HttpWebResponse for MP3 stream request.
-
-
-
- Initializes a new instance of the ShoutcastStream class.
-
- ShoutcastMediaStreamSource containing this ShoutcastStream.
- HttpWebResponse for MP3 stream request.
- Number of seconds of audio data to buffer.
-
-
-
- Initializes a new instance of the ShoutcastStream class.
-
- ShoutcastMediaStreamSource containing this ShoutcastStream.
- HttpWebResponse for MP3 stream request.
- Number of seconds of audio data to buffer.
- Text encoding used to decode the Shoutcast metadata.
-
-
-
- Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
-
- An array of bytes. This method copies count bytes from buffer to the current stream.
- The zero-based byte offset in buffer at which to begin copying bytes to the current stream.
- The number of bytes to be written to the current stream.
-
-
-
- Writes a byte to the current position in the stream and advances the position within the stream by one byte.
-
- The byte to write to the stream.
-
-
-
- Sets the position within the current stream.
-
- A byte offset relative to the origin parameter.
- A value of type SeekOrigin indicating the reference point used to obtain the new position.
- The new position within the current stream.
-
-
-
- Sets the length of the current stream.
-
- The desired length of the current stream in bytes.
-
-
-
- Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
-
- The unsigned byte cast to an Int32, or -1 if at the end of the stream.
-
-
-
- Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
-
- An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.
- The zero-based byte offset in buffer at which to begin storing the data read from the current stream.
- The maximum number of bytes to be read from the current stream.
- The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.
-
-
-
- Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
-
-
-
-
- Releases the unmanaged resources used by the Stream and optionally releases the managed resources.
-
- true to release both managed and unmanaged resources; false to release only unmanaged resources.
-
-
-
- Initializes a WaveFormatExtensible instance representing an AAC+ frame.
-
- Audio frame representing an AAC+ frame.
- A WaveFormatExtensible for the supplied audio frame.
-
-
-
- Initializes a WaveFormatExtensible instance representing an MP3 frame.
-
- Audio frame representing an MP3 frame.
- A WaveFormatExtensible for the supplied audio frame.
-
-
-
- Reads or Peeks data from the circular buffer.
-
- Buffer in which to put the read or peeked data.
- Number of bytes to read or peek.
- true if the data should be peeked from the circular buffer, otherwise the data is read from the circular buffer.
-
-
-
- Parses initial audio stream byte buffer.
-
- Initial bytes from the audio stream.
-
-
-
- Forces the specified number of bytes to be read from the inner stream.
-
- An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.
- The zero-based byte offset in buffer at which to begin storing the data read from the current stream.
- The maximum number of bytes to be read from the current stream.
- The total number of bytes read into the buffer. This should be the same as the count parameter.
-
-
-
- Calculates the buffer size required for this audio stream.
-
- Size, in bytes, of the initial MP3 frame.
- The required size of the circular buffer.
-
-
-
- Method used by the BackgroundWorker to read audio data from the inner stream.
-
- The source of the event.
- A DoWorkEventArgs that contains the event data.
-
-
-
- Parses the Shoutcast specific headers. This method is different because of how Shoutcast responds to an HttpWebRequest. The headers need to be parsed, then removed from the initialBuffer.
-
- Initial data buffer from the audio stream.
- ShoutcastStreamInformation containing information about the audio stream.
-
-
-
- Parses the headers from the audio stream.
-
- HttpWebResponse from the server sending the audio stream.
- Initial data buffer from the audio stream.
- ShoutcastStreamInformation containing information about the audio stream.
-
-
-
- Handles the RunWorkerCompleted event of the background worker.
-
- The source of the event.
- A RunWorkerCompletedEventArgs that contains the event data.
-
-
-
- Indicates if reading the specified number of bytes from the circular buffer contains MP3 metadata.
-
- Number of bytes to read from the circular buffer.
- true if reading the specified number of bytes from the circular buffer contains MP3 metadata, otherwise, false.
-
-
-
- Synchronizes the MP3 data on a frame header.
-
- Byte array representing a chunk of MP3 data.
- Assigned to the resultant, parsed MpegFrame pointed to by the return value.
- Offset into the audioData parameters representing the next, valid MpegFrame
-
-
-
- Resynchronizes the audio stream to the next valid Mp3 frame.
-
-
-
-
- Reads the next MP3 frame header.
-
-
-
-
- Called after the ShoutcastStream has been completely shut down.
-
-
-
-
- Gets a value indicating whether the current stream supports reading.
-
-
-
-
- Gets a value indicating whether the current stream supports seeking.
-
-
-
-
- Gets a value indicating whether the current stream supports writing.
-
-
-
-
- Gets the value containing the current stream information.
-
-
-
-
- Gets the length in bytes of the stream.
-
-
-
-
- Gets or sets the position within the current stream.
-
-
-
-
- Gets a value containing the audio stream description.
-
-
-
-
- Gets a value containing the audio source attributes.
-
-
-
-
- Gets a value representing the current MP3 frame size.
-
-
-
-
- Gets a value representing the current MP3 wave format.
-
-
-
-
- Gets a value representing the current percentage of the minimum required bytes in the circular buffer.
-
-
-
-
- Represents the metadata information about an MP3 stream.
-
-
-
-
- Base name of the ICY Notice header tag.
-
-
-
-
- ICY Name header tag.
-
-
-
-
- ICY Genre header tag.
-
-
-
-
- ICY Url header tag.
-
-
-
-
- ICY Public header tag.
-
-
-
-
- ICY Bitrate headter tag.
-
-
-
-
- ICY Metadata Interval header tag.
-
-
-
-
- List of ICY Notice header tags.
-
-
-
-
- Initializes a new instance of the ShoutcastStreamInformation class.
-
- IDictionary<string, string> of HTTP headers.
-
-
-
- Parses the supplied HTTP headers.
-
- IDictionary<string, string> of HTTP headers.
-
-
-
- Gets the name of the MP3 stream.
-
-
-
-
- Gets the genre of the MP3 stream.
-
-
-
-
- Gets the url of the MP3 stream.
-
-
-
-
- Gets a value indicating whether or not this MP3 stream is public.
-
-
-
-
- Gets the bitrate of the MP3 stream.
-
-
-
-
- Gets the metadata interval of the MP3 stream.
-
-
-
-
- Gets the notices of the MP3 stream..
-
-
-
-
- Gets the HTTP content type.
-
-
-
-
diff --git a/Src/Silverlight.Media.Shoutcast/CircularBuffer.cs b/Src/Silverlight.Media.Shoutcast/CircularBuffer.cs
deleted file mode 100644
index 2db9aaa..0000000
--- a/Src/Silverlight.Media.Shoutcast/CircularBuffer.cs
+++ /dev/null
@@ -1,427 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// (c) alexreg.
-// This source is subject to the Microsoft Public License (Ms-PL).
-// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
-// All other rights reserved.
-// Project site: http://circularbuffer.codeplex.com/
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Threading;
-
- ///
- /// Implements a circular buffer data structure.
- ///
- /// Type of elements contained in the circular buffer.
- public class CircularBuffer
- {
- ///
- /// Maximum number of elements allowed in the circular buffer.
- ///
- private int capacity;
-
- ///
- /// Current number of elements in the circular buffer.
- ///
- private int size;
-
- ///
- /// Current reading index.
- ///
- private int head;
-
- ///
- /// Current writing index.
- ///
- private int tail;
-
- ///
- /// Array containing the elements of the circular buffer.
- ///
- private T[] buffer;
-
- ///
- /// Initializes a new instance of the CircularBuffer class.
- ///
- /// Maximum number of elements allowed in the circular bufffer.
- public CircularBuffer(int capacity)
- : this(capacity, false)
- {
- }
-
- ///
- /// Initializes a new instance of the CircularBuffer class.
- ///
- /// Maximum number of elements allowed in the circular bufffer.
- /// true if overflow is allowed, otherwise, false.
- public CircularBuffer(int capacity, bool allowOverflow)
- {
- if (capacity < 0)
- {
- throw new ArgumentException("capacity must be greater than or equal to zero.", "capacity");
- }
-
- this.capacity = capacity;
- this.size = 0;
- this.head = 0;
- this.tail = 0;
- this.buffer = new T[capacity];
- this.AllowOverflow = allowOverflow;
- }
-
- ///
- /// Gets or sets a value indicating whether the circular buffer allows overflow.
- ///
- public bool AllowOverflow
- {
- get;
- set;
- }
-
- ///
- /// Gets or sets the maximum number of elements allowed in the circular buffer.
- ///
- public int Capacity
- {
- get
- {
- return this.capacity;
- }
-
- set
- {
- if (value == this.capacity)
- {
- return;
- }
-
- if (value < this.size)
- {
- throw new ArgumentOutOfRangeException("value", "value must be greater than or equal to the buffer size.");
- }
-
- var dst = new T[value];
- if (this.size > 0)
- {
- this.CopyTo(dst);
- }
-
- this.buffer = dst;
-
- this.capacity = value;
- }
- }
-
- ///
- /// Gets the current number of elements in the circular buffer.
- ///
- public int Size
- {
- get { return this.size; }
- }
-
- ///
- /// Searches the circular buffer for a particular item.
- ///
- /// Item for which to search.
- /// true if the item is found, otherwise, false.
- public bool Contains(T item)
- {
- int bufferIndex = this.head;
- var comparer = EqualityComparer.Default;
- for (int i = 0; i < this.size; i++, bufferIndex++)
- {
- if (bufferIndex == this.capacity)
- {
- bufferIndex = 0;
- }
-
- if (item == null && this.buffer[bufferIndex] == null)
- {
- return true;
- }
- else if ((this.buffer[bufferIndex] != null) &&
- comparer.Equals(this.buffer[bufferIndex], item))
- {
- return true;
- }
- }
-
- return false;
- }
-
- ///
- /// Clears the circular buffer.
- ///
- public void Clear()
- {
- this.size = 0;
- this.head = 0;
- this.tail = 0;
- }
-
- ///
- /// Writes data to the circular buffer.
- ///
- /// data to write to the circular buffer.
- /// Number of bytes written to the cirular buffer.
- public int Put(T[] src)
- {
- return this.Put(src, 0, src.Length);
- }
-
- ///
- /// Writes data to the circular buffer.
- ///
- /// Data to write to the circular buffer.
- /// A 32-bit integer that represents the index in the src at which reading begins.
- /// Number of elements to write.
- /// Number of bytes written to the cirular buffer.
- public int Put(T[] src, int offset, int count)
- {
- int realCount = this.AllowOverflow ? count : Math.Min(count, this.capacity - this.size);
- int srcIndex = offset;
- for (int i = 0; i < realCount; i++, this.tail++, srcIndex++)
- {
- if (this.tail == this.capacity)
- {
- this.tail = 0;
- }
-
- this.buffer[this.tail] = src[srcIndex];
- }
-
- this.size = Math.Min(this.size + realCount, this.capacity);
- return realCount;
- }
-
- ///
- /// Writes a single element to the circular buffer.
- ///
- /// Item to write to the circular buffer.
- public void Put(T item)
- {
- if ((!this.AllowOverflow) && (this.size == this.capacity))
- {
- throw new OverflowException("Buffer is full.");
- }
-
- this.buffer[this.tail] = item;
- if (this.tail++ == this.capacity)
- {
- this.tail = 0;
- }
-
- this.size++;
- }
-
- ///
- /// Advances the read pointer a specified number of elements.
- ///
- /// A 32-bit integer that represents the number of elements to skip.
- public void Skip(int count)
- {
- this.head += count;
- if (this.head >= this.capacity)
- {
- this.head -= this.capacity;
- }
- else if (this.head < 0)
- {
- // Handle negatives
- this.head += this.capacity;
- }
- }
-
- ///
- /// Reads a specified number of elements from the circular buffer without advancing the current read position.
- ///
- /// A 32-bit integer that represents the number of elements to read.
- /// An array containing the elements read.
- public T[] Peek(int count)
- {
- var dst = new T[count];
- this.Peek(dst);
- return dst;
- }
-
- ///
- /// Reads elements from the circular buffer without advancing the current read position.
- ///
- /// Buffer to receive the elements from the circular buffer.
- /// Number of bytes placed into the buffer.
- public int Peek(T[] dst)
- {
- return this.Peek(dst, 0, dst.Length);
- }
-
- ///
- /// Reads elements from the circular buffer without advancing the current read position.
- ///
- /// Buffer to receive the elements from the circular buffer.
- /// A 32-bit integer that represents the index in the src at which writing begins.
- /// Number of elements to read.
- /// Number of bytes placed into the buffer.
- public int Peek(T[] dst, int offset, int count)
- {
- int realCount = Math.Min(count, this.size);
- int dstIndex = offset;
- int tempHead = this.head;
- for (int i = 0; i < realCount; i++, tempHead++, dstIndex++)
- {
- if (tempHead == this.capacity)
- {
- tempHead = 0;
- }
-
- dst[dstIndex] = this.buffer[tempHead];
- }
-
- return realCount;
- }
-
- ///
- /// Reads a single element from the circular buffer without advancing the current read position.
- ///
- /// Element read from the circular buffer.
- public T Peek()
- {
- if (this.size == 0)
- {
- throw new InvalidOperationException("Buffer is empty.");
- }
-
- int tempHead = (this.head == this.capacity) ? 0 : this.head;
-
- var item = this.buffer[tempHead];
- return item;
- }
-
- ///
- /// Reads a specified number of elements from the circular buffer and advances the current read position.
- ///
- /// A 32-bit integer that represents the number of elements to read.
- /// An array containing the elements read.
- public T[] Get(int count)
- {
- var dst = new T[count];
- this.Get(dst);
- return dst;
- }
-
- ///
- /// Reads elements from the circular buffer and advances the current read position.
- ///
- /// Buffer to receive the elements from the circular buffer.
- /// Number of bytes placed into the buffer.
- public int Get(T[] dst)
- {
- return this.Get(dst, 0, dst.Length);
- }
-
- ///
- /// Reads elements from the circular buffer and advances the current read position.
- ///
- /// Buffer to receive the elements from the circular buffer.
- /// A 32-bit integer that represents the index in the src at which writing begins.
- /// Number of elements to read.
- /// Number of bytes placed into the buffer.
- public int Get(T[] dst, int offset, int count)
- {
- int realCount = Math.Min(count, this.size);
- int dstIndex = offset;
- for (int i = 0; i < realCount; i++, this.head++, dstIndex++)
- {
- if (this.head == this.capacity)
- {
- this.head = 0;
- }
-
- dst[dstIndex] = this.buffer[this.head];
- }
-
- this.size -= realCount;
- return realCount;
- }
-
- ///
- /// Reads a single element from the circular buffer and advances the current read position.
- ///
- /// Element read from the circular buffer.
- public T Get()
- {
- if (this.size == 0)
- {
- throw new InvalidOperationException("Buffer is empty.");
- }
-
- // Missing check for when size != 0 and one of the other get methods is called. It leaves the head pointer == capacity.
- if (this.head == this.capacity)
- {
- this.head = 0;
- }
-
- var item = this.buffer[this.head];
-
- // We probably don't need this now, as we are checking BEFORE we read, like the other methods.
- if (this.head++ == this.capacity)
- {
- this.head = 0;
- }
-
- this.size--;
- return item;
- }
-
- ///
- /// Copies the elements from the circular buffer to an array.
- ///
- /// Destination array.
- public void CopyTo(T[] array)
- {
- this.CopyTo(array, 0);
- }
-
- ///
- /// Copies the elements from the circular buffer to an array.
- ///
- /// Destination array.
- /// A 32-bit integer that represents the index in the array at which writing begins.
- public void CopyTo(T[] array, int arrayIndex)
- {
- // I'm thinking this is just wrong. We should be using the array.Length.
- this.CopyTo(array, arrayIndex, this.size);
- }
-
- ///
- /// Copies the elements from the circular buffer to an array.
- ///
- /// Destination array.
- /// A 32-bit integer that represents the index in the array at which writing begins.
- /// Number of elements to copy.
- public void CopyTo(T[] array, int arrayIndex, int count)
- {
- if (count > this.size)
- {
- throw new ArgumentOutOfRangeException("count", "count cannot be greater than the buffer size.");
- }
-
- int bufferIndex = this.head;
- for (int i = 0; i < count; i++, bufferIndex++, arrayIndex++)
- {
- if (bufferIndex == this.capacity)
- {
- bufferIndex = 0;
- }
-
- array[arrayIndex] = this.buffer[bufferIndex];
- }
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Extensions/WebHeaderCollectionExtensions.cs b/Src/Silverlight.Media.Shoutcast/Extensions/WebHeaderCollectionExtensions.cs
deleted file mode 100644
index a29f95a..0000000
--- a/Src/Silverlight.Media.Shoutcast/Extensions/WebHeaderCollectionExtensions.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Extensions
-{
- using System;
- using System.Collections.Generic;
- using System.Net;
-
- ///
- /// Extension methods for the WebHeaderCollection class.
- ///
- public static class WebHeaderCollectionExtensions
- {
- ///
- /// Converts a WebHeaderCollection to an IDictionary<string, string>.
- ///
- /// WebHeaderCollection to convert to an IDictionary<string, string>.
- /// IDictionary<string, string> representing the provided WebHeaderCollection.
- public static IDictionary ToDictionary(this WebHeaderCollection webHeaderCollection)
- {
- Dictionary headers = new Dictionary(StringComparer.OrdinalIgnoreCase);
- if (webHeaderCollection != null)
- {
- foreach (string key in webHeaderCollection.AllKeys)
- {
- headers.Add(key, webHeaderCollection[key]);
- }
- }
-
- return headers;
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/GPL.txt b/Src/Silverlight.Media.Shoutcast/GPL.txt
deleted file mode 100644
index 94a9ed0..0000000
--- a/Src/Silverlight.Media.Shoutcast/GPL.txt
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/Src/Silverlight.Media.Shoutcast/LICENSE.txt b/Src/Silverlight.Media.Shoutcast/LICENSE.txt
deleted file mode 100644
index 65c5ca8..0000000
--- a/Src/Silverlight.Media.Shoutcast/LICENSE.txt
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/Src/Silverlight.Media.Shoutcast/Metadata/ShoutcastMetadata.cs b/Src/Silverlight.Media.Shoutcast/Metadata/ShoutcastMetadata.cs
deleted file mode 100644
index 8737600..0000000
--- a/Src/Silverlight.Media.Shoutcast/Metadata/ShoutcastMetadata.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Metadata
-{
- using System.Collections.Generic;
- using System.Linq;
-
- ///
- /// Parses MP3 stream metadata.
- ///
- public class ShoutcastMetadata
- {
- ///
- /// Key for the stream title.
- ///
- private const string StreamTitle = "StreamTitle";
-
- ///
- /// Key for the stream url.
- ///
- private const string StreamUrl = "StreamUrl";
-
- ///
- /// Dictionary<string, string> to store the parsed metadata key/value pairs.
- ///
- private Dictionary metadatas = new Dictionary();
-
- ///
- /// Initializes a new instance of the ShoutcastMetadata class.
- ///
- public ShoutcastMetadata()
- : this(string.Empty)
- {
- }
-
- ///
- /// Initializes a new instance of the ShoutcastMetadata class.
- ///
- /// String representing the MP3 stream metadata.
- public ShoutcastMetadata(string metadata)
- {
- this.Title = string.Empty;
- this.Url = string.Empty;
-
- // We'll parse in here for now.
- if (string.IsNullOrEmpty(metadata))
- {
- return;
- }
-
- this.ParseMetadata(metadata);
- }
-
- ///
- /// Gets a value representing the title from the audio stream metadata.
- ///
- public string Title { get; private set; }
-
- ///
- /// Gets a value representing the url from the audio stream metadata.
- ///
- public string Url { get; private set; }
-
- ///
- /// Determines whether the specified Object is equal to the current Object
- ///
- /// The object to compare with the current object.
- /// true if the specified Object is equal to the current Object; otherwise, false.
- public override bool Equals(object obj)
- {
- // We need value-type semantics.
- ShoutcastMetadata other = obj as ShoutcastMetadata;
- if (other == null)
- {
- return false;
- }
-
- return this.Title.Equals(other.Title) && this.Url.Equals(other.Url);
- }
-
- ///
- /// Serves as a hash function for a particular type.
- ///
- /// A hash code for the current Object.
- public override int GetHashCode()
- {
- return this.Title.GetHashCode() ^ this.Url.GetHashCode();
- }
-
- ///
- /// Parses the metadata from the MP3 audio stream.
- ///
- /// String representing the MP3 stream metadata.
- private void ParseMetadata(string metadata)
- {
- if (string.IsNullOrEmpty(metadata))
- {
- return;
- }
-
- // I'm bored, so we'll use some LINQ. :)
- this.metadatas = metadata.Replace("\0", string.Empty).Split(';').Where(s => (!string.IsNullOrEmpty(s)) && (s.IndexOf('=') > -1)).Select(s =>
- {
- int equalSignIndex = s.IndexOf('=');
- string key = s.Substring(0, equalSignIndex);
- string value = s.Length > equalSignIndex ? s.Substring(equalSignIndex + 1).Trim('\'') : string.Empty;
- return new { Key = key, Value = value };
- }).ToDictionary(a => a.Key, a => a.Value);
-
- // Parse out the known values
- string metadataValue;
-
- if (this.metadatas.TryGetValue(ShoutcastMetadata.StreamTitle, out metadataValue))
- {
- this.Title = metadataValue;
- }
-
- if (this.metadatas.TryGetValue(ShoutcastMetadata.StreamUrl, out metadataValue))
- {
- this.Url = metadataValue;
- }
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Parsers/AacpFrame.cs b/Src/Silverlight.Media.Shoutcast/Parsers/AacpFrame.cs
deleted file mode 100644
index a48cda5..0000000
--- a/Src/Silverlight.Media.Shoutcast/Parsers/AacpFrame.cs
+++ /dev/null
@@ -1,237 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Parsers
-{
- using System;
-
- ///
- /// A partial implementation of an AAC audio frame
- ///
- ///
- ///
- /// The primary purpose of this class is to represent an AAC audio file.
- /// Many of the features not explicitly needed for audio rendering are omitted from the implementation.
- ///
- ///
- /// Data on this format is readily discoverable in many books as well as by
- /// searching for "AAC Frame" in your favorite search engine. As always,
- /// Wikipedia is well stocked in all of these areas as well.
- ///
- ///
- public class AacpFrame : AudioFrame
- {
- ///
- /// AAC headers are 7 bytes long.
- ///
- public static readonly int FrameHeaderSize = 7;
-
- ///
- /// AAC frame synchronization bytes.
- ///
- public static readonly byte[] SyncBytes = new byte[] { 0xFF, 0xF0 };
-
- ///
- /// Frame Sync is 12 1s
- ///
- private static readonly int syncValue = 4095;
-
- ///
- /// A table of all of the possible sampling rates of AAC audio.
- ///
- private static int[] sampleRateTable = new int[] { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350, 0, 0, -1 };
-
- ///
- /// A table of all of the possible number of channels for AAC audio.
- ///
- private static int[] numberOfChannelsTable = new int[] { 0, 1, 2, 3, 4, 5, 6, 8, 0, 0, 0, 0, 0, 0, 0, 0 };
-
- ///
- /// Number of bits per block for AAC audio.
- ///
- private static int bitsPerBlock = 6144;
-
- ///
- /// Number of samples per block for AAC audio.
- ///
- private static int samplesPerBlock = 1024;
-
- ///
- /// Initializes a new instance of the AacpFrame class.
- ///
- ///
- ///
- /// This class is a partial implementation of an AAC audio frame. The primary purpose of this class is to represent an AAC
- /// file. Many of the features not explicitly needed for audio rendering are omitted from the implementation.
- ///
- ///
- /// Data on this format is readily discoverable in many books as well as by
- /// searching for "AAC Frame" in your favorite search engine. As always,
- /// Wikipedia is well stocked in all of these areas as well.
- ///
- ///
- /// Byte array containing 4 bytes representing an AAC header.
- public AacpFrame(byte[] frameHeader)
- : base()
- {
- if (frameHeader == null)
- {
- throw new ArgumentNullException("frameHeader");
- }
-
- // Sync
- int value = BitTools.MaskBits(frameHeader, 0, 12);
- if (value != syncValue)
- {
- throw new ArgumentException("Invalid sync value.");
- }
-
- this.NumberOfChannels = AacpFrame.ParseChannel(frameHeader);
- this.SamplingRate = AacpFrame.ParseSampleRate(frameHeader);
- this.BitRate = AacpFrame.CalculateBitRate(this.SamplingRate, this.NumberOfChannels);
- this.FrameSize = AacpFrame.ParseFrameSize(frameHeader);
-
- int objectTypeId = BitTools.MaskBits(frameHeader, 16, 2);
- }
-
- ///
- /// Quickly checks an array of bytes to see if it represents a valid AAC frame header.
- ///
- /// Bytes representing an AAC frame header.
- /// true if the supplied bytes are a valid frame header, otherwise, false.
- public static bool IsValidFrame(byte[] frameHeader)
- {
- if (frameHeader == null)
- {
- throw new ArgumentNullException("frameHeader");
- }
-
- int value = BitTools.MaskBits(frameHeader, 0, 12);
- if (value != AacpFrame.syncValue)
- {
- return false;
- }
-
- int sampleRate = AacpFrame.ParseSampleRate(frameHeader);
-
- if (sampleRate == -1)
- {
- return false;
- }
-
- int numberOfChannels = AacpFrame.ParseChannel(frameHeader);
- if (numberOfChannels == -1)
- {
- return false;
- }
-
- return true;
- }
-
- ///
- /// Determines whether the specified Object is equal to the current Object
- ///
- /// The object to compare with the current object.
- /// true if the specified Object is equal to the current Object; otherwise, false.
- public override bool Equals(object obj)
- {
- AacpFrame other = obj as AacpFrame;
-
- if (other == null)
- {
- return false;
- }
-
- return (this.NumberOfChannels == other.NumberOfChannels) &&
- (this.SamplingRate == other.SamplingRate) &&
- (this.BitRate == other.BitRate);
- }
-
- ///
- /// Generates a hash code for the current Object.
- ///
- /// A hash code for the current Object.
- public override int GetHashCode()
- {
- // Pick a Prime!
- const int Prime = 17;
- int hash = Prime;
- hash = (hash * Prime) + this.NumberOfChannels;
- hash = (hash * Prime) + this.SamplingRate;
- hash = (hash * Prime) + this.BitRate;
- return hash;
- }
-
- ///
- /// Calculates the bit rate for an AAC frame.
- ///
- /// Sample rate of the AAC frame.
- /// Number of channels of the AAC frame.
- /// Bit rate of an AAC frame with the given sample rate and number of channels.
- private static int CalculateBitRate(int sampleRate, int numberOfChannels)
- {
- return AacpFrame.bitsPerBlock / AacpFrame.samplesPerBlock * sampleRate * numberOfChannels;
- }
-
- ///
- /// Parses the AAC frame header to find the actual size of the header.
- ///
- /// Byte array containing the AAC frame header.
- /// Actual size of the supplied AAC frame header.
- private static int ParseFrameSize(byte[] frameHeader)
- {
- int value = BitTools.MaskBits(frameHeader, 30, 13);
- return value;
- }
-
- ///
- /// Parses the sample rate from the supplied AAC frame header.
- ///
- /// Byte array containing the AAC frame header.
- /// The sample rate of the supplied AAC frame header.
- private static int ParseSampleRate(byte[] frameHeader)
- {
- int sampleRateValue = BitTools.MaskBits(frameHeader, 18, 4);
-
- if ((sampleRateValue < 0) || (sampleRateValue > 15))
- {
- return -1;
- }
-
- return AacpFrame.sampleRateTable[sampleRateValue];
- }
-
- ///
- /// Parses the number of channels from the supplied AAC frame header.
- ///
- /// Byte array containing the AAC frame header.
- /// The number of channels of the supplied AAC frame header.
- private static int ParseChannel(byte[] frameHeader)
- {
- int channelValue = BitTools.MaskBits(frameHeader, 23, 3);
-
- if ((channelValue < 1) || (channelValue > 7))
- {
- // Invalid or reserved channel value
- return -1;
- }
-
- return AacpFrame.numberOfChannelsTable[channelValue];
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Parsers/AudioFrame.cs b/Src/Silverlight.Media.Shoutcast/Parsers/AudioFrame.cs
deleted file mode 100644
index 137d692..0000000
--- a/Src/Silverlight.Media.Shoutcast/Parsers/AudioFrame.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Parsers
-{
- ///
- /// Base class used to represent an audio frame.
- ///
- public class AudioFrame
- {
- ///
- /// Initializes a new instance of the AudioFrame class.
- ///
- protected AudioFrame()
- {
- }
-
- ///
- /// Gets or sets the number of channels of the audio frame.
- ///
- public int NumberOfChannels { get; protected set; }
-
- ///
- /// Gets or sets the bit rate of the audio frame.
- ///
- public int BitRate { get; protected set; }
-
- ///
- /// Gets or sets the sampling rate of the audio frame.
- ///
- public int SamplingRate { get; protected set; }
-
- ///
- /// Gets or sets the frame size of the audio frame.
- ///
- public int FrameSize { get; protected set; }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Parsers/BitTools.cs b/Src/Silverlight.Media.Shoutcast/Parsers/BitTools.cs
deleted file mode 100644
index 79f84ba..0000000
--- a/Src/Silverlight.Media.Shoutcast/Parsers/BitTools.cs
+++ /dev/null
@@ -1,335 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// (c) Copyright Larry Olson.
-// This source is subject to the Microsoft Public License (Ms-PL)
-// See http://code.msdn.microsoft.com/ManagedMediaHelpers/Project/License.aspx
-// All other rights reserved.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Parsers
-{
- using System;
- using System.Diagnostics;
-
- ///
- /// Helper methods for manipulating values at the byte and binary level.
- ///
- public static class BitTools
- {
- ///
- /// Defined by ID3v2 spec as 4 bytes
- ///
- private const int SyncSafeIntegerSize = 4;
-
- ///
- /// 1 Byte is 8 bits
- ///
- private const int ByteSize = 8;
-
- ///
- /// Masks out up to an integer sized (4 bytes) set of bits from an
- /// array of bytes.
- ///
- /// An array of data in Little Endian Order
- /// The bit index of the first bit
- /// The length of the mask in bits
- /// An integer of the bits masked out
- public static int MaskBits(byte[] data, int firstBit, int maskSize)
- {
- // Guard against null data
- if (data == null)
- {
- throw new ArgumentNullException("data");
- }
-
- // Clear out numbers which are too small
- if (data.Length <= 0 || firstBit < 0 || maskSize <= 0)
- {
- throw new ArgumentException("data array, firstBit, or maskSize are too small");
- }
-
- // Clear out numbers where you are masking outside of the valid
- // range
- if ((firstBit + maskSize) > data.Length * ByteSize)
- {
- throw new ArgumentException("Attempting to mask outside of the data array");
- }
-
- // Clear out masks which are larger than the number of bits in an
- // int
- if (maskSize > sizeof(int) * ByteSize)
- {
- throw new ArgumentException("maskSize is larger than an integer");
- }
-
- // Figure out what byte the starting bit is in
- int startByteIndex = firstBit / ByteSize; // Int div
-
- // Figure what byte the ending bit is in
- int endByteIndex = (firstBit + maskSize - 1) / ByteSize; // Int div
-
- // initialize the mask
- int mask = 0;
-
- // Build an initial mask with the proper number of bits set to 1
- for (int i = 0; i < maskSize; i++)
- {
- mask |= 1 << i;
- }
-
- // initialize the return value
- long headerValue = 0;
-
- // initialize the bytes to be masked
- /*
- * The desired bits could be spread across 5 bytes
- * but they probably will be spread over fewer bytes
- */
- long temp;
- int shiftAmount;
- for (int bi = startByteIndex; bi <= endByteIndex; bi++)
- {
- temp = data[bi];
-
- shiftAmount = (endByteIndex - bi) * ByteSize;
- temp = temp << shiftAmount;
-
- headerValue = headerValue | temp;
- }
-
- // shift the bits to the right to make an int
- headerValue = headerValue >> (((ByteSize * (endByteIndex + 1)) - (firstBit + maskSize)) % 8);
-
- // mask out the appropriate bits
- headerValue = headerValue & mask;
-
- return (int)headerValue;
- }
-
- ///
- /// Converts a Syncronization Safe integer from the ID3v2 spec into a
- /// standard integer.
- ///
- ///
- /// An array of bytes containing raw data in Syncronization Safe format
- /// as defined in the ID3v2 spec. This means that it is a 4 byte
- /// integer where the leading bit of each byte is a 0.
- /// For Example:
- /// 01111111 01111111 01111111 01111111
- /// Output would be:
- /// 00001111 11111111 11111111 11111111
- /// Assumes syncSafeData array is in Big Endiah Order.
- ///
- ///
- /// Where in the array of bytes, the syncsafe data starts. Note that
- /// data's size is assumed to be 4 bytes in length.
- ///
- ///
- /// A standard integer. Note that this integer can only have a data
- /// resolution of 28 bits (max value of this could only be 2^28 -1).
- ///
- public static int ConvertSyncSafeToInt32(
- byte[] syncSafeData,
- int startIndex)
- {
- int integer = 0;
- int syncSafeByte = 0; // Store byte in an int to enable shifting
- int shiftAmount = 0;
-
- // Guard
- if (syncSafeData == null)
- {
- throw new ArgumentNullException("syncSafeData");
- }
-
- // Guard
- if (startIndex < 0 || startIndex >= syncSafeData.Length)
- {
- throw new ArgumentOutOfRangeException("startIndex", "startIndex is outside of the syncSafeData array");
- }
-
- // Guard
- if (syncSafeData.Length < 4)
- {
- throw new ArgumentException("syncSafeData array is smaller than an integer(4 bytes)", "syncSafeData");
- }
-
- // Guard
- if (startIndex + SyncSafeIntegerSize - 1 >= syncSafeData.Length)
- {
- throw new ArgumentOutOfRangeException("startIndex", "This startIndex is too close to the end of the data array");
- }
-
- // Shifts the first three bytes left and copies them into the int
- // Stop shifting before you hit the last byte. The last byte is
- // already where it needs to be
- int i;
- for (i = 0; i < SyncSafeIntegerSize - 1; i++)
- {
- syncSafeByte = syncSafeData[startIndex + i];
- shiftAmount = (ByteSize - 1) * (SyncSafeIntegerSize - 1 - i);
- integer |= syncSafeByte << shiftAmount;
- }
-
- // Copy the unshifted fourth bit into the int
- syncSafeByte = syncSafeData[startIndex + i];
- integer |= syncSafeByte;
-
- Debug.Assert(integer >= 0, "SyncSafeIntegers after conversion should always have the first 4 bits be 0 by spec and therefore cannot be negative");
- return integer;
- }
-
- ///
- /// Searches a byte array for a pattern of bits.
- ///
- ///
- /// The array of bytes to search for the pattern within.
- ///
- ///
- /// The pattern of bytes to match with undesired bits zeroed out.
- ///
- ///
- /// A mask to zero out bits that aren't part of the pattern.
- ///
- ///
- /// The byte to begin the search from.
- ///
- ///
- /// Returns the location of the first byte in the pattern or -1 if
- /// nothing was found or there was an error.
- ///
- public static int FindBitPattern(byte[] data, byte[] pattern, byte[] mask, int startIndex)
- {
- // GUARD
- if (data == null)
- {
- throw new ArgumentNullException("data");
- }
-
- // GUARD
- if (pattern == null)
- {
- throw new ArgumentNullException("pattern");
- }
-
- // GUARD
- if (mask == null)
- {
- throw new ArgumentNullException("mask");
- }
-
- // GUARD
- if (pattern.Length <= 0 || data.Length <= 0 || data.Length < pattern.Length || mask.Length != pattern.Length)
- {
- return -1;
- }
-
- // GUARD
- if (startIndex < 0 || startIndex >= data.Length)
- {
- throw new ArgumentOutOfRangeException("startIndex", "Start index must be in the range [0,data.Length-1]");
- }
-
- int di = startIndex; // data index
- int pati = 0; // pattern index
-
- while (di < data.Length)
- {
- if (pattern[pati] == (data[di] & mask[pati]))
- {
- pati++;
- }
- else if (pattern[pati] != (data[di] & mask[pati]))
- {
- pati = 0;
- }
- else
- {
- Debug.Assert(false, "All possible states should have already been covered.");
- }
-
- di++;
-
- if (pati == pattern.Length)
- {
- return di - pattern.Length;
- }
- }
-
- return -1;
- }
-
- ///
- /// Searches a byte array for a pattern of bits.
- ///
- ///
- /// The array of bytes to search for the pattern within.
- ///
- ///
- /// The pattern of bytes to match with undesired bits zeroed out.
- ///
- ///
- /// A mask to zero out bits that aren't part of the pattern.
- ///
- ///
- /// Returns the location of the first byte in the pattern or -1 if
- /// nothing was found or there was an error.
- ///
- public static int FindBitPattern(byte[] data, byte[] pattern, byte[] mask)
- {
- return FindBitPattern(data, pattern, mask, 0);
- }
-
- ///
- /// Searches a byte array for a pattern of bytes.
- ///
- ///
- /// The array of bytes to search for the pattern within.
- ///
- ///
- /// The pattern of bytes to match.
- ///
- ///
- /// The byte to begin the search from.
- ///
- ///
- /// Returns the location of the first byte in the pattern or -1 if
- /// nothing was found or there was an error.
- ///
- public static int FindBytePattern(byte[] data, byte[] pattern, int startIndex)
- {
- // GUARD
- if (pattern == null)
- {
- throw new ArgumentNullException("pattern");
- }
-
- byte[] mask = new byte[pattern.Length];
- for (int i = 0; i < pattern.Length; i++)
- {
- mask[i] = byte.MaxValue; // 1111 1111
- }
-
- return FindBitPattern(data, pattern, mask, startIndex);
- }
-
- ///
- /// Searches a byte array for a pattern of bytes.
- ///
- ///
- /// The array of bytes to search for the pattern within.
- ///
- ///
- /// The pattern of bytes to match.
- ///
- ///
- /// Returns the location of the first byte in the pattern or -1 if
- /// nothing was found or there was an error.
- ///
- public static int FindBytePattern(byte[] data, byte[] pattern)
- {
- return FindBytePattern(data, pattern, 0);
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Parsers/HeAacWaveFormat.cs b/Src/Silverlight.Media.Shoutcast/Parsers/HeAacWaveFormat.cs
deleted file mode 100644
index 46e5227..0000000
--- a/Src/Silverlight.Media.Shoutcast/Parsers/HeAacWaveFormat.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Parsers
-{
- using System.Globalization;
-
- ///
- /// A managed representation of the multimedia HEAACWAVEINFO
- /// structure declared in mmreg.h.
- ///
- ///
- /// This was designed for usage in an environment where PInvokes are not
- /// allowed.
- ///
- public class HeAacWaveFormat : WaveFormat
- {
- ///
- /// Initializes a new instance of the HeAacWaveFormat class.
- ///
- /// WaveFormatExtensible instance representing this audio format.
- public HeAacWaveFormat(WaveFormatExtensible waveFormatExtensible)
- : base(waveFormatExtensible)
- {
- }
-
- ///
- /// Gets or sets the the AAC payload type.
- ///
- public short PayloadType { get; set; }
-
- ///
- /// Gets or sets the audio profile indication (as defined in the MPEG-4 audio specification) required to process the audio.
- ///
- public short AudioProfileLevelIndication { get; set; }
-
- ///
- /// Gets or sets the structure type that describes the data that follows this structure (per MPEG-4 audio specification).
- ///
- public short StructType { get; set; }
-
- ///
- /// Returns a string representing the structure in little-endian
- /// hexadecimal format.
- ///
- ///
- /// The string generated here is intended to be passed as
- /// CodecPrivateData for Silverlight's MediaStreamSource
- ///
- ///
- /// A string representing the structure in little-endia hexadecimal
- /// format.
- ///
- public override string ToHexString()
- {
- string s = this.WaveFormatExtensible.ToHexString();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.PayloadType).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.AudioProfileLevelIndication).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.StructType).ToLittleEndian();
- return s;
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Parsers/MpegFrame.cs b/Src/Silverlight.Media.Shoutcast/Parsers/MpegFrame.cs
deleted file mode 100644
index a6e3c3c..0000000
--- a/Src/Silverlight.Media.Shoutcast/Parsers/MpegFrame.cs
+++ /dev/null
@@ -1,518 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// (c) Copyright Larry Olson.
-// This source is subject to the Microsoft Public License (Ms-PL)
-// See http://code.msdn.microsoft.com/ManagedMediaHelpers/Project/License.aspx
-// All other rights reserved.
-//
-//-----------------------------------------------------------------------
-
-// Supressing Code Analysis rule(s)
-
-[module: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional",
- Scope = "member",
- Target = "Silverlight.Media.Parsers.MpegFrame.#bitrateTable",
- MessageId = "Member",
- Justification = "Array is not Jagged and does not waste space.")]
-
-[module: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional",
- Scope = "member",
- Target = "Silverlight.Media.Parsers.MpegFrame.#samplingRateTable",
- MessageId = "Member",
- Justification = "Array is not Jagged and does not waste space.")]
-
-namespace Silverlight.Media.Parsers
-{
- using System;
- using System.IO;
-
- ///
- /// Reproduction mode of given audio data. Typically maps to the number of
- /// output devices used to reproduce it.
- ///
- public enum Channel
- {
- ///
- /// Stereo: independent audio typically output to 2 speakers and is intended
- /// to create a more realistic or pleasing representation of audio by
- /// representing sound coming from multiple directons.
- ///
- Stereo = 0,
-
- ///
- /// Joint Stereo: The joining of multiple channels of audio to create another separate
- /// one, to reduce the size of the file, or to increase the quality.
- ///
- JointStereo,
-
- ///
- /// Dual Channel: Two independent Mono channels. May overlap with stereo or may
- /// be completely independent as in the case of foreign language audio dubbing.
- ///
- DualChannel,
-
- ///
- /// Single Channel: Also known as Mono. Typically the reproduction of a single
- /// independent audio stream in one device or of the same independent audio stream
- /// in multiple devices.
- ///
- SingleChannel,
- }
-
- ///
- /// A partial implementation of an MPEG audio frame
- ///
- ///
- ///
- /// The primary purpose of this class is to represent an Mpeg 1 Layer 3
- /// file or MP3 file for short. Many of the features not explicitly needed
- /// for audio rendering are omitted from the implementation.
- ///
- ///
- /// Data on this format is readily discoverable in many books as well as by
- /// searching for "MP3 Frame" in your favorite search engine. As always,
- /// Wikipedia is well stocked in all of these areas as well.
- ///
- ///
- public class MpegFrame : AudioFrame
- {
- ///
- /// MP3 Headers are 4 Bytes long
- ///
- public const int FrameHeaderSize = 4;
-
- ///
- /// MP3 frame synchronization bytes.
- ///
- public static readonly byte[] SyncBytes = new byte[] { 0xFF, 0xE0 };
-
- ///
- /// Frame Sync is 11 1s
- ///
- private const int SyncValue = 2047;
-
- ///
- /// A table of bitrates / 1000. These are all of the possible bitrates for Mpeg 1 - 2.5 audio. -1 encodes an error lookup.
- ///
- private static int[,] bitrateTable = new int[,]
- {
- { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 },
- { 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 },
- { 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 },
- { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256 },
- { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 }
- };
-
- ///
- /// A table of all of the possible sampling rates of Mpeg 1 - 2.5 audio.
- ///
- private static int[,] samplingRateTable = new int[,]
- {
- { 44100, 48000, 32000 },
- { 22050, 24000, 16000 },
- { 11025, 12000, 8000 }
- };
-
- ///
- /// Initializes a new instance of the MpegFrame class.
- ///
- ///
- ///
- /// This class is a partial implementation of an MPEG audio frame. The primary purpose of this class is to represent an Mpeg 1 Layer 3
- /// file or MP3 file for short. Many of the features not explicitly needed
- /// for audio rendering are omitted from the implementation.
- ///
- ///
- /// Data on this format is readily discoverable in many books as well as by
- /// searching for "MP3 Frame" in your favorite search engine. As always,
- /// Wikipedia is well stocked in all of these areas as well.
- ///
- ///
- /// Byte array containing 4 bytes representing an MPEG Layer 3 header.
- public MpegFrame(byte[] frameHeader)
- {
- if (frameHeader == null)
- {
- throw new ArgumentNullException("frameHeader");
- }
-
- if (frameHeader.Length != 4)
- {
- throw new ArgumentException("Invalid frame header length.");
- }
-
- // Sync
- int value = BitTools.MaskBits(frameHeader, 0, 11);
- if (value != SyncValue)
- {
- throw new ArgumentException("Invalid sync value.");
- }
-
- this.Version = ParseVersion(frameHeader);
- this.Layer = ParseLayer(frameHeader);
- this.IsProtected = BitTools.MaskBits(frameHeader, 15, 1) == 1 ? false : true;
- this.BitrateIndex = BitTools.MaskBits(frameHeader, 16, 4);
- this.SamplingRateIndex = BitTools.MaskBits(frameHeader, 20, 2);
- this.Padding = BitTools.MaskBits(frameHeader, 22, 1);
- //// Private Bit = BitTools.MaskBits(_mp3FrameHeader,8,1); //USELESS
- this.Channels = ParseChannel(frameHeader);
- //// Joint Mode = ParseJoitMode(_mp3FrameHeader); //Not used by Mp3MSS
- //// CopyRight = BitTools.MaskBits(_mp3FrameHeader,3,1); //Not used by Mp3MSS
- //// Original = BitTools.MaskBits(_mp3FrameHeader,2,1); //Not used by Mp3MSS
- //// Emphasis = ParseEmphasis(_mp3FrameHeader); //Not used by Mp3MSS
-
- this.BitRate = MpegFrame.CalculateBitRate(this.Version, this.Layer, this.BitrateIndex);
- this.SamplingRate = MpegFrame.LookupSamplingRate(this.Version, this.SamplingRateIndex);
- this.FrameSize = MpegFrame.CalculateFrameSize(this.Version, this.Layer, this.BitRate, this.SamplingRate, this.Padding);
- this.NumberOfChannels = (this.Channels == Channel.SingleChannel) ? 1 : 2;
-
- if ((this.Version == -1) || (this.Layer == -1) ||
- (this.BitrateIndex < 0) || (this.BitrateIndex >= 15) ||
- (this.SamplingRateIndex < 0) || (this.SamplingRateIndex >= 3))
- {
- throw new ArgumentException("Invalid header values");
- }
-
- // Add in the bytes we already read
- if (this.FrameSize <= 0)
- {
- throw new InvalidOperationException("MpegFrame's FrameSize must be greater than zero.");
- }
- }
-
- /**********************************************************************
- * FILE DATA- data which comes directly from the MP3 header.
- *********************************************************************/
- #region File Data
-
- ///
- /// Gets the Version of the MPEG standard this frame conforms to.
- /// MPEG 1, MPEG 2, or MPEG 2.5
- ///
- public int Version { get; private set; }
-
- ///
- /// Gets the layer of complexity used in this frame.
- /// Layer 1, 2, or 3.
- ///
- public int Layer { get; private set; }
-
- ///
- /// Gets a value indicating whether or not the frame is protected by a
- /// Cyclic Redundancy Check (CRC). If true, then a 16 bit
- /// CRC follows the header.
- ///
- public bool IsProtected { get; private set; }
-
- ///
- /// Gets the Index into the bitrate table as defined in the MPEG spec.
- ///
- public int BitrateIndex { get; private set; }
-
- ///
- /// Gets the Index into the samplingrate table as defined in the MPEG spec.
- ///
- public int SamplingRateIndex { get; private set; }
-
- ///
- /// Gets the number of additional bytes of padding in this frame.
- ///
- public int Padding { get; private set; }
-
- ///
- /// Gets the output channel used to playback this frame.
- ///
- public Channel Channels { get; private set; }
-
- #endregion
-
- ///
- /// Quickly checks an array of bytes to see if it represents a valid MP3 frame header.
- ///
- /// Bytes representing an MP3 frame header.
- /// true if the supplied bytes are a valid frame header, otherwise, false.
- public static bool IsValidFrame(byte[] frameHeader)
- {
- if (frameHeader == null)
- {
- throw new ArgumentNullException("frameHeader");
- }
-
- if (frameHeader.Length != 4)
- {
- throw new ArgumentException("frameHeader must be of length 4.");
- }
-
- int value = BitTools.MaskBits(frameHeader, 0, 11);
- if (value != SyncValue)
- {
- return false;
- }
-
- int version = ParseVersion(frameHeader);
- int layer = ParseLayer(frameHeader);
- int bitrateIndex = BitTools.MaskBits(frameHeader, 16, 4);
- int samplingRateIndex = BitTools.MaskBits(frameHeader, 20, 2);
- if ((version == -1) || (layer == -1) ||
- (bitrateIndex < 0) || (bitrateIndex >= 15) ||
- (samplingRateIndex < 0) || (samplingRateIndex >= 3))
- {
- return false;
- }
-
- return true;
- }
-
- ///
- /// Determines whether the specified Object is equal to the current Object
- ///
- /// The object to compare with the current object.
- /// true if the specified Object is equal to the current Object; otherwise, false.
- public override bool Equals(object obj)
- {
- MpegFrame other = obj as MpegFrame;
-
- if (other == null)
- {
- return false;
- }
-
- return (this.Version == other.Version) &&
- (this.Layer == other.Layer) &&
- (this.SamplingRate == other.SamplingRate) &&
- (this.Channels == other.Channels);
- }
-
- ///
- /// Generates a hash code for the current Object.
- ///
- /// A hash code for the current Object.
- public override int GetHashCode()
- {
- // Pick a Prime!
- const int Prime = 17;
- int hash = Prime;
- hash = (hash * Prime) + this.Version;
- hash = (hash * Prime) + this.Layer;
- hash = (hash * Prime) + this.SamplingRate;
- hash = (hash * Prime) + (int)this.Channels;
- return hash;
- }
-
- ///
- /// Converts the MpegFrame into a human readable form.
- ///
- ///
- /// A textual representation of the MpegFrame.
- ///
- public override string ToString()
- {
- string s = string.Empty;
- s += "FrameSize\t" + this.FrameSize + "\n";
- s += "BitRate\t" + this.BitRate + "\n";
- s += "SamplingRate" + this.SamplingRate + "\n";
- return s;
- }
-
- /**********************************************************************
- * DERIVED DATA - data which is calculated from data in the header.
- *********************************************************************/
- #region Derived Data
-
- ///
- /// Calculates the bit rate of the Mp3 audio from the data in the frame header.
- ///
- /// Mp3 version parsed out of the audio frame header.
- /// Mp3 layer parsed out of the audio frame header.
- /// Mp3 Bit rate index parsed out of the audio frame header.
- /// Mp3 bit rate calculated from the provided values, if valid. Otherwise, -2 is returned.
- private static int CalculateBitRate(int version, int layer, int bitRateIndex)
- {
- switch (version)
- {
- case 1: // Version 1.0
- switch (layer)
- {
- case 1: // MPEG 1 Layer 1
- return bitrateTable[0, bitRateIndex] * 1000;
- case 2: // MPEG 1 Layer 2
- return bitrateTable[1, bitRateIndex] * 1000;
- case 3: // MPEG 1 Layer 3 (MP3)
- return bitrateTable[2, bitRateIndex] * 1000;
- default: // MPEG 1 LAYER ERROR
- return -2;
- }
-
- case 2: // Version 2.0
- case 3: // Version 2.5 in reality
- switch (layer)
- {
- case 1: // MPEG 2 or 2.5 Layer 1
- return bitrateTable[3, bitRateIndex] * 1000;
- case 2: // MPEG 2 or 2.5 Layer 2
- case 3: // MPEG 2 or 2.5 Layer 3
- return bitrateTable[4, bitRateIndex] * 1000;
- default: // Mpeg 2 LAYER ERROR
- return -2;
- }
-
- default: // VERSION ERROR
- return -2;
- }
- }
-
- ///
- /// Looks up the sampling rate of the Mp3 audio from the data in the frame header.
- ///
- /// Mp3 version parsed out of the audio frame header.
- /// Mp3 sampling rate index parsed out of the audio frame header.
- /// Mp3 sampling rate for the provided version and sampling rate index, if valid. Otherwise, -1 is returned.
- private static int LookupSamplingRate(int version, int samplingRateIndex)
- {
- switch (version)
- {
- case 1: // MPEG 1
- return samplingRateTable[0, samplingRateIndex];
- case 2: // MPEG 2
- return samplingRateTable[1, samplingRateIndex];
- case 3: // MPEG 2.5
- return samplingRateTable[2, samplingRateIndex];
- default:
- return -1; // RESERVED
- }
- }
-
- ///
- /// Calculates the frame size given the header information from the Mp3 frame.
- ///
- /// Mp3 version.
- /// Mp3 layer.
- /// Mp3 bit rate.
- /// Mp3 sampling rate.
- /// Mp3 padding.
- /// Mp3 frame size calculated from the provided values, if valid. Otherwise, -1 is returned.
- private static int CalculateFrameSize(int version, int layer, int bitRate, int samplingRate, int padding)
- {
- switch (layer)
- {
- case 1:
- return ((12 * bitRate / samplingRate) + padding) * 4;
- case 2:
- case 3:
- // MPEG2 is a special case here.
- switch (version)
- {
- case 1:
- return (144 * bitRate / samplingRate) + padding;
- case 2:
- case 3:
- return (72 * bitRate / samplingRate) + padding;
- default:
- return -1;
- }
-
- default:
- return -1;
- }
- }
-
- #endregion
-
- ///
- /// Parses the version of the MPEG standard this frame header conforms to from the frame header.
- ///
- /// The 4 byte header for this frame.
- ///
- /// The version of the MPEG standard this frame conforms to.
- /// 1 = Mpeg 1
- /// 2 = Mpeg 2
- /// 3 = Mpeg 2.5
- ///
- private static int ParseVersion(byte[] frameHeader)
- {
- int version;
- int versionValue = BitTools.MaskBits(frameHeader, 11, 2);
-
- switch (versionValue)
- {
- case 3:
- version = 1;
- break;
- case 2:
- version = 2;
- break;
- case 0:
- version = 3;
- break;
- default:
- // This indicates an invalid version.
- version = -1;
- break;
- }
-
- return version;
- }
-
- ///
- /// Parses which complexity layer of the MPEG standard this frame conforms to from the frame header.
- ///
- /// The 4 byte header for this frame.
- /// The complexity layer this frame conforms to.
- private static int ParseLayer(byte[] frameHeader)
- {
- int layer;
- int layerValue = BitTools.MaskBits(frameHeader, 13, 2);
-
- switch (layerValue)
- {
- case 3:
- layer = 1;
- break;
- case 2:
- layer = 2;
- break;
- case 1:
- layer = 3;
- break;
- default:
- // This indicates an invalid layer.
- layer = -1;
- break;
- }
-
- return layer;
- }
-
- ///
- /// Parses the audio output mode of this frame's audio data.
- ///
- /// The 4 byte header for this frame.
- /// The audio output mode of this frame's audio data.
- private static Channel ParseChannel(byte[] frameHeader)
- {
- Channel channel;
- int channelValue = BitTools.MaskBits(frameHeader, 24, 2);
-
- switch (channelValue)
- {
- case 3:
- channel = Channel.SingleChannel;
- break;
- case 2:
- channel = Channel.DualChannel;
- break;
- case 1:
- channel = Channel.JointStereo;
- break;
- case 0:
- channel = Channel.Stereo;
- break;
- default:
- channel = Channel.SingleChannel; // ERROR CASE
- break;
- }
-
- return channel;
- }
- }
-}
\ No newline at end of file
diff --git a/Src/Silverlight.Media.Shoutcast/Parsers/MpegLayer3WaveFormat.cs b/Src/Silverlight.Media.Shoutcast/Parsers/MpegLayer3WaveFormat.cs
deleted file mode 100644
index 03df0cf..0000000
--- a/Src/Silverlight.Media.Shoutcast/Parsers/MpegLayer3WaveFormat.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// (c) Copyright Larry Olson.
-// This source is subject to the Microsoft Public License (Ms-PL)
-// See http://code.msdn.microsoft.com/ManagedMediaHelpers/Project/License.aspx
-// All other rights reserved.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Parsers
-{
- using System;
- using System.Globalization;
-
- ///
- /// A managed representation of the multimedia MPEGLAYER3WAVEFORMATEX
- /// structure declared in mmreg.h.
- ///
- ///
- /// This was designed for usage in an environment where PInvokes are not
- /// allowed.
- ///
- public class MpegLayer3WaveFormat : WaveFormat
- {
- ///
- /// Initializes a new instance of the MpegLayer3WaveFormat class.
- ///
- /// WaveFormatExtensible instance representing this audio format.
- public MpegLayer3WaveFormat(WaveFormatExtensible waveFormatExtensible)
- : base(waveFormatExtensible)
- {
- }
-
- ///
- /// Gets or sets the FormatTag that defines what type of waveform audio this is.
- ///
- ///
- /// Set this to
- /// MPEGLAYER3_ID_MPEG = 1
- ///
- public short Id { get; set; }
-
- ///
- /// Gets or sets the bitrate padding mode.
- /// This value is set in an Mp3 file to determine if padding is needed to adjust the average bitrate
- /// to meet the sampling rate.
- /// 0 = adjust as needed
- /// 1 = always pad
- /// 2 = never pad
- ///
- ///
- /// This is different than the unmanaged version of MpegLayer3WaveFormat
- /// which has the field Flags instead of this name.
- ///
- public int BitratePaddingMode { get; set; }
-
- ///
- /// Gets or sets the Block Size in bytes. For MP3 audio this is
- /// 144 * bitrate / samplingRate + padding
- ///
- public short BlockSize { get; set; }
-
- ///
- /// Gets or sets the number of frames per block.
- ///
- public short FramesPerBlock { get; set; }
-
- ///
- /// Gets or sets the encoder delay in samples.
- ///
- public short CodecDelay { get; set; }
-
- ///
- /// Returns a string representing the structure in little-endian
- /// hexadecimal format.
- ///
- ///
- /// The string generated here is intended to be passed as
- /// CodecPrivateData for Silverlight 2's MediaStreamSource
- ///
- ///
- /// A string representing the structure in little-endia hexadecimal
- /// format.
- ///
- public override string ToHexString()
- {
- string s = WaveFormatExtensible.ToHexString();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.Id).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X8}", this.BitratePaddingMode).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.BlockSize).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.FramesPerBlock).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.CodecDelay).ToLittleEndian();
- return s;
- }
-
- ///
- /// Returns a string representing all of the fields in the object.
- ///
- ///
- /// A string representing all of the fields in the object.
- ///
- public override string ToString()
- {
- return "MPEGLAYER3 "
- + WaveFormatExtensible.ToString()
- + string.Format(
- CultureInfo.InvariantCulture,
- "ID: {0}, Flags: {1}, BlockSize: {2}, FramesPerBlock {3}, CodecDelay {4}",
- this.Id,
- this.BitratePaddingMode,
- this.BlockSize,
- this.FramesPerBlock,
- this.CodecDelay);
- }
- }
-}
\ No newline at end of file
diff --git a/Src/Silverlight.Media.Shoutcast/Parsers/StringExtensions.cs b/Src/Silverlight.Media.Shoutcast/Parsers/StringExtensions.cs
deleted file mode 100644
index 03128c1..0000000
--- a/Src/Silverlight.Media.Shoutcast/Parsers/StringExtensions.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// (c) Copyright Larry Olson.
-// This source is subject to the Microsoft Public License (Ms-PL)
-// See http://code.msdn.microsoft.com/ManagedMediaHelpers/Project/License.aspx
-// All other rights reserved.
-//
-//-----------------------------------------------------------------------
-
-// Supressing Code Analysis rule(s)
-[module: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes",
- Scope = "namespace",
- Target = "ExtensionMethods",
- Justification = "This is appropriate as a separate namespace because it logically is separate from the ManagedMediaParsers namespace.")]
-
-[module: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes",
- Scope = "member",
- Target = "ExtensionMethods.StringExtensions.#ToLittleEndian(System.String)",
- Justification = "This is appropriate to make this method look like a first class member of string.")]
-
-namespace Silverlight.Media.Parsers
-{
- using System;
-
- ///
- /// Extensions for the standard string class.
- ///
- public static class StringExtensions
- {
- ///
- ///
- /// Converts a string of characters from Big Endian byte order to
- /// Little Endian byte order.
- ///
- ///
- /// Assumptions this makes about the string. Every two characters
- /// make up the smallest data unit (analogous to byte). The entire
- /// string is the size of the systems natural unit of data (analogous
- /// to a word).
- ///
- ///
- ///
- /// A string in Big Endian Byte order.
- ///
- ///
- /// A string in Little Endian Byte order.
- ///
- ///
- /// This function was designed to take in a Big Endian string of
- /// hexadecimal digits.
- ///
- /// input:
- /// DEADBEEF
- /// output:
- /// EFBEADDE
- ///
- ///
- public static string ToLittleEndian(this string value)
- {
- // Guard
- if (value == null)
- {
- throw new NullReferenceException();
- }
-
- char[] bigEndianChars = value.ToCharArray();
-
- // Guard
- if (bigEndianChars.Length % 2 != 0)
- {
- return string.Empty;
- }
-
- int i, ai, bi, ci, di;
- char a, b, c, d;
-
- for (i = 0; i < bigEndianChars.Length / 2; i += 2)
- {
- // front byte ( in hex )
- ai = i;
- bi = i + 1;
-
- // back byte ( in hex )
- ci = bigEndianChars.Length - 2 - i;
- di = bigEndianChars.Length - 1 - i;
-
- a = bigEndianChars[ai];
- b = bigEndianChars[bi];
- c = bigEndianChars[ci];
- d = bigEndianChars[di];
-
- bigEndianChars[ci] = a;
- bigEndianChars[di] = b;
- bigEndianChars[ai] = c;
- bigEndianChars[bi] = d;
- }
-
- return new string(bigEndianChars);
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Parsers/WaveFormat.cs b/Src/Silverlight.Media.Shoutcast/Parsers/WaveFormat.cs
deleted file mode 100644
index d7ad6ce..0000000
--- a/Src/Silverlight.Media.Shoutcast/Parsers/WaveFormat.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Parsers
-{
- using System;
-
- ///
- /// Base class for wave format support.
- ///
- public abstract class WaveFormat
- {
- ///
- /// Initializes a new instance of the WaveFormat class.
- ///
- /// WaveFormatExtensible instance representing an audio format.
- public WaveFormat(WaveFormatExtensible waveFormatExtensible)
- {
- if (waveFormatExtensible == null)
- {
- throw new ArgumentNullException("waveFormatExtensible");
- }
-
- this.WaveFormatExtensible = waveFormatExtensible;
- }
-
- ///
- /// Gets the core WaveFormatExtensible strucutre representing the Mp3 audio data's
- /// core attributes.
- ///
- ///
- /// wfx.FormatTag must be WAVE_FORMAT_MPEGLAYER3 = 0x0055 = (85)
- /// wfx.Size must be >= 12
- ///
- public WaveFormatExtensible WaveFormatExtensible { get; private set; }
-
- ///
- /// Returns a string representing the structure in little-endian
- /// hexadecimal format.
- ///
- ///
- /// The string generated here is intended to be passed as
- /// CodecPrivateData for Silverlight's MediaStreamSource
- ///
- ///
- /// A string representing the structure in little-endia hexadecimal
- /// format.
- ///
- public abstract string ToHexString();
-
- ///
- /// Calculate the duration of audio based on the size of the buffer
- ///
- /// the buffer size in bytes
- /// The duration of that buffer
- public long AudioDurationFromBufferSize(uint audioDataSize)
- {
- if (this.WaveFormatExtensible.AverageBytesPerSecond == 0)
- {
- return 0;
- }
-
- return (long)audioDataSize * 10000000 / this.WaveFormatExtensible.AverageBytesPerSecond;
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Parsers/WaveFormatExtensible.cs b/Src/Silverlight.Media.Shoutcast/Parsers/WaveFormatExtensible.cs
deleted file mode 100644
index 04bbbdd..0000000
--- a/Src/Silverlight.Media.Shoutcast/Parsers/WaveFormatExtensible.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// (c) Copyright Larry Olson.
-// This source is subject to the Microsoft Public License (Ms-PL)
-// See http://code.msdn.microsoft.com/ManagedMediaHelpers/Project/License.aspx
-// All other rights reserved.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Parsers
-{
- using System;
- using System.Globalization;
-
- ///
- /// A managed representation of the multimedia WAVEFORMATEX structure
- /// declared in mmreg.h.
- ///
- ///
- /// This was designed for usage in an environment where PInvokes are not
- /// allowed.
- ///
- public class WaveFormatExtensible
- {
- ///
- /// Gets or sets the audio format type. A complete list of format tags can be
- /// found in the Mmreg.h header file.
- ///
- ///
- /// Silverlight 2 supports:
- /// WMA 7,8,9
- /// WMA 10 Pro
- /// Mp3
- /// WAVE_FORMAT_MPEGLAYER3 = 0x0055
- ///
- public short FormatTag { get; set; }
-
- ///
- /// Gets or sets the number of channels in the data.
- /// Mono 1
- /// Stereo 2
- /// Dual 2 (2 Mono channels)
- ///
- ///
- /// Silverlight 2 only supports stereo output and folds down higher
- /// numbers of channels to stereo.
- ///
- public short Channels { get; set; }
-
- ///
- /// Gets or sets the sampling rate in hertz (samples per second)
- ///
- public int SamplesPerSec { get; set; }
-
- ///
- /// Gets or sets the average data-transfer rate, in bytes per second, for the format.
- ///
- public int AverageBytesPerSecond { get; set; }
-
- ///
- /// Gets or sets the minimum size of a unit of data for the given format in Bytes.
- ///
- public short BlockAlign { get; set; }
-
- ///
- /// Gets or sets the number of bits in a single sample of the format's data.
- ///
- public short BitsPerSample { get; set; }
-
- ///
- /// Gets or sets the size in bytes of any extra format data added to the end of the
- /// WAVEFORMATEX structure.
- ///
- public short Size { get; set; }
-
- ///
- /// Returns a string representing the structure in little-endian
- /// hexadecimal format.
- ///
- ///
- /// The string generated here is intended to be passed as
- /// CodecPrivateData for Silverlight 2's MediaStreamSource
- ///
- ///
- /// A string representing the structure in little-endia hexadecimal
- /// format.
- ///
- public string ToHexString()
- {
- string s = string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.FormatTag).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.Channels).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X8}", this.SamplesPerSec).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X8}", this.AverageBytesPerSecond).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.BlockAlign).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.BitsPerSample).ToLittleEndian();
- s += string.Format(CultureInfo.InvariantCulture, "{0:X4}", this.Size).ToLittleEndian();
- return s;
- }
-
- ///
- /// Returns a string representing all of the fields in the object.
- ///
- ///
- /// A string representing all of the fields in the object.
- ///
- public override string ToString()
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "WAVEFORMATEX FormatTag: {0}, Channels: {1}, SamplesPerSec: {2}, AvgBytesPerSec: {3}, BlockAlign: {4}, BitsPerSample: {5}, Size: {6} ",
- this.FormatTag,
- this.Channels,
- this.SamplesPerSec,
- this.AverageBytesPerSecond,
- this.BlockAlign,
- this.BitsPerSample,
- this.Size);
- }
- }
-}
\ No newline at end of file
diff --git a/Src/Silverlight.Media.Shoutcast/Playlist/DuplicateNameHandling.cs b/Src/Silverlight.Media.Shoutcast/Playlist/DuplicateNameHandling.cs
deleted file mode 100644
index 9f79f60..0000000
--- a/Src/Silverlight.Media.Shoutcast/Playlist/DuplicateNameHandling.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
-
- ///
- /// Describes how IniParser will handle duplicate names within a section.
- ///
- public enum DuplicateNameHandling
- {
- ///
- /// Throw an InvalidOperationException when a duplicate name within a section is encountered.
- ///
- Abort,
-
- ///
- /// Ignore the value when a dupliate name within a section is encountered.
- ///
- Discard,
-
- ///
- /// Overwrite the existing value when a duplicate name within a section is encountered.
- ///
- Overwrite
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Playlist/IPlaylist.cs b/Src/Silverlight.Media.Shoutcast/Playlist/IPlaylist.cs
deleted file mode 100644
index 0f5b7f1..0000000
--- a/Src/Silverlight.Media.Shoutcast/Playlist/IPlaylist.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System.Collections.Generic;
-
- ///
- /// Interface representing an audio stream playlist.
- ///
- public interface IPlaylist
- {
- ///
- /// Gets an ICollection of IPlaylist entries.
- ///
- ICollection Items { get; }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Playlist/IPlaylistItem.cs b/Src/Silverlight.Media.Shoutcast/Playlist/IPlaylistItem.cs
deleted file mode 100644
index 2d6cbcd..0000000
--- a/Src/Silverlight.Media.Shoutcast/Playlist/IPlaylistItem.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
-
- ///
- /// Interface representing an audio stream playlist entry.
- ///
- public interface IPlaylistItem
- {
- ///
- /// Gets or sets the display name of the playlist entry.
- ///
- string DisplayName { get; set; }
-
- ///
- /// Gets or sets the length, in seconds, of the playlist entry.
- ///
- TimeSpan Length { get; set; }
-
- ///
- /// Gets or sets the path of the playlist entry. This is usually a Uri, but can be a file path as well.
- ///
- string Path { get; set; }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Playlist/IPlaylistParser.cs b/Src/Silverlight.Media.Shoutcast/Playlist/IPlaylistParser.cs
deleted file mode 100644
index b555399..0000000
--- a/Src/Silverlight.Media.Shoutcast/Playlist/IPlaylistParser.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
- using System.Collections.Generic;
- using System.IO;
-
- ///
- /// Interface representing a audio stream playlist parser.
- ///
- public interface IPlaylistParser
- {
- ///
- /// Gets the Internet content type supported by this playlist parser.
- ///
- string ContentType { get; }
-
- ///
- /// Parses the supplied Stream into an IPlaylist instance.
- ///
- /// Stream representing the playlist data.
- /// Successfully parsed IPlaylist instance.
- IPlaylist Parse(Stream stream);
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Playlist/IniParser.cs b/Src/Silverlight.Media.Shoutcast/Playlist/IniParser.cs
deleted file mode 100644
index e143385..0000000
--- a/Src/Silverlight.Media.Shoutcast/Playlist/IniParser.cs
+++ /dev/null
@@ -1,166 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.IO;
- using System.Text.RegularExpressions;
-
- ///
- /// Parses INI file format.
- ///
- public class IniParser
- {
- ///
- /// Regex to parse comment lines.
- ///
- private static Regex iniComment = new Regex(@"^\s*;.");
-
- ///
- /// Regex to parse section names.
- ///
- private static Regex iniSectionName = new Regex(@"^\[(?[\w\s]*)\]$");
-
- ///
- /// Regex to parse key/value pairs.
- ///
- private static Regex iniKeyValue = new Regex(@"^(?[\w\s]*)=(?.*)");
-
- ///
- /// Field to store duplicate name handling enumeration.
- ///
- private DuplicateNameHandling duplicateNameHandling;
-
- ///
- /// Dictionary to store ini file sections and their associated key/value pairs.
- ///
- private Dictionary> sections = new Dictionary>(StringComparer.CurrentCultureIgnoreCase);
-
- ///
- /// Initializes a new instance of the IniParser class.
- ///
- /// TextReader representing an ini file.
- public IniParser(TextReader textReader)
- : this(textReader, DuplicateNameHandling.Abort)
- {
- }
-
- ///
- /// Initializes a new instance of the IniParser class.
- ///
- /// TextReader representing an ini file.
- /// Specifies how IniParser will handle duplicate names.
- public IniParser(TextReader textReader, DuplicateNameHandling duplicateNameHandling)
- {
- if (textReader == null)
- {
- throw new ArgumentNullException("textReader");
- }
-
- this.duplicateNameHandling = duplicateNameHandling;
- this.Parse(textReader);
- }
-
- ///
- /// Gets the sections from the ini file containing name/value pairs.
- ///
- public Dictionary> Sections
- {
- get { return this.sections; }
- }
-
- ///
- /// Parses the ini file.
- ///
- /// TextReader representing an ini file.
- private void Parse(TextReader textReader)
- {
- if (textReader == null)
- {
- throw new ArgumentNullException("textReader");
- }
-
- int lineNumber = 0;
- string line = null;
- Dictionary currentSection = null;
-
- while ((line = textReader.ReadLine()) != null)
- {
- lineNumber++;
-
- // Skip blank lines and comments
- if (string.IsNullOrEmpty(line) || IniParser.iniComment.IsMatch(line))
- {
- continue;
- }
-
- Match match = IniParser.iniSectionName.Match(line);
- if (match.Success)
- {
- if (this.sections.ContainsKey(match.Groups["name"].Value))
- {
- throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Section name already exists: {0}", match.Groups["name"].Value));
- }
-
- currentSection = new Dictionary(StringComparer.CurrentCultureIgnoreCase);
- this.sections.Add(match.Groups["name"].Value, currentSection);
- }
- else
- {
- // Not a section, so maybe a key/value
- match = IniParser.iniKeyValue.Match(line);
- if (match.Success)
- {
- // If we have a null current section, the file format is invalid
- if (currentSection == null)
- {
- throw new InvalidOperationException("No current section");
- }
-
- if (currentSection.ContainsKey(match.Groups["key"].Value))
- {
- if (this.duplicateNameHandling == DuplicateNameHandling.Abort)
- {
- throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Duplicate key: {0}", match.Groups["key"].Value));
- }
- else if (this.duplicateNameHandling == DuplicateNameHandling.Overwrite)
- {
- currentSection[match.Groups["key"].Value] = match.Groups["value"].Value;
- }
- else if (this.duplicateNameHandling == DuplicateNameHandling.Discard)
- {
- // Just in case we need to add something in this case.
- continue;
- }
- }
-
- currentSection.Add(match.Groups["key"].Value, match.Groups["value"].Value);
- }
- else
- {
- // Invalid format
- throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Invalid line #: {0}", lineNumber));
- }
- }
- }
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Playlist/M3uParser.cs b/Src/Silverlight.Media.Shoutcast/Playlist/M3uParser.cs
deleted file mode 100644
index a75e039..0000000
--- a/Src/Silverlight.Media.Shoutcast/Playlist/M3uParser.cs
+++ /dev/null
@@ -1,176 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text.RegularExpressions;
-
- ///
- /// Parses M3U playlist.
- ///
- public class M3uParser : IPlaylistParser
- {
- ///
- /// Content type of the m3u playlist format.
- ///
- internal const string M3uContentType = "audio/x-mpegurl";
-
- ///
- /// M3U Extended Header tag.
- ///
- private const string M3uExtendedHeader = "#EXTM3U";
-
- ///
- /// M3U Extended Detail tag.
- ///
- private const string M3uExtendedDetail = "#EXTINF";
-
- ///
- /// Regex to parse M3U Extended Detail.
- ///
- private static Regex extendedDetailRegex = new Regex(M3uParser.M3uExtendedDetail + @":(?[\+-]?\d+),(?.*)");
-
- ///
- /// Initializes a new instance of the M3uParser class.
- ///
- public M3uParser()
- {
- }
-
- ///
- /// Initializes a new instance of the M3uParser class.
- ///
- /// TextReader representing an M3U file.
- public M3uParser(TextReader textReader)
- {
- if (textReader == null)
- {
- throw new ArgumentNullException("textReader");
- }
-
- this.Parse(textReader);
- }
-
- ///
- /// Gets the supported content type of the M3U playlist format.
- ///
- public string ContentType
- {
- get { return M3uParser.M3uContentType; }
- }
-
- ///
- /// Parses the M3U file.
- ///
- /// Stream representing a M3U file.
- /// Parsed M3U playlist.
- public IPlaylist Parse(Stream stream)
- {
- if (stream == null)
- {
- throw new ArgumentNullException("stream");
- }
-
- return this.Parse(new StreamReader(stream));
- }
-
- ///
- /// Parses the M3U playlist.
- ///
- /// TextReader representing the M3U playlist.
- /// Parsed M3U playlist.
- private IPlaylist Parse(TextReader textReader)
- {
- if (textReader == null)
- {
- throw new ArgumentNullException("textReader");
- }
-
- string line = textReader.ReadLine();
-
- if (line == null)
- {
- throw new ArgumentException("Invalid M3U playlist.");
- }
-
- M3uPlaylist playlist = new M3uPlaylist();
- ICollection items = playlist.Items;
-
- bool isExtended = line.Equals(M3uParser.M3uExtendedHeader);
-
- if (isExtended)
- {
- while ((line = textReader.ReadLine()) != null)
- {
- string extendedDetail = line;
- string detail = textReader.ReadLine();
-
- if ((extendedDetail == null) || (detail == null))
- {
- throw new Exception("File is malformed");
- }
-
- Match match = M3uParser.extendedDetailRegex.Match(extendedDetail);
- if (!match.Success)
- {
- throw new Exception("Invalid m3u extended detail line");
- }
-
- items.Add(new M3uPlaylistItem()
- {
- DisplayName = match.Groups["file"].Value,
- Path = detail,
- Length = new TimeSpan(0, 0, int.Parse(match.Groups["seconds"].Value))
- });
- }
- }
- else
- {
- if (!string.IsNullOrEmpty(line))
- {
- items.Add(new M3uPlaylistItem()
- {
- DisplayName = line,
- Path = line,
- Length = new TimeSpan(0, 0, -1)
- });
- }
-
- while ((line = textReader.ReadLine()) != null)
- {
- if (string.IsNullOrEmpty(line))
- {
- continue;
- }
-
- items.Add(new M3uPlaylistItem()
- {
- DisplayName = line,
- Path = line,
- Length = new TimeSpan(0, 0, -1)
- });
- }
- }
-
- return playlist;
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Playlist/M3uPlaylist.cs b/Src/Silverlight.Media.Shoutcast/Playlist/M3uPlaylist.cs
deleted file mode 100644
index 92f243f..0000000
--- a/Src/Silverlight.Media.Shoutcast/Playlist/M3uPlaylist.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System.Collections.Generic;
-
- ///
- /// Represents an M3U playlist.
- ///
- public class M3uPlaylist : IPlaylist
- {
- ///
- /// M3U playlist items.
- ///
- private List items = new List();
-
- ///
- /// Gets a collection of the M3U playlist items.
- ///
- public ICollection Items
- {
- get { return this.items; }
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Playlist/M3uPlaylistItem.cs b/Src/Silverlight.Media.Shoutcast/Playlist/M3uPlaylistItem.cs
deleted file mode 100644
index 40ad2be..0000000
--- a/Src/Silverlight.Media.Shoutcast/Playlist/M3uPlaylistItem.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
-
- ///
- /// Represents an M3U playlist entry.
- ///
- public class M3uPlaylistItem : PlaylistItem
- {
- ///
- /// Initializes a new instance of the M3uPlaylistItem class.
- ///
- public M3uPlaylistItem()
- : base()
- {
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Playlist/PlaylistFactory.cs b/Src/Silverlight.Media.Shoutcast/Playlist/PlaylistFactory.cs
deleted file mode 100644
index ad74b59..0000000
--- a/Src/Silverlight.Media.Shoutcast/Playlist/PlaylistFactory.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
- using System.Globalization;
- using System.IO;
-
- ///
- /// Factory to parse different playlist types.
- ///
- public static class PlaylistFactory
- {
- ///
- /// Factory method that parses a given Stream with the appropriate playlist type, based on the supplied content type.
- ///
- /// Internet content type representing the playlist type of the Stream.
- /// Stream representing the playlist data.
- /// Successfully parsed playlist.
- public static IPlaylist Parse(string contentType, Stream stream)
- {
- if (string.IsNullOrEmpty(contentType))
- {
- throw new ArgumentException("contentType cannot be null or empty.");
- }
-
- if (stream == null)
- {
- throw new ArgumentNullException("stream");
- }
-
- IPlaylistParser result;
- switch (contentType)
- {
- case M3uParser.M3uContentType:
- result = new M3uParser();
- break;
- case PlsParser.PlsContentType:
- result = new PlsParser();
- break;
- default:
- throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid content type: {0}", contentType));
- }
-
- return result.Parse(stream);
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Playlist/PlaylistItem.cs b/Src/Silverlight.Media.Shoutcast/Playlist/PlaylistItem.cs
deleted file mode 100644
index a624fb0..0000000
--- a/Src/Silverlight.Media.Shoutcast/Playlist/PlaylistItem.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
-
- ///
- /// Represents a playlist entry.
- ///
- public class PlaylistItem : IPlaylistItem
- {
- ///
- /// Initializes a new instance of the PlaylistItem class.
- ///
- public PlaylistItem()
- {
- }
-
- ///
- /// Gets or sets the display name of the playlist entry.
- ///
- public string DisplayName { get; set; }
-
- ///
- /// Gets or sets the path of the playlist entry.
- ///
- public string Path { get; set; }
-
- ///
- /// Gets or sets the length of the media represented by this playlist entry.
- ///
- public TimeSpan Length { get; set; }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Playlist/PlsParser.cs b/Src/Silverlight.Media.Shoutcast/Playlist/PlsParser.cs
deleted file mode 100644
index f9952e7..0000000
--- a/Src/Silverlight.Media.Shoutcast/Playlist/PlsParser.cs
+++ /dev/null
@@ -1,143 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.IO;
- using System.Linq;
-
- ///
- /// Parses the PLS playlist format.
- ///
- public class PlsParser : IPlaylistParser
- {
- ///
- /// Content type of the PLS playlist format.
- ///
- internal const string PlsContentType = "audio/x-scpls";
-
- ///
- /// Initializes a new instance of the PlsParser class.
- ///
- public PlsParser()
- {
- }
-
- ///
- /// Initializes a new instance of the PlsParser class.
- ///
- /// TextReader representing a PLS playlist file.
- public PlsParser(TextReader textReader)
- {
- if (textReader == null)
- {
- throw new ArgumentNullException("textReader");
- }
-
- this.Parse(textReader);
- }
-
- ///
- /// Gets the supported content type of the PLS playlist format.
- ///
- public string ContentType
- {
- get { return PlsParser.PlsContentType; }
- }
-
- ///
- /// Parses the PLS file.
- ///
- /// Stream representing a PLS file.
- /// A successfully parsed playlist.
- public IPlaylist Parse(Stream stream)
- {
- if (stream == null)
- {
- throw new ArgumentNullException("stream");
- }
-
- return this.Parse(new StreamReader(stream));
- }
-
- ///
- /// Parses the PLS file.
- ///
- /// TextReader representing a PLS playlist file.
- /// A successfully parsed playlist.
- private IPlaylist Parse(TextReader textReader)
- {
- if (textReader == null)
- {
- throw new ArgumentNullException("textReader");
- }
-
- // Shoutcast.com PLS files are messed up. The LengthX values are all Length1=-1 instead of LengthX=-1.
- IniParser iniFile = new IniParser(textReader, DuplicateNameHandling.Discard);
- Dictionary> sections = iniFile.Sections;
-
- if (!sections.ContainsKey("playlist"))
- {
- throw new InvalidOperationException("playlist section not found");
- }
-
- PlsPlaylist playlist = new PlsPlaylist();
- ICollection items = playlist.Items;
-
- Dictionary playlistEntries = sections["playlist"];
-
- int numberOfEntries;
- if ((!playlistEntries.ContainsKey("NumberOfEntries")) || (!int.TryParse(playlistEntries["NumberOfEntries"], out numberOfEntries)))
- {
- throw new InvalidOperationException("NumberOfEntries key missing or not a valid integer.");
- }
-
- for (int i = 1; i <= numberOfEntries; i++)
- {
- string fileKey = string.Format(CultureInfo.InvariantCulture, "File{0}", i);
- string titleKey = string.Format(CultureInfo.InvariantCulture, "Title{0}", i);
- string lengthKey = string.Format(CultureInfo.InvariantCulture, "Length{0}", i);
-
- if (!playlistEntries.ContainsKey(fileKey))
- {
- throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Missing file key: {0}", fileKey));
- }
-
- int lengthInSeconds = -1;
-
- if (playlistEntries.ContainsKey(lengthKey))
- {
- // We don't really care if this works or not
- int.TryParse(playlistEntries[lengthKey], out lengthInSeconds);
- }
-
- items.Add(new M3uPlaylistItem()
- {
- DisplayName = playlistEntries.ContainsKey(titleKey) ? playlistEntries[titleKey] : string.Empty,
- Length = new TimeSpan(0, 0, lengthInSeconds),
- Path = playlistEntries[fileKey]
- });
- }
-
- return playlist;
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Playlist/PlsPlaylist.cs b/Src/Silverlight.Media.Shoutcast/Playlist/PlsPlaylist.cs
deleted file mode 100644
index c4ac667..0000000
--- a/Src/Silverlight.Media.Shoutcast/Playlist/PlsPlaylist.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System.Collections.Generic;
-
- ///
- /// Represents a PLS playlist.
- ///
- public class PlsPlaylist : IPlaylist
- {
- ///
- /// PLS playlist items.
- ///
- private List items = new List();
-
- ///
- /// Gets a collection of the PLS playlist items.
- ///
- public ICollection Items
- {
- get { return this.items; }
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Playlist/PlsPlaylistItem.cs b/Src/Silverlight.Media.Shoutcast/Playlist/PlsPlaylistItem.cs
deleted file mode 100644
index bc5d0de..0000000
--- a/Src/Silverlight.Media.Shoutcast/Playlist/PlsPlaylistItem.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media.Playlist
-{
- using System;
-
- ///
- /// Represents a PLS playlist entry.
- ///
- public class PlsPlaylistItem : PlaylistItem
- {
- ///
- /// Initializes a new instance of the PlsPlaylistItem class.
- ///
- public PlsPlaylistItem()
- : base()
- {
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Properties/AssemblyInfo.cs b/Src/Silverlight.Media.Shoutcast/Properties/AssemblyInfo.cs
deleted file mode 100644
index 003f431..0000000
--- a/Src/Silverlight.Media.Shoutcast/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Silverlight.Media")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Silverlight.Media")]
-[assembly: AssemblyCopyright("Copyright © 2010 Andrew Oakley")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("3b126eb4-809d-4f07-974e-13378788dcff")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Src/Silverlight.Media.Shoutcast/Settings.StyleCop b/Src/Silverlight.Media.Shoutcast/Settings.StyleCop
deleted file mode 100644
index 7f55ce6..0000000
--- a/Src/Silverlight.Media.Shoutcast/Settings.StyleCop
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/Src/Silverlight.Media.Shoutcast/ShoutcastMediaStreamSource.cs b/Src/Silverlight.Media.Shoutcast/ShoutcastMediaStreamSource.cs
deleted file mode 100644
index b2a2d35..0000000
--- a/Src/Silverlight.Media.Shoutcast/ShoutcastMediaStreamSource.cs
+++ /dev/null
@@ -1,444 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-[module: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming",
- "CA1709:IdentifiersShouldBeCasedCorrectly",
- Scope = "type",
- Target = "Silverlight.Media.ShoutcastMediaStreamSource",
- MessageId = "Mp",
- Justification = "Mp is not a two letter acyonym but is instead part of Mp3")]
-
-namespace Silverlight.Media
-{
- using System;
- using System.Collections.Generic;
- using System.Net;
- using System.Windows;
- using System.Windows.Media;
- using Silverlight.Media.Metadata;
-
- ///
- /// A Simple MediaStreamSource which can play back MP3 streams from
- /// beginning to end.
- ///
- public class ShoutcastMediaStreamSource : MediaStreamSource, IDisposable
- {
- ///
- /// The current metadata for the Shoutcast stream.
- ///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter", Justification = "There is a public property representing the current metadata, which causes a naming conflict.")]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "This field is used in an Interlocked statement.")]
- internal ShoutcastMetadata currentMetadata = new ShoutcastMetadata();
-
- ///
- /// Exception set by the worker thread.
- ///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter", Justification = "This is an internal field only accessed by the private ShoutcastStream.")]
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "This field is used in an Interlocked statement.")]
- internal Exception workerException;
-
- ///
- /// Empty dictionary of MediaSampleAttributeKeys, as they are unused in this MedaStreamSource.
- ///
- private static Dictionary emptyDict = new Dictionary();
-
- ///
- /// Current timestamp at which a sample should be rendered as measured in 100 nanosecond increments.
- ///
- private long currentTimestamp;
-
- ///
- /// MediaStreamDescription for the associated Mp3 stream.
- ///
- private MediaStreamDescription audioStreamDescription;
-
- ///
- /// The Mp3 stream being played back.
- ///
- private ShoutcastStream audioStream;
-
- ///
- /// Initializes a new instance of the ShoutcastMediaStreamSource class.
- ///
- /// Uri of the Mp3 stream.
- public ShoutcastMediaStreamSource(Uri uri)
- : this(uri, true)
- {
- }
-
- ///
- /// Initializes a new instance of the ShoutcastMediaStreamSource class.
- ///
- /// Uri of the Mp3 stream.
- /// true to include metadata, otherwise, false.
- public ShoutcastMediaStreamSource(Uri uri, bool includeMetadata)
- {
- if (uri == null)
- {
- throw new ArgumentNullException("uri");
- }
-
- this.StreamUri = uri;
- this.IncludeMetadata = includeMetadata;
- }
-
- ///
- /// Finalizes an instance of the ShoutcastMediaStreamSource class.
- ///
- ~ShoutcastMediaStreamSource()
- {
- this.Dispose(false);
- }
-
- ///
- /// Fired when the Mp3 metadata changed.
- ///
- public event RoutedEventHandler MetadataChanged;
-
- ///
- /// Fired when the ShoutcastStream is closed.
- ///
- public event EventHandler Closed;
-
- ///
- /// Gets the Uri of the audio stream.
- ///
- public Uri StreamUri { get; private set; }
-
- ///
- /// Gets a value representing the current Shoutcast metadata.
- ///
- public ShoutcastMetadata CurrentMetadata
- {
- get { return this.currentMetadata; }
- }
-
- ///
- /// Gets a value indicating whether or not metadata is included in this MSS.
- ///
- internal bool IncludeMetadata { get; private set; }
-
- ///
- /// Releases all resources used by the MediaStreamSource.
- ///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", Justification = "This mimics the System.IO.Stream Dispose() code")]
- public void Dispose()
- {
- // Like System.IO.Stream
- this.CloseMedia();
- }
-
- ///
- /// Fires the MetadataChanged event.
- ///
- internal void OnMetadataChanged()
- {
- RoutedEventHandler handler = this.MetadataChanged;
- if (handler != null)
- {
- handler(this, new RoutedEventArgs());
- }
- }
-
- ///
- /// Raises the Closed event.
- ///
- internal void OnClosed()
- {
- EventHandler handler = this.Closed;
- if (handler != null)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": OnClosed()");
- handler(this, EventArgs.Empty);
- }
- }
-
- ///
- /// Releases the unmanaged resources used by the MediaStreamSource and optionally releases the managed resources.
- ///
- /// true to release both managed and unmanaged resources; false to release only unmanaged resources.
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- this.CleanupAudioStream();
- }
- }
-
- ///
- /// Parses the passed in MediaStream to find the first frame and signals
- /// to its parent MediaElement that it is ready to begin playback by calling
- /// ReportOpenMediaCompleted.
- ///
- protected override void OpenMediaAsync()
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": OpenMediaAsync()");
-
- // So, here is why this is a little weird.
- // The Shoutcast server software has the ability to provide web pages. These pages just happen to be served from the SAME address as the media stream.
- // Putting a "/;" at the end of the Uri will tell the Shoutcast server that we aren't a web browser, so stream the data. The problem is that not ALL
- // Shoutcast servers are configured that way. So, we have to do a request to get the content type. If it is text/html, we append the "/;" and move on.
- // If it is an empty string, 99.9% of the time, this will be the media stream (If it's an ICY stream, the ICY "headers" don't parse properly). The ShoutcastStream
- // will handle this case, so we let it go through.
- HttpWebRequest contentTypeRequest = ShoutcastMediaStreamSource.CreateHttpWebRequest(this.StreamUri, this.IncludeMetadata);
- contentTypeRequest.BeginGetResponse(
- ia1 =>
- {
- HttpWebRequest req1 = ia1.AsyncState as HttpWebRequest;
- try
- {
- HttpWebResponse res1 = (HttpWebResponse)req1.EndGetResponse(ia1);
- string contentType = res1.ContentType;
- if ((contentType == string.Empty) || (contentType == "audio/mpeg"))
- {
- try
- {
- this.audioStream = new ShoutcastStream(this, res1);
- this.audioStreamDescription = this.audioStream.AudioStreamDescription;
- this.ReportOpenMediaCompleted(this.audioStream.AudioSourceAttributes, new MediaStreamDescription[] { this.audioStream.AudioStreamDescription });
- }
- catch (Exception ex)
- {
- this.CleanupAudioStream();
- this.ErrorOccurred(ex.Message);
- }
- }
- else
- {
- // Close the original response. We need another one.
- res1.Close();
- res1 = null;
- if (!this.StreamUri.OriginalString.EndsWith("/", StringComparison.Ordinal))
- {
- this.StreamUri = new Uri(this.StreamUri.OriginalString + "/;", UriKind.Absolute);
- }
- else
- {
- this.StreamUri = new Uri(this.StreamUri.OriginalString + ";", UriKind.Absolute);
- }
-
- HttpWebRequest streamRequest = ShoutcastMediaStreamSource.CreateHttpWebRequest(this.StreamUri, this.IncludeMetadata);
- streamRequest.BeginGetResponse(
- ia =>
- {
- HttpWebRequest req = ia.AsyncState as HttpWebRequest;
- try
- {
- HttpWebResponse res = (HttpWebResponse)req.EndGetResponse(ia);
- this.audioStream = new ShoutcastStream(this, res);
- this.audioStreamDescription = this.audioStream.AudioStreamDescription;
- this.ReportOpenMediaCompleted(this.audioStream.AudioSourceAttributes, new MediaStreamDescription[] { this.audioStream.AudioStreamDescription });
- }
- catch (Exception ex)
- {
- if (res1 != null)
- {
- res1.Close();
- }
-
- this.CleanupAudioStream();
- this.ErrorOccurred(ex.Message);
- }
- },
- streamRequest);
- }
- }
- catch (Exception ex)
- {
- this.CleanupAudioStream();
- this.ErrorOccurred(ex.Message);
- }
- },
- contentTypeRequest);
- }
-
- ///
- /// Parses the next sample from the requested stream and then calls ReportGetSampleCompleted
- /// to inform its parent MediaElement of the next sample.
- ///
- ///
- /// Should always be Audio for this MediaStreamSource.
- ///
- protected override void GetSampleAsync(MediaStreamType mediaStreamType)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": GetSampleAsync()");
-
- // If the MSS has been disposed, but the player has not been stopped, this will force a stop by returning an empty sample.
- if (this.audioStream == null)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Race condition #1 handled!");
- this.ReportGetSampleCompleted(new MediaStreamSample(this.audioStreamDescription, null, 0, 0, 0, ShoutcastMediaStreamSource.emptyDict));
- return;
- }
-
- if (this.workerException != null)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Error #1 handled!");
- this.CleanupAudioStream();
- this.ErrorOccurred(this.workerException.Message);
- return;
- }
-
- // See if we need to report buffering.
- int bufferingPercentage = this.audioStream.BufferingPercentage;
- while (bufferingPercentage < 100)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Buffering percentage less than 100");
- this.ReportGetSampleProgress(bufferingPercentage / 100.0d);
-
- // DANGER WILL ROBINSON!!! DANGER!!!
- // This line causes a race condition, as Thread.Sleep() causes the current thread to give up its time slice. If the next thread scheduled to run is a thread that
- // is calling Dispose, our audio stream can be null, so we need to check after we wake up. If so, we need to return an empty audio sample to shut everything down
- // properly.
- System.Threading.Thread.Sleep(10);
-
- // If the MSS has been disposed, but the player has not been stopped, this will force a stop by returning an empty sample.
- if (this.audioStream == null)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Race condition #2 handled!");
- this.ReportGetSampleCompleted(new MediaStreamSample(this.audioStreamDescription, null, 0, 0, 0, ShoutcastMediaStreamSource.emptyDict));
- return;
- }
-
- if (this.workerException != null)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Error #2 handled!");
- this.ErrorOccurred(this.workerException.Message);
- return;
- }
-
- bufferingPercentage = this.audioStream.BufferingPercentage;
- }
-
- try
- {
- System.Diagnostics.Debug.WriteLine("ReportGetSampleCompleted()");
- MediaStreamSample audioSample = new MediaStreamSample(
- this.audioStreamDescription,
- this.audioStream,
- 0,
- this.audioStream.CurrentFrameSize,
- this.currentTimestamp,
- ShoutcastMediaStreamSource.emptyDict);
-
- this.currentTimestamp += this.audioStream.WaveFormat.AudioDurationFromBufferSize((uint)this.audioStream.CurrentFrameSize);
- this.ReportGetSampleCompleted(audioSample);
- }
- catch (Exception ex)
- {
- this.ErrorOccurred(ex.Message);
- }
- }
-
- ///
- /// Closes down the open media streams and otherwise cleans up the MediaStreamSource. The MediaElement can call this method when going through normal shutdown or as a result of an error.
- ///
- protected override void CloseMedia()
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": CloseMedia()");
- System.Diagnostics.Debug.WriteLine("StackTrace: {0}", new System.Diagnostics.StackTrace());
-
- // Call the dispose, the way System.IO.Stream works.
- this.Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- ///
- /// Gathers the diagnostic information requested.
- ///
- ///
- /// A member of the MediaStreamSourceDiagnosticKind enumeration describing what type of information is desired.
- ///
- protected override void GetDiagnosticAsync(MediaStreamSourceDiagnosticKind diagnosticKind)
- {
- throw new NotImplementedException();
- }
-
- ///
- ///
- /// Effectively a Null-Op for when a MediaElement requests a seek at the beginning
- /// of the stream. This makes the stream semi-unseekable.
- ///
- ///
- /// In a fuller MediaStreamSource, the logic here would be to actually seek to
- /// the correct mpeg frame matching the seekToTime passed in.
- ///
- ///
- ///
- /// The time to seek to in nanosecond ticks.
- ///
- protected override void SeekAsync(long seekToTime)
- {
- this.ReportSeekCompleted(seekToTime);
- }
-
- ///
- /// Called when a stream switch is requested on the MediaElement.
- ///
- ///
- /// The stream switched to.
- ///
- protected override void SwitchMediaStreamAsync(MediaStreamDescription mediaStreamDescription)
- {
- throw new NotImplementedException();
- }
-
- ///
- /// Creates an HttpWebRequest for streaming Shoutcast MP3 streams.
- ///
- /// The Uri of the Shoutcast MP3 stream.
- /// Indicates whether or not to include metadata with the Shoutcast Mp3 stream.
- /// An HttpWebRequest
- private static HttpWebRequest CreateHttpWebRequest(Uri uri, bool includeMetadata)
- {
- if (uri == null)
- {
- throw new ArgumentNullException("uri");
- }
-
- HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
- if (includeMetadata)
- {
- request.Headers["icy-metadata"] = "1";
- }
-
- // We have to turn off ReadStreamBuffering, as it will try to download the whole stream before we can do anything, which is BAD!
- request.AllowReadStreamBuffering = false;
-
- return request;
- }
-
- ///
- /// Cleans up all associated streaming resources.
- ///
- private void CleanupAudioStream()
- {
- var tempStream = this.audioStream;
- this.audioStream = null;
- if (tempStream != null)
- {
- tempStream.Closed += (s, e) =>
- {
- this.OnClosed();
- };
-
- tempStream.Dispose();
- }
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/ShoutcastStream.cs b/Src/Silverlight.Media.Shoutcast/ShoutcastStream.cs
deleted file mode 100644
index c72a81f..0000000
--- a/Src/Silverlight.Media.Shoutcast/ShoutcastStream.cs
+++ /dev/null
@@ -1,1167 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media
-{
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Globalization;
- using System.IO;
- using System.Net;
- using System.Text;
- using System.Threading;
- using System.Windows;
- using System.Windows.Media;
- using Silverlight.Media.Extensions;
- using Silverlight.Media.Metadata;
- using Silverlight.Media.Parsers;
-
- ///
- /// Implements the Shoutcast streaming protocol.
- ///
- public class ShoutcastStream : Stream
- {
- ///
- /// The default initial buffer size.
- ///
- private const int DefaultInitialBufferSize = 8192;
-
- ///
- /// Number of milliseconds to sleep if a buffer read will overwrite our read buffer's pointer.
- ///
- private const int BufferOverwriteSleepTime = 10;
-
- ///
- /// Number of seconds per frame, per MP3 specification.
- ///
- private const double NumberOfSecondsPerMp3Frame = 0.026d; // 0.026d;
-
- ///
- /// Default number of seconds to buffer.
- ///
- private const int DefaultSecondsToBuffer = 10;
-
- ///
- /// Number of times to retry reading from the initial buffer read.
- ///
- private const int NumberOfReadRetries = 10;
-
- ///
- /// Minimum number of bytes required to keep in the buffer.
- ///
- private int minimumBufferedBytes;
-
- ///
- /// Number of seconds to buffer.
- ///
- private int numberOfSecondsToBuffer;
-
- ///
- /// Background worker to fill circular buffer from network stream.
- ///
- private BackgroundWorker backgroundWorker;
-
- ///
- /// Shoutcast metadata interval byte count.
- ///
- private int icyMetadata;
-
- ///
- /// Inner stream providing MP3 bytes.
- ///
- private Stream innerStream;
-
- ///
- /// Current stream metadata.
- ///
- private string currentMetadata;
-
- ///
- /// Current parsed stream metadata.
- ///
- private ShoutcastMetadata currentMpegMetadata = new ShoutcastMetadata();
-
- ///
- /// Circular buffer synchronization object.
- ///
- private object syncRoot = new object();
-
- ///
- /// Number of bytes left in stream until metadata.
- ///
- private int metadataCount;
-
- ///
- /// Audio stream description.
- ///
- private MediaStreamDescription audioStreamDescription;
-
- ///
- /// Audio source attributes.
- ///
- private Dictionary audioSourceAttributes;
-
- ///
- /// Current frame size.
- ///
- private int currentFrameSize;
-
- ///
- /// Circular buffer for audio stream data.
- ///
- private CircularBuffer circularBuffer;
-
- ///
- /// Number of bytes left in current frame.
- ///
- private int bytesLeftInFrame;
-
- ///
- /// MpegFrame representing the next MP3 frame.
- ///
- private AudioFrame nextFrame;
-
- ///
- /// MpegLayer3WaveFormat representing MP3 format.
- ///
- private WaveFormat mpegLayer3WaveFormat;
-
- ///
- /// Current percentage of the minimum required bytes in the circular buffer.
- ///
- private int bufferingPercentage;
-
- ///
- /// MediaStreamSource associated with this stream.
- ///
- private ShoutcastMediaStreamSource mediaStreamSource;
-
- ///
- /// Represents whether or not this stream should request to receive metadata.
- ///
- private bool includeMetadata;
-
- ///
- /// Text encoding used to decode metadata bytes.
- ///
- private Encoding metadataEncoding;
-
- ///
- /// Initializes a new instance of the ShoutcastStream class.
- ///
- /// ShoutcastMediaStreamSource containing this ShoutcastStream.
- /// HttpWebResponse for MP3 stream request.
- public ShoutcastStream(ShoutcastMediaStreamSource mediaStreamSource, HttpWebResponse httpWebResponse)
- : this(mediaStreamSource, httpWebResponse, ShoutcastStream.DefaultSecondsToBuffer)
- {
- }
-
- ///
- /// Initializes a new instance of the ShoutcastStream class.
- ///
- /// ShoutcastMediaStreamSource containing this ShoutcastStream.
- /// HttpWebResponse for MP3 stream request.
- /// Number of seconds of audio data to buffer.
- public ShoutcastStream(ShoutcastMediaStreamSource mediaStreamSource, HttpWebResponse httpWebResponse, int numberOfSecondsToBuffer)
- : this(mediaStreamSource, httpWebResponse, numberOfSecondsToBuffer, Encoding.UTF8)
- {
- }
-
- ///
- /// Initializes a new instance of the ShoutcastStream class.
- ///
- /// ShoutcastMediaStreamSource containing this ShoutcastStream.
- /// HttpWebResponse for MP3 stream request.
- /// Number of seconds of audio data to buffer.
- /// Text encoding used to decode the Shoutcast metadata.
- public ShoutcastStream(ShoutcastMediaStreamSource mediaStreamSource, HttpWebResponse httpWebResponse, int numberOfSecondsToBuffer, Encoding metadataEncoding)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": ShoutcastStream() ctor");
- if (mediaStreamSource == null)
- {
- throw new ArgumentNullException("mediaStreamSource");
- }
-
- if (httpWebResponse == null)
- {
- throw new ArgumentNullException("httpWebResponse");
- }
-
- if (metadataEncoding == null)
- {
- throw new ArgumentNullException("encoding");
- }
-
- this.mediaStreamSource = mediaStreamSource;
- this.includeMetadata = this.mediaStreamSource.IncludeMetadata;
- this.numberOfSecondsToBuffer = numberOfSecondsToBuffer;
- this.metadataEncoding = metadataEncoding;
-
- // If the request is bad, this will die first, so we can just not worry about it.
- this.innerStream = httpWebResponse.GetResponseStream();
- try
- {
- // Read a chunk of data, but likely one smaller than the circular buffer size.
- byte[] initialBuffer = new byte[ShoutcastStream.DefaultInitialBufferSize];
-
- // Make sure we have enough data to work with initially
- int bytesRead = this.ForceReadFromStream(initialBuffer, 0, initialBuffer.Length);
-
- if (bytesRead == 0)
- {
- // Should this be -1?
- // This means there was something wrong with the stream.
- throw new InvalidOperationException("Zero initial bytes read from stream.");
- }
-
- this.MediaInformation = this.FindStreamInformation(httpWebResponse, ref initialBuffer);
-
- if (this.MediaInformation == null)
- {
- throw new ArgumentException("Invalid MediaInformation");
- }
-
- this.icyMetadata = this.MediaInformation.MetadataInterval;
- this.ParseInitialBuffer(initialBuffer);
- }
- catch (Exception)
- {
- // No matter what, we need to shut down!
- if (this.innerStream != null)
- {
- this.innerStream.Dispose();
- this.innerStream = null;
- }
-
- // Rethrow
- throw;
- }
-
- this.backgroundWorker = new BackgroundWorker()
- {
- WorkerReportsProgress = false,
- WorkerSupportsCancellation = true
- };
-
- this.backgroundWorker.DoWork += new DoWorkEventHandler(this.DoWork);
- this.backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.RunWorkerCompleted);
- this.backgroundWorker.RunWorkerAsync(this.innerStream);
- }
-
- ///
- /// Called after the ShoutcastStream has been completely shut down.
- ///
- public event EventHandler Closed;
-
- ///
- /// Gets a value indicating whether the current stream supports reading.
- ///
- public override bool CanRead
- {
- get { return true; }
- }
-
- ///
- /// Gets a value indicating whether the current stream supports seeking.
- ///
- public override bool CanSeek
- {
- get { return false; }
- }
-
- ///
- /// Gets a value indicating whether the current stream supports writing.
- ///
- public override bool CanWrite
- {
- get { return false; }
- }
-
- ///
- /// Gets the value containing the current stream information.
- ///
- public ShoutcastStreamInformation MediaInformation { get; private set; }
-
- ///
- /// Gets the length in bytes of the stream.
- ///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Justification = "This property is overridden from the base class, so we have to throw this exception.")]
- public override long Length
- {
- get { throw new NotImplementedException(); }
- }
-
- ///
- /// Gets or sets the position within the current stream.
- ///
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Justification = "This property is overridden from the base class, so we have to throw this exception.")]
- public override long Position
- {
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
- }
-
- ///
- /// Gets a value containing the audio stream description.
- ///
- public MediaStreamDescription AudioStreamDescription
- {
- get { return this.audioStreamDescription; }
- }
-
- ///
- /// Gets a value containing the audio source attributes.
- ///
- public Dictionary AudioSourceAttributes
- {
- get { return this.audioSourceAttributes; }
- }
-
- ///
- /// Gets a value representing the current MP3 frame size.
- ///
- public int CurrentFrameSize
- {
- get { return this.currentFrameSize; }
- }
-
- ///
- /// Gets a value representing the current MP3 wave format.
- ///
- public WaveFormat WaveFormat
- {
- get { return this.mpegLayer3WaveFormat; }
- }
-
- ///
- /// Gets a value representing the current percentage of the minimum required bytes in the circular buffer.
- ///
- public int BufferingPercentage
- {
- get { return this.bufferingPercentage; }
- }
-
- ///
- /// Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
- ///
- /// An array of bytes. This method copies count bytes from buffer to the current stream.
- /// The zero-based byte offset in buffer at which to begin copying bytes to the current stream.
- /// The number of bytes to be written to the current stream.
- public override void Write(byte[] buffer, int offset, int count)
- {
- throw new NotImplementedException();
- }
-
- ///
- /// Writes a byte to the current position in the stream and advances the position within the stream by one byte.
- ///
- /// The byte to write to the stream.
- public override void WriteByte(byte value)
- {
- throw new NotImplementedException();
- }
-
- ///
- /// Sets the position within the current stream.
- ///
- /// A byte offset relative to the origin parameter.
- /// A value of type SeekOrigin indicating the reference point used to obtain the new position.
- /// The new position within the current stream.
- public override long Seek(long offset, SeekOrigin origin)
- {
- throw new NotImplementedException();
- }
-
- ///
- /// Sets the length of the current stream.
- ///
- /// The desired length of the current stream in bytes.
- public override void SetLength(long value)
- {
- throw new NotImplementedException();
- }
-
- ///
- /// Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
- ///
- /// The unsigned byte cast to an Int32, or -1 if at the end of the stream.
- public override int ReadByte()
- {
- // Nobody should use this, as it complicates the metadata stuff, so let's just throw for now.
- throw new NotImplementedException();
- }
-
- ///
- /// Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
- ///
- /// An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.
- /// The zero-based byte offset in buffer at which to begin storing the data read from the current stream.
- /// The maximum number of bytes to be read from the current stream.
- /// The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.
- public override int Read(byte[] buffer, int offset, int count)
- {
- this.bytesLeftInFrame -= count;
-
- this.ReadOrPeekBuffer(buffer, count, false);
- if (this.bytesLeftInFrame == 0)
- {
- this.SetupNextFrame();
- }
-
- return count;
- }
-
- ///
- /// Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
- ///
- public override void Flush()
- {
- throw new NotImplementedException();
- }
-
- ///
- /// Releases the unmanaged resources used by the Stream and optionally releases the managed resources.
- ///
- /// true to release both managed and unmanaged resources; false to release only unmanaged resources.
- protected override void Dispose(bool disposing)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Dispose(bool)");
- if (disposing)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Dispose(true)");
- this.backgroundWorker.CancelAsync();
- }
-
- base.Dispose(disposing);
- }
-
- ///
- /// Initializes a WaveFormatExtensible instance representing an AAC+ frame.
- ///
- /// Audio frame representing an AAC+ frame.
- /// A WaveFormatExtensible for the supplied audio frame.
- private static HeAacWaveFormat CreateAacPlusFormat(AudioFrame audioFrame)
- {
- if (audioFrame == null)
- {
- throw new ArgumentNullException("audioFrame");
- }
-
- WaveFormatExtensible wfx = new WaveFormatExtensible();
-
- wfx.FormatTag = 0x1610;
- wfx.Channels = (short)audioFrame.NumberOfChannels;
- wfx.SamplesPerSec = audioFrame.SamplingRate;
- wfx.AverageBytesPerSecond = audioFrame.BitRate / 8;
- wfx.BlockAlign = 1;
- wfx.BitsPerSample = 0;
- wfx.Size = 12;
-
- HeAacWaveFormat aacf = new HeAacWaveFormat(wfx);
-
- // Extra 3 words in WAVEFORMATEX
- aacf.PayloadType = 0x1; // Audio Data Transport Stream (ADTS). The stream contains an adts_sequence, as defined by MPEG-2.
- aacf.AudioProfileLevelIndication = 0xFE;
- aacf.StructType = 0;
-
- return aacf;
- }
-
- ///
- /// Initializes a WaveFormatExtensible instance representing an MP3 frame.
- ///
- /// Audio frame representing an MP3 frame.
- /// A WaveFormatExtensible for the supplied audio frame.
- private static MpegLayer3WaveFormat CreateMp3WaveFormat(AudioFrame audioFrame)
- {
- if (audioFrame == null)
- {
- throw new ArgumentNullException("audioFrame");
- }
-
- WaveFormatExtensible waveFormatExtensible = new WaveFormatExtensible()
- {
- AverageBytesPerSecond = audioFrame.BitRate / 8,
- BitsPerSample = 0,
- BlockAlign = 1,
- Channels = (short)audioFrame.NumberOfChannels,
- FormatTag = 85,
- SamplesPerSec = audioFrame.SamplingRate,
- Size = 12
- };
-
- MpegLayer3WaveFormat waveFormat = new MpegLayer3WaveFormat(waveFormatExtensible);
- waveFormat.Id = 1;
- waveFormat.BitratePaddingMode = 0;
- waveFormat.FramesPerBlock = 1;
- waveFormat.BlockSize = (short)audioFrame.FrameSize;
- waveFormat.CodecDelay = 0;
-
- return waveFormat;
- }
-
- ///
- /// Reads or Peeks data from the circular buffer.
- ///
- /// Buffer in which to put the read or peeked data.
- /// Number of bytes to read or peek.
- /// true if the data should be peeked from the circular buffer, otherwise the data is read from the circular buffer.
- private void ReadOrPeekBuffer(byte[] buffer, int count, bool shouldPeek)
- {
- if (buffer == null)
- {
- throw new ArgumentNullException("buffer");
- }
-
- if (this.ReadIncludesMetadata(count))
- {
- // Read to metadata chunk
- int metadataOffset = this.icyMetadata - this.metadataCount;
- byte[] metadataSizeBuffer = new byte[metadataOffset + 1];
- int bytesRead = 0;
- int metadataSize = 0;
- lock (this.syncRoot)
- {
- bytesRead = this.circularBuffer.Peek(metadataSizeBuffer, 0, metadataOffset + 1);
- }
-
- if (bytesRead != (metadataOffset + 1))
- {
- // We didn't read enough.
- throw new IndexOutOfRangeException("metadataSize buffer not filled.");
- }
-
- metadataSize = metadataSizeBuffer[metadataOffset];
- int metadataByteCount = metadataSize * 16;
- int numberOfBytesAfterMetadata = count - metadataOffset;
-
- // We need the size of the pre-metadata bytes + metadata size byte + metadata byte count + remaining data bytes.
- byte[] metadataBuffer = new byte[metadataOffset + 1 + metadataByteCount + numberOfBytesAfterMetadata];
-
- lock (this.syncRoot)
- {
- // Here is where we either Get() or Peek(). The work before is just to get the right size.
- if (shouldPeek)
- {
- bytesRead = this.circularBuffer.Peek(metadataBuffer, 0, metadataBuffer.Length);
- }
- else
- {
- bytesRead = this.circularBuffer.Get(metadataBuffer, 0, metadataBuffer.Length);
- this.metadataCount = numberOfBytesAfterMetadata;
- }
- }
-
- // We are going to throw the metadata away here, as it will be read again.
- // Copy from beginning to metadata offset
- Array.Copy(metadataBuffer, 0, buffer, 0, metadataOffset);
-
- // Copy after metadata
- Array.Copy(metadataBuffer, metadataOffset + 1 + metadataByteCount, buffer, metadataOffset, numberOfBytesAfterMetadata);
-
- // Only change the metadata when we ACTUALLY read.
- if ((!shouldPeek) && (metadataSize != 0))
- {
- string newMetadata = this.metadataEncoding.GetString(metadataBuffer, metadataOffset + 1, metadataByteCount) ?? string.Empty;
-
- // TODO - Should we fire this every time the metadata changes, or whenever it is parsed.
- // See if we need to fire the metadata changed event
- if (string.Compare(this.currentMetadata, newMetadata) != 0)
- {
- this.currentMetadata = newMetadata;
-
- // We need to set the current metadata on the MSS so it is always available.
- ShoutcastMetadata metadata = new ShoutcastMetadata(this.currentMetadata);
- Interlocked.Exchange(ref this.mediaStreamSource.currentMetadata, metadata);
-
- // Since MediaElement can only be created on the UI thread, we will marshal this event over to the UI thread, plus this keeps us from blocking.
- Deployment.Current.Dispatcher.BeginInvoke(() => this.mediaStreamSource.OnMetadataChanged());
- }
- }
- }
- else
- {
- int bytesRead;
- lock (this.syncRoot)
- {
- // Here is where we either Get() or Peek(). The work before is just to get the right size.
- if (shouldPeek)
- {
- bytesRead = this.circularBuffer.Peek(buffer, 0, count);
- }
- else
- {
- bytesRead = this.circularBuffer.Get(buffer, 0, count);
- this.metadataCount += bytesRead;
- }
- }
- }
- }
-
- ///
- /// Parses initial audio stream byte buffer.
- ///
- /// Initial bytes from the audio stream.
- private void ParseInitialBuffer(byte[] initialBuffer)
- {
- // Initialize data structures to pass to the Media pipeline via the MediaStreamSource
- Dictionary mediaSourceAttributes = new Dictionary();
- Dictionary mediaStreamAttributes = new Dictionary();
-
- byte[] audioData = initialBuffer;
- int bytesRead = initialBuffer.Length;
-
- AudioFrame mpegLayer3Frame;
- int result = this.SyncStream(audioData, out mpegLayer3Frame);
- this.metadataCount = result;
-
- if (this.MediaInformation.ContentType == "audio/mpeg")
- {
- this.mpegLayer3WaveFormat = ShoutcastStream.CreateMp3WaveFormat(mpegLayer3Frame);
- }
- else if (this.MediaInformation.ContentType == "audio/aacp")
- {
- this.mpegLayer3WaveFormat = ShoutcastStream.CreateAacPlusFormat(mpegLayer3Frame);
- }
- else
- {
- throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Invalid content type: {0}", this.MediaInformation.ContentType));
- }
-
- mediaStreamAttributes[MediaStreamAttributeKeys.CodecPrivateData] = this.mpegLayer3WaveFormat.ToHexString();
-
- this.audioStreamDescription = new MediaStreamDescription(MediaStreamType.Audio, mediaStreamAttributes);
-
- // Setting a 0 duration, since we are a potentially infinite Mp3 stream.
- mediaSourceAttributes[MediaSourceAttributesKeys.Duration] = TimeSpan.FromMinutes(0).Ticks.ToString(CultureInfo.InvariantCulture);
-
- // No seeking within the stream!
- mediaSourceAttributes[MediaSourceAttributesKeys.CanSeek] = "0";
-
- this.audioSourceAttributes = mediaSourceAttributes;
-
- this.currentFrameSize = mpegLayer3Frame.FrameSize;
-
- // Set up bytes left in frame so we can support non-frame size counts
- this.bytesLeftInFrame = this.currentFrameSize;
- this.nextFrame = mpegLayer3Frame;
-
- int bufferByteSize = this.CalculateCircularBufferSize(mpegLayer3Frame.FrameSize);
- this.circularBuffer = new CircularBuffer(bufferByteSize, true);
- this.circularBuffer.Put(audioData, result, bytesRead - result);
-
- // Read some more to fill out the buffer
- // audioData = new byte[this.minimumBufferedBytes - this.circularBuffer.Size];
-
- // We have to force reading from the stream at first. This is because when we read from the NetworkStream, it will return all of the available data in its buffer.
- // If there is less data than we ask for, it only returns what it has. It does not block until it has enough. So, we will force a loop until we have read what we need.
- // bytesRead = this.ForceReadFromStream(audioData, 0, audioData.Length);
- // this.circularBuffer.Put(audioData, 0, bytesRead);
- }
-
- ///
- /// Forces the specified number of bytes to be read from the inner stream.
- ///
- /// An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.
- /// The zero-based byte offset in buffer at which to begin storing the data read from the current stream.
- /// The maximum number of bytes to be read from the current stream.
- /// The total number of bytes read into the buffer. This should be the same as the count parameter.
- private int ForceReadFromStream(byte[] buffer, int offset, int count)
- {
- // NOTE - We aren't locking the inner NetworkStream here. This is because we don't need to yet, as the thread loop hasn't started.
- int bytesRead = 0;
- int loopCount = 0;
- int zeroReadCount = 0;
- int tempBytesRead = 0;
-
- // We need to be careful here. If for some reason the stream stops, this will be stuck in an infinite loop. So we'll put some insurance in here so we can't get stuck.
- while (bytesRead != count)
- {
- tempBytesRead = this.innerStream.Read(buffer, offset + bytesRead, count - bytesRead);
- if (tempBytesRead == 0)
- {
- // Rest for a tenth of a second and try again. If we do this ten times, bail so we don't get stuck.
- zeroReadCount++;
- if (zeroReadCount == ShoutcastStream.NumberOfReadRetries)
- {
- return 0;
- }
-
- Thread.Sleep(100);
- }
- else
- {
- // Reset zeroReadCount as we have SOME data.
- zeroReadCount = 0;
- bytesRead += tempBytesRead;
- }
-
- loopCount++;
- }
-
- return bytesRead;
- }
-
- ///
- /// Calculates the buffer size required for this audio stream.
- ///
- /// Size, in bytes, of the initial MP3 frame.
- /// The required size of the circular buffer.
- private int CalculateCircularBufferSize(int initialFrameSize)
- {
- // Number of frames per second, rounded up to whole number
- int numberOfFramesPerSecond = (int)Math.Ceiling(1.0 / ShoutcastStream.NumberOfSecondsPerMp3Frame);
-
- // Number of bytes needed to buffer n seconds, rounded up to the nearest power of 2. This defaults to 10 seconds.
- this.minimumBufferedBytes = (int)Math.Pow(2, Math.Ceiling(Math.Log(this.numberOfSecondsToBuffer * numberOfFramesPerSecond * initialFrameSize) / Math.Log(2)));
-
- // Return the circular buffer size, which is our minimum buffered bytes * 2, so we have the capacity of n * 2 number of seconds in our buffer
- return this.minimumBufferedBytes *2;
- }
-
- ///
- /// Method used by the BackgroundWorker to read audio data from the inner stream.
- ///
- /// The source of the event.
- /// A DoWorkEventArgs that contains the event data.
- private void DoWork(object sender, DoWorkEventArgs e)
- {
- try
- {
- BackgroundWorker worker = sender as BackgroundWorker;
- Stream stream = (Stream)e.Argument;
- int bufferLength = this.icyMetadata > 0 ? this.icyMetadata : ShoutcastStream.DefaultInitialBufferSize;
- byte[] buffer = new byte[bufferLength];
- int bytesRead = 0;
- int availableBytes;
- int bufferingPercent;
- using (ManualResetEvent shutdownEvent = new ManualResetEvent(false))
- {
- while (true)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Work loop start");
- if (worker.CancellationPending)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Cancellation");
- e.Cancel = true;
- shutdownEvent.Set();
- break;
- }
-
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": No cancellation pending");
- lock (this.syncRoot)
- {
- availableBytes = this.circularBuffer.Capacity - this.circularBuffer.Size;
-
- // This is for reporting buffer progress, if needed.
- bufferingPercent = Math.Min((int)(((double)this.circularBuffer.Size / (double)this.minimumBufferedBytes) * 100), 100);
- }
-
- // Update the buffering percentage, if needed.
- if (bufferingPercent != this.bufferingPercentage)
- {
- // The current buffering percent has fallen below the previous percentage, so replace.
- // We have to do a little math voodoo since Silverlight doesn't support exchanging doubles.
- Interlocked.Exchange(ref this.bufferingPercentage, bufferingPercent);
- }
-
- if (availableBytes < bufferLength)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Not enough bytes available. Sleeping.");
-
- // We'll overwrite the head pointer, so sleep, and reloop.
- shutdownEvent.WaitOne(ShoutcastStream.BufferOverwriteSleepTime);
- }
- else
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Reading from stream.");
- bytesRead = stream.Read(buffer, 0, bufferLength);
- if (bytesRead > 0)
- {
- lock (this.syncRoot)
- {
- this.circularBuffer.Put(buffer, 0, bytesRead);
- }
- }
-
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": Done reading from stream.");
- }
- }
- }
- }
- catch (Exception ex)
- {
- // Normally, this is going to be the ThreadAbortException, which happens if the CLR is shutdown before we are closed.
- // Call the completed method ourselves.
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": DoWork() - Exception: {0}", ex);
- throw;
- }
- }
-
- ///
- /// Parses the Shoutcast specific headers. This method is different because of how Shoutcast responds to an HttpWebRequest. The headers need to be parsed, then removed from the initialBuffer.
- ///
- /// Initial data buffer from the audio stream.
- /// ShoutcastStreamInformation containing information about the audio stream.
- private ShoutcastStreamInformation ParseShoutcastHeaders(ref byte[] initialBuffer)
- {
- ShoutcastStreamInformation result = null;
- int byteCount = 0;
- Dictionary responseHeaders = new Dictionary(StringComparer.OrdinalIgnoreCase);
-
- // We may have a REAL ICY stream
- MemoryStream stream = null;
- try
- {
- stream = new MemoryStream(initialBuffer, false);
- using (StreamReader reader = new StreamReader(stream, this.metadataEncoding, true))
- {
- // This is to resolve CA2202.
- stream = null;
-
- // Read until we get a blank line. This is SUCH a bad and unsafe way to parse "http" headers.
- List headerLines = new List();
- string line;
- string responseHeader;
- HttpStatusCode status = HttpStatusCode.NotFound;
- string statusDescription = string.Empty;
-
- // Get the ICY header
- responseHeader = reader.ReadLine();
- string[] headerParts = responseHeader.Split(' ');
- if (headerParts.Length >= 2)
- {
- string s = headerParts[1];
- status = (HttpStatusCode)int.Parse(s);
- if (headerParts.Length >= 3)
- {
- string str3 = headerParts[2];
- for (int i = 3; i < headerParts.Length; i++)
- {
- str3 = str3 + " " + headerParts[i];
- }
-
- statusDescription = str3;
- }
- }
-
- if (status != HttpStatusCode.OK)
- {
- // Bail!
- return result;
- }
-
- byteCount = responseHeader.Length + 2;
- while (!string.IsNullOrEmpty((line = reader.ReadLine())))
- {
- headerLines.Add(line);
- }
-
- // We should be pointing right at the data now! :)
- // Parse the headers
- foreach (string headerLine in headerLines)
- {
- byteCount += this.metadataEncoding.GetByteCount(headerLine) + 2;
- int colonIndex = headerLine.IndexOf(':');
- string key = headerLine.Substring(0, colonIndex);
- string value = headerLine.Substring(colonIndex + 1).Trim();
-
- // We are going to not duplicate headers for now, as this requires order parsing, comma appending, etc.
- // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
- if (!responseHeaders.ContainsKey(key))
- {
- responseHeaders.Add(key, value);
- }
- }
-
- // Add the last CRLF
- byteCount += 2;
- }
- }
- finally
- {
- if (stream != null)
- {
- stream.Dispose();
- }
- }
-
- // Resize the initialBuffer to reflect the headers we've read.
- int newBufferLength = initialBuffer.Length - byteCount;
- byte[] tempBuffer = initialBuffer;
- initialBuffer = new byte[newBufferLength];
- Array.Copy(tempBuffer, byteCount, initialBuffer, 0, newBufferLength);
-
- result = new ShoutcastStreamInformation(responseHeaders);
-
- if (result.MetadataInterval == -1)
- {
- // TODO - Fix this!!!
- return null;
- }
-
- return result;
- }
-
- ///
- /// Parses the headers from the audio stream.
- ///
- /// HttpWebResponse from the server sending the audio stream.
- /// Initial data buffer from the audio stream.
- /// ShoutcastStreamInformation containing information about the audio stream.
- private ShoutcastStreamInformation FindStreamInformation(HttpWebResponse httpWebResponse, ref byte[] initialBuffer)
- {
- if (httpWebResponse == null)
- {
- throw new ArgumentNullException("httpWebResponse");
- }
-
- if (initialBuffer == null)
- {
- throw new ArgumentNullException("initialBuffer");
- }
-
- ShoutcastStreamInformation result = null;
-
- // See if we are a Shoutcast stream.
- if (string.IsNullOrEmpty(httpWebResponse.Headers[HttpRequestHeader.ContentType]))
- {
- // We may have a REAL ICY stream
- result = this.ParseShoutcastHeaders(ref initialBuffer);
- }
- else
- {
- // We are a non-Shoutcast server stream, so we can assign the information here.
- result = new ShoutcastStreamInformation(httpWebResponse.Headers.ToDictionary());
- }
-
- return result;
- }
-
- ///
- /// Handles the RunWorkerCompleted event of the background worker.
- ///
- /// The source of the event.
- /// A RunWorkerCompletedEventArgs that contains the event data.
- private void RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
- {
- System.Diagnostics.Debug.WriteLine(System.Threading.Thread.CurrentThread.ManagedThreadId.ToString() + ": RunWorkerCompleted()");
- this.innerStream.Close();
- if (e.Error != null)
- {
- Interlocked.Exchange(ref this.mediaStreamSource.workerException, e.Error);
- }
-
- var handler = this.Closed;
- if (handler != null)
- {
- handler(this, EventArgs.Empty);
- }
- }
-
- ///
- /// Indicates if reading the specified number of bytes from the circular buffer contains MP3 metadata.
- ///
- /// Number of bytes to read from the circular buffer.
- /// true if reading the specified number of bytes from the circular buffer contains MP3 metadata, otherwise, false.
- private bool ReadIncludesMetadata(int count)
- {
- return this.includeMetadata && ((this.metadataCount + count) >= this.icyMetadata);
- }
-
- ///
- /// Synchronizes the MP3 data on a frame header.
- ///
- /// Byte array representing a chunk of MP3 data.
- /// Assigned to the resultant, parsed MpegFrame pointed to by the return value.
- /// Offset into the audioData parameters representing the next, valid MpegFrame
- private int SyncStream(byte[] audioData, out AudioFrame mpegFrame)
- {
- if (audioData == null)
- {
- throw new ArgumentNullException("audioData");
- }
-
- if (audioData.Length == 0)
- {
- throw new ArgumentException("audioData cannot have a Length of 0.");
- }
-
- int frameHeaderSize;
- byte[] syncBytes;
- Func isValidFrame;
- Func createFrame;
-
- if (this.MediaInformation.ContentType == "audio/mpeg")
- {
- frameHeaderSize = MpegFrame.FrameHeaderSize;
- syncBytes = MpegFrame.SyncBytes;
- isValidFrame = MpegFrame.IsValidFrame;
- createFrame = b => new MpegFrame(b);
- }
- else if (this.MediaInformation.ContentType == "audio/aacp")
- {
- frameHeaderSize = AacpFrame.FrameHeaderSize;
- syncBytes = AacpFrame.SyncBytes;
- isValidFrame = AacpFrame.IsValidFrame;
- createFrame = b => new AacpFrame(b);
- }
- else
- {
- throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Invalid content type: {0}", this.MediaInformation.ContentType));
- }
-
- // We need to restructure this whole thing!!!
- // This is PROBABLY due to an intro file, so resync and hope for the best. :D
- int bytesRead = audioData.Length;
-
- // Find the syncpoint
- int result = BitTools.FindBitPattern(audioData, syncBytes, syncBytes);
- AudioFrame mpegLayer3Frame = null;
- byte[] frameHeader = new byte[frameHeaderSize];
-
- // TODO - Make sure we have enough left in the array, otherwise, we'll get an exception!
- while (mpegLayer3Frame == null)
- {
- if (result == -1)
- {
- // Something is wrong. Likely due to the the socket returning no data.
- // We'll throw for now.
- throw new InvalidOperationException("Sync bit pattern not found");
- }
-
- Array.Copy(audioData, result, frameHeader, 0, frameHeaderSize);
-
- if (isValidFrame(frameHeader))
- {
- mpegLayer3Frame = createFrame(frameHeader);
-
- // If this works, we need to take the frame size, index into the buffer, and pull out another frame header. If the sample rate and such match, then we are good.
- // Otherwise, we need to find the next set of sync bytes starting at the first index and do it again. This is to reduce the false positives.
- byte[] nextFrameHeader = new byte[frameHeaderSize];
- Array.Copy(audioData, result + mpegLayer3Frame.FrameSize, nextFrameHeader, 0, frameHeaderSize);
- if (isValidFrame(nextFrameHeader))
- {
- // Both are valid frame, so compare.
- AudioFrame nextMpegLayer3Frame = createFrame(nextFrameHeader);
-
- // Check the version, layer, sampling frequency, and number of channels. If they match, we should be good.
- if (!mpegLayer3Frame.Equals(nextMpegLayer3Frame))
- {
- mpegLayer3Frame = null;
- result = BitTools.FindBitPattern(audioData, syncBytes, syncBytes, result + 1);
- }
- }
- else
- {
- // The second frame header was not valid, so we need to reset.
- mpegLayer3Frame = null;
- result = BitTools.FindBitPattern(audioData, syncBytes, syncBytes, result + 1);
- }
- }
- else
- {
- // The second frame header was not valid, so we need to reset.
- mpegLayer3Frame = null;
- result = BitTools.FindBitPattern(audioData, syncBytes, syncBytes, result + 1);
- }
- }
-
- mpegFrame = mpegLayer3Frame;
- return result;
- }
-
- ///
- /// Resynchronizes the audio stream to the next valid Mp3 frame.
- ///
- private void ResyncStream()
- {
- // We need to restructure this whole thing!!!
- // This is PROBABLY due to an intro file, so resync and hope for the best. :D
- byte[] audioData = new byte[ShoutcastStream.DefaultInitialBufferSize];
- int bytesRead;
- lock (this.syncRoot)
- {
- bytesRead = this.circularBuffer.Peek(audioData, 0, audioData.Length);
- }
-
- AudioFrame mpegLayer3Frame;
- int result = this.SyncStream(audioData, out mpegLayer3Frame);
-
- // Throw away X bytes
- byte[] garbage = new byte[result];
- bytesRead = this.circularBuffer.Get(garbage, 0, result);
-
- // Fix the metadata
- this.metadataCount += bytesRead;
- this.currentFrameSize = mpegLayer3Frame.FrameSize;
- this.bytesLeftInFrame = this.currentFrameSize;
- this.nextFrame = mpegLayer3Frame;
- }
-
- ///
- /// Reads the next MP3 frame header.
- ///
- private void SetupNextFrame()
- {
- int frameHeaderSize;
- byte[] frameHeader;
- Func isValidFrame;
- Func createFrame;
-
- if (this.MediaInformation.ContentType == "audio/mpeg")
- {
- frameHeaderSize = MpegFrame.FrameHeaderSize;
- frameHeader = new byte[frameHeaderSize];
- isValidFrame = MpegFrame.IsValidFrame;
- createFrame = b => new MpegFrame(b);
- }
- else if (this.MediaInformation.ContentType == "audio/aacp")
- {
- frameHeaderSize = AacpFrame.FrameHeaderSize;
- frameHeader = new byte[frameHeaderSize];
- isValidFrame = AacpFrame.IsValidFrame;
- createFrame = b => new AacpFrame(b);
- }
- else
- {
- throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Invalid content type: {0}", this.MediaInformation.ContentType));
- }
-
- // If bytesLeftInFrame == 0, then we need to read the next frame header
- if (this.bytesLeftInFrame == 0)
- {
- this.ReadOrPeekBuffer(frameHeader, frameHeaderSize, true);
-
- if (isValidFrame(frameHeader))
- {
- AudioFrame mpegFrame = createFrame(frameHeader);
- this.currentFrameSize = mpegFrame.FrameSize;
- this.bytesLeftInFrame = this.currentFrameSize;
- this.nextFrame = mpegFrame;
- }
- else
- {
- // We are out of sync, probably due to an intro
- this.ResyncStream();
- }
- }
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/ShoutcastStreamInformation.cs b/Src/Silverlight.Media.Shoutcast/ShoutcastStreamInformation.cs
deleted file mode 100644
index 53d34ae..0000000
--- a/Src/Silverlight.Media.Shoutcast/ShoutcastStreamInformation.cs
+++ /dev/null
@@ -1,198 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (c) 2010 Andrew Oakley
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program. If not, see http://www.gnu.org/licenses.
-//
-//-----------------------------------------------------------------------
-
-namespace Silverlight.Media
-{
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Globalization;
-
- ///
- /// Represents the metadata information about an MP3 stream.
- ///
- public class ShoutcastStreamInformation
- {
- ///
- /// Base name of the ICY Notice header tag.
- ///
- private const string IcyNoticeBase = "icy-notice";
-
- ///
- /// ICY Name header tag.
- ///
- private const string IcyName = "icy-name";
-
- ///
- /// ICY Genre header tag.
- ///
- private const string IcyGenre = "icy-genre";
-
- ///
- /// ICY Url header tag.
- ///
- private const string IcyUrl = "icy-url";
-
- ///
- /// ICY Public header tag.
- ///
- private const string IcyPublic = "icy-pub";
-
- ///
- /// ICY Bitrate headter tag.
- ///
- private const string IcyBitrate = "icy-br";
-
- ///
- /// ICY Metadata Interval header tag.
- ///
- private const string IcyMetadataInterval = "icy-metaint";
-
- ///
- /// List of ICY Notice header tags.
- ///
- private List notices = new List();
-
- ///
- /// Initializes a new instance of the ShoutcastStreamInformation class.
- ///
- /// IDictionary<string, string> of HTTP headers.
- public ShoutcastStreamInformation(IDictionary headers)
- {
- if (headers == null)
- {
- throw new ArgumentNullException("headers");
- }
-
- this.ParseHeaders(headers);
- }
-
- ///
- /// Gets the name of the MP3 stream.
- ///
- public string Name { get; private set; }
-
- ///
- /// Gets the genre of the MP3 stream.
- ///
- public string Genre { get; private set; }
-
- ///
- /// Gets the url of the MP3 stream.
- ///
- public Uri Url { get; private set; }
-
- ///
- /// Gets a value indicating whether or not this MP3 stream is public.
- ///
- public bool IsPublic { get; private set; }
-
- ///
- /// Gets the bitrate of the MP3 stream.
- ///
- public int BitRate { get; private set; }
-
- ///
- /// Gets the metadata interval of the MP3 stream.
- ///
- public int MetadataInterval { get; private set; }
-
- ///
- /// Gets the notices of the MP3 stream..
- ///
- public ReadOnlyCollection Notices
- {
- get { return new ReadOnlyCollection(this.notices); }
- }
-
- ///
- /// Gets the HTTP content type.
- ///
- public string ContentType { get; private set; }
-
- ///
- /// Parses the supplied HTTP headers.
- ///
- /// IDictionary<string, string> of HTTP headers.
- private void ParseHeaders(IDictionary headers)
- {
- if (headers == null)
- {
- throw new ArgumentNullException("headers");
- }
-
- // Get the notice headers. While the normal number is 2, we'll support more, just in case.
- int i = 1;
- string value = null;
- while (headers.TryGetValue(string.Format(CultureInfo.InvariantCulture, "{0}{1}", ShoutcastStreamInformation.IcyNoticeBase, i), out value))
- {
- this.notices.Add(value);
- i++;
- }
-
- if (headers.TryGetValue(ShoutcastStreamInformation.IcyName, out value))
- {
- this.Name = value;
- }
-
- if (headers.TryGetValue(ShoutcastStreamInformation.IcyGenre, out value))
- {
- this.Genre = value;
- }
-
- if (headers.TryGetValue(ShoutcastStreamInformation.IcyUrl, out value))
- {
- this.Url = new Uri(value);
- }
-
- if (headers.TryGetValue(ShoutcastStreamInformation.IcyPublic, out value))
- {
- this.IsPublic = value == "1";
- }
-
- if (headers.TryGetValue(ShoutcastStreamInformation.IcyBitrate, out value))
- {
- int bitRate = -1;
- if (int.TryParse(value, out bitRate))
- {
- // Per Mp3 specs
- bitRate *= 1000;
- }
-
- this.BitRate = bitRate;
- }
-
- if (headers.TryGetValue(ShoutcastStreamInformation.IcyMetadataInterval, out value))
- {
- int metadataInterval = -1;
- if (!int.TryParse(value, out metadataInterval))
- {
- // TODO - Should this be an error?
- // throw new ArgumentException("icy-metaint must be a valid integer");
- }
-
- this.MetadataInterval = metadataInterval;
- }
-
- if (headers.TryGetValue("Content-Type", out value))
- {
- this.ContentType = value;
- }
- }
- }
-}
diff --git a/Src/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.Phone.csproj b/Src/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.Phone.csproj
deleted file mode 100644
index a7a9d28..0000000
--- a/Src/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.Phone.csproj
+++ /dev/null
@@ -1,135 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 10.0.20506
- 2.0
- {05CC4102-451C-4EB5-8FEA-614F5B49AB2D}
- {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
- Library
- Properties
- Silverlight.Media.Phone
- Silverlight.Media.Phone
- v8.0
-
-
-
-
- WindowsPhone
- false
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
- 4.0
- 11.0
-
-
- true
- full
- false
- Bin\Debug
- DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
- Bin\Debug\Silverlight.Media.Phone.xml
-
-
- pdbonly
- true
- Bin\Release
- TRACE;SILVERLIGHT;WINDOWS_PHONE
- true
- true
- prompt
- 4
- Bin\Release\Silverlight.Media.Phone.xml
-
-
-
- Bin\x86\Debug
- true
- full
- false
-
-
-
- Bin\x86\Release
- pdbonly
- true
-
-
-
- Bin\ARM\Debug
- true
- full
- false
-
-
-
- Bin\ARM\Release
- pdbonly
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.Phone.csproj.user b/Src/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.Phone.csproj.user
deleted file mode 100644
index 5a95376..0000000
--- a/Src/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.Phone.csproj.user
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- it-IT
- false
-
-
-
-
-
- True
- Managed
- Managed
- False
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.csproj b/Src/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.csproj
deleted file mode 100644
index 6151e0f..0000000
--- a/Src/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.csproj
+++ /dev/null
@@ -1,128 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 8.0.50727
- 2.0
- {65DD033A-AA4C-414F-8D23-F8642A74CC3F}
- {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
- Library
- Properties
- Silverlight.Media
- Silverlight.Media
- Silverlight
- v5.0
- $(TargetFrameworkVersion)
- false
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
- v3.5
-
-
- true
- full
- false
- Bin\Debug
- DEBUG;TRACE;SILVERLIGHT
- true
- true
- prompt
- 4
- Bin\Debug\Silverlight.Media.xml
-
-
- pdbonly
- true
- Bin\Release
- TRACE;SILVERLIGHT
- true
- true
- prompt
- 4
- Bin\Release\Silverlight.Media.xml
-
-
- true
-
-
- Silverlight.Media.Shoutcast.snk
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.csproj.user b/Src/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.csproj.user
deleted file mode 100644
index 8b80b1f..0000000
--- a/Src/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.csproj.user
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
- DynamicPage
- True
- False
- False
-
-
-
-
-
-
-
-
- True
-
-
- True
-
-
-
-
-
\ No newline at end of file
diff --git a/Src/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.snk b/Src/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.snk
deleted file mode 100644
index e3a0cbf..0000000
Binary files a/Src/Silverlight.Media.Shoutcast/Silverlight.Media.Shoutcast.snk and /dev/null differ
diff --git a/Src/Silverlight.Media.Shoutcast/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Src/Silverlight.Media.Shoutcast/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
deleted file mode 100644
index 9a156b0..0000000
Binary files a/Src/Silverlight.Media.Shoutcast/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and /dev/null differ
diff --git a/Src/Silverlight.Media.Shoutcast/obj/Debug/Silverlight.Media.Phone.dll b/Src/Silverlight.Media.Shoutcast/obj/Debug/Silverlight.Media.Phone.dll
deleted file mode 100644
index a63ef12..0000000
Binary files a/Src/Silverlight.Media.Shoutcast/obj/Debug/Silverlight.Media.Phone.dll and /dev/null differ
diff --git a/Src/Silverlight.Media.Shoutcast/obj/Debug/Silverlight.Media.Phone.pdb b/Src/Silverlight.Media.Shoutcast/obj/Debug/Silverlight.Media.Phone.pdb
deleted file mode 100644
index a83698a..0000000
Binary files a/Src/Silverlight.Media.Shoutcast/obj/Debug/Silverlight.Media.Phone.pdb and /dev/null differ
diff --git a/Src/Silverlight.Media.Shoutcast/obj/Debug/Silverlight.Media.Shoutcast.Phone.csproj.FileListAbsolute.txt b/Src/Silverlight.Media.Shoutcast/obj/Debug/Silverlight.Media.Shoutcast.Phone.csproj.FileListAbsolute.txt
deleted file mode 100644
index 79b0210..0000000
--- a/Src/Silverlight.Media.Shoutcast/obj/Debug/Silverlight.Media.Shoutcast.Phone.csproj.FileListAbsolute.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-C:\Users\Francesco\Desktop\Src\Silverlight.Media.Shoutcast\Bin\Debug\Silverlight.Media.Phone.xml
-C:\Users\Francesco\Desktop\Src\Silverlight.Media.Shoutcast\Bin\Debug\Silverlight.Media.Phone.dll
-C:\Users\Francesco\Desktop\Src\Silverlight.Media.Shoutcast\Bin\Debug\Silverlight.Media.Phone.pdb
-C:\Users\Francesco\Desktop\Src\Silverlight.Media.Shoutcast\obj\Debug\Silverlight.Media.Phone.dll
-C:\Users\Francesco\Desktop\Src\Silverlight.Media.Shoutcast\obj\Debug\Silverlight.Media.Phone.pdb
diff --git a/Src/Silverlight.Media.Shoutcast/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/Src/Silverlight.Media.Shoutcast/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
deleted file mode 100644
index e69de29..0000000
diff --git a/Src/Silverlight.Media.Shoutcast/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/Src/Silverlight.Media.Shoutcast/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
deleted file mode 100644
index e69de29..0000000
diff --git a/Src/Silverlight.Media.Shoutcast/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/Src/Silverlight.Media.Shoutcast/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
deleted file mode 100644
index e69de29..0000000
diff --git a/Src/UpgradeLog.htm b/Src/UpgradeLog.htm
deleted file mode 100644
index 447a893..0000000
Binary files a/Src/UpgradeLog.htm and /dev/null differ
diff --git a/packages/repositories.config b/packages/repositories.config
new file mode 100644
index 0000000..236ac65
--- /dev/null
+++ b/packages/repositories.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/strillone.sln b/strillone.sln
index 43a8175..9fadc4d 100644
--- a/strillone.sln
+++ b/strillone.sln
@@ -5,7 +5,9 @@ VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "strillone", "strillone\strillone.csproj", "{3CF6EED8-F18B-4817-9B37-E23CFAE1BAD2}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silverlight.Media.Shoutcast.Phone", "Src\Silverlight.Media.Shoutcast\Silverlight.Media.Shoutcast.Phone.csproj", "{05CC4102-451C-4EB5-8FEA-614F5B49AB2D}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silverlight.Media.Shoutcast.Phone", "..\Src\Silverlight.Media.Shoutcast\Silverlight.Media.Shoutcast.Phone.csproj", "{05CC4102-451C-4EB5-8FEA-614F5B49AB2D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyAudioPlaybackAgent", "MyAudioPlaybackAgent\MyAudioPlaybackAgent.csproj", "{408FDA62-9BCB-4BE0-9F74-D82B4A902468}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -47,6 +49,18 @@ Global
{05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Release|ARM.Build.0 = Release|ARM
{05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Release|x86.ActiveCfg = Release|x86
{05CC4102-451C-4EB5-8FEA-614F5B49AB2D}.Release|x86.Build.0 = Release|x86
+ {408FDA62-9BCB-4BE0-9F74-D82B4A902468}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {408FDA62-9BCB-4BE0-9F74-D82B4A902468}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {408FDA62-9BCB-4BE0-9F74-D82B4A902468}.Debug|ARM.ActiveCfg = Debug|ARM
+ {408FDA62-9BCB-4BE0-9F74-D82B4A902468}.Debug|ARM.Build.0 = Debug|ARM
+ {408FDA62-9BCB-4BE0-9F74-D82B4A902468}.Debug|x86.ActiveCfg = Debug|x86
+ {408FDA62-9BCB-4BE0-9F74-D82B4A902468}.Debug|x86.Build.0 = Debug|x86
+ {408FDA62-9BCB-4BE0-9F74-D82B4A902468}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {408FDA62-9BCB-4BE0-9F74-D82B4A902468}.Release|Any CPU.Build.0 = Release|Any CPU
+ {408FDA62-9BCB-4BE0-9F74-D82B4A902468}.Release|ARM.ActiveCfg = Release|ARM
+ {408FDA62-9BCB-4BE0-9F74-D82B4A902468}.Release|ARM.Build.0 = Release|ARM
+ {408FDA62-9BCB-4BE0-9F74-D82B4A902468}.Release|x86.ActiveCfg = Release|x86
+ {408FDA62-9BCB-4BE0-9F74-D82B4A902468}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/strillone.v12.suo b/strillone.v12.suo
index 992f4f5..e8807b5 100644
Binary files a/strillone.v12.suo and b/strillone.v12.suo differ
diff --git a/strillone/Bin/Release/AppManifest.xaml b/strillone/Bin/Release/AppManifest.xaml
index 3a13d9d..0a35475 100644
--- a/strillone/Bin/Release/AppManifest.xaml
+++ b/strillone/Bin/Release/AppManifest.xaml
@@ -1,6 +1,7 @@
+
diff --git a/strillone/Bin/Release/MDIL/MyAudioPlaybackAgent.dll b/strillone/Bin/Release/MDIL/MyAudioPlaybackAgent.dll
new file mode 100644
index 0000000..2fe5e6d
Binary files /dev/null and b/strillone/Bin/Release/MDIL/MyAudioPlaybackAgent.dll differ
diff --git a/strillone/Bin/Release/MDIL/Silverlight.Media.Phone.dll b/strillone/Bin/Release/MDIL/Silverlight.Media.Phone.dll
index a63ef12..794b053 100644
Binary files a/strillone/Bin/Release/MDIL/Silverlight.Media.Phone.dll and b/strillone/Bin/Release/MDIL/Silverlight.Media.Phone.dll differ
diff --git a/strillone/Bin/Release/MDIL/WMAppManifest.xml b/strillone/Bin/Release/MDIL/WMAppManifest.xml
index 4012abf..5b80079 100644
--- a/strillone/Bin/Release/MDIL/WMAppManifest.xml
+++ b/strillone/Bin/Release/MDIL/WMAppManifest.xml
@@ -19,6 +19,9 @@
+
+
+
diff --git a/strillone/Bin/Release/MDIL/en-US/strillone.resources.dll b/strillone/Bin/Release/MDIL/en-US/strillone.resources.dll
index 815053e..3df0345 100644
Binary files a/strillone/Bin/Release/MDIL/en-US/strillone.resources.dll and b/strillone/Bin/Release/MDIL/en-US/strillone.resources.dll differ
diff --git a/strillone/Bin/Release/MDIL/en/strillone.resources.dll b/strillone/Bin/Release/MDIL/en/strillone.resources.dll
index 7ac4c2f..f815e06 100644
Binary files a/strillone/Bin/Release/MDIL/en/strillone.resources.dll and b/strillone/Bin/Release/MDIL/en/strillone.resources.dll differ
diff --git a/strillone/Bin/Release/MDIL/fr/strillone.resources.dll b/strillone/Bin/Release/MDIL/fr/strillone.resources.dll
index db8f745..bf8f0b4 100644
Binary files a/strillone/Bin/Release/MDIL/fr/strillone.resources.dll and b/strillone/Bin/Release/MDIL/fr/strillone.resources.dll differ
diff --git a/strillone/Bin/Release/MDIL/pt/strillone.resources.dll b/strillone/Bin/Release/MDIL/pt/strillone.resources.dll
index c6cd966..b6807e3 100644
Binary files a/strillone/Bin/Release/MDIL/pt/strillone.resources.dll and b/strillone/Bin/Release/MDIL/pt/strillone.resources.dll differ
diff --git a/strillone/Bin/Release/MDIL/strillone.dll b/strillone/Bin/Release/MDIL/strillone.dll
index 83abf15..ff3fde9 100644
Binary files a/strillone/Bin/Release/MDIL/strillone.dll and b/strillone/Bin/Release/MDIL/strillone.dll differ
diff --git a/strillone/Bin/Release/MyAudioPlaybackAgent.dll b/strillone/Bin/Release/MyAudioPlaybackAgent.dll
new file mode 100644
index 0000000..2fe5e6d
Binary files /dev/null and b/strillone/Bin/Release/MyAudioPlaybackAgent.dll differ
diff --git a/strillone/Bin/Release/MyAudioPlaybackAgent.pdb b/strillone/Bin/Release/MyAudioPlaybackAgent.pdb
new file mode 100644
index 0000000..b70e532
Binary files /dev/null and b/strillone/Bin/Release/MyAudioPlaybackAgent.pdb differ
diff --git a/strillone/Bin/Release/Properties/WMAppManifest.xml b/strillone/Bin/Release/Properties/WMAppManifest.xml
index 4012abf..5b80079 100644
--- a/strillone/Bin/Release/Properties/WMAppManifest.xml
+++ b/strillone/Bin/Release/Properties/WMAppManifest.xml
@@ -19,6 +19,9 @@
+
+
+
diff --git a/strillone/Bin/Release/Silverlight.Media.Phone.dll b/strillone/Bin/Release/Silverlight.Media.Phone.dll
index a63ef12..794b053 100644
Binary files a/strillone/Bin/Release/Silverlight.Media.Phone.dll and b/strillone/Bin/Release/Silverlight.Media.Phone.dll differ
diff --git a/strillone/Bin/Release/Silverlight.Media.Phone.pdb b/strillone/Bin/Release/Silverlight.Media.Phone.pdb
index a83698a..cd3a0b6 100644
Binary files a/strillone/Bin/Release/Silverlight.Media.Phone.pdb and b/strillone/Bin/Release/Silverlight.Media.Phone.pdb differ
diff --git a/strillone/Bin/Release/en-US/strillone.resources.dll b/strillone/Bin/Release/en-US/strillone.resources.dll
index 815053e..3df0345 100644
Binary files a/strillone/Bin/Release/en-US/strillone.resources.dll and b/strillone/Bin/Release/en-US/strillone.resources.dll differ
diff --git a/strillone/Bin/Release/en/strillone.resources.dll b/strillone/Bin/Release/en/strillone.resources.dll
index 7ac4c2f..f815e06 100644
Binary files a/strillone/Bin/Release/en/strillone.resources.dll and b/strillone/Bin/Release/en/strillone.resources.dll differ
diff --git a/strillone/Bin/Release/fr/strillone.resources.dll b/strillone/Bin/Release/fr/strillone.resources.dll
index db8f745..bf8f0b4 100644
Binary files a/strillone/Bin/Release/fr/strillone.resources.dll and b/strillone/Bin/Release/fr/strillone.resources.dll differ
diff --git a/strillone/Bin/Release/pt/strillone.resources.dll b/strillone/Bin/Release/pt/strillone.resources.dll
index c6cd966..b6807e3 100644
Binary files a/strillone/Bin/Release/pt/strillone.resources.dll and b/strillone/Bin/Release/pt/strillone.resources.dll differ
diff --git a/strillone/Bin/Release/strillone.dll b/strillone/Bin/Release/strillone.dll
index 83abf15..ff3fde9 100644
Binary files a/strillone/Bin/Release/strillone.dll and b/strillone/Bin/Release/strillone.dll differ
diff --git a/strillone/Bin/Release/strillone.pdb b/strillone/Bin/Release/strillone.pdb
index 9159a88..68409a0 100644
Binary files a/strillone/Bin/Release/strillone.pdb and b/strillone/Bin/Release/strillone.pdb differ
diff --git a/strillone/Bin/Release/strillone_Release_AnyCPU.xap b/strillone/Bin/Release/strillone_Release_AnyCPU.xap
index 44ba763..c2f8074 100644
Binary files a/strillone/Bin/Release/strillone_Release_AnyCPU.xap and b/strillone/Bin/Release/strillone_Release_AnyCPU.xap differ
diff --git a/strillone/Presenter/MainPresenter.cs b/strillone/Presenter/MainPresenter.cs
index 3adb8c1..846bbb2 100644
--- a/strillone/Presenter/MainPresenter.cs
+++ b/strillone/Presenter/MainPresenter.cs
@@ -74,7 +74,7 @@ public class MainPresenter : IMainPresenter
private String mainURL = "http://www.walks.to/strillonews/newspapers";
- //private String mainURL = "http://192.168.1.132/strillonews/newspapers";
+ //private String mainURL = "http://192.168.1.133/strillonews/newspapers";
// Get e Set su CurrentNavigation e CurrentNavigationIndex
@@ -190,7 +190,7 @@ public void navigatePrev()
String prepend = " ";
String stringToRead = "";
mp.streamSoundShoutcast.Pause();
- mp.streamSound.Pause();
+ BackgroundAudioPlayer.Instance.Close();
//funzionalità utili per la navigazione
if (this.disableAll)
{
@@ -303,7 +303,8 @@ public void navigateNext()
String prepend = " ";
String stringToRead = "";
mp.streamSoundShoutcast.Pause();
- mp.streamSound.Pause();
+ BackgroundAudioPlayer.Instance.Close();
+ //BackgroundAudioPlayer.Instance.Stop();
if (this.CurrentNavigation == "testo")
{
this.CurrentNavigation = "articoli";
@@ -386,8 +387,7 @@ public void navigateNext()
this.ttsRead(prepend + stringToRead);
}
-
- // navigazione tasto sin-sotto
+ // navigazione tasto sin-sotto
public async void navigateEnter()
{
//String prepend = strillone.Resources.AppResources.SuggestionBtnEntra + ", ";
@@ -395,7 +395,7 @@ public async void navigateEnter()
String stringToRead = "";
Boolean b = false;
mp.streamSoundShoutcast.Pause();
- mp.streamSound.Pause();
+ BackgroundAudioPlayer.Instance.Close();
this.mp.tbox.Text = "Lettura " + "\"" + this.currT.getName() + "...\"";
this.mp.progressBar1.Visibility = System.Windows.Visibility.Visible;
@@ -472,9 +472,18 @@ public async void navigateEnter()
{
Uri u=new Uri(stringToRead, UriKind.Absolute);
- mp.streamSound.Source = new Uri(stringToRead, UriKind.Absolute);
- mp.streamSound.Play();
+
+
+ AudioTrack _currentAudioTrack = new AudioTrack(new Uri(stringToRead, UriKind.Absolute), this.currA.getTitle(), " ", " ", null, null, EnabledPlayerControls.All);
+
+ this.ttsRead( strillone.Resources.AppResources.Buffering);
+
+ BackgroundAudioPlayer.Instance.Track = _currentAudioTrack;
+ BackgroundAudioPlayer.Instance.Play();
+
+
ShoutcastMediaStreamSource source = new ShoutcastMediaStreamSource(new Uri(stringToRead, UriKind.Absolute));
+
mp.streamSoundShoutcast.SetSource(source);
@@ -510,7 +519,7 @@ public void navigateExit(bool forced=false)
this.isFirstElement = false;
this.isLastElement = false;
mp.streamSoundShoutcast.Pause();
- mp.streamSound.Pause();
+ BackgroundAudioPlayer.Instance.Close();
//funzionalità utili per la navigazione
if (this.disableAll)
{
diff --git a/strillone/Resources/AppResources.Designer.cs b/strillone/Resources/AppResources.Designer.cs
index 057bd29..a97d136 100644
--- a/strillone/Resources/AppResources.Designer.cs
+++ b/strillone/Resources/AppResources.Designer.cs
@@ -87,6 +87,15 @@ public static string ApplicationTitle {
}
}
+ ///
+ /// Cerca una stringa localizzata simile a Caricamento in corso.
+ ///
+ public static string Buffering {
+ get {
+ return ResourceManager.GetString("Buffering", resourceCulture);
+ }
+ }
+
///
/// Cerca una stringa localizzata simile a Edizione del.
///
diff --git a/strillone/Resources/AppResources.resx b/strillone/Resources/AppResources.resx
index a7a6f32..72880c4 100644
--- a/strillone/Resources/AppResources.resx
+++ b/strillone/Resources/AppResources.resx
@@ -251,4 +251,7 @@
Non è stata selezionata alcuna testata
+
+ Caricamento in corso
+
\ No newline at end of file
diff --git a/strillone/View/MainPage.xaml.cs b/strillone/View/MainPage.xaml.cs
index 4a0ada0..1018c7e 100644
--- a/strillone/View/MainPage.xaml.cs
+++ b/strillone/View/MainPage.xaml.cs
@@ -20,6 +20,7 @@
+
namespace strillone
{
public partial class MainPage : PhoneApplicationPage
diff --git a/strillone/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache b/strillone/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache
index 0693103..135b03a 100644
Binary files a/strillone/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache and b/strillone/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache differ
diff --git a/strillone/obj/Release/MDIL/MDILXapCompileLog.txt b/strillone/obj/Release/MDIL/MDILXapCompileLog.txt
index f14512f..4ea33e5 100644
--- a/strillone/obj/Release/MDIL/MDILXapCompileLog.txt
+++ b/strillone/obj/Release/MDIL/MDILXapCompileLog.txt
@@ -1,26 +1,28 @@
Compile filter specified. Only the following files will be processed:
-c:\users\francesco\desktop\strillone android\strillone-spl\strillone\bin\release\mdil\strillone.dll
-c:\users\francesco\desktop\strillone android\strillone-spl\strillone\bin\release\mdil\en-us\strillone.resources.dll
-c:\users\francesco\desktop\strillone android\strillone-spl\strillone\bin\release\mdil\en\strillone.resources.dll
-c:\users\francesco\desktop\strillone android\strillone-spl\strillone\bin\release\mdil\fr\strillone.resources.dll
-c:\users\francesco\desktop\strillone android\strillone-spl\strillone\bin\release\mdil\pt\strillone.resources.dll
-Processing file: C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\MDIL\Silverlight.Media.Phone.dll
-File C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\MDIL\Silverlight.Media.Phone.dll is not in the compile filter. Skipping.
-Processing file: C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\MDIL\strillone.dll
+c:\users\francesco\desktop\strillone-spl-windowsphone-streamingradios\strillone\bin\release\mdil\strillone.dll
+c:\users\francesco\desktop\strillone-spl-windowsphone-streamingradios\strillone\bin\release\mdil\en-us\strillone.resources.dll
+c:\users\francesco\desktop\strillone-spl-windowsphone-streamingradios\strillone\bin\release\mdil\en\strillone.resources.dll
+c:\users\francesco\desktop\strillone-spl-windowsphone-streamingradios\strillone\bin\release\mdil\fr\strillone.resources.dll
+c:\users\francesco\desktop\strillone-spl-windowsphone-streamingradios\strillone\bin\release\mdil\pt\strillone.resources.dll
+Processing file: C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL\MyAudioPlaybackAgent.dll
+File C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL\MyAudioPlaybackAgent.dll is not in the compile filter. Skipping.
+Processing file: C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL\Silverlight.Media.Phone.dll
+File C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL\Silverlight.Media.Phone.dll is not in the compile filter. Skipping.
+Processing file: C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL\strillone.dll
Calling CrossGen with arguments:
-/nologo /mdil /MissingDependenciesOK /fulltrust /app_paths "C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\MDIL;" /trusted_platform_assemblies "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.CSharp.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\mscorlib.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\mscorlib.extensions.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Collections.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.ComponentModel.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.ComponentModel.EventBasedAsync.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Core.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Diagnostics.Contracts.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Diagnostics.Debug.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Diagnostics.Tools.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Dynamic.Runtime.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Globalization.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.IO.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Linq.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Linq.Expressions.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Linq.Queryable.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Net.NetworkInformation.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Net.Primitives.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Net.Requests.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.ObjectModel.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Observable.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Reflection.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Reflection.Emit.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Reflection.Emit.ILGeneration.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Reflection.Emit.Lightweight.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Reflection.Extensions.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Reflection.Primitives.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Resources.ResourceManager.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Runtime.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Runtime.Extensions.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Runtime.InteropServices.WindowsRuntime.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Runtime.Serialization.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Runtime.Serialization.Json.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Runtime.Serialization.Primitives.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Runtime.Serialization.Xml.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Runtime.WindowsRuntime.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Security.Principal.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.ServiceModel.Http.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.ServiceModel.Primitives.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.ServiceModel.Security.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.ServiceModel.Web.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Text.Encoding.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Text.Encoding.Extensions.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Text.RegularExpressions.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Threading.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Threading.Tasks.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Xml.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Xml.Linq.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Xml.ReaderWriter.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Xml.Serialization.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Xml.XDocument.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Xml.XmlSerializer.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\LocationService.Interop.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Devices.Camera.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Devices.Sensors.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Phone.Data.Internal.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Phone.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Phone.Interop.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Phone.Maps.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Phone.Reactive.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Xna.Framework.Avatar.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Xna.Framework.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Xna.Framework.Game.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Xna.Framework.GamerServices.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Xna.Framework.Graphics.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Xna.Framework.Input.Touch.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Xna.Framework.Interop.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Xna.Framework.MediaLibraryExtensions.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Data.Linq.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Device.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Net.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.ServiceModel.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Windows.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Windows.RuntimeHost.dll;" /platform_winmd_paths "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\WinMds;" /out "C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\MDIL\strillone.dll" "C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\MDIL\strillone.dll"
+/nologo /mdil /MissingDependenciesOK /fulltrust /app_paths "C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL;" /trusted_platform_assemblies "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.CSharp.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\mscorlib.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\mscorlib.extensions.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Collections.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.ComponentModel.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.ComponentModel.EventBasedAsync.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Core.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Diagnostics.Contracts.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Diagnostics.Debug.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Diagnostics.Tools.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Dynamic.Runtime.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Globalization.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.IO.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Linq.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Linq.Expressions.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Linq.Queryable.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Net.NetworkInformation.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Net.Primitives.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Net.Requests.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.ObjectModel.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Observable.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Reflection.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Reflection.Emit.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Reflection.Emit.ILGeneration.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Reflection.Emit.Lightweight.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Reflection.Extensions.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Reflection.Primitives.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Resources.ResourceManager.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Runtime.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Runtime.Extensions.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Runtime.InteropServices.WindowsRuntime.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Runtime.Serialization.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Runtime.Serialization.Json.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Runtime.Serialization.Primitives.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Runtime.Serialization.Xml.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Runtime.WindowsRuntime.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Security.Principal.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.ServiceModel.Http.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.ServiceModel.Primitives.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.ServiceModel.Security.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.ServiceModel.Web.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Text.Encoding.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Text.Encoding.Extensions.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Text.RegularExpressions.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Threading.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Threading.Tasks.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Xml.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Xml.Linq.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Xml.ReaderWriter.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Xml.Serialization.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Xml.XDocument.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Xml.XmlSerializer.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\LocationService.Interop.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Devices.Camera.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Devices.Sensors.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Phone.Data.Internal.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Phone.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Phone.Interop.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Phone.Maps.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Phone.Reactive.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Xna.Framework.Avatar.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Xna.Framework.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Xna.Framework.Game.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Xna.Framework.GamerServices.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Xna.Framework.Graphics.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Xna.Framework.Input.Touch.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Xna.Framework.Interop.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\Microsoft.Xna.Framework.MediaLibraryExtensions.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Data.Linq.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Device.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Net.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.ServiceModel.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Windows.dll;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\Framework\System.Windows.RuntimeHost.dll;" /platform_winmd_paths "C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\WinMds;" /out "C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\obj\Release\MDIL\strillone.dll" "C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL\strillone.dll"
Output:
-MDIL image C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\MDIL\strillone.dll generated successfully.
+MDIL image C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\obj\Release\MDIL\strillone.dll generated successfully.
-File C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\MDIL\strillone.dll output C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\MDIL\strillone.dll
-Processing file: C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\MDIL\WMAppManifest.xml
-File C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\MDIL\WMAppManifest.xml is not in the compile filter. Skipping.
-Processing file: C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\MDIL\en\strillone.resources.dll
-File C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\MDIL\en\strillone.resources.dll is not an IL assembly. Copying.
-Processing file: C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\MDIL\en-US\strillone.resources.dll
-File C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\MDIL\en-US\strillone.resources.dll is not an IL assembly. Copying.
-Processing file: C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\MDIL\fr\strillone.resources.dll
-File C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\MDIL\fr\strillone.resources.dll is not an IL assembly. Copying.
-Processing file: C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\MDIL\pt\strillone.resources.dll
-File C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\MDIL\pt\strillone.resources.dll is not an IL assembly. Copying.
+File C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL\strillone.dll output C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\obj\Release\MDIL\strillone.dll
+Processing file: C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL\WMAppManifest.xml
+File C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL\WMAppManifest.xml is not in the compile filter. Skipping.
+Processing file: C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL\en\strillone.resources.dll
+File C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL\en\strillone.resources.dll is not an IL assembly. Copying.
+Processing file: C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL\en-US\strillone.resources.dll
+File C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL\en-US\strillone.resources.dll is not an IL assembly. Copying.
+Processing file: C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL\fr\strillone.resources.dll
+File C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL\fr\strillone.resources.dll is not an IL assembly. Copying.
+Processing file: C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL\pt\strillone.resources.dll
+File C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MDIL\pt\strillone.resources.dll is not an IL assembly. Copying.
diff --git a/strillone/obj/Release/MDIL/MyAudioPlaybackAgent.dll b/strillone/obj/Release/MDIL/MyAudioPlaybackAgent.dll
new file mode 100644
index 0000000..4442e0a
Binary files /dev/null and b/strillone/obj/Release/MDIL/MyAudioPlaybackAgent.dll differ
diff --git a/strillone/obj/Release/MDIL/Silverlight.Media.Phone.dll b/strillone/obj/Release/MDIL/Silverlight.Media.Phone.dll
index 8fecb7f..d0a7b43 100644
Binary files a/strillone/obj/Release/MDIL/Silverlight.Media.Phone.dll and b/strillone/obj/Release/MDIL/Silverlight.Media.Phone.dll differ
diff --git a/strillone/obj/Release/MDIL/en-US/strillone.resources.dll b/strillone/obj/Release/MDIL/en-US/strillone.resources.dll
index 815053e..3df0345 100644
Binary files a/strillone/obj/Release/MDIL/en-US/strillone.resources.dll and b/strillone/obj/Release/MDIL/en-US/strillone.resources.dll differ
diff --git a/strillone/obj/Release/MDIL/en/strillone.resources.dll b/strillone/obj/Release/MDIL/en/strillone.resources.dll
index 7ac4c2f..f815e06 100644
Binary files a/strillone/obj/Release/MDIL/en/strillone.resources.dll and b/strillone/obj/Release/MDIL/en/strillone.resources.dll differ
diff --git a/strillone/obj/Release/MDIL/fr/strillone.resources.dll b/strillone/obj/Release/MDIL/fr/strillone.resources.dll
index db8f745..bf8f0b4 100644
Binary files a/strillone/obj/Release/MDIL/fr/strillone.resources.dll and b/strillone/obj/Release/MDIL/fr/strillone.resources.dll differ
diff --git a/strillone/obj/Release/MDIL/pt/strillone.resources.dll b/strillone/obj/Release/MDIL/pt/strillone.resources.dll
index c6cd966..b6807e3 100644
Binary files a/strillone/obj/Release/MDIL/pt/strillone.resources.dll and b/strillone/obj/Release/MDIL/pt/strillone.resources.dll differ
diff --git a/strillone/obj/Release/MDIL/strillone.dll b/strillone/obj/Release/MDIL/strillone.dll
index ba0d136..eb94628 100644
Binary files a/strillone/obj/Release/MDIL/strillone.dll and b/strillone/obj/Release/MDIL/strillone.dll differ
diff --git a/strillone/obj/Release/MDILCacheFile.xml b/strillone/obj/Release/MDILCacheFile.xml
index 8950d35..92d4869 100644
--- a/strillone/obj/Release/MDILCacheFile.xml
+++ b/strillone/obj/Release/MDILCacheFile.xml
@@ -1,35 +1,36 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/strillone/obj/Release/TempPE/Resources.AppResources.Designer.cs.dll b/strillone/obj/Release/TempPE/Resources.AppResources.Designer.cs.dll
index de60b08..9276939 100644
Binary files a/strillone/obj/Release/TempPE/Resources.AppResources.Designer.cs.dll and b/strillone/obj/Release/TempPE/Resources.AppResources.Designer.cs.dll differ
diff --git a/strillone/obj/Release/XapCacheFile.xml b/strillone/obj/Release/XapCacheFile.xml
index 8950d35..92d4869 100644
--- a/strillone/obj/Release/XapCacheFile.xml
+++ b/strillone/obj/Release/XapCacheFile.xml
@@ -1,35 +1,36 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/strillone/obj/Release/en-US/strillone.resources.dll b/strillone/obj/Release/en-US/strillone.resources.dll
index 815053e..3df0345 100644
Binary files a/strillone/obj/Release/en-US/strillone.resources.dll and b/strillone/obj/Release/en-US/strillone.resources.dll differ
diff --git a/strillone/obj/Release/en/strillone.resources.dll b/strillone/obj/Release/en/strillone.resources.dll
index 7ac4c2f..f815e06 100644
Binary files a/strillone/obj/Release/en/strillone.resources.dll and b/strillone/obj/Release/en/strillone.resources.dll differ
diff --git a/strillone/obj/Release/fr/strillone.resources.dll b/strillone/obj/Release/fr/strillone.resources.dll
index db8f745..bf8f0b4 100644
Binary files a/strillone/obj/Release/fr/strillone.resources.dll and b/strillone/obj/Release/fr/strillone.resources.dll differ
diff --git a/strillone/obj/Release/pt/strillone.resources.dll b/strillone/obj/Release/pt/strillone.resources.dll
index c6cd966..b6807e3 100644
Binary files a/strillone/obj/Release/pt/strillone.resources.dll and b/strillone/obj/Release/pt/strillone.resources.dll differ
diff --git a/strillone/obj/Release/strillone.Resources.AppResources.resources b/strillone/obj/Release/strillone.Resources.AppResources.resources
index 2ff9c38..9bc201a 100644
Binary files a/strillone/obj/Release/strillone.Resources.AppResources.resources and b/strillone/obj/Release/strillone.Resources.AppResources.resources differ
diff --git a/strillone/obj/Release/strillone.csproj.FileListAbsolute.txt b/strillone/obj/Release/strillone.csproj.FileListAbsolute.txt
index 8b04450..531e183 100644
--- a/strillone/obj/Release/strillone.csproj.FileListAbsolute.txt
+++ b/strillone/obj/Release/strillone.csproj.FileListAbsolute.txt
@@ -54,33 +54,5 @@ C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\
C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\Silverlight.Media.Phone.pdb
C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\Silverlight.Media.Phone.xml
C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\obj\Release\strillone.csprojResolveAssemblyReference.cache
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\strillone.dll
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\strillone.pdb
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\en-US\strillone.resources.dll
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\en\strillone.resources.dll
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\fr\strillone.resources.dll
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\pt\strillone.resources.dll
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\AppManifest.xaml
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\Properties\WMAppManifest.xml
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\strillone_Release_AnyCPU.xap
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\Silverlight.Media.Phone.dll
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\Silverlight.Media.Phone.pdb
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\Bin\Release\Silverlight.Media.Phone.xml
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\strillone.csprojResolveAssemblyReference.cache
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\App.g.cs
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\View\MainPage.g.cs
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\View\ExtendedSplashScreen.g.cs
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\strillone.g.resources
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\strillone.Resources.AppResources.resources
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\strillone.Resources.AppResources.en-US.resources
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\strillone.Resources.AppResources.en.resources
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\strillone.Resources.AppResources.fr.resources
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\strillone.Resources.AppResources.pt.resources
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\strillone.csproj.GenerateResource.Cache
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\en-US\strillone.resources.dll
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\en\strillone.resources.dll
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\fr\strillone.resources.dll
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\pt\strillone.resources.dll
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\strillone.dll
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\strillone.pdb
-C:\Users\Francesco\Desktop\strillone android\strillone-spl\strillone\obj\Release\XapCacheFile.xml
+C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MyAudioPlaybackAgent.dll
+C:\Users\Francesco\Desktop\strillone-spl-WindowsPhone-StreamingRadios\strillone\Bin\Release\MyAudioPlaybackAgent.pdb
diff --git a/strillone/obj/Release/strillone.csproj.GenerateResource.Cache b/strillone/obj/Release/strillone.csproj.GenerateResource.Cache
index d81085c..98ee011 100644
Binary files a/strillone/obj/Release/strillone.csproj.GenerateResource.Cache and b/strillone/obj/Release/strillone.csproj.GenerateResource.Cache differ
diff --git a/strillone/obj/Release/strillone.csprojResolveAssemblyReference.cache b/strillone/obj/Release/strillone.csprojResolveAssemblyReference.cache
index 91e534c..3f9d29d 100644
Binary files a/strillone/obj/Release/strillone.csprojResolveAssemblyReference.cache and b/strillone/obj/Release/strillone.csprojResolveAssemblyReference.cache differ
diff --git a/strillone/obj/Release/strillone.dll b/strillone/obj/Release/strillone.dll
index 83abf15..ff3fde9 100644
Binary files a/strillone/obj/Release/strillone.dll and b/strillone/obj/Release/strillone.dll differ
diff --git a/strillone/obj/Release/strillone.pdb b/strillone/obj/Release/strillone.pdb
index 9159a88..68409a0 100644
Binary files a/strillone/obj/Release/strillone.pdb and b/strillone/obj/Release/strillone.pdb differ
diff --git a/strillone/strillone.csproj b/strillone/strillone.csproj
index a93c033..2cba272 100644
--- a/strillone/strillone.csproj
+++ b/strillone/strillone.csproj
@@ -184,10 +184,14 @@
-
+
{05CC4102-451C-4EB5-8FEA-614F5B49AB2D}
Silverlight.Media.Shoutcast.Phone
+
+ {408FDA62-9BCB-4BE0-9F74-D82B4A902468}
+ MyAudioPlaybackAgent
+