Search in sources :

Example 1 with FakeMetadataEntry

use of androidx.media3.test.utils.FakeMetadataEntry 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();
}
Also used : FakeMetadataEntry(androidx.media3.test.utils.FakeMetadataEntry) ArrayList(java.util.ArrayList)

Example 2 with FakeMetadataEntry

use of androidx.media3.test.utils.FakeMetadataEntry in project media by androidx.

the class MetadataTest method parcelable.

@Test
public void parcelable() {
    Metadata metadataToParcel = new Metadata(new FakeMetadataEntry("id1"), new FakeMetadataEntry("id2"));
    Parcel parcel = Parcel.obtain();
    metadataToParcel.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);
    Metadata metadataFromParcel = Metadata.CREATOR.createFromParcel(parcel);
    assertThat(metadataFromParcel).isEqualTo(metadataToParcel);
    parcel.recycle();
}
Also used : FakeMetadataEntry(androidx.media3.test.utils.FakeMetadataEntry) Parcel(android.os.Parcel) Test(org.junit.Test)

Aggregations

FakeMetadataEntry (androidx.media3.test.utils.FakeMetadataEntry)2 Parcel (android.os.Parcel)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1