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();
}
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);
}
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);
}
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);
}
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;
}
Aggregations