2 * DemosceneMusic - AudioCodecFilter.java - Copyright © 2012 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.demoscenemusic.utils;
20 import java.util.HashMap;
24 * Helper for audio codec descriptions.
26 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
28 public class AudioCodecs {
30 /** Descriptions for audio codecs. */
31 public static final Map<String, AudioCodecDescription> codecDescriptions = new HashMap<String, AudioCodecDescription>();
34 codecDescriptions.put("mp3", new AudioCodecDescription("mp3", "MPEG 1 Layer 3", "MP3", "audio/mpeg", true, false));
35 codecDescriptions.put("vorbis", new AudioCodecDescription("vorbis", "Ogg Vorbis", "Vorbis", "audio/vorbis", true, false));
36 codecDescriptions.put("aac", new AudioCodecDescription("aac", "Advanced Audio Coding", "AAC", "audio/x-aac", true, false));
37 codecDescriptions.put("flac", new AudioCodecDescription("flac", "Free Lossless Audio Codec", "FLAC", "audio/ogg", true, true));
38 codecDescriptions.put("wav", new AudioCodecDescription("wav", "Waveform Audio", "WAV", "audio/vnc.wave", true, true));
39 codecDescriptions.put("mod", new AudioCodecDescription("mod", "Module", "MOD", "audio/mod", false, true));
40 codecDescriptions.put("ft2", new AudioCodecDescription("ft2", "FastTracker II Module", "XM", "audio/xm", false, true));
44 * Bundles descriptions for various audio codecs. For simplicity reasons,
45 * file formats such as MOD, IT, or SID are also treated as audio codecs
46 * even though they are not.
48 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
50 public final static class AudioCodecDescription {
52 /** The code of this codec. */
53 public final String code;
55 /** The full name of the codec. */
56 public final String name;
58 /** The short name of the codec. */
59 public final String shortName;
62 public final String mimeType;
64 /** Whether this is a streaming codec. */
65 public final boolean streaming;
67 /** Whether this codec is lossless. */
68 public final boolean lossless;
71 * Creates a new audio codec description.
74 * The code of the codec
76 * The full name of the codec
78 * The short name of the codec
80 * The MIME type of the audio codec
82 * {@code true} if the codec is a streaming audio codec,
83 * {@code false} otherwise
85 * {@code true} if the codec is a lossless audio codec,
86 * {@code false} otherwise
88 AudioCodecDescription(String code, String name, String shortName, String mimeType, boolean streaming, boolean lossless) {
91 this.shortName = shortName;
92 this.mimeType = mimeType;
93 this.streaming = streaming;
94 this.lossless = lossless;