com.google.android.exoplayer2.C.Encoding Java Examples

The following examples show how to use com.google.android.exoplayer2.C.Encoding. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SonicAudioProcessor.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean configure(int sampleRateHz, int channelCount, @Encoding int encoding)
    throws UnhandledFormatException {
  if (encoding != C.ENCODING_PCM_16BIT) {
    throw new UnhandledFormatException(sampleRateHz, channelCount, encoding);
  }
  int outputSampleRateHz = pendingOutputSampleRateHz == SAMPLE_RATE_NO_CHANGE
      ? sampleRateHz : pendingOutputSampleRateHz;
  if (this.sampleRateHz == sampleRateHz && this.channelCount == channelCount
      && this.outputSampleRateHz == outputSampleRateHz) {
    return false;
  }
  this.sampleRateHz = sampleRateHz;
  this.channelCount = channelCount;
  this.outputSampleRateHz = outputSampleRateHz;
  sonic = null;
  return true;
}
 
Example #2
Source File: SonicAudioProcessor.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean configure(int sampleRateHz, int channelCount, @Encoding int encoding)
    throws UnhandledFormatException {
  if (encoding != C.ENCODING_PCM_16BIT) {
    throw new UnhandledFormatException(sampleRateHz, channelCount, encoding);
  }
  int outputSampleRateHz = pendingOutputSampleRateHz == SAMPLE_RATE_NO_CHANGE
      ? sampleRateHz : pendingOutputSampleRateHz;
  if (this.sampleRateHz == sampleRateHz && this.channelCount == channelCount
      && this.outputSampleRateHz == outputSampleRateHz) {
    return false;
  }
  this.sampleRateHz = sampleRateHz;
  this.channelCount = channelCount;
  this.outputSampleRateHz = outputSampleRateHz;
  sonic = null;
  return true;
}
 
Example #3
Source File: SonicAudioProcessor.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean configure(int sampleRateHz, int channelCount, @Encoding int encoding)
    throws UnhandledFormatException {
  if (encoding != C.ENCODING_PCM_16BIT) {
    throw new UnhandledFormatException(sampleRateHz, channelCount, encoding);
  }
  int outputSampleRateHz = pendingOutputSampleRateHz == SAMPLE_RATE_NO_CHANGE
      ? sampleRateHz : pendingOutputSampleRateHz;
  if (this.sampleRateHz == sampleRateHz && this.channelCount == channelCount
      && this.outputSampleRateHz == outputSampleRateHz) {
    return false;
  }
  this.sampleRateHz = sampleRateHz;
  this.channelCount = channelCount;
  this.outputSampleRateHz = outputSampleRateHz;
  pendingSonicRecreation = true;
  return true;
}
 
Example #4
Source File: SonicAudioProcessor.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean configure(int sampleRateHz, int channelCount, @Encoding int encoding)
    throws UnhandledFormatException {
  if (encoding != C.ENCODING_PCM_16BIT) {
    throw new UnhandledFormatException(sampleRateHz, channelCount, encoding);
  }
  int outputSampleRateHz = pendingOutputSampleRateHz == SAMPLE_RATE_NO_CHANGE
      ? sampleRateHz : pendingOutputSampleRateHz;
  if (this.sampleRateHz == sampleRateHz && this.channelCount == channelCount
      && this.outputSampleRateHz == outputSampleRateHz) {
    return false;
  }
  this.sampleRateHz = sampleRateHz;
  this.channelCount = channelCount;
  this.outputSampleRateHz = outputSampleRateHz;
  pendingSonicRecreation = true;
  return true;
}
 
Example #5
Source File: ChannelMappingAudioProcessor.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean configure(int sampleRateHz, int channelCount, @Encoding int encoding)
    throws UnhandledFormatException {
  boolean outputChannelsChanged = !Arrays.equals(pendingOutputChannels, outputChannels);
  outputChannels = pendingOutputChannels;
  if (outputChannels == null) {
    active = false;
    return outputChannelsChanged;
  }
  if (encoding != C.ENCODING_PCM_16BIT) {
    throw new UnhandledFormatException(sampleRateHz, channelCount, encoding);
  }
  if (!outputChannelsChanged && this.sampleRateHz == sampleRateHz
      && this.channelCount == channelCount) {
    return false;
  }
  this.sampleRateHz = sampleRateHz;
  this.channelCount = channelCount;

  active = channelCount != outputChannels.length;
  for (int i = 0; i < outputChannels.length; i++) {
    int channelIndex = outputChannels[i];
    if (channelIndex >= channelCount) {
      throw new UnhandledFormatException(sampleRateHz, channelCount, encoding);
    }
    active |= (channelIndex != i);
  }
  return true;
}
 
