Tabnine Logo
DecoderInputBuffer.flip
Code IndexAdd Tabnine to your IDE (free)

How to use
flip
method
in
com.google.android.exoplayer2.decoder.DecoderInputBuffer

Best Java code snippets using com.google.android.exoplayer2.decoder.DecoderInputBuffer.flip (Showing top 7 results out of 315)

origin: google/ExoPlayer

/**
 * Asserts {@code inputBuffer} does not contain any sample data.
 */
private void assertInputBufferContainsNoSampleData() {
 if (inputBuffer.data == null) {
  return;
 }
 inputBuffer.flip();
 assertThat(inputBuffer.data.limit()).isEqualTo(0);
}
origin: google/ExoPlayer

@Override
public int readData(FormatHolder formatHolder, DecoderInputBuffer buffer,
  boolean formatRequired) {
 if (eventDispatcher != null && !notifiedDownstreamFormat) {
  eventDispatcher.downstreamFormatChanged(
    C.TRACK_TYPE_UNKNOWN,
    format,
    C.SELECTION_REASON_UNKNOWN,
    /* trackSelectionData= */ null,
    /* mediaTimeUs= */ 0);
  notifiedDownstreamFormat = true;
 }
 if (formatRequired || !readFormat) {
  formatHolder.format = format;
  readFormat = true;
  return C.RESULT_FORMAT_READ;
 } else if (!readSample) {
  buffer.timeUs = 0;
  buffer.ensureSpaceForWrite(1);
  buffer.data.put((byte) 0);
  buffer.flip();
  readSample = true;
  return C.RESULT_BUFFER_READ;
 } else {
  buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
  return C.RESULT_BUFFER_READ;
 }
}
origin: google/ExoPlayer

@Override
public int readData(FormatHolder formatHolder, DecoderInputBuffer buffer,
  boolean formatRequired) {
 if (eventDispatcher != null && !notifiedDownstreamFormat) {
  eventDispatcher.downstreamFormatChanged(
    C.TRACK_TYPE_UNKNOWN,
    format,
    C.SELECTION_REASON_UNKNOWN,
    /* trackSelectionData= */ null,
    /* mediaTimeUs= */ 0);
  notifiedDownstreamFormat = true;
 }
 if (formatRequired || !readFormat) {
  formatHolder.format = format;
  readFormat = true;
  return C.RESULT_FORMAT_READ;
 } else if (!readSample) {
  buffer.timeUs = 0;
  buffer.ensureSpaceForWrite(1);
  buffer.data.put((byte) 0);
  buffer.flip();
  readSample = true;
  return C.RESULT_BUFFER_READ;
 } else {
  buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
  return C.RESULT_BUFFER_READ;
 }
}
origin: google/ExoPlayer

@Override
public void render(long positionUs, long elapsedRealtimeUs) throws ExoPlaybackException {
 // Keep reading available samples as long as the sample time is not too far into the future.
 while (!hasReadStreamToEnd() && lastTimestampUs < positionUs + SAMPLE_WINDOW_DURATION_US) {
  buffer.clear();
  int result = readSource(formatHolder, buffer, /* formatRequired= */ false);
  if (result != C.RESULT_BUFFER_READ || buffer.isEndOfStream()) {
   return;
  }
  buffer.flip();
  lastTimestampUs = buffer.timeUs;
  if (listener != null) {
   float[] rotation = parseMetadata(buffer.data);
   if (rotation != null) {
    Util.castNonNull(listener).onCameraMotion(lastTimestampUs - offsetUs, rotation);
   }
  }
 }
}
origin: google/ExoPlayer

/**
 * Asserts {@link SampleQueue#read} returns {@link C#RESULT_BUFFER_READ} and that the buffer is
 * filled with the specified sample data.
 *
 * @param timeUs The expected buffer timestamp.
 * @param isKeyframe The expected keyframe flag.
 * @param sampleData An array containing the expected sample data.
 * @param offset The offset in {@code sampleData} of the expected sample data.
 * @param length The length of the expected sample data.
 */
private void assertReadSample(
  long timeUs, boolean isKeyframe, byte[] sampleData, int offset, int length) {
 clearFormatHolderAndInputBuffer();
 int result = sampleQueue.read(formatHolder, inputBuffer, false, false, 0);
 assertThat(result).isEqualTo(RESULT_BUFFER_READ);
 // formatHolder should not be populated.
 assertThat(formatHolder.format).isNull();
 // inputBuffer should be populated.
 assertThat(inputBuffer.timeUs).isEqualTo(timeUs);
 assertThat(inputBuffer.isKeyFrame()).isEqualTo(isKeyframe);
 assertThat(inputBuffer.isDecodeOnly()).isFalse();
 assertThat(inputBuffer.isEncrypted()).isFalse();
 inputBuffer.flip();
 assertThat(inputBuffer.data.limit()).isEqualTo(length);
 byte[] readData = new byte[length];
 inputBuffer.data.get(readData);
 assertThat(readData).isEqualTo(copyOfRange(sampleData, offset, offset + length));
}
origin: google/ExoPlayer

buffer.flip();
onQueueInputBuffer(buffer);
origin: google/ExoPlayer

 return false;
inputBuffer.flip();
onQueueInputBuffer(inputBuffer);
decoder.queueInputBuffer(inputBuffer);
com.google.android.exoplayer2.decoderDecoderInputBufferflip

Javadoc

Flips #data in preparation for being queued to a decoder.

Popular methods of DecoderInputBuffer

  • <init>
  • clear
  • ensureSpaceForWrite
    Ensures that #data is large enough to accommodate a write of a given length at its current position.
  • isEndOfStream
  • setFlags
  • isEncrypted
    Returns whether the C#BUFFER_FLAG_ENCRYPTED flag is set.
  • isDecodeOnly
  • isKeyFrame
  • newFlagsOnlyInstance
    Creates a new instance for which #isFlagsOnly() will return true.
  • addFlag
  • createReplacementByteBuffer
  • getFlag
  • createReplacementByteBuffer,
  • getFlag,
  • isFlagsOnly

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setScale (BigDecimal)
  • getResourceAsStream (ClassLoader)
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now