use of org.tritonus.share.sampled.file.TAudioFileFormat in project Minim by ddf.
the class JSMinim method getID3Tags.
@SuppressWarnings("unchecked")
private Map<String, Object> getID3Tags(String filename) {
debug("Getting the properties.");
Map<String, Object> props = new HashMap<String, Object>();
try {
MpegAudioFileReader reader = new MpegAudioFileReader(this);
InputStream stream = (InputStream) createInput.invoke(fileLoader, filename);
if (stream != null) {
AudioFileFormat baseFileFormat = reader.getAudioFileFormat(stream, stream.available());
stream.close();
if (baseFileFormat instanceof TAudioFileFormat) {
TAudioFileFormat fileFormat = (TAudioFileFormat) baseFileFormat;
props = (Map<String, Object>) fileFormat.properties();
if (props.size() == 0) {
error("No file properties available for " + filename + ".");
} else {
debug("File properties: " + props.toString());
}
}
}
} catch (UnsupportedAudioFileException e) {
error("Couldn't get the file format for " + filename + ": " + e.getMessage());
} catch (IOException e) {
error("Couldn't access " + filename + ": " + e.getMessage());
} catch (Exception e) {
error("Error invoking createInput on the file loader object: " + e.getMessage());
}
return props;
}
Aggregations