summaryrefslogtreecommitdiff
path: root/model
diff options
context:
space:
mode:
authorByteHamster <info@bytehamster.com>2022-01-25 22:08:05 +0100
committerByteHamster <info@bytehamster.com>2022-01-25 22:08:05 +0100
commitd4d506345b222406a41ddd2a49af5c208f76e236 (patch)
treea221bd74d64a9c8837504a74405fa12c0d7f8f87 /model
parentc376be44dd14132dafe49e311714b637e3af61fd (diff)
downloadantennapod-d4d506345b222406a41ddd2a49af5c208f76e236.zip
Move mime type guessing out of MediaType enum
Diffstat (limited to 'model')
-rw-r--r--model/src/main/java/de/danoeh/antennapod/model/playback/MediaType.java26
1 files changed, 0 insertions, 26 deletions
diff --git a/model/src/main/java/de/danoeh/antennapod/model/playback/MediaType.java b/model/src/main/java/de/danoeh/antennapod/model/playback/MediaType.java
index 6a7b36097..799977e9a 100644
--- a/model/src/main/java/de/danoeh/antennapod/model/playback/MediaType.java
+++ b/model/src/main/java/de/danoeh/antennapod/model/playback/MediaType.java
@@ -15,16 +15,6 @@ public enum MediaType {
"application/x-flac"
));
- // based on https://developer.android.com/guide/topics/media/media-formats
- static final Set<String> AUDIO_FILE_EXTENSIONS = new HashSet<>(Arrays.asList(
- "3gp", "aac", "amr", "flac", "imy", "m4a", "mid", "mkv", "mp3", "mp4", "mxmf", "oga",
- "ogg", "ogx", "opus", "ota", "rtttl", "rtx", "wav", "xmf"
- ));
-
- static final Set<String> VIDEO_FILE_EXTENSIONS = new HashSet<>(Arrays.asList(
- "3gp", "mkv", "mp4", "ogg", "ogv", "ogx", "webm"
- ));
-
public static MediaType fromMimeType(String mimeType) {
if (TextUtils.isEmpty(mimeType)) {
return MediaType.UNKNOWN;
@@ -37,20 +27,4 @@ public enum MediaType {
}
return MediaType.UNKNOWN;
}
-
- /**
- * @param extensionWithoutDot the file extension (suffix) without the dot
- * @return the {@link MediaType} that likely corresponds to the extension. However, since the
- * extension is not always enough to determine whether a file is an audio or video (3gp
- * can be both, for example), this may not be correct. As a result, where possible,
- * {@link #fromMimeType(String) fromMimeType} should always be tried first.
- */
- public static MediaType fromFileExtension(String extensionWithoutDot) {
- if (AUDIO_FILE_EXTENSIONS.contains(extensionWithoutDot)) {
- return MediaType.AUDIO;
- } else if (VIDEO_FILE_EXTENSIONS.contains(extensionWithoutDot)) {
- return MediaType.VIDEO;
- }
- return MediaType.UNKNOWN;
- }
}