Parse widevine tag in manifest for secure decryption.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=128345063
This commit is contained in:
mishragaurav 2016-07-25 05:12:58 -07:00 committed by Oliver Woodman
parent abcd10513a
commit 1624135c20
52 changed files with 73 additions and 100 deletions

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/raw sampleMimeType = audio/raw
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/raw sampleMimeType = audio/raw
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/raw sampleMimeType = audio/raw
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/raw sampleMimeType = audio/raw
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 8:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/mp4a-latm sampleMimeType = audio/mp4a-latm
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0
@ -215,7 +214,6 @@ track 9:
containerMimeType = null containerMimeType = null
sampleMimeType = video/avc sampleMimeType = video/avc
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = 1080 width = 1080
height = 720 height = 720
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 1:
containerMimeType = null containerMimeType = null
sampleMimeType = video/avc sampleMimeType = video/avc
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = 1080 width = 1080
height = 720 height = 720
frameRate = -1.0 frameRate = -1.0
@ -156,7 +155,6 @@ track 2:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/ac3 sampleMimeType = audio/ac3
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 1:
containerMimeType = null containerMimeType = null
sampleMimeType = video/avc sampleMimeType = video/avc
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = 1080 width = 1080
height = 720 height = 720
frameRate = -1.0 frameRate = -1.0
@ -124,7 +123,6 @@ track 2:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/ac3 sampleMimeType = audio/ac3
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 1:
containerMimeType = null containerMimeType = null
sampleMimeType = video/avc sampleMimeType = video/avc
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = 1080 width = 1080
height = 720 height = 720
frameRate = -1.0 frameRate = -1.0
@ -80,7 +79,6 @@ track 2:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/ac3 sampleMimeType = audio/ac3
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 1:
containerMimeType = null containerMimeType = null
sampleMimeType = video/avc sampleMimeType = video/avc
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = 1080 width = 1080
height = 720 height = 720
frameRate = -1.0 frameRate = -1.0
@ -36,7 +35,6 @@ track 2:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/ac3 sampleMimeType = audio/ac3
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/mpeg sampleMimeType = audio/mpeg
maxInputSize = 4096 maxInputSize = 4096
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/mpeg sampleMimeType = audio/mpeg
maxInputSize = 4096 maxInputSize = 4096
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/mpeg sampleMimeType = audio/mpeg
maxInputSize = 4096 maxInputSize = 4096
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/mpeg sampleMimeType = audio/mpeg
maxInputSize = 4096 maxInputSize = 4096
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = video/avc sampleMimeType = video/avc
maxInputSize = 36722 maxInputSize = 36722
requiresSecureDecryption = false
width = 1080 width = 1080
height = 720 height = 720
frameRate = -1.0 frameRate = -1.0
@ -156,7 +155,6 @@ track 1:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/mp4a-latm sampleMimeType = audio/mp4a-latm
maxInputSize = 294 maxInputSize = 294
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = video/avc sampleMimeType = video/avc
maxInputSize = 36722 maxInputSize = 36722
requiresSecureDecryption = false
width = 1080 width = 1080
height = 720 height = 720
frameRate = -1.0 frameRate = -1.0
@ -156,7 +155,6 @@ track 1:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/mp4a-latm sampleMimeType = audio/mp4a-latm
maxInputSize = 294 maxInputSize = 294
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = video/avc sampleMimeType = video/avc
maxInputSize = 36722 maxInputSize = 36722
requiresSecureDecryption = false
width = 1080 width = 1080
height = 720 height = 720
frameRate = -1.0 frameRate = -1.0
@ -156,7 +155,6 @@ track 1:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/mp4a-latm sampleMimeType = audio/mp4a-latm
maxInputSize = 294 maxInputSize = 294
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = video/avc sampleMimeType = video/avc
maxInputSize = 36722 maxInputSize = 36722
requiresSecureDecryption = false
width = 1080 width = 1080
height = 720 height = 720
frameRate = -1.0 frameRate = -1.0
@ -156,7 +155,6 @@ track 1:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/mp4a-latm sampleMimeType = audio/mp4a-latm
maxInputSize = 294 maxInputSize = 294
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = video/avc sampleMimeType = video/avc
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = 1080 width = 1080
height = 720 height = 720
frameRate = -1.0 frameRate = -1.0
@ -156,7 +155,6 @@ track 1:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/mp4a-latm sampleMimeType = audio/mp4a-latm
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/opus sampleMimeType = audio/opus
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/opus sampleMimeType = audio/opus
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/opus sampleMimeType = audio/opus
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/opus sampleMimeType = audio/opus
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/opus sampleMimeType = audio/opus
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/x-flac sampleMimeType = audio/x-flac
maxInputSize = 768000 maxInputSize = 768000
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/x-flac sampleMimeType = audio/x-flac
maxInputSize = 768000 maxInputSize = 768000
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/x-flac sampleMimeType = audio/x-flac
maxInputSize = 768000 maxInputSize = 768000
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/x-flac sampleMimeType = audio/x-flac
maxInputSize = 768000 maxInputSize = 768000
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/x-flac sampleMimeType = audio/x-flac
maxInputSize = 768000 maxInputSize = 768000
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/x-flac sampleMimeType = audio/x-flac
maxInputSize = 768000 maxInputSize = 768000
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/x-flac sampleMimeType = audio/x-flac
maxInputSize = 768000 maxInputSize = 768000
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/x-flac sampleMimeType = audio/x-flac
maxInputSize = 768000 maxInputSize = 768000
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/x-flac sampleMimeType = audio/x-flac
maxInputSize = 768000 maxInputSize = 768000
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/x-flac sampleMimeType = audio/x-flac
maxInputSize = 768000 maxInputSize = 768000
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/vorbis sampleMimeType = audio/vorbis
maxInputSize = 65025 maxInputSize = 65025
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/vorbis sampleMimeType = audio/vorbis
maxInputSize = 65025 maxInputSize = 65025
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/vorbis sampleMimeType = audio/vorbis
maxInputSize = 65025 maxInputSize = 65025
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/vorbis sampleMimeType = audio/vorbis
maxInputSize = 65025 maxInputSize = 65025
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/vorbis sampleMimeType = audio/vorbis
maxInputSize = 65025 maxInputSize = 65025
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/mp4a-latm sampleMimeType = audio/mp4a-latm
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0
@ -611,7 +610,6 @@ track 1:
containerMimeType = null containerMimeType = null
sampleMimeType = application/id3 sampleMimeType = application/id3
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 192:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/mpeg-L2 sampleMimeType = audio/mpeg-L2
maxInputSize = 4096 maxInputSize = 4096
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0
@ -50,7 +49,6 @@ track 224:
containerMimeType = null containerMimeType = null
sampleMimeType = video/mpeg2 sampleMimeType = video/mpeg2
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = 640 width = 640
height = 426 height = 426
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 2:
containerMimeType = null containerMimeType = null
sampleMimeType = video/mpeg2 sampleMimeType = video/mpeg2
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = 640 width = 640
height = 426 height = 426
frameRate = -1.0 frameRate = -1.0
@ -43,7 +42,6 @@ track 3:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/mpeg-L2 sampleMimeType = audio/mpeg-L2
maxInputSize = 4096 maxInputSize = 4096
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0
@ -83,7 +81,6 @@ track 21:
containerMimeType = null containerMimeType = null
sampleMimeType = application/id3 sampleMimeType = application/id3
maxInputSize = -1 maxInputSize = -1
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/raw sampleMimeType = audio/raw
maxInputSize = 32768 maxInputSize = 32768
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/raw sampleMimeType = audio/raw
maxInputSize = 32768 maxInputSize = 32768
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/raw sampleMimeType = audio/raw
maxInputSize = 32768 maxInputSize = 32768
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -10,7 +10,6 @@ track 0:
containerMimeType = null containerMimeType = null
sampleMimeType = audio/raw sampleMimeType = audio/raw
maxInputSize = 32768 maxInputSize = 32768
requiresSecureDecryption = false
width = -1 width = -1
height = -1 height = -1
frameRate = -1.0 frameRate = -1.0

