Java Code Examples for com.google.android.exoplayer2.util.ParsableByteArray#readNullTerminatedString()
The following examples show how to use
com.google.android.exoplayer2.util.ParsableByteArray#readNullTerminatedString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetadataUtil.java From K-Sonic with MIT License | 5 votes |
private static TextInformationFrame parseTextAttribute(int type, String id, ParsableByteArray data) { int atomSize = data.readInt(); int atomType = data.readInt(); if (atomType == Atom.TYPE_data) { data.skipBytes(8); // version (1), flags (3), empty (4) String value = data.readNullTerminatedString(atomSize - 16); return new TextInformationFrame(id, null, value); } Log.w(TAG, "Failed to parse text attribute: " + Atom.getAtomTypeString(type)); return null; }
Example 2
Source File: MetadataUtil.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Nullable private static Id3Frame parseInternalAttribute(ParsableByteArray data, int endPosition) { String domain = null; String name = null; int dataAtomPosition = -1; int dataAtomSize = -1; while (data.getPosition() < endPosition) { int atomPosition = data.getPosition(); int atomSize = data.readInt(); int atomType = data.readInt(); data.skipBytes(4); // version (1), flags (3) if (atomType == Atom.TYPE_mean) { domain = data.readNullTerminatedString(atomSize - 12); } else if (atomType == Atom.TYPE_name) { name = data.readNullTerminatedString(atomSize - 12); } else { if (atomType == Atom.TYPE_data) { dataAtomPosition = atomPosition; dataAtomSize = atomSize; } data.skipBytes(atomSize - 12); } } if (domain == null || name == null || dataAtomPosition == -1) { return null; } data.setPosition(dataAtomPosition); data.skipBytes(16); // size (4), type (4), version (1), flags (3), empty (4) String value = data.readNullTerminatedString(dataAtomSize - 16); return new InternalFrame(domain, name, value); }
Example 3
Source File: MetadataUtil.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Nullable private static CommentFrame parseCommentAttribute(int type, ParsableByteArray data) { int atomSize = data.readInt(); int atomType = data.readInt(); if (atomType == Atom.TYPE_data) { data.skipBytes(8); // version (1), flags (3), empty (4) String value = data.readNullTerminatedString(atomSize - 16); return new CommentFrame(LANGUAGE_UNDEFINED, value, value); } Log.w(TAG, "Failed to parse comment attribute: " + Atom.getAtomTypeString(type)); return null; }
Example 4
Source File: MetadataUtil.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Nullable private static TextInformationFrame parseTextAttribute( int type, String id, ParsableByteArray data) { int atomSize = data.readInt(); int atomType = data.readInt(); if (atomType == Atom.TYPE_data) { data.skipBytes(8); // version (1), flags (3), empty (4) String value = data.readNullTerminatedString(atomSize - 16); return new TextInformationFrame(id, /* description= */ null, value); } Log.w(TAG, "Failed to parse text attribute: " + Atom.getAtomTypeString(type)); return null; }
Example 5
Source File: MetadataUtil.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Nullable private static Id3Frame parseInternalAttribute(ParsableByteArray data, int endPosition) { String domain = null; String name = null; int dataAtomPosition = -1; int dataAtomSize = -1; while (data.getPosition() < endPosition) { int atomPosition = data.getPosition(); int atomSize = data.readInt(); int atomType = data.readInt(); data.skipBytes(4); // version (1), flags (3) if (atomType == Atom.TYPE_mean) { domain = data.readNullTerminatedString(atomSize - 12); } else if (atomType == Atom.TYPE_name) { name = data.readNullTerminatedString(atomSize - 12); } else { if (atomType == Atom.TYPE_data) { dataAtomPosition = atomPosition; dataAtomSize = atomSize; } data.skipBytes(atomSize - 12); } } if (domain == null || name == null || dataAtomPosition == -1) { return null; } data.setPosition(dataAtomPosition); data.skipBytes(16); // size (4), type (4), version (1), flags (3), empty (4) String value = data.readNullTerminatedString(dataAtomSize - 16); return new InternalFrame(domain, name, value); }
Example 6
Source File: MetadataUtil.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Nullable private static CommentFrame parseCommentAttribute(int type, ParsableByteArray data) { int atomSize = data.readInt(); int atomType = data.readInt(); if (atomType == Atom.TYPE_data) { data.skipBytes(8); // version (1), flags (3), empty (4) String value = data.readNullTerminatedString(atomSize - 16); return new CommentFrame(LANGUAGE_UNDEFINED, value, value); } Log.w(TAG, "Failed to parse comment attribute: " + Atom.getAtomTypeString(type)); return null; }
Example 7
Source File: MetadataUtil.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Nullable private static TextInformationFrame parseTextAttribute( int type, String id, ParsableByteArray data) { int atomSize = data.readInt(); int atomType = data.readInt(); if (atomType == Atom.TYPE_data) { data.skipBytes(8); // version (1), flags (3), empty (4) String value = data.readNullTerminatedString(atomSize - 16); return new TextInformationFrame(id, /* description= */ null, value); } Log.w(TAG, "Failed to parse text attribute: " + Atom.getAtomTypeString(type)); return null; }
Example 8
Source File: FragmentedMp4Extractor.java From K-Sonic with MIT License | 5 votes |
/** * Handles an emsg atom (defined in 23009-1). */ private void onEmsgLeafAtomRead(ParsableByteArray atom) { if (eventMessageTrackOutput == null) { return; } // Parse the event's presentation time delta. atom.setPosition(Atom.FULL_HEADER_SIZE); atom.readNullTerminatedString(); // schemeIdUri atom.readNullTerminatedString(); // value long timescale = atom.readUnsignedInt(); long presentationTimeDeltaUs = Util.scaleLargeTimestamp(atom.readUnsignedInt(), C.MICROS_PER_SECOND, timescale); // Output the sample data. atom.setPosition(Atom.FULL_HEADER_SIZE); int sampleSize = atom.bytesLeft(); eventMessageTrackOutput.sampleData(atom, sampleSize); // Output the sample metadata. if (segmentIndexEarliestPresentationTimeUs != C.TIME_UNSET) { // We can output the sample metadata immediately. eventMessageTrackOutput.sampleMetadata( segmentIndexEarliestPresentationTimeUs + presentationTimeDeltaUs, C.BUFFER_FLAG_KEY_FRAME, sampleSize, 0 /* offset */, null); } else { // We need the first sample timestamp in the segment before we can output the metadata. pendingMetadataSampleInfos.addLast( new MetadataSampleInfo(presentationTimeDeltaUs, sampleSize)); pendingMetadataSampleBytes += sampleSize; } }
Example 9
Source File: MetadataUtil.java From K-Sonic with MIT License | 5 votes |
private static Id3Frame parseInternalAttribute(ParsableByteArray data, int endPosition) { String domain = null; String name = null; int dataAtomPosition = -1; int dataAtomSize = -1; while (data.getPosition() < endPosition) { int atomPosition = data.getPosition(); int atomSize = data.readInt(); int atomType = data.readInt(); data.skipBytes(4); // version (1), flags (3) if (atomType == Atom.TYPE_mean) { domain = data.readNullTerminatedString(atomSize - 12); } else if (atomType == Atom.TYPE_name) { name = data.readNullTerminatedString(atomSize - 12); } else { if (atomType == Atom.TYPE_data) { dataAtomPosition = atomPosition; dataAtomSize = atomSize; } data.skipBytes(atomSize - 12); } } if (!"com.apple.iTunes".equals(domain) || !"iTunSMPB".equals(name) || dataAtomPosition == -1) { // We're only interested in iTunSMPB. return null; } data.setPosition(dataAtomPosition); data.skipBytes(16); // size (4), type (4), version (1), flags (3), empty (4) String value = data.readNullTerminatedString(dataAtomSize - 16); return new CommentFrame(LANGUAGE_UNDEFINED, name, value); }
Example 10
Source File: MetadataUtil.java From K-Sonic with MIT License | 5 votes |
private static CommentFrame parseCommentAttribute(int type, ParsableByteArray data) { int atomSize = data.readInt(); int atomType = data.readInt(); if (atomType == Atom.TYPE_data) { data.skipBytes(8); // version (1), flags (3), empty (4) String value = data.readNullTerminatedString(atomSize - 16); return new CommentFrame(LANGUAGE_UNDEFINED, value, value); } Log.w(TAG, "Failed to parse comment attribute: " + Atom.getAtomTypeString(type)); return null; }
Example 11
Source File: MetadataUtil.java From MediaSDK with Apache License 2.0 | 5 votes |
@Nullable private static TextInformationFrame parseTextAttribute( int type, String id, ParsableByteArray data) { int atomSize = data.readInt(); int atomType = data.readInt(); if (atomType == Atom.TYPE_data) { data.skipBytes(8); // version (1), flags (3), empty (4) String value = data.readNullTerminatedString(atomSize - 16); return new TextInformationFrame(id, /* description= */ null, value); } Log.w(TAG, "Failed to parse text attribute: " + Atom.getAtomTypeString(type)); return null; }
Example 12
Source File: MetadataUtil.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private static @Nullable Id3Frame parseInternalAttribute( ParsableByteArray data, int endPosition) { String domain = null; String name = null; int dataAtomPosition = -1; int dataAtomSize = -1; while (data.getPosition() < endPosition) { int atomPosition = data.getPosition(); int atomSize = data.readInt(); int atomType = data.readInt(); data.skipBytes(4); // version (1), flags (3) if (atomType == Atom.TYPE_mean) { domain = data.readNullTerminatedString(atomSize - 12); } else if (atomType == Atom.TYPE_name) { name = data.readNullTerminatedString(atomSize - 12); } else { if (atomType == Atom.TYPE_data) { dataAtomPosition = atomPosition; dataAtomSize = atomSize; } data.skipBytes(atomSize - 12); } } if (domain == null || name == null || dataAtomPosition == -1) { return null; } data.setPosition(dataAtomPosition); data.skipBytes(16); // size (4), type (4), version (1), flags (3), empty (4) String value = data.readNullTerminatedString(dataAtomSize - 16); return new InternalFrame(domain, name, value); }
Example 13
Source File: MetadataUtil.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private static @Nullable CommentFrame parseCommentAttribute(int type, ParsableByteArray data) { int atomSize = data.readInt(); int atomType = data.readInt(); if (atomType == Atom.TYPE_data) { data.skipBytes(8); // version (1), flags (3), empty (4) String value = data.readNullTerminatedString(atomSize - 16); return new CommentFrame(LANGUAGE_UNDEFINED, value, value); } Log.w(TAG, "Failed to parse comment attribute: " + Atom.getAtomTypeString(type)); return null; }
Example 14
Source File: MetadataUtil.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private static @Nullable TextInformationFrame parseTextAttribute( int type, String id, ParsableByteArray data) { int atomSize = data.readInt(); int atomType = data.readInt(); if (atomType == Atom.TYPE_data) { data.skipBytes(8); // version (1), flags (3), empty (4) String value = data.readNullTerminatedString(atomSize - 16); return new TextInformationFrame(id, /* description= */ null, value); } Log.w(TAG, "Failed to parse text attribute: " + Atom.getAtomTypeString(type)); return null; }
Example 15
Source File: MetadataUtil.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private static @Nullable Id3Frame parseInternalAttribute( ParsableByteArray data, int endPosition) { String domain = null; String name = null; int dataAtomPosition = -1; int dataAtomSize = -1; while (data.getPosition() < endPosition) { int atomPosition = data.getPosition(); int atomSize = data.readInt(); int atomType = data.readInt(); data.skipBytes(4); // version (1), flags (3) if (atomType == Atom.TYPE_mean) { domain = data.readNullTerminatedString(atomSize - 12); } else if (atomType == Atom.TYPE_name) { name = data.readNullTerminatedString(atomSize - 12); } else { if (atomType == Atom.TYPE_data) { dataAtomPosition = atomPosition; dataAtomSize = atomSize; } data.skipBytes(atomSize - 12); } } if (domain == null || name == null || dataAtomPosition == -1) { return null; } data.setPosition(dataAtomPosition); data.skipBytes(16); // size (4), type (4), version (1), flags (3), empty (4) String value = data.readNullTerminatedString(dataAtomSize - 16); return new InternalFrame(domain, name, value); }
Example 16
Source File: MetadataUtil.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private static @Nullable CommentFrame parseCommentAttribute(int type, ParsableByteArray data) { int atomSize = data.readInt(); int atomType = data.readInt(); if (atomType == Atom.TYPE_data) { data.skipBytes(8); // version (1), flags (3), empty (4) String value = data.readNullTerminatedString(atomSize - 16); return new CommentFrame(LANGUAGE_UNDEFINED, value, value); } Log.w(TAG, "Failed to parse comment attribute: " + Atom.getAtomTypeString(type)); return null; }
Example 17
Source File: MetadataUtil.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private static @Nullable TextInformationFrame parseTextAttribute( int type, String id, ParsableByteArray data) { int atomSize = data.readInt(); int atomType = data.readInt(); if (atomType == Atom.TYPE_data) { data.skipBytes(8); // version (1), flags (3), empty (4) String value = data.readNullTerminatedString(atomSize - 16); return new TextInformationFrame(id, /* description= */ null, value); } Log.w(TAG, "Failed to parse text attribute: " + Atom.getAtomTypeString(type)); return null; }
Example 18
Source File: MetadataUtil.java From MediaSDK with Apache License 2.0 | 5 votes |
@Nullable private static Id3Frame parseInternalAttribute(ParsableByteArray data, int endPosition) { String domain = null; String name = null; int dataAtomPosition = -1; int dataAtomSize = -1; while (data.getPosition() < endPosition) { int atomPosition = data.getPosition(); int atomSize = data.readInt(); int atomType = data.readInt(); data.skipBytes(4); // version (1), flags (3) if (atomType == Atom.TYPE_mean) { domain = data.readNullTerminatedString(atomSize - 12); } else if (atomType == Atom.TYPE_name) { name = data.readNullTerminatedString(atomSize - 12); } else { if (atomType == Atom.TYPE_data) { dataAtomPosition = atomPosition; dataAtomSize = atomSize; } data.skipBytes(atomSize - 12); } } if (domain == null || name == null || dataAtomPosition == -1) { return null; } data.setPosition(dataAtomPosition); data.skipBytes(16); // size (4), type (4), version (1), flags (3), empty (4) String value = data.readNullTerminatedString(dataAtomSize - 16); return new InternalFrame(domain, name, value); }
Example 19
Source File: MetadataUtil.java From MediaSDK with Apache License 2.0 | 5 votes |
@Nullable private static CommentFrame parseCommentAttribute(int type, ParsableByteArray data) { int atomSize = data.readInt(); int atomType = data.readInt(); if (atomType == Atom.TYPE_data) { data.skipBytes(8); // version (1), flags (3), empty (4) String value = data.readNullTerminatedString(atomSize - 16); return new CommentFrame(LANGUAGE_UNDEFINED, value, value); } Log.w(TAG, "Failed to parse comment attribute: " + Atom.getAtomTypeString(type)); return null; }