Methods Summary |
---|
public synchronized void | close()
if (debug) {
System.err.println("SunRayRenderer close() entered");
}
if (xeventThread != null) {
xeventThread.stopChecking();
xeventThread.interrupt();
while (xeventThread.isAlive()) {
try {
Thread.currentThread().sleep(5);
} catch (InterruptedException ex) {
}
}
xeventThread = null;
}
if (available && blitter != 0)
srFree();
if (debug) {
System.err.println("SunRayRenderer close() complete");
}
|
protected int | doProcess(javax.media.Buffer buffer)
return doProcess(buffer, false);
|
protected int | doProcess(javax.media.Buffer buffer, boolean repaint)
// if (debug) {
// System.err.println("SunRayRenderer doProcess() entered");
// }
if (!available || component == null)
return BUFFER_PROCESSED_OK;
synchronized (this) {
if (!componentAvailable)
return BUFFER_PROCESSED_OK;
if (blitter == 0 || firstTime) {
firstTime = false;
if (blitter == 0)
srInitialize();
int handle = com.sun.media.util.WindowUtil.getWindowHandle(component);
if (handle != 0) {
srSetComponent(component);
// Reset it to force calling setInputFormat
inputFormat = new VideoFormat(null);
}
if (blitter == 0) {
if (debug) {
System.err.println("Could not create blitter");
}
return BUFFER_PROCESSED_FAILED;
}
}
if (!repaint) {
if (!buffer.getFormat().equals(inputFormat)) {
if (setInputFormat(buffer.getFormat()) == null)
return BUFFER_PROCESSED_FAILED;
}
data = buffer.getData();
} else
if (data == null)
return BUFFER_PROCESSED_FAILED;
if (outWidth > 0 && outHeight > 0) {
if (outWidth != lastOutWidth || outHeight != lastOutHeight) {
outWidth &= ~1;
lastOutWidth = outWidth;
lastOutHeight = outHeight;
srSetOutputSize(outWidth, outHeight);
if (debug) {
System.err.println("SunRayRenderer srSetOutputSize() "
+ outWidth + "x" + outHeight);
}
}
return (srDraw(data))?
BUFFER_PROCESSED_OK : BUFFER_PROCESSED_FAILED;
} else
return BUFFER_PROCESSED_FAILED;
}
|
public javax.media.Format[] | getBaseInputFormats()
if (debug) {
System.err.println("SunRayRenderer getBaseInputFormats() entered");
}
Format [] formats = new Format[1];
formats[0] = new YUVFormat();
return formats;
|
public javax.media.Format[] | getBaseOutputFormats()
if (debug) {
System.err.println("SunRayRenderer getBaseOutputFormats() entered");
}
Format [] formats = new Format[0];
return formats;
|
public void | open()
if (debug) {
System.err.println("SunRayRenderer open() entered");
}
if (!available) {
if (debug) {
System.err.println("SunRayRenderer Sun Ray not available");
}
throw new ResourceUnavailableException("Sun Ray not available");
}
|
protected synchronized void | removingComponent()
if (debug) {
System.err.println("SunRayRenderer removingComponent() entered");
}
if (blitter != 0) {
srFree();
}
|
protected synchronized void | repaint()
if (debug) {
System.err.println("SunRayRenderer repaint() entered");
}
if (!isStarted() && data != null)
doProcess(null, true);
|
public void | reset()
|
protected void | setAvailable(boolean on)
if (debug) {
System.err.println("SunRayRenderer setAvailable() entered");
}
Thread xevt = null;
super.setAvailable(on);
synchronized (this) {
if (on) {
if (xeventThread == null) {
xeventThread = new EventThread(this);
xeventThread.start();
}
} else {
if (xeventThread != null) {
xeventThread.stopChecking();
xeventThread.interrupt();
xevt = xeventThread;
xeventThread = null;
data = null;
}
}
}
// wait for the thread to end outside the synchronized block
// to avoid a deadlock
if (xevt != null) {
while (xevt.isAlive()) {
try {
Thread.currentThread().sleep(5);
} catch (InterruptedException ex) {
}
}
}
|
public javax.media.Format | setInputFormat(javax.media.Format format)Set the data input format.
if (debug) {
System.err.println("SunRayRenderer setInputFormat() entered");
}
if (!available) {
if (debug) {
System.err.println("SunRayRenderer setInputFormat !available");
}
return null;
}
if (!(format instanceof YUVFormat))
return null;
if (super.setInputFormat(format) != null) {
if (inputFormat instanceof YUVFormat) {
YUVFormat yuvf = (YUVFormat) inputFormat;
yuvType = yuvf.getYuvType();
yOff = yuvf.getOffsetY();
uOff = yuvf.getOffsetU();
vOff = yuvf.getOffsetV();
yStride = yuvf.getStrideY();
uvStride = yuvf.getStrideUV();
} else
return null;
int subx = 4; // assume 411
int suby = 4;
if (yuvType == YUVFormat.YUV_422) {
subx = 2;
suby = 2;
} else if (yuvType == YUVFormat.YUV_111) {
subx = 1;
suby = 1;
} else if (yuvType == YUVFormat.YUV_420) {
subx = 2;
suby = 2;
}
// Inform the native code of the input format change
srSetInputFormat(inWidth, inHeight,
yOff, uOff, vOff,
yStride, uvStride,
subx, suby);
if (outWidth == -1 || outHeight == -1) {
outWidth = inWidth;
outHeight = inHeight;
}
if (component != null)
component.setSize(outWidth, outHeight);
// All's well
if (debug) {
System.err.println("SunRayRenderer setInputFormat() returned "
+ format);
}
return format;
} else {
// Unsupported format
return null;
}
|
private native synchronized boolean | srDisplayIsSunRay()
|
private native synchronized boolean | srDraw(java.lang.Object data)
|
private native synchronized boolean | srEventCheck()
|
private native synchronized boolean | srFree()
|
private native synchronized boolean | srInitialize()
|
private native synchronized boolean | srSetComponent(java.lang.Object component)
|
private native synchronized boolean | srSetInputFormat(int width, int height, int offY, int offU, int offV, int strideY, int strideUV, int subX, int subY)
|
private native void | srSetJAWT(int jawt)
|
private native synchronized boolean | srSetOutputSize(int width, int height)
|