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


Java C.BufferFlags方法代码示例

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


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

示例1: sampleMetadata

import com.google.android.exoplayer2.C; //导入方法依赖的package包/类
@Override
public void sampleMetadata(long timeUs, @C.BufferFlags int flags, int size, int offset,
    byte[] encryptionKey) {
  if (pendingFormatAdjustment) {
    format(lastUnadjustedFormat);
  }
  if (!startWriteOperation()) {
    infoQueue.commitSampleTimestamp(timeUs);
    return;
  }
  try {
    if (pendingSplice) {
      if ((flags & C.BUFFER_FLAG_KEY_FRAME) == 0 || !infoQueue.attemptSplice(timeUs)) {
        return;
      }
      pendingSplice = false;
    }
    timeUs += sampleOffsetUs;
    long absoluteOffset = totalBytesWritten - size - offset;
    infoQueue.commitSample(timeUs, flags, absoluteOffset, size, encryptionKey);
  } finally {
    endWriteOperation();
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:25,代码来源:DefaultTrackOutput.java

示例2: sampleMetadata

import com.google.android.exoplayer2.C; //导入方法依赖的package包/类
@Override
public void sampleMetadata(long timeUs, @C.BufferFlags int flags, int size, int offset,
    byte[] encryptionKey) {
  sampleTimesUs.add(timeUs);
  sampleFlags.add(flags);
  sampleStartOffsets.add(sampleData.length - offset - size);
  sampleEndOffsets.add(sampleData.length - offset);
  sampleEncryptionKeys.add(encryptionKey);
}
 
开发者ID:ashwanijanghu,项目名称:ExoPlayer-Offline,代码行数:10,代码来源:FakeTrackOutput.java

示例3: consume

import com.google.android.exoplayer2.C; //导入方法依赖的package包/类
@Override
public void consume(ParsableByteArray data) {
  int offset = data.getPosition();
  int limit = data.limit();
  byte[] dataArray = data.data;

  // Append the data to the buffer.
  totalBytesWritten += data.bytesLeft();
  output.sampleData(data, data.bytesLeft());

  int searchOffset = offset;
  while (true) {
    int startCodeOffset = NalUnitUtil.findNalUnit(dataArray, searchOffset, limit, prefixFlags);

    if (startCodeOffset == limit) {
      // We've scanned to the end of the data without finding another start code.
      if (!hasOutputFormat) {
        csdBuffer.onData(dataArray, offset, limit);
      }
      return;
    }

    // We've found a start code with the following value.
    int startCodeValue = data.data[startCodeOffset + 3] & 0xFF;

    if (!hasOutputFormat) {
      // This is the number of bytes from the current offset to the start of the next start
      // code. It may be negative if the start code started in the previously consumed data.
      int lengthToStartCode = startCodeOffset - offset;
      if (lengthToStartCode > 0) {
        csdBuffer.onData(dataArray, offset, startCodeOffset);
      }
      // This is the number of bytes belonging to the next start code that have already been
      // passed to csdDataTargetBuffer.
      int bytesAlreadyPassed = lengthToStartCode < 0 ? -lengthToStartCode : 0;
      if (csdBuffer.onStartCode(startCodeValue, bytesAlreadyPassed)) {
        // The csd data is complete, so we can decode and output the media format.
        Pair<Format, Long> result = parseCsdBuffer(csdBuffer, formatId);
        output.format(result.first);
        frameDurationUs = result.second;
        hasOutputFormat = true;
      }
    }

    if (hasOutputFormat && (startCodeValue == START_GROUP || startCodeValue == START_PICTURE)) {
      int bytesWrittenPastStartCode = limit - startCodeOffset;
      if (foundFirstFrameInGroup) {
        @C.BufferFlags int flags = isKeyframe ? C.BUFFER_FLAG_KEY_FRAME : 0;
        int size = (int) (totalBytesWritten - framePosition) - bytesWrittenPastStartCode;
        output.sampleMetadata(frameTimeUs, flags, size, bytesWrittenPastStartCode, null);
        isKeyframe = false;
      }
      if (startCodeValue == START_GROUP) {
        foundFirstFrameInGroup = false;
        isKeyframe = true;
      } else /* startCodeValue == START_PICTURE */ {
        frameTimeUs = pesPtsUsAvailable ? pesTimeUs : (frameTimeUs + frameDurationUs);
        framePosition = totalBytesWritten - bytesWrittenPastStartCode;
        pesPtsUsAvailable = false;
        foundFirstFrameInGroup = true;
      }
    }

    offset = startCodeOffset;
    searchOffset = offset + 3;
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:68,代码来源:H262Reader.java

示例4: outputSample

import com.google.android.exoplayer2.C; //导入方法依赖的package包/类
private void outputSample(int offset) {
  @C.BufferFlags int flags = sampleIsKeyframe ? C.BUFFER_FLAG_KEY_FRAME : 0;
  int size = (int) (nalUnitStartPosition - samplePosition);
  output.sampleMetadata(sampleTimeUs, flags, size, offset, null);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:6,代码来源:H264Reader.java

示例5: sampleMetadata

import com.google.android.exoplayer2.C; //导入方法依赖的package包/类
@Override
public void sampleMetadata(long timeUs, @C.BufferFlags int flags, int size, int offset,
    byte[] encryptionKey) {
  // Do nothing.
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:6,代码来源:DummyTrackOutput.java

示例6: commitSample

import com.google.android.exoplayer2.C; //导入方法依赖的package包/类
public synchronized void commitSample(long timeUs, @C.BufferFlags int sampleFlags, long offset,
    int size, byte[] encryptionKey) {
  if (upstreamKeyframeRequired) {
    if ((sampleFlags & C.BUFFER_FLAG_KEY_FRAME) == 0) {
      return;
    }
    upstreamKeyframeRequired = false;
  }
  Assertions.checkState(!upstreamFormatRequired);
  commitSampleTimestamp(timeUs);
  timesUs[relativeWriteIndex] = timeUs;
  offsets[relativeWriteIndex] = offset;
  sizes[relativeWriteIndex] = size;
  flags[relativeWriteIndex] = sampleFlags;
  encryptionKeys[relativeWriteIndex] = encryptionKey;
  formats[relativeWriteIndex] = upstreamFormat;
  sourceIds[relativeWriteIndex] = upstreamSourceId;
  // Increment the write index.
  queueSize++;
  if (queueSize == capacity) {
    // Increase the capacity.
    int newCapacity = capacity + SAMPLE_CAPACITY_INCREMENT;
    int[] newSourceIds = new int[newCapacity];
    long[] newOffsets = new long[newCapacity];
    long[] newTimesUs = new long[newCapacity];
    int[] newFlags = new int[newCapacity];
    int[] newSizes = new int[newCapacity];
    byte[][] newEncryptionKeys = new byte[newCapacity][];
    Format[] newFormats = new Format[newCapacity];
    int beforeWrap = capacity - relativeReadIndex;
    System.arraycopy(offsets, relativeReadIndex, newOffsets, 0, beforeWrap);
    System.arraycopy(timesUs, relativeReadIndex, newTimesUs, 0, beforeWrap);
    System.arraycopy(flags, relativeReadIndex, newFlags, 0, beforeWrap);
    System.arraycopy(sizes, relativeReadIndex, newSizes, 0, beforeWrap);
    System.arraycopy(encryptionKeys, relativeReadIndex, newEncryptionKeys, 0, beforeWrap);
    System.arraycopy(formats, relativeReadIndex, newFormats, 0, beforeWrap);
    System.arraycopy(sourceIds, relativeReadIndex, newSourceIds, 0, beforeWrap);
    int afterWrap = relativeReadIndex;
    System.arraycopy(offsets, 0, newOffsets, beforeWrap, afterWrap);
    System.arraycopy(timesUs, 0, newTimesUs, beforeWrap, afterWrap);
    System.arraycopy(flags, 0, newFlags, beforeWrap, afterWrap);
    System.arraycopy(sizes, 0, newSizes, beforeWrap, afterWrap);
    System.arraycopy(encryptionKeys, 0, newEncryptionKeys, beforeWrap, afterWrap);
    System.arraycopy(formats, 0, newFormats, beforeWrap, afterWrap);
    System.arraycopy(sourceIds, 0, newSourceIds, beforeWrap, afterWrap);
    offsets = newOffsets;
    timesUs = newTimesUs;
    flags = newFlags;
    sizes = newSizes;
    encryptionKeys = newEncryptionKeys;
    formats = newFormats;
    sourceIds = newSourceIds;
    relativeReadIndex = 0;
    relativeWriteIndex = capacity;
    queueSize = capacity;
    capacity = newCapacity;
  } else {
    relativeWriteIndex++;
    if (relativeWriteIndex == capacity) {
      // Wrap around.
      relativeWriteIndex = 0;
    }
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:65,代码来源:DefaultTrackOutput.java

示例7: sampleMetadata

import com.google.android.exoplayer2.C; //导入方法依赖的package包/类
@Override
public void sampleMetadata(long timeUs, @C.BufferFlags int flags, int size, int offset,
    byte[] encryptionKey) {
  trackOutput.sampleMetadata(timeUs, flags, size, offset, encryptionKey);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:6,代码来源:ChunkExtractorWrapper.java

示例8: sampleMetadata

import com.google.android.exoplayer2.C; //导入方法依赖的package包/类
/**
 * Called when metadata associated with a sample has been extracted from the stream.
 * <p>
 * The corresponding sample data will have already been passed to the output via calls to
 * {@link #sampleData(ExtractorInput, int, boolean)} or
 * {@link #sampleData(ParsableByteArray, int)}.
 *
 * @param timeUs The media timestamp associated with the sample, in microseconds.
 * @param flags Flags associated with the sample. See {@code C.BUFFER_FLAG_*}.
 * @param size The size of the sample data, in bytes.
 * @param offset The number of bytes that have been passed to
 *     {@link #sampleData(ExtractorInput, int, boolean)} or
 *     {@link #sampleData(ParsableByteArray, int)} since the last byte belonging to the sample
 *     whose metadata is being passed.
 * @param encryptionKey The encryption key associated with the sample. May be null.
 */
void sampleMetadata(long timeUs, @C.BufferFlags int flags, int size, int offset,
    byte[] encryptionKey);
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:19,代码来源:TrackOutput.java

示例9: setFlags

import com.google.android.exoplayer2.C; //导入方法依赖的package包/类
/**
 * Replaces this buffer's flags with {@code flags}.
 *
 * @param flags The flags to set, which should be a combination of the {@code C.BUFFER_FLAG_*}
 *     constants.
 */
public final void setFlags(@C.BufferFlags int flags) {
  this.flags = flags;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:10,代码来源:Buffer.java

示例10: addFlag

import com.google.android.exoplayer2.C; //导入方法依赖的package包/类
/**
 * Adds the {@code flag} to this buffer's flags.
 *
 * @param flag The flag to add to this buffer's flags, which should be one of the
 *     {@code C.BUFFER_FLAG_*} constants.
 */
public final void addFlag(@C.BufferFlags int flag) {
  flags |= flag;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:10,代码来源:Buffer.java

示例11: clearFlag

import com.google.android.exoplayer2.C; //导入方法依赖的package包/类
/**
 * Removes the {@code flag} from this buffer's flags, if it is set.
 *
 * @param flag The flag to remove.
 */
public final void clearFlag(@C.BufferFlags int flag) {
  flags &= ~flag;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:9,代码来源:Buffer.java

示例12: getFlag

import com.google.android.exoplayer2.C; //导入方法依赖的package包/类
/**
 * Returns whether the specified flag has been set on this buffer.
 *
 * @param flag The flag to check.
 * @return Whether the flag is set.
 */
protected final boolean getFlag(@C.BufferFlags int flag) {
  return (flags & flag) == flag;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:10,代码来源:Buffer.java


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