FileDocCategorySizeDatePackage
DataSource.javaAPI DocJMF 2.1.1e4423Mon May 12 12:21:26 BST 2003com.sun.media.protocol.sunvideoplus

DataSource

public class DataSource extends BasicPushBufferDataSource implements CaptureDevice, RateConfigureable

Fields Summary
PushBufferStream[]
streams
OPISourceStream
sourceStream
String
contentType
Time
duration
boolean
connected
boolean
started
static String
ContentType
Constructors Summary
public DataSource()

    //	static String ContentType = VideoFormat.JPEG;

      
	com.sun.media.JMFSecurityManager.checkCapture();
	contentType = ContentType;
	duration = DURATION_UNBOUNDED;
    
Methods Summary
public voidconnect()

	//	System.err.println("OPIDataSource.connect()");
	if (connected)
	    return;
	if (sourceStream == null) {
	    sourceStream = new OPISourceStream(this);
	    streams = new PushBufferStream[1];
	    streams[0] = sourceStream;
	}
	sourceStream.connect();
	connected = true;
	// TODO
	//	super.connect();
    
public voiddisconnect()

	//	System.err.println("OPIDataSource.disconnect()");
	// TODO
	sourceStream.disconnect();
	connected = false;
	//	super.disconnect();
    
public javax.media.CaptureDeviceInfogetCaptureDeviceInfo()

	//	System.err.println("OPIDataSource.getCaptureDeviceInfo()");
	if (sourceStream == null) {
	    sourceStream = new OPISourceStream(this);
	    streams = new PushBufferStream[1];
	    streams[0] = sourceStream;
	}
	return sourceStream.getCaptureDeviceInfo();
    
public java.lang.StringgetContentType()

	//	System.err.println("OPIDataSource.getContentType() ");
	return contentType;
    
public java.lang.ObjectgetControl(java.lang.String name)

	//	System.err.println("OPIDataSource.getControl()");
	if (sourceStream != null)
	    return sourceStream.getControl(name);
	return null;
    
public java.lang.Object[]getControls()

	//	System.err.println("OPIDataSource.getControls()");
	if (sourceStream != null)
	    return sourceStream.getControls();
	return null;
    
public javax.media.TimegetDuration()

	//	System.err.println("OPIDataSource.getDuration()");
	return duration;
    
public javax.media.control.FormatControl[]getFormatControls()

	//	System.err.println("OPIDataSource.getFormatControls()");
	if (sourceStream == null) {
	    sourceStream = new OPISourceStream(this);
	    streams = new PushBufferStream[1];
	    streams[0] = sourceStream;
	}
	FormatControl[] fc = new FormatControl[1];
	fc[0] = (FormatControl)sourceStream.getControl(
					"javax.media.control.FormatControl");
	return fc;
    
public javax.media.protocol.RateConfiguration[]getRateConfigurations()
Methods for the RateConfigurable interface.

	RateConfiguration config [] = { new OneRateConfig() };
	return config;
    
booleangetStarted()

	//	System.err.println("OPIDataSource.getStarted()");
	return started;
    
public javax.media.protocol.PushBufferStream[]getStreams()

	//	System.err.println("OPIDataSource.getStreams()");
	if (!connected) {
	    System.err.println(
		"DataSource needs to be connected before calling getStreams");
	    return null;
	}
	return streams;
    
public javax.media.protocol.RateConfigurationsetRateConfiguration(javax.media.protocol.RateConfiguration config)

	return config;
    
public voidstart()

	if (started)
	    return;
	//	System.err.println("OPIDataSource.start()");
	sourceStream.start();
	started = true;
	//	super.start();
    
public voidstop()

	if (!started)
	    return;
	//	System.err.println("OPIDataSource.stop()");
	sourceStream.stop();
	started = false;
	//	super.stop();