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

OPICapture

public class OPICapture extends Object

Fields Summary
private static boolean
available
private static Integer
OPILock
private long
peer
Maintained by native code.
private SourceStream
stream
Referenced by native code.
Constructors Summary
public OPICapture(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 (OPILock) {
		return opiConnect(devnum, port);
	    }
	else
	    return false;
    
public booleandisconnect()

	if (available)
	    synchronized (OPILock) {
		return opiDisconnect();
	    }
	else
	    return false;
    
public voidfinalize()

	if (available)
	    synchronized (OPILock) {
		opiDisconnect();
	    }
    
public intgetHeight()

	if (available)
	    synchronized (OPILock) {
		return opiGetHeight();
	    }
	else
	    return 0;
    
public intgetLineStride()

	if (available)
	    synchronized (OPILock) {
		return opiGetLineStride();
	    }
	else
	    return 0;
    
public intgetWidth()

	if (available)
	    synchronized (OPILock) {
		return opiGetWidth();
	    }
	else
	    return 0;
    
public static booleanisAvailable()


     
	try {
	    com.sun.media.JMFSecurityManager.loadLibrary("jmutil");
	    com.sun.media.JMFSecurityManager.loadLibrary("jmopi");
	    if (opiInitialize() && cacheFieldIDs())
		available = true;
	    else
		System.err.println("OPICapture initialize failed");
	} catch (Exception e) {
		System.err.println("OPICapture initialize failed: " + e);
	} catch (UnsatisfiedLinkError ule) {
		System.err.println("OPICapture initialize failed: " + ule);
	}
    
	return available;
    
private native booleanopiConnect(int devnum, int port)

private native booleanopiDisconnect()

private native intopiGetHeight()

private native intopiGetLineStride()

private native intopiGetWidth()

private static native booleanopiInitialize()

private native booleanopiLittleEndian()

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

private native booleanopiSetBitRate(int bitrate)

private native booleanopiSetCompress(java.lang.String compress)

private native booleanopiSetFrameRate(int fps)

private native booleanopiSetPort(int port)

private native booleanopiSetQuality(int quality)

private native booleanopiSetScale(int scale)

private native booleanopiSetSignal(java.lang.String signal)

private native booleanopiStart()

private native booleanopiStop()

public intread(byte[] buf, int len)

	int rlen = 0;
	if (available) {
	    synchronized (OPILock) {
		rlen = opiRead(buf, len);
	    }
	    if (rlen < 0) {
		throw (new IOException("OPICapture read() failed"));
	    }
	} else {
	    throw (new IOException("OPICapture shared library not available"));
	}
	return rlen;
    
public booleansetBitRate(int bitrate)

	if (available)
	    synchronized (OPILock) {
		return opiSetBitRate(bitrate);
	    }
	else
	    return false;
    
public booleansetCompress(java.lang.String compress)

	if (available)
	    synchronized (OPILock) {
		return opiSetCompress(compress);
	    }
	else
	    return false;
    
public booleansetFrameRate(int fps)

	if (available)
	    synchronized (OPILock) {
		return opiSetFrameRate(fps);
	    }
	else
	    return false;
    
public booleansetPort(int port)

	if (available)
	    synchronized (OPILock) {
		return opiSetPort(port);
	    }
	else
	    return false;
    
public booleansetQuality(int quality)

	if (available)
	    synchronized (OPILock) {
		return opiSetQuality(quality);
	    }
	else
	    return false;
    
public booleansetScale(int scale)

	if (available)
	    synchronized (OPILock) {
		return opiSetScale(scale);
	    }
	else
	    return false;
    
public booleansetSignal(java.lang.String signal)

	if (available)
	    synchronized (OPILock) {
		return opiSetSignal(signal);
	    }
	else
	    return false;
    
public booleanstart()

	if (available)
	    synchronized (OPILock) {
		return opiStart();
	    }
	else
	    return false;
    
public booleanstop()

	if (available)
	    synchronized (OPILock) {
		return opiStop();
	    }
	else
	    return false;