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


Java LongArray类代码示例

本文整理汇总了Java中com.google.android.exoplayer.util.LongArray的典型用法代码示例。如果您正苦于以下问题:Java LongArray类的具体用法?Java LongArray怎么用?Java LongArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LongArray类属于com.google.android.exoplayer.util包,在下文中一共展示了LongArray类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onMasterElementStart

import com.google.android.exoplayer.util.LongArray; //导入依赖的package包/类
boolean onMasterElementStart(
    int id, long elementOffsetBytes, int headerSizeBytes,
    long contentsSizeBytes) throws ParserException {
  switch (id) {
    case ID_SEGMENT:
      if (segmentStartOffsetBytes != UNKNOWN || segmentEndOffsetBytes != UNKNOWN) {
        throw new ParserException("Multiple Segment elements not supported");
      }
      segmentStartOffsetBytes = elementOffsetBytes + headerSizeBytes;
      segmentEndOffsetBytes = elementOffsetBytes + headerSizeBytes + contentsSizeBytes;
      break;
    case ID_CUES:
      cuesSizeBytes = headerSizeBytes + contentsSizeBytes;
      cueTimesUs = new LongArray();
      cueClusterPositions = new LongArray();
      break;
    default:
      // pass
  }
  return true;
}
 
开发者ID:Weco,项目名称:android-exoplayer,代码行数:22,代码来源:WebmExtractor.java

示例2: onMasterElementStart

