Commit 80ff26b6 by ibaker Committed by Ian Baker

Add @ContentType IntDef to Util.getAdaptiveMimeTypeForContentType

Also add a case for RTSP, otherwise lint complains.

PiperOrigin-RevId: 438805903
parent 0370e053
...@@ -718,17 +718,17 @@ public final class C { ...@@ -718,17 +718,17 @@ public final class C {
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({TYPE_DASH, TYPE_SS, TYPE_HLS, TYPE_RTSP, TYPE_OTHER}) @IntDef({TYPE_DASH, TYPE_SS, TYPE_HLS, TYPE_RTSP, TYPE_OTHER})
public @interface ContentType {} 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; 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; 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; 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; public static final int TYPE_RTSP = 3;
/** /**
* Value returned by {@link Util#inferContentType(String)} for files other than DASH, HLS or * Value returned by {@link Util#inferContentType} for files other than DASH, HLS or Smooth
* Smooth Streaming manifests, or RTSP URIs. * Streaming manifests, or RTSP URIs.
*/ */
public static final int TYPE_OTHER = 4; public static final int TYPE_OTHER = 4;
......
...@@ -1902,10 +1902,10 @@ public final class Util { ...@@ -1902,10 +1902,10 @@ public final class Util {
/** /**
* Returns the MIME type corresponding to the given adaptive {@link ContentType}, or {@code null} * 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 @Nullable
public static String getAdaptiveMimeTypeForContentType(int contentType) { public static String getAdaptiveMimeTypeForContentType(@ContentType int contentType) {
switch (contentType) { switch (contentType) {
case C.TYPE_DASH: case C.TYPE_DASH:
return MimeTypes.APPLICATION_MPD; return MimeTypes.APPLICATION_MPD;
...@@ -1913,6 +1913,7 @@ public final class Util { ...@@ -1913,6 +1913,7 @@ public final class Util {
return MimeTypes.APPLICATION_M3U8; return MimeTypes.APPLICATION_M3U8;
case C.TYPE_SS: case C.TYPE_SS:
return MimeTypes.APPLICATION_SS; return MimeTypes.APPLICATION_SS;
case C.TYPE_RTSP:
case C.TYPE_OTHER: case C.TYPE_OTHER:
default: default:
return null; return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment