baa4e92edf121110e5448fa38ddfc90924a0b68f
[demoscenemusic.git] / src / main / java / net / pterodactylus / demoscenemusic / utils / AudioCodecs.java
1 /*
2  * DemosceneMusic - AudioCodecFilter.java - Copyright © 2012 David Roden
3  *
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.
8  *
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.
13  *
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/>.
16  */
17
18 package net.pterodactylus.demoscenemusic.utils;
19
20 import java.util.HashMap;
21 import java.util.Map;
22
23 /**
24  * Helper for audio codec descriptions.
25  *
26  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
27  */
28 public class AudioCodecs {
29
30         /** Descriptions for audio codecs. */
31         public static final Map<String, AudioCodecDescription> codecDescriptions = new HashMap<String, AudioCodecDescription>();
32
33         static {
34                 codecDescriptions.put("mp3", new AudioCodecDescription("MPEG 1 Layer 3", "MP3", true, false));
35                 codecDescriptions.put("vorbis", new AudioCodecDescription("Ogg Vorbis", "Vorbis", true, false));
36                 codecDescriptions.put("aac", new AudioCodecDescription("Advanced Audio Coding", "AAC", true, false));
37                 codecDescriptions.put("flac", new AudioCodecDescription("Free Lossless Audio Codec", "FLAC", true, true));
38                 codecDescriptions.put("WAV", new AudioCodecDescription("Waveform Audio", "WAV", true, true));
39                 codecDescriptions.put("mod", new AudioCodecDescription("Module", "MOD", false, true));
40         }
41
42         /**
43          * Bundles descriptions for various audio codecs. For simplicity reasons,
44          * file formats such as MOD, IT, or SID are also treated as audio codecs
45          * even though they are not.
46          *
47          * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
48          */
49         public final static class AudioCodecDescription {
50
51                 /** The full name of the codec. */
52                 public final String name;
53
54                 /** The short name of the codec. */
55                 public final String shortName;
56
57                 /** Whether this is a streaming codec. */
58                 public final boolean streaming;
59
60                 /** Whether this codec is lossless. */
61                 public final boolean lossless;
62
63                 /**
64                  * Creates a new audio codec description.
65                  *
66                  * @param name
67                  *            The full name of the codec
68                  * @param shortName
69                  *            The short name of the codec
70                  * @param streaming
71                  *            {@code true} if the codec is a streaming audio codec,
72                  *            {@code false} otherwise
73                  * @param lossless
74                  *            {@code true} if the codec is a lossless audio codec,
75                  *            {@code false} otherwise
76                  */
77                 AudioCodecDescription(String name, String shortName, boolean streaming, boolean lossless) {
78                         this.name = name;
79                         this.shortName = shortName;
80                         this.streaming = streaming;
81                         this.lossless = lossless;
82                 }
83
84         }
85
86 }