DLNAMediaAudio audio = new DLNAMediaAudio();
if (inputFile.getFile() != null) {
try {
AudioFile af = AudioFileIO.read(inputFile.getFile());
AudioHeader ah = af.getAudioHeader();
if (ah != null && !thumbOnly) {
int length = ah.getTrackLength();
int rate = ah.getSampleRateAsNumber();
if (ah.getEncodingType().toLowerCase().contains("flac 24")) {
audio.setBitsperSample(24);
}
audio.setSampleFrequency("" + rate);
setDuration((double) length);
setBitrate((int) ah.getBitRateAsNumber());
audio.getAudioProperties().setNumberOfChannels(2);
if (ah.getChannels() != null && ah.getChannels().toLowerCase().contains("mono")) {
audio.getAudioProperties().setNumberOfChannels(1);
} else if (ah.getChannels() != null && ah.getChannels().toLowerCase().contains("stereo")) {
audio.getAudioProperties().setNumberOfChannels(2);
} else if (ah.getChannels() != null) {
audio.getAudioProperties().setNumberOfChannels(Integer.parseInt(ah.getChannels()));
}
audio.setCodecA(ah.getEncodingType().toLowerCase());
if (audio.getCodecA().contains("(windows media")) {
audio.setCodecA(audio.getCodecA().substring(0, audio.getCodecA().indexOf("(windows media")).trim());
}
}