JavaDecoderpublic class JavaDecoder extends VideoCodec
Fields Summary |
---|
private static final int | rMask | private static final int | gMask | private static final int | bMask | private int[] | refData | private CineStore | fOurStorethe cinepak java decoder |
Constructors Summary |
---|
public JavaDecoder()
supportedInputFormats = new VideoFormat[] {new VideoFormat(VideoFormat.CINEPAK) };
defaultOutputFormats = new VideoFormat[] {new RGBFormat(
null, Format.NOT_SPECIFIED,
Format.intArray,
Format.NOT_SPECIFIED, // frame rate
32,
rMask, gMask, bMask,
1,Format.NOT_SPECIFIED,
Format.FALSE, // flipped
Format.NOT_SPECIFIED // endian
) };
PLUGIN_NAME = "Cinepak Decoder";
|
Methods Summary |
---|
public void | close()
fOurStore=null;
| protected javax.media.Format[] | getMatchingOutputFormats(javax.media.Format in)
VideoFormat ivf = (VideoFormat) in;
Dimension inSize = ivf.getSize();
int lineStride = (inSize.width + 3) & ~3;
int rowStride = (inSize.height + 3) & ~3;
supportedOutputFormats= new VideoFormat[] {
new RGBFormat (new Dimension(inSize),
lineStride * rowStride, Format.intArray,
ivf.getFrameRate(),
32,
rMask, gMask, bMask
)
};
return supportedOutputFormats;
| protected void | initDecoder()
fOurStore = new CineStore();
| public void | open()
initDecoder();
| public int | process(javax.media.Buffer inputBuffer, javax.media.Buffer outputBuffer)
if (!checkInputBuffer(inputBuffer) ) {
return BUFFER_PROCESSED_FAILED;
}
if (isEOM(inputBuffer) ) {
propagateEOM(outputBuffer);
return BUFFER_PROCESSED_OK;
}
VideoFormat ivf=(VideoFormat) inputBuffer.getFormat();
int inLength=inputBuffer.getLength();
int inMaxLength=ivf.getMaxDataLength();
int outMaxLength=outputFormat.getMaxDataLength();
byte[] inData =(byte[]) inputBuffer.getData();
int[] outData = validateIntArraySize(outputBuffer,outMaxLength );
if (refData == null) {
refData = outData;
outputBuffer.setData(null);
outData = validateIntArraySize(outputBuffer, outMaxLength);
}
outputBuffer.setData(refData); // temporarily
// the java decoder relies on output Buffer format
outputBuffer.setFormat(outputFormat);
fOurStore.DoFrame(inputBuffer, outputBuffer, fOurStore);
System.arraycopy(refData, 0,
outData, 0,
outMaxLength); // make a copy
outputBuffer.setData(outData); // put it back in the buffer
updateOutput(outputBuffer,outputFormat, outMaxLength, 0);
return BUFFER_PROCESSED_OK;
| public void | reset()
// no need to init decoder as first frame is always a key frame
| protected void | videoResized()
initDecoder();
|
|