FileDocCategorySizeDatePackage
DataSource.javaAPI DocJMF 2.1.1e3642Mon May 12 12:21:20 BST 2003com.sun.media.protocol.vfw

DataSource

public class DataSource extends com.sun.media.protocol.BasicPushBufferDataSource implements CaptureDevice, RateConfigureable

Fields Summary
private PushBufferStream[]
streams
private VFWSourceStream
vfwStream
private static String
ContentType
private javax.media.control.FormatControl
fc
protected Control[]
controls
Constructors Summary
public DataSource()

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

	if (streams == null) {
	    streams = new PushBufferStream[1];
	    if (vfwStream == null)
		vfwStream = new VFWSourceStream(getLocator());
	    streams[0] = vfwStream;
	}

        vfwStream.connect(null);

	super.connect();
    
public voiddisconnect()

	vfwStream.disconnect();
	super.disconnect();
    
public CaptureDeviceInfogetCaptureDeviceInfo()

	if (vfwStream == null)
	    return null;
	else
	    return vfwStream.getCaptureDeviceInfo();
    
public java.lang.ObjectgetControl(java.lang.String controlType)
Return the control based on a control type for the PlugIn.

       try {
          Class  cls = Class.forName(controlType);
          Object cs[] = getControls();
          for (int i = 0; i < cs.length; i++) {
             if (cls.isInstance(cs[i]))
                return cs[i];
          }
          return null;

       } catch (Exception e) {   // no such controlType or such control
         return null;
       }
    
public java.lang.Object[]getControls()

	if (vfwStream != null)
	    return vfwStream.getControls();
	else
	    return new Control[0];
    
public javax.media.control.FormatControl[]getFormatControls()

	if (vfwStream == null)
	    return new FormatControl[0];
	else
	    return new FormatControl[] {(FormatControl) vfwStream};
    
public RateConfiguration[]getRateConfigurations()
Methods for the RateConfigurable interface.

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

	return started;
    
public PushBufferStream[]getStreams()

	if (streams == null)
	    System.err.println("DataSource needs to be connected before calling getStreams");
	return streams;
    
public voidsetLocator(MediaLocator loc)

	super.setLocator(loc);
	if (vfwStream == null) {
	    vfwStream = new VFWSourceStream(getLocator());
	}
    
public RateConfigurationsetRateConfiguration(RateConfiguration config)

	return config;
    
public voidstart()

	vfwStream.start();
	super.start();
    
public voidstop()

	vfwStream.stop();
	super.stop();