Search in sources :

Example 1 with TextInformationFrame

use of com.google.android.exoplayer2.metadata.id3.TextInformationFrame in project ExoPlayer by google.

the class FormatTest method testParcelable.

public void testParcelable() {
    DrmInitData.SchemeData DRM_DATA_1 = new DrmInitData.SchemeData(WIDEVINE_UUID, VIDEO_MP4, TestUtil.buildTestData(128, 1));
    DrmInitData.SchemeData DRM_DATA_2 = new DrmInitData.SchemeData(C.UUID_NIL, VIDEO_WEBM, TestUtil.buildTestData(128, 1));
    DrmInitData drmInitData = new DrmInitData(DRM_DATA_1, DRM_DATA_2);
    byte[] projectionData = new byte[] { 1, 2, 3 };
    Metadata metadata = new Metadata(new TextInformationFrame("id1", "description1", "value1"), new TextInformationFrame("id2", "description2", "value2"));
    Format formatToParcel = new Format("id", MimeTypes.VIDEO_MP4, MimeTypes.VIDEO_H264, null, 1024, 2048, 1920, 1080, 24, 90, 2, projectionData, C.STEREO_MODE_TOP_BOTTOM, 6, 44100, C.ENCODING_PCM_24BIT, 1001, 1002, 0, "und", Format.NO_VALUE, Format.OFFSET_SAMPLE_RELATIVE, INIT_DATA, drmInitData, metadata);
    Parcel parcel = Parcel.obtain();
    formatToParcel.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);
    Format formatFromParcel = Format.CREATOR.createFromParcel(parcel);
    assertEquals(formatToParcel, formatFromParcel);
    parcel.recycle();
}
Also used : DrmInitData(com.google.android.exoplayer2.drm.DrmInitData) MediaFormat(android.media.MediaFormat) Parcel(android.os.Parcel) Metadata(com.google.android.exoplayer2.metadata.Metadata) TextInformationFrame(com.google.android.exoplayer2.metadata.id3.TextInformationFrame)

Example 2 with TextInformationFrame

use of com.google.android.exoplayer2.metadata.id3.TextInformationFrame in project ExoPlayer by google.

the class Id3DecoderTest method testDecodeTxxxFrame.

public void testDecodeTxxxFrame() throws MetadataDecoderException {
    byte[] rawId3 = new byte[] { 73, 68, 51, 4, 0, 0, 0, 0, 0, 41, 84, 88, 88, 88, 0, 0, 0, 31, 0, 0, 3, 0, 109, 100, 105, 97, 108, 111, 103, 95, 86, 73, 78, 68, 73, 67, 79, 49, 53, 50, 55, 54, 54, 52, 95, 115, 116, 97, 114, 116, 0 };
    Id3Decoder decoder = new Id3Decoder();
    Metadata metadata = decoder.decode(rawId3, rawId3.length);
    assertEquals(1, metadata.length());
    TextInformationFrame textInformationFrame = (TextInformationFrame) metadata.get(0);
    assertEquals("TXXX", textInformationFrame.id);
    assertEquals("", textInformationFrame.description);
    assertEquals("mdialog_VINDICO1527664_start", textInformationFrame.value);
}
Also used : Metadata(com.google.android.exoplayer2.metadata.Metadata)

Example 3 with TextInformationFrame

use of com.google.android.exoplayer2.metadata.id3.TextInformationFrame in project react-native-video by react-native-community.

the class VideoEventEmitter method timedMetadata.

void timedMetadata(Metadata metadata) {
    WritableArray metadataArray = Arguments.createArray();
    for (int i = 0; i < metadata.length(); i++) {
        Id3Frame frame = (Id3Frame) metadata.get(i);
        String value = "";
        if (frame instanceof TextInformationFrame) {
            TextInformationFrame txxxFrame = (TextInformationFrame) frame;
            value = txxxFrame.value;
        }
        String identifier = frame.id;
        WritableMap map = Arguments.createMap();
        map.putString("identifier", identifier);
        map.putString("value", value);
        metadataArray.pushMap(map);
    }
    WritableMap event = Arguments.createMap();
    event.putArray(EVENT_PROP_TIMED_METADATA, metadataArray);
    receiveEvent(EVENT_TIMED_METADATA, event);
}
Also used : WritableMap(com.facebook.react.bridge.WritableMap) WritableArray(com.facebook.react.bridge.WritableArray) Id3Frame(com.google.android.exoplayer2.metadata.id3.Id3Frame) TextInformationFrame(com.google.android.exoplayer2.metadata.id3.TextInformationFrame)

