当前位置: 首页>>代码示例>>Java>>正文


Java ParsableByteArray.readNullTerminatedString方法代码示例

本文整理汇总了Java中com.google.android.exoplayer2.util.ParsableByteArray.readNullTerminatedString方法的典型用法代码示例。如果您正苦于以下问题:Java ParsableByteArray.readNullTerminatedString方法的具体用法?Java ParsableByteArray.readNullTerminatedString怎么用?Java ParsableByteArray.readNullTerminatedString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.exoplayer2.util.ParsableByteArray的用法示例。


在下文中一共展示了ParsableByteArray.readNullTerminatedString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseTextAttribute

import com.google.android.exoplayer2.util.ParsableByteArray; //导入方法依赖的package包/类
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;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:13,代码来源:MetadataUtil.java

示例2: parseCommentAttribute

import com.google.android.exoplayer2.util.ParsableByteArray; //导入方法依赖的package包/类
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;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:12,代码来源:MetadataUtil.java

示例3: parseInternalAttribute

import com.google.android.exoplayer2.util.ParsableByteArray; //导入方法依赖的package包/类
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);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:32,代码来源:MetadataUtil.java

示例4: onEmsgLeafAtomRead

import com.google.android.exoplayer2.util.ParsableByteArray; //导入方法依赖的package包/类
/**
 * 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;
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:32,代码来源:FragmentedMp4Extractor.java


注:本文中的com.google.android.exoplayer2.util.ParsableByteArray.readNullTerminatedString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。