本文整理汇总了Java中com.google.android.exoplayer2.util.ParsableByteArray.readLong方法的典型用法代码示例。如果您正苦于以下问题:Java ParsableByteArray.readLong方法的具体用法?Java ParsableByteArray.readLong怎么用?Java ParsableByteArray.readLong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.exoplayer2.util.ParsableByteArray
的用法示例。
在下文中一共展示了ParsableByteArray.readLong方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseEdts
import com.google.android.exoplayer2.util.ParsableByteArray; //导入方法依赖的package包/类
/**
* Parses the edts atom (defined in 14496-12 subsection 8.6.5).
*
* @param edtsAtom edts (edit box) atom to decode.
* @return Pair of edit list durations and edit list media times, or a pair of nulls if they are
* not present.
*/
private static Pair<long[], long[]> parseEdts(Atom.ContainerAtom edtsAtom) {
Atom.LeafAtom elst;
if (edtsAtom == null || (elst = edtsAtom.getLeafAtomOfType(Atom.TYPE_elst)) == null) {
return Pair.create(null, null);
}
ParsableByteArray elstData = elst.data;
elstData.setPosition(Atom.HEADER_SIZE);
int fullAtom = elstData.readInt();
int version = Atom.parseFullAtomVersion(fullAtom);
int entryCount = elstData.readUnsignedIntToInt();
long[] editListDurations = new long[entryCount];
long[] editListMediaTimes = new long[entryCount];
for (int i = 0; i < entryCount; i++) {
editListDurations[i] =
version == 1 ? elstData.readUnsignedLongToLong() : elstData.readUnsignedInt();
editListMediaTimes[i] = version == 1 ? elstData.readLong() : elstData.readInt();
int mediaRateInteger = elstData.readShort();
if (mediaRateInteger != 1) {
// The extractor does not handle dwell edits (mediaRateInteger == 0).
throw new IllegalArgumentException("Unsupported media rate.");
}
elstData.skipBytes(2);
}
return Pair.create(editListDurations, editListMediaTimes);
}
示例2: parseMsAcmCodecPrivate
import com.google.android.exoplayer2.util.ParsableByteArray; //导入方法依赖的package包/类
/**
* Parses an MS/ACM codec private, returning whether it indicates PCM audio.
*
* @return Whether the codec private indicates PCM audio.
* @throws ParserException If a parsing error occurs.
*/
private static boolean parseMsAcmCodecPrivate(ParsableByteArray buffer) throws ParserException {
try {
int formatTag = buffer.readLittleEndianUnsignedShort();
if (formatTag == WAVE_FORMAT_PCM) {
return true;
} else if (formatTag == WAVE_FORMAT_EXTENSIBLE) {
buffer.setPosition(WAVE_FORMAT_SIZE + 6); // unionSamples(2), channelMask(4)
return buffer.readLong() == WAVE_SUBFORMAT_PCM.getMostSignificantBits()
&& buffer.readLong() == WAVE_SUBFORMAT_PCM.getLeastSignificantBits();
} else {
return false;
}
} catch (ArrayIndexOutOfBoundsException e) {
throw new ParserException("Error parsing MS/ACM codec private");
}
}
示例3: parseSeekTable
import com.google.android.exoplayer2.util.ParsableByteArray; //导入方法依赖的package包/类
/**
* Parses a FLAC file seek table metadata structure and initializes internal fields.
*
* @param data A {@link ParsableByteArray} including whole seek table metadata block. Its
* position should be set to the beginning of the block.
* @see <a href="https://xiph.org/flac/format.html#metadata_block_seektable">FLAC format
* METADATA_BLOCK_SEEKTABLE</a>
*/
public void parseSeekTable(ParsableByteArray data) {
data.skipBytes(METADATA_LENGTH_OFFSET);
int length = data.readUnsignedInt24();
int numberOfSeekPoints = length / SEEK_POINT_SIZE;
seekPointGranules = new long[numberOfSeekPoints];
seekPointOffsets = new long[numberOfSeekPoints];
for (int i = 0; i < numberOfSeekPoints; i++) {
seekPointGranules[i] = data.readLong();
seekPointOffsets[i] = data.readLong();
data.skipBytes(2); // Skip "Number of samples in the target frame."
}
}
示例4: parsePsshAtom
import com.google.android.exoplayer2.util.ParsableByteArray; //导入方法依赖的package包/类
/**
* Parses the UUID and scheme specific data from a PSSH atom. Version 0 and 1 PSSH atoms are
* supported.
*
* @param atom The atom to parse.
* @return A pair consisting of the parsed UUID and scheme specific data. Null if the input is
* not a valid PSSH atom, or if the PSSH atom has an unsupported version.
*/
private static Pair<UUID, byte[]> parsePsshAtom(byte[] atom) {
ParsableByteArray atomData = new ParsableByteArray(atom);
if (atomData.limit() < Atom.FULL_HEADER_SIZE + 16 /* UUID */ + 4 /* DataSize */) {
// Data too short.
return null;
}
atomData.setPosition(0);
int atomSize = atomData.readInt();
if (atomSize != atomData.bytesLeft() + 4) {
// Not an atom, or incorrect atom size.
return null;
}
int atomType = atomData.readInt();
if (atomType != Atom.TYPE_pssh) {
// Not an atom, or incorrect atom type.
return null;
}
int atomVersion = Atom.parseFullAtomVersion(atomData.readInt());
if (atomVersion > 1) {
Log.w(TAG, "Unsupported pssh version: " + atomVersion);
return null;
}
UUID uuid = new UUID(atomData.readLong(), atomData.readLong());
if (atomVersion == 1) {
int keyIdCount = atomData.readUnsignedIntToInt();
atomData.skipBytes(16 * keyIdCount);
}
int dataSize = atomData.readUnsignedIntToInt();
if (dataSize != atomData.bytesLeft()) {
// Incorrect dataSize.
return null;
}
byte[] data = new byte[dataSize];
atomData.readBytes(data, 0, dataSize);
return Pair.create(uuid, data);
}