Example 4 with TextInformationFrame

use of com.google.android.exoplayer2.metadata.id3.TextInformationFrame in project ExoPlayer by google.

the class MetadataRendererTest method decodeMetadata_handlesId3WrappedInEmsg.

@Test
public void decodeMetadata_handlesId3WrappedInEmsg() throws Exception {
    EventMessage emsg = new EventMessage(EventMessage.ID3_SCHEME_ID_AOM, /* value= */
    "", /* durationMs= */
    1, /* id= */
    0, encodeTxxxId3Frame("Test description", "Test value"));
    List<Metadata> metadata = runRenderer(eventMessageEncoder.encode(emsg));
    assertThat(metadata).hasSize(1);
    assertThat(metadata.get(0).length()).isEqualTo(1);
    TextInformationFrame expectedId3Frame = new TextInformationFrame("TXXX", "Test description", "Test value");
    assertThat(metadata.get(0).get(0)).isEqualTo(expectedId3Frame);
}
Also used : EventMessage(com.google.android.exoplayer2.metadata.emsg.EventMessage) TextInformationFrame(com.google.android.exoplayer2.metadata.id3.TextInformationFrame) Test(org.junit.Test)

Example 5 with TextInformationFrame

use of com.google.android.exoplayer2.metadata.id3.TextInformationFrame in project ExoPlayer by google.

the class MetadataUtil method parseUint8Attribute.

@Nullable
private static Id3Frame parseUint8Attribute(int type, String id, ParsableByteArray data, boolean isTextInformationFrame, boolean isBoolean) {
    int value = parseUint8AttributeValue(data);
    if (isBoolean) {
        value = min(1, value);
    }
    if (value >= 0) {
        return isTextInformationFrame ? new TextInformationFrame(id, /* description= */
        null, Integer.toString(value)) : new CommentFrame(C.LANGUAGE_UNDETERMINED, id, Integer.toString(value));
    }
    Log.w(TAG, "Failed to parse uint8 attribute: " + Atom.getAtomTypeString(type));
    return null;
}
Also used : CommentFrame(com.google.android.exoplayer2.metadata.id3.CommentFrame) TextInformationFrame(com.google.android.exoplayer2.metadata.id3.TextInformationFrame) Nullable(androidx.annotation.Nullable)

Aggregations

Metadata (com.google.android.exoplayer2.metadata.Metadata)8 TextInformationFrame (com.google.android.exoplayer2.metadata.id3.TextInformationFrame)6 Test (org.junit.Test)5 EventMessage (com.google.android.exoplayer2.metadata.emsg.EventMessage)2 CommentFrame (com.google.android.exoplayer2.metadata.id3.CommentFrame)2 Id3Frame (com.google.android.exoplayer2.metadata.id3.Id3Frame)2 MediaFormat (android.media.MediaFormat)1 Parcel (android.os.Parcel)1 Nullable (androidx.annotation.Nullable)1 WritableArray (com.facebook.react.bridge.WritableArray)1 WritableMap (com.facebook.react.bridge.WritableMap)1 MediaMetadata (com.google.android.exoplayer2.MediaMetadata)1 Listener (com.google.android.exoplayer2.Player.Listener)1 DrmInitData (com.google.android.exoplayer2.drm.DrmInitData)1 ApicFrame (com.google.android.exoplayer2.metadata.id3.ApicFrame)1 BinaryFrame (com.google.android.exoplayer2.metadata.id3.BinaryFrame)1 GeobFrame (com.google.android.exoplayer2.metadata.id3.GeobFrame)1 PrivFrame (com.google.android.exoplayer2.metadata.id3.PrivFrame)1 UrlLinkFrame (com.google.android.exoplayer2.metadata.id3.UrlLinkFrame)1 FakeMediaSource (com.google.android.exoplayer2.testutil.FakeMediaSource)1