Methods Summary |
---|
public synchronized void | close()
if (available) {
dxFree();
if (yuyvInUseByMe) {
yuyvInUseByMe = false;
yuyvInUse = false;
}
}
|
protected synchronized int | doProcess(javax.media.Buffer buffer)
if (!available || component == null)
return BUFFER_PROCESSED_OK;
synchronized (this) {
if (!componentAvailable)
return BUFFER_PROCESSED_OK;
if (blitter == 0) {
int handle = com.sun.media.util.WindowUtil.getWindowHandle(component);
if (handle != 0) {
dxSetComponent(handle);
inputFormat = new VideoFormat(null);
}
if (blitter == 0) {
System.err.println("Could not create blitter");
return BUFFER_PROCESSED_FAILED;
}
}
if (!buffer.getFormat().equals(inputFormat)) {
if (setInputFormat(buffer.getFormat()) == null)
return BUFFER_PROCESSED_FAILED;
}
synchronized (processLock) {
long dataBytes = 0;
data = getInputData(buffer);
if (data instanceof NBA) {
dataBytes = ((NBA)data).getNativeData();
}
if (data == null)
return BUFFER_PROCESSED_OK;
if (outWidth > 0 && outHeight > 0)
return (dxDraw(data, dataBytes, outWidth, outHeight))?
BUFFER_PROCESSED_OK : BUFFER_PROCESSED_FAILED;
else
return BUFFER_PROCESSED_FAILED;
}
}
|
private native synchronized boolean | dxDraw(java.lang.Object array, long bytes, int width, int height)
|
private native synchronized boolean | dxFree()
|
private native synchronized boolean | dxInitialize()
|
private native synchronized boolean | dxSetComponent(int windowHandle)
|
private native synchronized boolean | dxSetFourCCInputFormat(int width, int height, int yuvType)
|
private native synchronized boolean | dxSetInputFormat(int width, int height, int strideX, int bpp, int rm, int gm, int bm, boolean flipped)
|
private native synchronized boolean | dxSetOutputSize(int width, int height)
|
public javax.media.Format[] | getBaseInputFormats()DynamicPlugIn methods
Format [] formats = new Format[2];
formats[0] = new RGBFormat();
formats[1] = new YUVFormat();
return formats;
|
public javax.media.Format[] | getBaseOutputFormats()
Format [] formats = new Format[0];
return formats;
|
protected java.awt.Color | getPreferredBackground()Local Methods
return new Color(255, 0, 255);
|
public synchronized void | open()
if (!available)
throw new ResourceUnavailableException("DirectDraw not available");
if (inputFormat instanceof YUVFormat) {
yuyvInUse = true;
yuyvInUseByMe = true;
}
|
protected synchronized void | removingComponent()
if (blitter != 0)
dxFree();
|
protected synchronized void | repaint()
if (!isStarted() && data != null && blitter != 0)
if (outWidth > 0 && outHeight > 0) {
long dataBytes = 0;
if (data instanceof NBA) {
dataBytes = ((NBA)data).getNativeData();
}
dxDraw(data, dataBytes, outWidth, outHeight);
}
|
public void | reset()
|
public synchronized javax.media.Format | setInputFormat(javax.media.Format format)Set the data input format.
if (!available)
return null;
if (super.setInputFormat(format) != null) {
if (inputFormat instanceof RGBFormat) {
RGBFormat rgbf = (RGBFormat) inputFormat;
bitsPerPixel = rgbf.getBitsPerPixel();
rMask = rgbf.getRedMask();
gMask = rgbf.getGreenMask();
bMask = rgbf.getBlueMask();
lineStride = rgbf.getLineStride();
if (bitsPerPixel == 24)
lineStride /= 3;
pixelStride = rgbf.getPixelStride();
if (rgbf.getFlipped() == Format.TRUE)
upsideDown = true;
else
upsideDown = false;
// Inform the native code of the input format change
if (!dxSetInputFormat(inWidth, inHeight, lineStride,
bitsPerPixel, rMask, gMask, bMask, upsideDown))
return null;
} else if (inputFormat instanceof IndexedColorFormat) {
lineStride = ((IndexedColorFormat)format).getLineStride();
} else if (inputFormat instanceof YUVFormat) {
if ((fccSupported & (YUYV)) == 0)
return null;
YUVFormat yuv = (YUVFormat) inputFormat;
int yuvType = yuv.getYuvType();
if (yuvType != YUVFormat.YUV_420 &&
yuvType != YUVFormat.YUV_422)
return null;
lineStride = yuv.getStrideY();
pixelStride = 1;
offsetY = yuv.getOffsetY();
offsetU = yuv.getOffsetU();
offsetV = yuv.getOffsetV();
if (!dxSetFourCCInputFormat(inWidth, inHeight, yuvType))
return null;
} else
return null;
if (outWidth == -1 || outHeight == -1) {
outWidth = inWidth;
outHeight = inHeight;
}
// Determine the bytesPerPixel of the data data
Class dataType = inputFormat.getDataType();
if (dataType == Format.intArray)
bytesPerPixel = 4;
else if (dataType == Format.shortArray)
bytesPerPixel = 2;
else if (dataType == Format.byteArray)
bytesPerPixel = 1;
if (component != null)
component.setSize(outWidth, outHeight);
// All's well
return format;
} else {
// Unsupported format
return null;
}
|