Example #6
Source File: TrimmingAudioProcessor.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean configure(int sampleRateHz, int channelCount, @Encoding int encoding)
    throws UnhandledFormatException {
  if (encoding != C.ENCODING_PCM_16BIT) {
    throw new UnhandledFormatException(sampleRateHz, channelCount, encoding);
  }
  this.channelCount = channelCount;
  this.sampleRateHz = sampleRateHz;
  endBuffer = new byte[trimEndFrames * channelCount * 2];
  endBufferSize = 0;
  pendingTrimStartBytes = trimStartFrames * channelCount * 2;
  boolean wasActive = isActive;
  isActive = trimStartFrames != 0 || trimEndFrames != 0;
  return wasActive != isActive;
}
 
Example #7
Source File: ChannelMappingAudioProcessor.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean configure(int sampleRateHz, int channelCount, @Encoding int encoding)
    throws UnhandledFormatException {
  boolean outputChannelsChanged = !Arrays.equals(pendingOutputChannels, outputChannels);
  outputChannels = pendingOutputChannels;
  if (outputChannels == null) {
    active = false;
    return outputChannelsChanged;
  }
  if (encoding != C.ENCODING_PCM_16BIT) {
    throw new UnhandledFormatException(sampleRateHz, channelCount, encoding);
  }
  if (!outputChannelsChanged && this.sampleRateHz == sampleRateHz
      && this.channelCount == channelCount) {
    return false;
  }
  this.sampleRateHz = sampleRateHz;
  this.channelCount = channelCount;

  active = channelCount != outputChannels.length;
  for (int i = 0; i < outputChannels.length; i++) {
    int channelIndex = outputChannels[i];
    if (channelIndex >= channelCount) {
      throw new UnhandledFormatException(sampleRateHz, channelCount, encoding);
    }
    active |= (channelIndex != i);
  }
  return true;
}
 
Example #8
Source File: TrimmingAudioProcessor.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean configure(int sampleRateHz, int channelCount, @Encoding int encoding)
    throws UnhandledFormatException {
  if (encoding != C.ENCODING_PCM_16BIT) {
    throw new UnhandledFormatException(sampleRateHz, channelCount, encoding);
  }
  this.channelCount = channelCount;
  this.sampleRateHz = sampleRateHz;
  endBuffer = new byte[trimEndFrames * channelCount * 2];
  endBufferSize = 0;
  pendingTrimStartBytes = trimStartFrames * channelCount * 2;
  boolean wasActive = isActive;
  isActive = trimStartFrames != 0 || trimEndFrames != 0;
  return wasActive != isActive;
}
 
Example #9
Source File: ChannelMappingAudioProcessor.java    From K-Sonic with MIT License 5 votes vote down vote up
@Override
public boolean configure(int sampleRateHz, int channelCount, @Encoding int encoding)
    throws UnhandledFormatException {
  boolean outputChannelsChanged = !Arrays.equals(pendingOutputChannels, outputChannels);
  outputChannels = pendingOutputChannels;
  if (outputChannels == null) {
    active = false;
    return outputChannelsChanged;
  }
  if (encoding != C.ENCODING_PCM_16BIT) {
    throw new UnhandledFormatException(sampleRateHz, channelCount, encoding);
  }
  if (!outputChannelsChanged && this.sampleRateHz == sampleRateHz
      && this.channelCount == channelCount) {
    return false;
  }
  this.sampleRateHz = sampleRateHz;
  this.channelCount = channelCount;

  active = channelCount != outputChannels.length;
  for (int i = 0; i < outputChannels.length; i++) {
    int channelIndex = outputChannels[i];
    if (channelIndex >= channelCount) {
      throw new UnhandledFormatException(sampleRateHz, channelCount, encoding);
    }
    active |= (channelIndex != i);
  }
  return true;
}