public void fire() throws IllegalActionException {
super.fire();
if (input.hasToken(0)) {
JMFImageToken jmfImageToken = (JMFImageToken) input.get(0);
Buffer in = jmfImageToken.getValue();
VideoFormat videoFormat = (VideoFormat) in.getFormat();
YUVFormat yuvFormat = null;
try {
yuvFormat = (YUVFormat) videoFormat;
} catch (ClassCastException ex) {
throw new IllegalActionException(this, ex, "Failed to cast "
+ videoFormat.getClass() + ":\n" + videoFormat
+ "\nto YUVFormat\n" + "in.getFormat() was: "
+ in.getFormat().getClass()
+ "\nPerhaps the video source is not generating YUV?");
}
byte[] data = (byte[]) in.getData();
if (data != null) {
System.arraycopy(data, yuvFormat.getOffsetY(), YArray, 0,
YArray.length);
System.arraycopy(data, yuvFormat.getOffsetU(), UArray, 0,