@Override public void seek(double second) { throw new NotSupportedException(); } }
@Override public void seek(double second) { throw new NotSupportedException(); }
public short[] encode(byte[] orig) { throw new NotSupportedException(); }
public static String lookupFourcc(AudioFormat format) { if (format.getSampleSizeInBits() == 16 && !format.isBigEndian()) return "sowt"; else if (format.getSampleSizeInBits() == 24) return "in24"; else throw new NotSupportedException("Audio format " + format + " is not supported."); }
/** * Generic byte-array to integer-array conversion * * Converts each depth-bit sequence from the input byte array into integer * * @param b * Input bytes * @param depth * Bit depth of the integers * @param isBe * If integers are big-endian or little-endian * @return */ public static int[] fromByte(byte[] b, int depth, boolean isBe) { if (depth == 24) if (isBe) return from24BE(b); else return from24LE(b); else if (depth == 16) if (isBe) return from16BE(b); else return from16LE(b); throw new NotSupportedException("Conversion from " + depth + "bit " + (isBe ? "big endian" : "little endian") + " is not supported."); }
/** * Generic integer-array to byte-array conversion * * Converts each integer into depth-bit sequence in the output byte array * * @param ia * Integer array * @param depth * Bit depth of the integers * @param isBe * If integers are big-endian or little-endian * @return */ public static byte[] toByte(int[] ia, int depth, boolean isBe) { if (depth == 24) if (isBe) return to24BE(ia); else return to24LE(ia); else if (depth == 16) if (isBe) return to16BE(ia); else return to16LE(ia); throw new NotSupportedException("Conversion to " + depth + "bit " + (isBe ? "big endian" : "little endian") + " is not supported."); } }
public static int fromInt(int[] data, int len, AudioFormat format, ByteBuffer buf) { if (!format.isSigned()) throw new NotSupportedException("Unsigned PCM is not supported ( yet? )."); if (format.getSampleSizeInBits() != 16 && format.getSampleSizeInBits() != 24) throw new NotSupportedException(format.getSampleSizeInBits() + " bit PCM is not supported ( yet? )."); if (format.isBigEndian()) { if (format.getSampleSizeInBits() == 16) { return fromInt16BE(buf, data, len); } else { return fromInt24BE(buf, data, len); } } else { if (format.getSampleSizeInBits() == 16) { return fromInt16LE(buf, data, len); } else { return fromInt24LE(buf, data, len); } } }
public static int toInt(AudioFormat format, ByteBuffer buf, int[] samples) { if (!format.isSigned()) throw new NotSupportedException("Unsigned PCM is not supported ( yet? )."); if (format.getSampleSizeInBits() != 16 && format.getSampleSizeInBits() != 24) throw new NotSupportedException(format.getSampleSizeInBits() + " bit PCM is not supported ( yet? )."); if (format.isBigEndian()) { if (format.getSampleSizeInBits() == 16) { return toInt16BE(buf, samples); } else { return toInt24BE(buf, samples); } } else { if (format.getSampleSizeInBits() == 16) { return toInt16LE(buf, samples); } else { return toInt24LE(buf, samples); } } }
/** * Converts float PCM samples stored in floatBuf to integer representation * according to format and stores them in buf * * @param format * Supported formats - *_*_S16_LE, *_*_S24_LE, *_*_S16_BE, * *_*_S24_LE * @param buf * @param floatBuf * @return Total number of samples written to the buffer */ public static void fromFloat(FloatBuffer floatBuf, AudioFormat format, ByteBuffer buf) { if (!format.isSigned()) throw new NotSupportedException("Unsigned PCM is not supported ( yet? )."); if (format.getSampleSizeInBits() != 16 && format.getSampleSizeInBits() != 24) throw new NotSupportedException(format.getSampleSizeInBits() + " bit PCM is not supported ( yet? )."); if (format.isBigEndian()) { if (format.getSampleSizeInBits() == 16) { fromFloat16BE(buf, floatBuf); } else { fromFloat24BE(buf, floatBuf); } } else { if (format.getSampleSizeInBits() == 16) { fromFloat16LE(buf, floatBuf); } else { fromFloat24LE(buf, floatBuf); } } }
@Override public void transform(PictureHiBD src, PictureHiBD dst) { if (src.getColor() != ColorSpace.RGB && src.getColor() != ColorSpace.BGR || dst.getColor() != ColorSpace.RGB && dst.getColor() != ColorSpace.BGR) { throw new IllegalArgumentException( "Expected RGB or BGR inputs, was: " + src.getColor() + ", " + dst.getColor()); } if (src.getCrop() != null || dst.getCrop() != null) throw new NotSupportedException("Cropped images not supported"); int[] dataSrc = src.getPlaneData(0); int[] dataDst = dst.getPlaneData(0); for (int i = 0; i < dataSrc.length; i += 3) { // src and dst can actually be the same array int tmp = dataSrc[i + 2]; dataDst[i + 2] = dataSrc[i]; dataDst[i] = tmp; } }
/** * Converts PCM samples stored in buf and described with format to float * array representation * * @param format * Supported formats - *_*_S16_LE, *_*_S24_LE, *_*_S16_BE, * *_*_S24_LE * @param buf * @param floatBuf * @return Total number of samples read from the buffer */ public static void toFloat(AudioFormat format, ByteBuffer buf, FloatBuffer floatBuf) { if (!format.isSigned()) throw new NotSupportedException("Unsigned PCM is not supported ( yet? )."); if (format.getSampleSizeInBits() != 16 && format.getSampleSizeInBits() != 24) throw new NotSupportedException(format.getSampleSizeInBits() + " bit PCM is not supported ( yet? )."); if (format.isBigEndian()) { if (format.getSampleSizeInBits() == 16) { toFloat16BE(buf, floatBuf); } else { toFloat24BE(buf, floatBuf); } } else { if (format.getSampleSizeInBits() == 16) { toFloat16LE(buf, floatBuf); } else { toFloat24LE(buf, floatBuf); } } }
throw new NotSupportedException("TODO: unknowwn mode: "+this.mode);