From 80ff26b6fa09ef78415ad96be8cede9a446563c8 Mon Sep 17 00:00:00 2001 From: ibaker Date: Fri, 1 Apr 2022 14:02:35 +0100 Subject: [PATCH] Add @ContentType IntDef to Util.getAdaptiveMimeTypeForContentType Also add a case for RTSP, otherwise lint complains. PiperOrigin-RevId: 438805903 --- .../main/java/com/google/android/exoplayer2/C.java | 12 ++++++------ .../com/google/android/exoplayer2/util/Util.java | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/library/common/src/main/java/com/google/android/exoplayer2/C.java b/library/common/src/main/java/com/google/android/exoplayer2/C.java index 5b1786f5c7..3eef49c42c 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/C.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/C.java @@ -718,17 +718,17 @@ public final class C { @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @IntDef({TYPE_DASH, TYPE_SS, TYPE_HLS, TYPE_RTSP, TYPE_OTHER}) public @interface ContentType {} - /** Value returned by {@link Util#inferContentType(String)} for DASH manifests. */ + /** Value returned by {@link Util#inferContentType} for DASH manifests. */ public static final int TYPE_DASH = 0; - /** Value returned by {@link Util#inferContentType(String)} for Smooth Streaming manifests. */ + /** Value returned by {@link Util#inferContentType} for Smooth Streaming manifests. */ public static final int TYPE_SS = 1; - /** Value returned by {@link Util#inferContentType(String)} for HLS manifests. */ + /** Value returned by {@link Util#inferContentType} for HLS manifests. */ public static final int TYPE_HLS = 2; - /** Value returned by {@link Util#inferContentType(String)} for RTSP. */ + /** Value returned by {@link Util#inferContentType} for RTSP. */ public static final int TYPE_RTSP = 3; /** - * Value returned by {@link Util#inferContentType(String)} for files other than DASH, HLS or - * Smooth Streaming manifests, or RTSP URIs. + * Value returned by {@link Util#inferContentType} for files other than DASH, HLS or Smooth + * Streaming manifests, or RTSP URIs. */ public static final int TYPE_OTHER = 4; diff --git a/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java b/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java index 00a0fd355d..6f33ef788e 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java @@ -1902,10 +1902,10 @@ public final class Util { /** * Returns the MIME type corresponding to the given adaptive {@link ContentType}, or {@code null} - * if the content type is {@link C#TYPE_OTHER}. + * if the content type is not adaptive. */ @Nullable - public static String getAdaptiveMimeTypeForContentType(int contentType) { + public static String getAdaptiveMimeTypeForContentType(@ContentType int contentType) { switch (contentType) { case C.TYPE_DASH: return MimeTypes.APPLICATION_MPD; @@ -1913,6 +1913,7 @@ public final class Util { return MimeTypes.APPLICATION_M3U8; case C.TYPE_SS: return MimeTypes.APPLICATION_SS; + case C.TYPE_RTSP: case C.TYPE_OTHER: default: return null;