import com.google.android.exoplayer.util.LongArray; //导入依赖的package包/类
boolean onMasterElementStart(
    int id, long elementOffsetBytes, int headerSizeBytes, long contentsSizeBytes) {
  switch (id) {
    case ID_SEGMENT:
      if (segmentStartOffsetBytes != UNKNOWN || segmentEndOffsetBytes != UNKNOWN) {
        throw new IllegalStateException("Multiple Segment elements not supported");
      }
      segmentStartOffsetBytes = elementOffsetBytes + headerSizeBytes;
      segmentEndOffsetBytes = elementOffsetBytes + headerSizeBytes + contentsSizeBytes;
      break;
    case ID_CUES:
      cuesSizeBytes = headerSizeBytes + contentsSizeBytes;
      cueTimesUs = new LongArray();
      cueClusterPositions = new LongArray();
      break;
    default:
      // pass
  }
  return true;
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:21,代码来源:WebmExtractor.java

示例3: startMasterElement

import com.google.android.exoplayer.util.LongArray; //导入依赖的package包/类
void startMasterElement(int id, long contentPosition, long contentSize)
    throws ParserException {
  switch (id) {
    case ID_SEGMENT:
      if (segmentContentPosition != UNKNOWN && segmentContentPosition != contentPosition) {
        throw new ParserException("Multiple Segment elements not supported");
      }
      segmentContentPosition = contentPosition;
      segmentContentSize = contentSize;
      return;
    case ID_SEEK:
      seekEntryId = UNKNOWN;
      seekEntryPosition = UNKNOWN;
      return;
    case ID_CUES:
      cueTimesUs = new LongArray();
      cueClusterPositions = new LongArray();
      return;
    case ID_CUE_POINT:
      seenClusterPositionForCurrentCuePoint = false;
      return;
    case ID_CLUSTER:
      if (cuesState == CUES_STATE_NOT_BUILT) {
        // We need to build cues before parsing the cluster.
        if (cuesContentPosition != UNKNOWN) {
          // We know where the Cues element is located. Seek to request it.
          seekForCues = true;
        } else {
          // We don't know where the Cues element is located. It's most likely omitted. Allow
          // playback, but disable seeking.
          extractorOutput.seekMap(SeekMap.UNSEEKABLE);
          cuesState = CUES_STATE_BUILT;
        }
      }
      return;
    case ID_BLOCK_GROUP:
      sampleSeenReferenceBlock = false;
      return;
    case ID_CONTENT_ENCODING:
      // TODO: check and fail if more than one content encoding is present.
      return;
    case ID_CONTENT_ENCRYPTION:
      trackFormat.hasContentEncryption = true;
      return;
    case ID_TRACK_ENTRY:
      trackFormat = new TrackFormat();
      return;
    default:
      return;
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:52,代码来源:WebmExtractor.java

示例4: parse

import com.google.android.exoplayer.util.LongArray; //导入依赖的package包/类
@Override
public SubripSubtitle parse(InputStream inputStream, String inputEncoding, long startTimeUs)
    throws IOException {
  ArrayList<Cue> cues = new ArrayList<>();
  LongArray cueTimesUs = new LongArray();
  BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, C.UTF8_NAME));
  String currentLine;

  while ((currentLine = reader.readLine()) != null) {
    // Parse the numeric counter as a sanity check.
    try {
      Integer.parseInt(currentLine);
    } catch (NumberFormatException e) {
      throw new ParserException("Expected numeric counter: " + currentLine);
    }

    // Read and parse the timing line.
    currentLine = reader.readLine();
    Matcher matcher = SUBRIP_TIMING_LINE.matcher(currentLine);
    if (matcher.find()) {
      cueTimesUs.add(startTimeUs + parseTimestampUs(matcher.group(1)));
      cueTimesUs.add(startTimeUs + parseTimestampUs(matcher.group(2)));
    } else {
      throw new ParserException("Expected timing line: " + currentLine);
    }

    // Read and parse the text.
    textBuilder.setLength(0);
    while (!TextUtils.isEmpty(currentLine = reader.readLine())) {
      if (textBuilder.length() > 0) {
        textBuilder.append("<br>");
      }
      textBuilder.append(currentLine.trim());
    }

    Spanned text = Html.fromHtml(textBuilder.toString());
    cues.add(new Cue(text));
  }

  Cue[] cuesArray = new Cue[cues.size()];
  cues.toArray(cuesArray);
  long[] cueTimesUsArray = cueTimesUs.toArray();
  return new SubripSubtitle(startTimeUs, cuesArray, cueTimesUsArray);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:45,代码来源:SubripParser.java

示例5: startMasterElement

import com.google.android.exoplayer.util.LongArray; //导入依赖的package包/类
void startMasterElement(int id, long contentPosition, long contentSize)
    throws ParserException {
  switch (id) {
    case ID_SEGMENT:
      if (segmentContentPosition != UNKNOWN && segmentContentPosition != contentPosition) {
        throw new ParserException("Multiple Segment elements not supported");
      }
      segmentContentPosition = contentPosition;
      segmentContentSize = contentSize;
      return;
    case ID_SEEK:
      seekEntryId = UNKNOWN;
      seekEntryPosition = UNKNOWN;
      return;
    case ID_CUES:
      cueTimesUs = new LongArray();
      cueClusterPositions = new LongArray();
      return;
    case ID_CUE_POINT:
      seenClusterPositionForCurrentCuePoint = false;
      return;
    case ID_CLUSTER:
      if (!sentSeekMap) {
        // We need to build cues before parsing the cluster.
        if (cuesContentPosition != UNKNOWN) {
          // We know where the Cues element is located. Seek to request it.
          seekForCues = true;
        } else {
          // We don't know where the Cues element is located. It's most likely omitted. Allow
          // playback, but disable seeking.
          extractorOutput.seekMap(SeekMap.UNSEEKABLE);
          sentSeekMap = true;
        }
      }
      return;
    case ID_BLOCK_GROUP:
      sampleSeenReferenceBlock = false;
      return;
    case ID_CONTENT_ENCODING:
      // TODO: check and fail if more than one content encoding is present.
      return;
    case ID_CONTENT_ENCRYPTION:
      currentTrack.hasContentEncryption = true;
      return;
    case ID_TRACK_ENTRY:
      currentTrack = new Track();
      return;
    default:
      return;
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:52,代码来源:WebmExtractor.java

示例6: parse

import com.google.android.exoplayer.util.LongArray; //导入依赖的package包/类
@Override
public SubripSubtitle parse(byte[] bytes, int offset, int length) {
  ArrayList<Cue> cues = new ArrayList<>();
  LongArray cueTimesUs = new LongArray();
  ParsableByteArray subripData = new ParsableByteArray(bytes, offset + length);
  subripData.setPosition(offset);
  boolean haveEndTimecode;
  String currentLine;

  while ((currentLine = subripData.readLine()) != null) {
    if (currentLine.length() == 0) {
      // Skip blank lines.
      continue;
    }

    // Parse the index line as a sanity check.
    try {
      Integer.parseInt(currentLine);
    } catch (NumberFormatException e) {
      Log.w(TAG, "Skipping invalid index: " + currentLine);
      continue;
    }

    // Read and parse the timing line.
    haveEndTimecode = false;
    currentLine = subripData.readLine();
    Matcher matcher = SUBRIP_TIMING_LINE.matcher(currentLine);
    if (matcher.find()) {
      cueTimesUs.add(parseTimecode(matcher.group(1)));
      String endTimecode = matcher.group(2);
      if (!TextUtils.isEmpty(endTimecode)) {
        haveEndTimecode = true;
        cueTimesUs.add(parseTimecode(matcher.group(2)));
      }
    } else {
      Log.w(TAG, "Skipping invalid timing: " + currentLine);
      continue;
    }

    // Read and parse the text.
    textBuilder.setLength(0);
    while (!TextUtils.isEmpty(currentLine = subripData.readLine())) {
      if (textBuilder.length() > 0) {
        textBuilder.append("<br>");
      }
      textBuilder.append(currentLine.trim());
    }

    Spanned text = Html.fromHtml(textBuilder.toString());
    cues.add(new Cue(text));
    if (haveEndTimecode) {
      cues.add(null);
    }
  }

  Cue[] cuesArray = new Cue[cues.size()];
  cues.toArray(cuesArray);
  long[] cueTimesUsArray = cueTimesUs.toArray();
  return new SubripSubtitle(cuesArray, cueTimesUsArray);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:61,代码来源:SubripParser.java

示例7: parse

import com.google.android.exoplayer.util.LongArray; //导入依赖的package包/类
@Override
public FlyingSubTitle parse(InputStream inputStream) throws IOException {
	ArrayList<Cue> cues = new ArrayList<>();
	LongArray cueTimesUs = new LongArray();
	BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, C.UTF8_NAME));
	boolean haveEndTimecode;
	String currentLine;

	while ((currentLine = reader.readLine()) != null) {
		if (currentLine.length() == 0) {
			// Skip blank lines.
			continue;
		}

		// Parse the index line as a sanity check.
		try {
			Integer.parseInt(currentLine);
		} catch (NumberFormatException e) {
			Log.w(TAG, "Skipping invalid index: " + currentLine);
			continue;
		}

		// Read and parse the timing line.
		haveEndTimecode = false;
		currentLine = reader.readLine();
		Matcher matcher = SUBRIP_TIMING_LINE.matcher(currentLine);
		if (matcher.find()) {
			cueTimesUs.add(parseTimecode(matcher.group(1)));
			String endTimecode = matcher.group(2);
			if (!TextUtils.isEmpty(endTimecode)) {
				haveEndTimecode = true;
				cueTimesUs.add(parseTimecode(matcher.group(2)));
			}
		} else {
			Log.w(TAG, "Skipping invalid timing: " + currentLine);
			continue;
		}

		// Read and parse the text.
		textBuilder.setLength(0);
		while (!TextUtils.isEmpty(currentLine = reader.readLine())) {
			if (textBuilder.length() > 0) {
				textBuilder.append("<br>");
			}
			textBuilder.append(currentLine.trim());
		}

		Spanned text = Html.fromHtml(textBuilder.toString());
		cues.add(new Cue(text));
		if (haveEndTimecode) {
			cues.add(null);
		}
	}

	Cue[] cuesArray = new Cue[cues.size()];
	cues.toArray(cuesArray);
	long[] cueTimesUsArray = cueTimesUs.toArray();
	return new FlyingSubTitle(cuesArray, cueTimesUsArray);
}
 
开发者ID:birdcopy,项目名称:Android-Birdcopy-Application,代码行数:60,代码来源:FlyingSrtParser.java


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