Move UUID constants to C, and make C an interface.
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=122242006
This commit is contained in:
parent
b53a941ffd
commit
ea8d0a7aef
@ -15,8 +15,8 @@
|
||||
*/
|
||||
package com.google.android.exoplayer.drm;
|
||||
|
||||
import static com.google.android.exoplayer.drm.StreamingDrmSessionManager.PLAYREADY_UUID;
|
||||
import static com.google.android.exoplayer.drm.StreamingDrmSessionManager.WIDEVINE_UUID;
|
||||
import static com.google.android.exoplayer.C.PLAYREADY_UUID;
|
||||
import static com.google.android.exoplayer.C.WIDEVINE_UUID;
|
||||
import static com.google.android.exoplayer.util.MimeTypes.VIDEO_MP4;
|
||||
|
||||
import com.google.android.exoplayer.C;
|
||||
|
@ -26,196 +26,209 @@ import java.util.UUID;
|
||||
/**
|
||||
* Defines constants that are generally useful throughout the library.
|
||||
*/
|
||||
public final class C {
|
||||
public interface C {
|
||||
|
||||
/**
|
||||
* Special microsecond constant representing the end of a source.
|
||||
*/
|
||||
public static final long END_OF_SOURCE_US = Long.MIN_VALUE;
|
||||
long END_OF_SOURCE_US = Long.MIN_VALUE;
|
||||
|
||||
/**
|
||||
* Special microsecond constant representing an unset or unknown time or duration.
|
||||
*/
|
||||
public static final long UNSET_TIME_US = Long.MIN_VALUE + 1;
|
||||
long UNSET_TIME_US = Long.MIN_VALUE + 1;
|
||||
|
||||
/**
|
||||
* The number of microseconds in one second.
|
||||
*/
|
||||
public static final long MICROS_PER_SECOND = 1000000L;
|
||||
long MICROS_PER_SECOND = 1000000L;
|
||||
|
||||
/**
|
||||
* Represents an unbounded length of data.
|
||||
*/
|
||||
public static final int LENGTH_UNBOUNDED = -1;
|
||||
int LENGTH_UNBOUNDED = -1;
|
||||
|
||||
/**
|
||||
* The name of the UTF-8 charset.
|
||||
*/
|
||||
public static final String UTF8_NAME = "UTF-8";
|
||||
String UTF8_NAME = "UTF-8";
|
||||
|
||||
/**
|
||||
* @see MediaCodec#CRYPTO_MODE_AES_CTR
|
||||
*/
|
||||
@SuppressWarnings("InlinedApi")
|
||||
public static final int CRYPTO_MODE_AES_CTR = MediaCodec.CRYPTO_MODE_AES_CTR;
|
||||
int CRYPTO_MODE_AES_CTR = MediaCodec.CRYPTO_MODE_AES_CTR;
|
||||
|
||||
/**
|
||||
* @see AudioFormat#ENCODING_INVALID
|
||||
*/
|
||||
public static final int ENCODING_INVALID = AudioFormat.ENCODING_INVALID;
|
||||
int ENCODING_INVALID = AudioFormat.ENCODING_INVALID;
|
||||
|
||||
/**
|
||||
* @see AudioFormat#ENCODING_PCM_8BIT
|
||||
*/
|
||||
public static final int ENCODING_PCM_8BIT = AudioFormat.ENCODING_PCM_8BIT;
|
||||
int ENCODING_PCM_8BIT = AudioFormat.ENCODING_PCM_8BIT;
|
||||
|
||||
/**
|
||||
* @see AudioFormat#ENCODING_PCM_16BIT
|
||||
*/
|
||||
public static final int ENCODING_PCM_16BIT = AudioFormat.ENCODING_PCM_16BIT;
|
||||
int ENCODING_PCM_16BIT = AudioFormat.ENCODING_PCM_16BIT;
|
||||
|
||||
/**
|
||||
* PCM encoding with 24 bits per sample.
|
||||
*/
|
||||
public static final int ENCODING_PCM_24BIT = 0x80000000;
|
||||
int ENCODING_PCM_24BIT = 0x80000000;
|
||||
|
||||
/**
|
||||
* PCM encoding with 32 bits per sample.
|
||||
*/
|
||||
public static final int ENCODING_PCM_32BIT = 0x40000000;
|
||||
int ENCODING_PCM_32BIT = 0x40000000;
|
||||
|
||||
/**
|
||||
* @see AudioFormat#ENCODING_AC3
|
||||
*/
|
||||
@SuppressWarnings("InlinedApi")
|
||||
public static final int ENCODING_AC3 = AudioFormat.ENCODING_AC3;
|
||||
int ENCODING_AC3 = AudioFormat.ENCODING_AC3;
|
||||
|
||||
/**
|
||||
* @see AudioFormat#ENCODING_E_AC3
|
||||
*/
|
||||
@SuppressWarnings("InlinedApi")
|
||||
public static final int ENCODING_E_AC3 = AudioFormat.ENCODING_E_AC3;
|
||||
int ENCODING_E_AC3 = AudioFormat.ENCODING_E_AC3;
|
||||
|
||||
/**
|
||||
* @see AudioFormat#ENCODING_DTS
|
||||
*/
|
||||
@SuppressWarnings("InlinedApi")
|
||||
public static final int ENCODING_DTS = AudioFormat.ENCODING_DTS;
|
||||
int ENCODING_DTS = AudioFormat.ENCODING_DTS;
|
||||
|
||||
/**
|
||||
* @see AudioFormat#ENCODING_DTS_HD
|
||||
*/
|
||||
@SuppressWarnings("InlinedApi")
|
||||
public static final int ENCODING_DTS_HD = AudioFormat.ENCODING_DTS_HD;
|
||||
int ENCODING_DTS_HD = AudioFormat.ENCODING_DTS_HD;
|
||||
|
||||
/**
|
||||
* @see AudioFormat#CHANNEL_OUT_7POINT1_SURROUND
|
||||
*/
|
||||
@SuppressWarnings({"InlinedApi", "deprecation"})
|
||||
public static final int CHANNEL_OUT_7POINT1_SURROUND = Util.SDK_INT < 23
|
||||
int CHANNEL_OUT_7POINT1_SURROUND = Util.SDK_INT < 23
|
||||
? AudioFormat.CHANNEL_OUT_7POINT1 : AudioFormat.CHANNEL_OUT_7POINT1_SURROUND;
|
||||
|
||||
/**
|
||||
* Indicates that a buffer holds a synchronization sample.
|
||||
*/
|
||||
@SuppressWarnings("InlinedApi")
|
||||
public static final int BUFFER_FLAG_KEY_FRAME = MediaCodec.BUFFER_FLAG_KEY_FRAME;
|
||||
int BUFFER_FLAG_KEY_FRAME = MediaCodec.BUFFER_FLAG_KEY_FRAME;
|
||||
|
||||
/**
|
||||
* Flag for empty buffers that signal that the end of the stream was reached.
|
||||
*/
|
||||
@SuppressWarnings("InlinedApi")
|
||||
public static final int BUFFER_FLAG_END_OF_STREAM = MediaCodec.BUFFER_FLAG_END_OF_STREAM;
|
||||
int BUFFER_FLAG_END_OF_STREAM = MediaCodec.BUFFER_FLAG_END_OF_STREAM;
|
||||
|
||||
/**
|
||||
* Indicates that a buffer is (at least partially) encrypted.
|
||||
*/
|
||||
public static final int BUFFER_FLAG_ENCRYPTED = 0x40000000;
|
||||
int BUFFER_FLAG_ENCRYPTED = 0x40000000;
|
||||
|
||||
/**
|
||||
* Indicates that a buffer should be decoded but not rendered.
|
||||
*/
|
||||
public static final int BUFFER_FLAG_DECODE_ONLY = 0x80000000;
|
||||
int BUFFER_FLAG_DECODE_ONLY = 0x80000000;
|
||||
|
||||
/**
|
||||
* A return value for methods where the end of an input was encountered.
|
||||
*/
|
||||
public static final int RESULT_END_OF_INPUT = -1;
|
||||
int RESULT_END_OF_INPUT = -1;
|
||||
|
||||
/**
|
||||
* A return value for methods where the length of parsed data exceeds the maximum length allowed.
|
||||
*/
|
||||
public static final int RESULT_MAX_LENGTH_EXCEEDED = -2;
|
||||
int RESULT_MAX_LENGTH_EXCEEDED = -2;
|
||||
|
||||
/**
|
||||
* A type constant for tracks of unknown type.
|
||||
*/
|
||||
public static final int TRACK_TYPE_UNKNOWN = -1;
|
||||
int TRACK_TYPE_UNKNOWN = -1;
|
||||
|
||||
/**
|
||||
* A type constant for tracks of some default type, where the type itself is unknown.
|
||||
*/
|
||||
public static final int TRACK_TYPE_DEFAULT = 0;
|
||||
int TRACK_TYPE_DEFAULT = 0;
|
||||
|
||||
/**
|
||||
* A type constant for audio tracks.
|
||||
*/
|
||||
public static final int TRACK_TYPE_AUDIO = 1;
|
||||
int TRACK_TYPE_AUDIO = 1;
|
||||
|
||||
/**
|
||||
* A type constant for video tracks.
|
||||
*/
|
||||
public static final int TRACK_TYPE_VIDEO = 2;
|
||||
int TRACK_TYPE_VIDEO = 2;
|
||||
|
||||
/**
|
||||
* A type constant for text tracks.
|
||||
*/
|
||||
public static final int TRACK_TYPE_TEXT = 3;
|
||||
int TRACK_TYPE_TEXT = 3;
|
||||
|
||||
/**
|
||||
* A type constant for metadata tracks.
|
||||
*/
|
||||
public static final int TRACK_TYPE_METADATA = 4;
|
||||
int TRACK_TYPE_METADATA = 4;
|
||||
|
||||
/**
|
||||
* A default size in bytes for an individual allocation that forms part of a larger buffer.
|
||||
*/
|
||||
public static final int DEFAULT_BUFFER_SEGMENT_SIZE = 64 * 1024;
|
||||
int DEFAULT_BUFFER_SEGMENT_SIZE = 64 * 1024;
|
||||
|
||||
/**
|
||||
* A default size in bytes for a video buffer.
|
||||
*/
|
||||
public static final int DEFAULT_VIDEO_BUFFER_SIZE = 200 * DEFAULT_BUFFER_SEGMENT_SIZE;
|
||||
int DEFAULT_VIDEO_BUFFER_SIZE = 200 * DEFAULT_BUFFER_SEGMENT_SIZE;
|
||||
|
||||
/**
|
||||
* A default size in bytes for an audio buffer.
|
||||
*/
|
||||
public static final int DEFAULT_AUDIO_BUFFER_SIZE = 54 * DEFAULT_BUFFER_SEGMENT_SIZE;
|
||||
int DEFAULT_AUDIO_BUFFER_SIZE = 54 * DEFAULT_BUFFER_SEGMENT_SIZE;
|
||||
|
||||
/**
|
||||
* A default size in bytes for a text buffer.
|
||||
*/
|
||||
public static final int DEFAULT_TEXT_BUFFER_SIZE = 2 * DEFAULT_BUFFER_SEGMENT_SIZE;
|
||||
int DEFAULT_TEXT_BUFFER_SIZE = 2 * DEFAULT_BUFFER_SEGMENT_SIZE;
|
||||
|
||||
/**
|
||||
* A default size in bytes for a muxed buffer (e.g. containing video, audio and text).
|
||||
*/
|
||||
public static final int DEFAULT_MUXED_BUFFER_SIZE = DEFAULT_VIDEO_BUFFER_SIZE
|
||||
int DEFAULT_MUXED_BUFFER_SIZE = DEFAULT_VIDEO_BUFFER_SIZE
|
||||
+ DEFAULT_AUDIO_BUFFER_SIZE + DEFAULT_TEXT_BUFFER_SIZE;
|
||||
|
||||
/**
|
||||
* The Nil UUID as defined by
|
||||
* <a href="https://tools.ietf.org/html/rfc4122#section-4.1.7">RFC4122</a>.
|
||||
*/
|
||||
public static final UUID UUID_NIL = new UUID(0L, 0L);
|
||||
UUID UUID_NIL = new UUID(0L, 0L);
|
||||
|
||||
/**
|
||||
* UUID for the Widevine DRM scheme.
|
||||
* <p></p>
|
||||
* Widevine is supported on Android devices running Android 4.3 (API Level 18) and up.
|
||||
*/
|
||||
UUID WIDEVINE_UUID = new UUID(0xEDEF8BA979D64ACEL, 0xA3C827DCD51D21EDL);
|
||||
|
||||
/**
|
||||
* UUID for the PlayReady DRM scheme.
|
||||
* <p>
|
||||
* PlayReady is supported on all AndroidTV devices. Note that most other Android devices do not
|
||||
* provide PlayReady support.
|
||||
*/
|
||||
UUID PLAYREADY_UUID = new UUID(0x9A04F07998404286L, 0xAB92E65BE0885F95L);
|
||||
|
||||
/**
|
||||
* The type of a message that can be passed to an video {@link TrackRenderer} via
|
||||
* {@link ExoPlayer#sendMessage} or {@link ExoPlayer#blockingSendMessage}. The message object
|
||||
* should be the target {@link Surface}, or null.
|
||||
*/
|
||||
public static final int MSG_SET_SURFACE = 1;
|
||||
|
||||
private C() {}
|
||||
int MSG_SET_SURFACE = 1;
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.google.android.exoplayer.drm;
|
||||
|
||||
import com.google.android.exoplayer.C;
|
||||
import com.google.android.exoplayer.drm.DrmInitData.SchemeData;
|
||||
import com.google.android.exoplayer.extractor.mp4.PsshAtomUtil;
|
||||
import com.google.android.exoplayer.util.Util;
|
||||
@ -65,19 +66,6 @@ public class StreamingDrmSessionManager implements DrmSessionManager {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* UUID for the Widevine DRM scheme.
|
||||
*/
|
||||
public static final UUID WIDEVINE_UUID = new UUID(0xEDEF8BA979D64ACEL, 0xA3C827DCD51D21EDL);
|
||||
|
||||
/**
|
||||
* UUID for the PlayReady DRM scheme.
|
||||
* <p>
|
||||
* Note that PlayReady is unsupported by most Android devices, with the exception of Android TV
|
||||
* devices, which do provide support.
|
||||
*/
|
||||
public static final UUID PLAYREADY_UUID = new UUID(0x9A04F07998404286L, 0xAB92E65BE0885F95L);
|
||||
|
||||
/**
|
||||
* The key to use when passing CustomData to a PlayReady instance in an optional parameter map.
|
||||
*/
|
||||
@ -123,7 +111,7 @@ public class StreamingDrmSessionManager implements DrmSessionManager {
|
||||
public static StreamingDrmSessionManager newWidevineInstance(Looper playbackLooper,
|
||||
MediaDrmCallback callback, HashMap<String, String> optionalKeyRequestParameters,
|
||||
Handler eventHandler, EventListener eventListener) throws UnsupportedDrmException {
|
||||
return new StreamingDrmSessionManager(WIDEVINE_UUID, playbackLooper, callback,
|
||||
return new StreamingDrmSessionManager(C.WIDEVINE_UUID, playbackLooper, callback,
|
||||
optionalKeyRequestParameters, eventHandler, eventListener);
|
||||
}
|
||||
|
||||
@ -152,7 +140,7 @@ public class StreamingDrmSessionManager implements DrmSessionManager {
|
||||
} else {
|
||||
optionalKeyRequestParameters = null;
|
||||
}
|
||||
return new StreamingDrmSessionManager(PLAYREADY_UUID, playbackLooper, callback,
|
||||
return new StreamingDrmSessionManager(C.PLAYREADY_UUID, playbackLooper, callback,
|
||||
optionalKeyRequestParameters, eventHandler, eventListener);
|
||||
}
|
||||
|
||||
@ -281,11 +269,11 @@ public class StreamingDrmSessionManager implements DrmSessionManager {
|
||||
}
|
||||
if (Util.SDK_INT < 21) {
|
||||
// Prior to L the Widevine CDM required data to be extracted from the PSSH atom.
|
||||
byte[] psshData = PsshAtomUtil.parseSchemeSpecificData(schemeData.data, WIDEVINE_UUID);
|
||||
byte[] psshData = PsshAtomUtil.parseSchemeSpecificData(schemeData.data, C.WIDEVINE_UUID);
|
||||
if (psshData == null) {
|
||||
// Extraction failed. schemeData isn't a Widevine PSSH atom, so leave it unchanged.
|
||||
} else {
|
||||
schemeData = new SchemeData(WIDEVINE_UUID, schemeData.mimeType, psshData);
|
||||
schemeData = new SchemeData(C.WIDEVINE_UUID, schemeData.mimeType, psshData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user