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

DataSource

public class DataSource extends BasicPushBufferDataSource implements CaptureDevice, RateConfigureable

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


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

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

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

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

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

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

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

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

	//	System.err.println("SunVideoDataSource.getFormatControls()");
	if (sourceStream == null) {
	    sourceStream = new SunVideoSourceStream(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("SunVideoDataSource.getStarted()");
	return started;
    
public javax.media.protocol.PushBufferStream[]getStreams()

	//	System.err.println("SunVideoDataSource.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()

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

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