use of androidx.media3.extractor.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 androidx.media3.extractor.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 androidx.media3.extractor.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;
}
use of androidx.media3.extractor.metadata.id3.TextInformationFrame in project react-native-track-player by react-native-kit.
the class SourceMetadata method handleId3Metadata.
/**
* ID3 Metadata (MP3)
*
* https://en.wikipedia.org/wiki/ID3
*/
private static void handleId3Metadata(MusicManager manager, Metadata metadata) {
String title = null, url = null, artist = null, album = null, date = null, genre = null;
for (int i = 0; i < metadata.length(); i++) {
Metadata.Entry entry = metadata.get(i);
if (entry instanceof TextInformationFrame) {
// ID3 text tag
TextInformationFrame id3 = (TextInformationFrame) entry;
String id = id3.id.toUpperCase();
if (id.equals("TIT2") || id.equals("TT2")) {
title = id3.value;
} else if (id.equals("TALB") || id.equals("TOAL") || id.equals("TAL")) {
album = id3.value;
} else if (id.equals("TOPE") || id.equals("TPE1") || id.equals("TP1")) {
artist = id3.value;
} else if (id.equals("TDRC") || id.equals("TOR")) {
date = id3.value;
} else if (id.equals("TCON") || id.equals("TCO")) {
genre = id3.value;
}
} else if (entry instanceof UrlLinkFrame) {
// ID3 URL tag
UrlLinkFrame id3 = (UrlLinkFrame) entry;
String id = id3.id.toUpperCase();
if (id.equals("WOAS") || id.equals("WOAF") || id.equals("WOAR") || id.equals("WAR")) {
url = id3.url;
}
}
}
if (title != null || url != null || artist != null || album != null || date != null || genre != null) {
manager.onMetadataReceived("id3", title, url, artist, album, date, genre);
}
}
use of androidx.media3.extractor.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++) {
Metadata.Entry entry = metadata.get(i);
if (entry instanceof Id3Frame) {
Id3Frame frame = (Id3Frame) entry;
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);
} else if (entry instanceof EventMessage) {
EventMessage eventMessage = (EventMessage) entry;
WritableMap map = Arguments.createMap();
map.putString("identifier", eventMessage.schemeIdUri);
map.putString("value", eventMessage.value);
metadataArray.pushMap(map);
}
}
WritableMap event = Arguments.createMap();
event.putArray(EVENT_PROP_TIMED_METADATA, metadataArray);
receiveEvent(EVENT_TIMED_METADATA, event);
}
Aggregations