import javax.media.MediaLocator;
import javax.media.Time;
import javax.media.format.VideoFormat;
import javax.media.protocol.ContentDescriptor;
import javax.media.protocol.PullBufferDataSource;
import javax.media.protocol.PullBufferStream;

/**
 * Reads from a list of JPEG image files and turn that into a
 * stream of JMF buffers. The DataSource is not seekable nor positionable.
 */
class ImageDataSource extends PullBufferDataSource
{
	ImageSourceStream streams[];

	ImageDataSource(VideoFormat format, IActions actions)
	{
		streams = new ImageSourceStream[1];
		streams[0] = new ImageSourceStream(format, actions);
	}

	public void setLocator(MediaLocator source) {}

	public MediaLocator getLocator()
	{
		return null;
	}

	public String getContentType()
	{
		return ContentDescriptor.RAW;
	}

	public void connect() {}

	public void disconnect() {}

	public void start() {}

	public void stop() {}

	/**
	 * Return the ImageSourceStreams.
	 */
	public PullBufferStream[] getStreams()
	{
		return streams;
	}

	/**
	 * We could have derived the duration from the number of frames and frame
	 * rate. But for the purpose of this program, it's not necessary.
	 */
	public Time getDuration()
	{
		return DURATION_UNKNOWN;
	}

	public Object[] getControls()
	{
		return new Object[0];
	}

	public Object getControl(String type)
	{
		return null;
	}
}