View File

@ -61,7 +61,7 @@ public final class FormatTest extends TestCase {
Format formatToParcel = new Format("id", MimeTypes.VIDEO_MP4, MimeTypes.VIDEO_H264, null, Format formatToParcel = new Format("id", MimeTypes.VIDEO_MP4, MimeTypes.VIDEO_H264, null,
1024, 2048, 1920, 1080, 24, 90, 2, 6, 44100, C.ENCODING_PCM_24BIT, 1001, 1002, 0, "und", 1024, 2048, 1920, 1080, 24, 90, 2, 6, 44100, C.ENCODING_PCM_24BIT, 1001, 1002, 0, "und",
Format.OFFSET_SAMPLE_RELATIVE, INIT_DATA, drmInitData, false); Format.OFFSET_SAMPLE_RELATIVE, INIT_DATA, drmInitData);
Parcel parcel = Parcel.obtain(); Parcel parcel = Parcel.obtain();
formatToParcel.writeToParcel(parcel, 0); formatToParcel.writeToParcel(parcel, 0);

View File

@ -104,10 +104,6 @@ public final class Format implements Parcelable {
* not applicable. * not applicable.
*/ */
public final int maxInputSize; public final int maxInputSize;
/**
* Whether the decoder is required to support secure decryption.
*/
public final boolean requiresSecureDecryption;
/** /**
* Initialization data that must be provided to the decoder. Will not be null, but may be empty * Initialization data that must be provided to the decoder. Will not be null, but may be empty
* if initialization data is not required. * if initialization data is not required.
@ -203,7 +199,7 @@ public final class Format implements Parcelable {
float frameRate, List<byte[]> initializationData) { float frameRate, List<byte[]> initializationData) {
return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, NO_VALUE, width, return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, NO_VALUE, width,
height, frameRate, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, 0, height, frameRate, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, 0,
null, OFFSET_SAMPLE_RELATIVE, initializationData, null, false); null, OFFSET_SAMPLE_RELATIVE, initializationData, null);
} }
public static Format createVideoSampleFormat(String id, String sampleMimeType, String codecs, public static Format createVideoSampleFormat(String id, String sampleMimeType, String codecs,
@ -219,7 +215,7 @@ public final class Format implements Parcelable {
DrmInitData drmInitData) { DrmInitData drmInitData) {
return new Format(id, null, sampleMimeType, codecs, bitrate, maxInputSize, width, height, return new Format(id, null, sampleMimeType, codecs, bitrate, maxInputSize, width, height,
frameRate, rotationDegrees, pixelWidthHeightRatio, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, frameRate, rotationDegrees, pixelWidthHeightRatio, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE,
NO_VALUE, 0, null, OFFSET_SAMPLE_RELATIVE, initializationData, drmInitData, false); NO_VALUE, 0, null, OFFSET_SAMPLE_RELATIVE, initializationData, drmInitData);
} }
// Audio. // Audio.
@ -229,8 +225,7 @@ public final class Format implements Parcelable {
List<byte[]> initializationData, int selectionFlags, String language) { List<byte[]> initializationData, int selectionFlags, String language) {
return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, NO_VALUE, NO_VALUE, return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, NO_VALUE, NO_VALUE,
NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, channelCount, sampleRate, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, channelCount, sampleRate, NO_VALUE, NO_VALUE,
NO_VALUE, selectionFlags, language, OFFSET_SAMPLE_RELATIVE, initializationData, null, NO_VALUE, selectionFlags, language, OFFSET_SAMPLE_RELATIVE, initializationData, null);
false);
} }
public static Format createAudioSampleFormat(String id, String sampleMimeType, String codecs, public static Format createAudioSampleFormat(String id, String sampleMimeType, String codecs,
@ -257,7 +252,7 @@ public final class Format implements Parcelable {
return new Format(id, null, sampleMimeType, codecs, bitrate, maxInputSize, NO_VALUE, NO_VALUE, return new Format(id, null, sampleMimeType, codecs, bitrate, maxInputSize, NO_VALUE, NO_VALUE,
NO_VALUE, NO_VALUE, NO_VALUE, channelCount, sampleRate, pcmEncoding, encoderDelay, NO_VALUE, NO_VALUE, NO_VALUE, channelCount, sampleRate, pcmEncoding, encoderDelay,
encoderPadding, selectionFlags, language, OFFSET_SAMPLE_RELATIVE, initializationData, encoderPadding, selectionFlags, language, OFFSET_SAMPLE_RELATIVE, initializationData,
drmInitData, false); drmInitData);
} }
// Text. // Text.
@ -266,7 +261,7 @@ public final class Format implements Parcelable {
String sampleMimeType, String codecs, int bitrate, int selectionFlags, String language) { String sampleMimeType, String codecs, int bitrate, int selectionFlags, String language) {
return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, NO_VALUE, NO_VALUE, return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, NO_VALUE, NO_VALUE,
NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE,
selectionFlags, language, OFFSET_SAMPLE_RELATIVE, null, null, false); selectionFlags, language, OFFSET_SAMPLE_RELATIVE, null, null);
} }
public static Format createTextSampleFormat(String id, String sampleMimeType, String codecs, public static Format createTextSampleFormat(String id, String sampleMimeType, String codecs,
@ -280,7 +275,7 @@ public final class Format implements Parcelable {
long subsampleOffsetUs) { long subsampleOffsetUs) {
return new Format(id, null, sampleMimeType, codecs, bitrate, NO_VALUE, NO_VALUE, NO_VALUE, return new Format(id, null, sampleMimeType, codecs, bitrate, NO_VALUE, NO_VALUE, NO_VALUE,
NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE,
selectionFlags, language, subsampleOffsetUs, null, drmInitData, false); selectionFlags, language, subsampleOffsetUs, null, drmInitData);
} }
// Image. // Image.
@ -289,7 +284,7 @@ public final class Format implements Parcelable {
int bitrate, List<byte[]> initializationData, String language, DrmInitData drmInitData) { int bitrate, List<byte[]> initializationData, String language, DrmInitData drmInitData) {
return new Format(id, null, sampleMimeType, codecs, bitrate, NO_VALUE, NO_VALUE, NO_VALUE, return new Format(id, null, sampleMimeType, codecs, bitrate, NO_VALUE, NO_VALUE, NO_VALUE,
NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, 0, language, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, 0, language,
OFFSET_SAMPLE_RELATIVE, initializationData, drmInitData, false); OFFSET_SAMPLE_RELATIVE, initializationData, drmInitData);
} }
// Generic. // Generic.
@ -298,22 +293,21 @@ public final class Format implements Parcelable {
String sampleMimeType, int bitrate) { String sampleMimeType, int bitrate) {
return new Format(id, containerMimeType, sampleMimeType, null, bitrate, NO_VALUE, NO_VALUE, return new Format(id, containerMimeType, sampleMimeType, null, bitrate, NO_VALUE, NO_VALUE,
NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE,
0, null, OFFSET_SAMPLE_RELATIVE, null, null, false); 0, null, OFFSET_SAMPLE_RELATIVE, null, null);
} }
public static Format createSampleFormat(String id, String sampleMimeType, String codecs, public static Format createSampleFormat(String id, String sampleMimeType, String codecs,
int bitrate, DrmInitData drmInitData) { int bitrate, DrmInitData drmInitData) {
return new Format(id, null, sampleMimeType, codecs, bitrate, NO_VALUE, NO_VALUE, NO_VALUE, return new Format(id, null, sampleMimeType, codecs, bitrate, NO_VALUE, NO_VALUE, NO_VALUE,
NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, 0, null, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, 0, null,
OFFSET_SAMPLE_RELATIVE, null, drmInitData, false); OFFSET_SAMPLE_RELATIVE, null, drmInitData);
} }
/* package */ Format(String id, String containerMimeType, String sampleMimeType, String codecs, /* package */ Format(String id, String containerMimeType, String sampleMimeType, String codecs,
int bitrate, int maxInputSize, int width, int height, float frameRate, int rotationDegrees, int bitrate, int maxInputSize, int width, int height, float frameRate, int rotationDegrees,
float pixelWidthHeightRatio, int channelCount, int sampleRate, int pcmEncoding, float pixelWidthHeightRatio, int channelCount, int sampleRate, int pcmEncoding,
int encoderDelay, int encoderPadding, int selectionFlags, String language, int encoderDelay, int encoderPadding, int selectionFlags, String language,
long subsampleOffsetUs, List<byte[]> initializationData, DrmInitData drmInitData, long subsampleOffsetUs, List<byte[]> initializationData, DrmInitData drmInitData) {
boolean requiresSecureDecryption) {
this.id = id; this.id = id;
this.containerMimeType = containerMimeType; this.containerMimeType = containerMimeType;
this.sampleMimeType = sampleMimeType; this.sampleMimeType = sampleMimeType;
@ -336,7 +330,6 @@ public final class Format implements Parcelable {
this.initializationData = initializationData == null ? Collections.<byte[]>emptyList() this.initializationData = initializationData == null ? Collections.<byte[]>emptyList()
: initializationData; : initializationData;
this.drmInitData = drmInitData; this.drmInitData = drmInitData;
this.requiresSecureDecryption = requiresSecureDecryption;
} }
/* package */ Format(Parcel in) { /* package */ Format(Parcel in) {
@ -365,21 +358,20 @@ public final class Format implements Parcelable {
initializationData.add(in.createByteArray()); initializationData.add(in.createByteArray());
} }
drmInitData = in.readParcelable(DrmInitData.class.getClassLoader()); drmInitData = in.readParcelable(DrmInitData.class.getClassLoader());
requiresSecureDecryption = in.readInt() == 1;
} }
public Format copyWithMaxInputSize(int maxInputSize) { public Format copyWithMaxInputSize(int maxInputSize) {
return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, maxInputSize, return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, maxInputSize,
width, height, frameRate, rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate, width, height, frameRate, rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate,
pcmEncoding, encoderDelay, encoderPadding, selectionFlags, language, subsampleOffsetUs, pcmEncoding, encoderDelay, encoderPadding, selectionFlags, language, subsampleOffsetUs,
initializationData, drmInitData, requiresSecureDecryption); initializationData, drmInitData);
} }
public Format copyWithSubsampleOffsetUs(long subsampleOffsetUs) { public Format copyWithSubsampleOffsetUs(long subsampleOffsetUs) {
return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, maxInputSize, return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, maxInputSize,
width, height, frameRate, rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate, width, height, frameRate, rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate,
pcmEncoding, encoderDelay, encoderPadding, selectionFlags, language, subsampleOffsetUs, pcmEncoding, encoderDelay, encoderPadding, selectionFlags, language, subsampleOffsetUs,
initializationData, drmInitData, requiresSecureDecryption); initializationData, drmInitData);
} }
public Format copyWithContainerInfo(String id, int bitrate, int width, int height, public Format copyWithContainerInfo(String id, int bitrate, int width, int height,
@ -387,7 +379,7 @@ public final class Format implements Parcelable {
return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, maxInputSize, return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, maxInputSize,
width, height, frameRate, rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate, width, height, frameRate, rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate,
pcmEncoding, encoderDelay, encoderPadding, selectionFlags, language, subsampleOffsetUs, pcmEncoding, encoderDelay, encoderPadding, selectionFlags, language, subsampleOffsetUs,
initializationData, drmInitData, requiresSecureDecryption); initializationData, drmInitData);
} }
public Format copyWithManifestFormatInfo(Format manifestFormat, public Format copyWithManifestFormatInfo(Format manifestFormat,
@ -400,26 +392,24 @@ public final class Format implements Parcelable {
String language = this.language == null ? manifestFormat.language : this.language; String language = this.language == null ? manifestFormat.language : this.language;
DrmInitData drmInitData = (preferManifestDrmInitData && manifestFormat.drmInitData != null) DrmInitData drmInitData = (preferManifestDrmInitData && manifestFormat.drmInitData != null)
|| this.drmInitData == null ? manifestFormat.drmInitData : this.drmInitData; || this.drmInitData == null ? manifestFormat.drmInitData : this.drmInitData;
boolean requiresSecureDecryption = this.requiresSecureDecryption
|| manifestFormat.requiresSecureDecryption;
return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, maxInputSize, width, return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, maxInputSize, width,
height, frameRate, rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate, height, frameRate, rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate,
pcmEncoding, encoderDelay, encoderPadding, selectionFlags, language, subsampleOffsetUs, pcmEncoding, encoderDelay, encoderPadding, selectionFlags, language, subsampleOffsetUs,
initializationData, drmInitData, requiresSecureDecryption); initializationData, drmInitData);
} }
public Format copyWithGaplessInfo(int encoderDelay, int encoderPadding) { public Format copyWithGaplessInfo(int encoderDelay, int encoderPadding) {
return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, maxInputSize, return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, maxInputSize,
width, height, frameRate, rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate, width, height, frameRate, rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate,
pcmEncoding, encoderDelay, encoderPadding, selectionFlags, language, subsampleOffsetUs, pcmEncoding, encoderDelay, encoderPadding, selectionFlags, language, subsampleOffsetUs,
initializationData, drmInitData, requiresSecureDecryption); initializationData, drmInitData);
} }
public Format copyWithDrmInitData(DrmInitData drmInitData) { public Format copyWithDrmInitData(DrmInitData drmInitData) {
return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, maxInputSize, return new Format(id, containerMimeType, sampleMimeType, codecs, bitrate, maxInputSize,
width, height, frameRate, rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate, width, height, frameRate, rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate,
pcmEncoding, encoderDelay, encoderPadding, selectionFlags, language, subsampleOffsetUs, pcmEncoding, encoderDelay, encoderPadding, selectionFlags, language, subsampleOffsetUs,
initializationData, drmInitData, requiresSecureDecryption); initializationData, drmInitData);
} }
/** /**
@ -486,7 +476,6 @@ public final class Format implements Parcelable {
} }
Format other = (Format) obj; Format other = (Format) obj;
if (bitrate != other.bitrate || maxInputSize != other.maxInputSize if (bitrate != other.bitrate || maxInputSize != other.maxInputSize
|| requiresSecureDecryption != other.requiresSecureDecryption
|| width != other.width || height != other.height || frameRate != other.frameRate || width != other.width || height != other.height || frameRate != other.frameRate
|| rotationDegrees != other.rotationDegrees || rotationDegrees != other.rotationDegrees
|| pixelWidthHeightRatio != other.pixelWidthHeightRatio || pixelWidthHeightRatio != other.pixelWidthHeightRatio
@ -565,7 +554,6 @@ public final class Format implements Parcelable {
dest.writeByteArray(initializationData.get(i)); dest.writeByteArray(initializationData.get(i));
} }
dest.writeParcelable(drmInitData, 0); dest.writeParcelable(drmInitData, 0);
dest.writeInt(requiresSecureDecryption ? 1 : 0);
} }
public static final Creator<Format> CREATOR = new Creator<Format>() { public static final Creator<Format> CREATOR = new Creator<Format>() {

View File

@ -148,8 +148,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
if (allowPassthrough(mimeType) && mediaCodecSelector.getPassthroughDecoderInfo() != null) { if (allowPassthrough(mimeType) && mediaCodecSelector.getPassthroughDecoderInfo() != null) {
return ADAPTIVE_NOT_SEAMLESS | FORMAT_HANDLED; return ADAPTIVE_NOT_SEAMLESS | FORMAT_HANDLED;
} }
MediaCodecInfo decoderInfo = mediaCodecSelector.getDecoderInfo(mimeType, MediaCodecInfo decoderInfo = mediaCodecSelector.getDecoderInfo(mimeType, false);
format.requiresSecureDecryption);
if (decoderInfo == null) { if (decoderInfo == null) {
return FORMAT_UNSUPPORTED_SUBTYPE; return FORMAT_UNSUPPORTED_SUBTYPE;
} }

View File

@ -38,6 +38,11 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
// Lazily initialized hashcode. // Lazily initialized hashcode.
private int hashCode; private int hashCode;
/**
* Number of {@link SchemeData}s.
*/
public final int schemeDataCount;
/** /**
* @param schemeDatas Scheme initialization data for possibly multiple DRM schemes. * @param schemeDatas Scheme initialization data for possibly multiple DRM schemes.
*/ */
@ -66,10 +71,12 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
} }
} }
this.schemeDatas = schemeDatas; this.schemeDatas = schemeDatas;
schemeDataCount = schemeDatas.length;
} }
/* package */ DrmInitData(Parcel in) { /* package */ DrmInitData(Parcel in) {
schemeDatas = in.createTypedArray(SchemeData.CREATOR); schemeDatas = in.createTypedArray(SchemeData.CREATOR);
schemeDataCount = schemeDatas.length;
} }
/** /**
@ -87,6 +94,16 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
return null; return null;
} }
/**
* Retrieves the {@link SchemeData} at a given index.
*
* @param index index of the scheme to return.
* @return The {@link SchemeData} at the index.
*/
public SchemeData get(int index) {
return schemeDatas[index];
}
@Override @Override
public int hashCode() { public int hashCode() {
if (hashCode == 0) { if (hashCode == 0) {
@ -160,6 +177,10 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
* The initialization data. * The initialization data.
*/ */
public final byte[] data; public final byte[] data;
/**
* Whether secure decryption is required.
*/
public final boolean requiresSecureDecryption;
/** /**
* @param uuid The {@link UUID} of the DRM scheme, or {@link C#UUID_NIL} if the data is * @param uuid The {@link UUID} of the DRM scheme, or {@link C#UUID_NIL} if the data is
@ -168,15 +189,28 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
* @param data The initialization data. * @param data The initialization data.
*/ */
public SchemeData(UUID uuid, String mimeType, byte[] data) { public SchemeData(UUID uuid, String mimeType, byte[] data) {
this(uuid, mimeType, data, false);
}
/**
* @param uuid The {@link UUID} of the DRM scheme, or {@link C#UUID_NIL} if the data is
* universal (i.e. applies to all schemes).
* @param mimeType The mimeType of the initialization data.
* @param data The initialization data.
* @param requiresSecureDecryption Whether secure decryption is required.
*/
public SchemeData(UUID uuid, String mimeType, byte[] data, boolean requiresSecureDecryption) {
this.uuid = Assertions.checkNotNull(uuid); this.uuid = Assertions.checkNotNull(uuid);
this.mimeType = Assertions.checkNotNull(mimeType); this.mimeType = Assertions.checkNotNull(mimeType);
this.data = Assertions.checkNotNull(data); this.data = Assertions.checkNotNull(data);
this.requiresSecureDecryption = requiresSecureDecryption;
} }
/* package */ SchemeData(Parcel in) { /* package */ SchemeData(Parcel in) {
uuid = new UUID(in.readLong(), in.readLong()); uuid = new UUID(in.readLong(), in.readLong());
mimeType = in.readString(); mimeType = in.readString();
data = in.createByteArray(); data = in.createByteArray();
requiresSecureDecryption = in.readByte() != 0;
} }
/** /**
@ -226,6 +260,7 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
dest.writeLong(uuid.getLeastSignificantBits()); dest.writeLong(uuid.getLeastSignificantBits());
dest.writeString(mimeType); dest.writeString(mimeType);
dest.writeByteArray(data); dest.writeByteArray(data);
dest.writeByte((byte) (requiresSecureDecryption ? 1 : 0));
} }
@SuppressWarnings("hiding") @SuppressWarnings("hiding")

View File

@ -315,25 +315,30 @@ public class DashManifestParser extends DefaultHandler
**/ **/
protected SchemeData parseContentProtection(XmlPullParser xpp) protected SchemeData parseContentProtection(XmlPullParser xpp)
throws XmlPullParserException, IOException { throws XmlPullParserException, IOException {
SchemeData schemeData = null; byte[] data = null;
UUID uuid = null;
boolean seenPsshElement = false; boolean seenPsshElement = false;
boolean requiresSecureDecoder = false;
do { do {
xpp.next(); xpp.next();
// The cenc:pssh element is defined in 23001-7:2015. // The cenc:pssh element is defined in 23001-7:2015.
if (XmlPullParserUtil.isStartTag(xpp, "cenc:pssh") && xpp.next() == XmlPullParser.TEXT) { if (XmlPullParserUtil.isStartTag(xpp, "cenc:pssh") && xpp.next() == XmlPullParser.TEXT) {
seenPsshElement = true; seenPsshElement = true;
byte[] data = Base64.decode(xpp.getText(), Base64.DEFAULT); data = Base64.decode(xpp.getText(), Base64.DEFAULT);
UUID uuid = PsshAtomUtil.parseUuid(data); uuid = PsshAtomUtil.parseUuid(data);
if (uuid != null) { } else if (XmlPullParserUtil.isStartTag(xpp, "widevine:license")) {
schemeData = new SchemeData(uuid, MimeTypes.VIDEO_MP4, data); String robustnessLevel = xpp.getAttributeValue(null, "robustness_level");
} requiresSecureDecoder = robustnessLevel != null && robustnessLevel.startsWith("HW");
} }
} while (!XmlPullParserUtil.isEndTag(xpp, "ContentProtection")); } while (!XmlPullParserUtil.isEndTag(xpp, "ContentProtection"));
if (seenPsshElement && schemeData == null) { if (!seenPsshElement) {
return null;
} else if (uuid != null) {
return new SchemeData(uuid, MimeTypes.VIDEO_MP4, data, requiresSecureDecoder);
} else {
Log.w(TAG, "Skipped unsupported ContentProtection element"); Log.w(TAG, "Skipped unsupported ContentProtection element");
return null; return null;
} }
return schemeData;
} }
/** /**

View File

@ -18,6 +18,7 @@ package com.google.android.exoplayer2.video;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.drm.DrmInitData;
import com.google.android.exoplayer2.drm.DrmSessionManager; import com.google.android.exoplayer2.drm.DrmSessionManager;
import com.google.android.exoplayer2.mediacodec.MediaCodecInfo; import com.google.android.exoplayer2.mediacodec.MediaCodecInfo;
import com.google.android.exoplayer2.mediacodec.MediaCodecRenderer; import com.google.android.exoplayer2.mediacodec.MediaCodecRenderer;
@ -175,8 +176,13 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
if (!MimeTypes.isVideo(mimeType)) { if (!MimeTypes.isVideo(mimeType)) {
return FORMAT_UNSUPPORTED_TYPE; return FORMAT_UNSUPPORTED_TYPE;
} }
DrmInitData drmInitData = format.drmInitData;
boolean requiresSecureDecryption = false;
for (int i = 0; i < drmInitData.schemeDataCount; i++) {
requiresSecureDecryption |= drmInitData.get(i).requiresSecureDecryption;
}
MediaCodecInfo decoderInfo = mediaCodecSelector.getDecoderInfo(mimeType, MediaCodecInfo decoderInfo = mediaCodecSelector.getDecoderInfo(mimeType,
format.requiresSecureDecryption); requiresSecureDecryption);
if (decoderInfo == null) { if (decoderInfo == null) {
return FORMAT_UNSUPPORTED_SUBTYPE; return FORMAT_UNSUPPORTED_SUBTYPE;
} }

View File

@ -145,7 +145,6 @@ public final class FakeTrackOutput implements TrackOutput, Dumper.Dumpable {
.add("containerMimeType", format.containerMimeType) .add("containerMimeType", format.containerMimeType)
.add("sampleMimeType", format.sampleMimeType) .add("sampleMimeType", format.sampleMimeType)
.add("maxInputSize", format.maxInputSize) .add("maxInputSize", format.maxInputSize)
.add("requiresSecureDecryption", format.requiresSecureDecryption)
.add("width", format.width) .add("width", format.width)
.add("height", format.height) .add("height", format.height)
.add("frameRate", format.frameRate) .add("frameRate", format.frameRate)