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

XILCapture

public class XILCapture extends Object
This class shares XILLock with com.sun.media.renderer.video.XILRenderer. XIL 1.2 (Solaris 2.5, 2.5.1) is not multithread safe. All calls to the XIL library must be single threaded, whether for capture or rendering. Because of this common lock, calls that will result in delays are not to be encouraged since this will result in erratic performance of the renderer. For example, setting Jpeg quality high with a high frame rate will result in jerky rendering of video other than the capture stream.

Fields Summary
private static boolean
available
private long
peer
Maintained by native code.
private SourceStream
stream
Referenced by native code.
Constructors Summary
public XILCapture(SourceStream stream)

	this.stream = stream;
    
Methods Summary
private static native booleancacheFieldIDs()

public booleanconnect(int devnum)

	return connect(devnum, 1);
    
public booleanconnect(int devnum, int port)

	if (available)
	    synchronized (com.sun.media.renderer.video.XILRenderer.XILLock) {
		return xilConnect(devnum, port);
	    }
	else
	    return false;
    
public booleandisconnect()

	if (available)
	    synchronized (com.sun.media.renderer.video.XILRenderer.XILLock) {
		return xilDisconnect();
	    }
	else
	    return false;
    
public voidfinalize()

	if (available)
	    synchronized (com.sun.media.renderer.video.XILRenderer.XILLock) {
		xilDisconnect();
	    }
    
public intgetHeight()

	if (available)
	    synchronized (com.sun.media.renderer.video.XILRenderer.XILLock) {
		return xilGetHeight();
	    }
	else
	    return 0;
    
public intgetLineStride()

	if (available)
	    synchronized (com.sun.media.renderer.video.XILRenderer.XILLock) {
		return xilGetLineStride();
	    }
	else
	    return 0;
    
public intgetWidth()

	if (available)
	    synchronized (com.sun.media.renderer.video.XILRenderer.XILLock) {
		return xilGetWidth();
	    }
	else
	    return 0;
    
public static booleanisAvailable()


     
	try {
	    com.sun.media.JMFSecurityManager.loadLibrary("jmutil");
	    com.sun.media.JMFSecurityManager.loadLibrary("jmxil");
	    if (xilInitialize() && cacheFieldIDs())
		available = true;
	    else
		System.err.println("XILCapture initialize failed");
	} catch (Exception e) {
		System.err.println("XILCapture initialize failed: " + e);
	} catch (UnsatisfiedLinkError ule) {
		System.err.println("XILCapture initialize failed: " + ule);
	}
    
	return available;
    
public intread(byte[] buf, int len)

	int rlen = 0;
	if (available) {
	    synchronized (com.sun.media.renderer.video.XILRenderer.XILLock) {
		rlen = xilRead(buf, len);
	    }
	    if (rlen < 0) {
		throw (new IOException("XILCapture read() failed"));
	    }
	} else {
	    throw (new IOException("XILCapture shared library not available"));
	}
	return rlen;
    
public booleansetCompress(java.lang.String compress)

	if (available)
	    synchronized (com.sun.media.renderer.video.XILRenderer.XILLock) {
		return xilSetCompress(compress);
	    }
	else
	    return false;
    
public booleansetPort(int port)

	if (available)
	    synchronized (com.sun.media.renderer.video.XILRenderer.XILLock) {
		return xilSetPort(port);
	    }
	else
	    return false;
    
public booleansetQuality(int quality)

	if (available)
	    synchronized (com.sun.media.renderer.video.XILRenderer.XILLock) {
		return xilSetQuality(quality);
	    }
	else
	    return false;
    
public booleansetScale(int scale)

	if (available)
	    synchronized (com.sun.media.renderer.video.XILRenderer.XILLock) {
		return xilSetScale(scale);
	    }
	else
	    return false;
    
public booleansetSkip(int skip)

	if (available)
	    synchronized (com.sun.media.renderer.video.XILRenderer.XILLock) {
		return xilSetSkip(skip);
	    }
	else
	    return false;
    
public booleanstart()

	if (available)
	    synchronized (com.sun.media.renderer.video.XILRenderer.XILLock) {
		return xilStart();
	    }
	else
	    return false;
    
public booleanstop()

	if (available)
	    synchronized (com.sun.media.renderer.video.XILRenderer.XILLock) {
		return xilStop();
	    }
	else
	    return false;
    
private native booleanxilConnect(int devnum, int port)

private native booleanxilDisconnect()

private native intxilGetHeight()

private native intxilGetLineStride()

private native intxilGetWidth()

private static native booleanxilInitialize()

private native booleanxilLittleEndian()

private native intxilRead(byte[] buf, int len)

private native booleanxilSetCompress(java.lang.String compress)

private native booleanxilSetPort(int port)

private native booleanxilSetQuality(int quality)

private native booleanxilSetScale(int scale)

private native booleanxilSetSkip(int skip)

private native booleanxilStart()

private native booleanxilStop()