// Path: src/uk/ac/open/audio/streaming/StreamPlayer.java
// public enum State
// {
// 	/** Downloading but not yet ready to play */
// 	WAITBEFOREPLAY,
// 	/** Downloaded enough that you should be able to start playing */
// 	READYTOPLAY,
// 	/** Completely downloaded */
// 	FULLYLOADED,
// 	/** Fully loaded, but audio buffer is empty */
// 	BUFFEREMPTY,
// 	/** Closed (no more playback possible) */
//   CLOSED
// }


import java.awt.*;
import java.io.*;
import java.util.*;
import uk.ac.open.audio.*;
import static uk.ac.open.audio.streaming.StreamPlayer.State.*;
	 * Displays an error message in standard format.
	 * @param message Message
	 * @param detail If true, only logs when detailed logging is on
	 */
	private static void log(String message, boolean detail)
	{
		if(detail && !DETAILED_LOG)
		{
			return;
		}
		System.err.println("[uk.ac.open.audio.streaming.StreamPlayer] " + message);
	}

	private final Class<? extends StreamableDecoder> decoderClass;

	private final LinkedList<DataBlock> data=new LinkedList<DataBlock>();
	private boolean downloadFinished=false,playFinished=false;
	private long lastBlock;
	private final LinkedList<AudioBlock> nextAudio=new LinkedList<AudioBlock>();
	private boolean isFromMemory;

	// Current statistics
	private final int length;
	private int totalSamplesDecoded,firstFrameBytes,firstFrameSamples;
	private double averageBytesPerSecondPlayback=0.0;
	private double recentBytesPerSecondDownload=0.0;

	private boolean close;

	/** States that the stream can be in. */
// Path: src/uk/ac/open/audio/streaming/StreamPlayer.java
// public enum State
// {
// 	/** Downloading but not yet ready to play */
// 	WAITBEFOREPLAY,
// 	/** Downloaded enough that you should be able to start playing */
// 	READYTOPLAY,
// 	/** Completely downloaded */
// 	FULLYLOADED,
// 	/** Fully loaded, but audio buffer is empty */
// 	BUFFEREMPTY,
// 	/** Closed (no more playback possible) */
//   CLOSED
// }


// Path: src/uk/ac/open/audio/streaming/StreamPlayer.java
import java.awt.*;
import java.io.*;
import java.util.*;
import uk.ac.open.audio.*;
import static uk.ac.open.audio.streaming.StreamPlayer.State.*;

	 * Displays an error message in standard format.
	 * @param message Message
	 * @param detail If true, only logs when detailed logging is on
	 */
	private static void log(String message, boolean detail)
	{
		if(detail && !DETAILED_LOG)
		{
			return;
		}
		System.err.println("[uk.ac.open.audio.streaming.StreamPlayer] " + message);
	}

	private final Class<? extends StreamableDecoder> decoderClass;

	private final LinkedList<DataBlock> data=new LinkedList<DataBlock>();
	private boolean downloadFinished=false,playFinished=false;
	private long lastBlock;
	private final LinkedList<AudioBlock> nextAudio=new LinkedList<AudioBlock>();
	private boolean isFromMemory;

	// Current statistics
	private final int length;
	private int totalSamplesDecoded,firstFrameBytes,firstFrameSamples;
	private double averageBytesPerSecondPlayback=0.0;
	private double recentBytesPerSecondDownload=0.0;

	private boolean close;

	/** States that the stream can be in. */
	public enum State