use of androidx.media3.common.C.WIDEVINE_UUID in project media by androidx.
the class FormatTest method createTestFormat.
private static Format createTestFormat() {
byte[] initData1 = new byte[] { 1, 2, 3 };
byte[] initData2 = new byte[] { 4, 5, 6 };
List<byte[]> initializationData = new ArrayList<>();
initializationData.add(initData1);
initializationData.add(initData2);
DrmInitData.SchemeData drmData1 = new DrmInitData.SchemeData(WIDEVINE_UUID, VIDEO_MP4, buildTestData(128, 1));
DrmInitData.SchemeData drmData2 = new DrmInitData.SchemeData(C.UUID_NIL, VIDEO_WEBM, buildTestData(128, 1));
DrmInitData drmInitData = new DrmInitData(drmData1, drmData2);
byte[] projectionData = new byte[] { 1, 2, 3 };
Metadata metadata = new Metadata(new FakeMetadataEntry("id1"), new FakeMetadataEntry("id2"));
ColorInfo colorInfo = new ColorInfo(C.COLOR_SPACE_BT709, C.COLOR_RANGE_LIMITED, C.COLOR_TRANSFER_SDR, new byte[] { 1, 2, 3, 4, 5, 6, 7 });
return new Format.Builder().setId("id").setLabel("label").setLanguage("language").setSelectionFlags(C.SELECTION_FLAG_DEFAULT).setRoleFlags(C.ROLE_FLAG_MAIN).setAverageBitrate(1024).setPeakBitrate(2048).setCodecs("codec").setMetadata(metadata).setContainerMimeType(VIDEO_MP4).setSampleMimeType(MimeTypes.VIDEO_H264).setMaxInputSize(5000).setInitializationData(initializationData).setDrmInitData(drmInitData).setSubsampleOffsetUs(Format.OFFSET_SAMPLE_RELATIVE).setWidth(1920).setHeight(1080).setFrameRate(24).setRotationDegrees(90).setPixelWidthHeightRatio(4).setProjectionData(projectionData).setStereoMode(C.STEREO_MODE_TOP_BOTTOM).setColorInfo(colorInfo).setChannelCount(6).setSampleRate(44100).setPcmEncoding(C.ENCODING_PCM_24BIT).setEncoderDelay(1001).setEncoderPadding(1002).setAccessibilityChannel(2).setCryptoType(C.CRYPTO_TYPE_CUSTOM_BASE).build();
}
use of androidx.media3.common.C.WIDEVINE_UUID in project media by androidx.
the class PsshAtomUtilTest method buildPsshAtom.
@Test
public void buildPsshAtom() {
byte[] schemeData = new byte[] { 0, 1, 2, 3, 4, 5 };
byte[] psshAtom = PsshAtomUtil.buildPsshAtom(C.WIDEVINE_UUID, schemeData);
// Read the PSSH atom back and assert its content is as expected.
ParsableByteArray parsablePsshAtom = new ParsableByteArray(psshAtom);
// length
assertThat(parsablePsshAtom.readUnsignedIntToInt()).isEqualTo(psshAtom.length);
// type
assertThat(parsablePsshAtom.readInt()).isEqualTo(TYPE_pssh);
// version + flags
int fullAtomInt = parsablePsshAtom.readInt();
assertThat(parseFullAtomVersion(fullAtomInt)).isEqualTo(0);
assertThat(parseFullAtomFlags(fullAtomInt)).isEqualTo(0);
UUID systemId = new UUID(parsablePsshAtom.readLong(), parsablePsshAtom.readLong());
assertThat(systemId).isEqualTo(WIDEVINE_UUID);
assertThat(parsablePsshAtom.readUnsignedIntToInt()).isEqualTo(schemeData.length);
byte[] psshSchemeData = new byte[schemeData.length];
parsablePsshAtom.readBytes(psshSchemeData, 0, schemeData.length);
assertThat(psshSchemeData).isEqualTo(schemeData);
}
Aggregations