process the media from the input buffer to the output buffer
// System.out.println("in " + inputBuffer.getLength() );
// System.out.println("out " + outputBuffer.getLength() );
if (flagEOM) {
outputBuffer.setLength(0);
outputBuffer.setEOM(true);
flagEOM=false;
return BUFFER_PROCESSED_OK;
}
if (outputBuffer.isDiscard()) {
outputBuffer.setLength(0);
outputBuffer.setOffset(0);
}
if (inputBuffer.isEOM()) {
// this is a little tricky since we have to output two frames now:
// one to close former session, another to signle EOM
if (outputBuffer.getLength() > 0 ) {
flagEOM=true;
return BUFFER_PROCESSED_OK | INPUT_BUFFER_NOT_CONSUMED ;
} else {
// in case we have nothing in the output, we are done
outputBuffer.setLength(0);
outputBuffer.setEOM(true);
return BUFFER_PROCESSED_OK;
}
}
if (outputBuffer.getData()==null)
outputBuffer.setData(new byte[10000]);
System.arraycopy(inputBuffer.getData(),inputBuffer.getOffset(),
outputBuffer.getData(),outputBuffer.getLength(),
inputBuffer.getLength() );
outputBuffer.setLength(outputBuffer.getLength() + inputBuffer.getLength() );
if ( (++counter) == 5 ) {
counter=0;
outputBuffer.setFormat(af );
return BUFFER_PROCESSED_OK;
}
return BUFFER_PROCESSED_OK | OUTPUT_BUFFER_NOT_FILLED ;