Java 类com.google.android.exoplayer2.C.Encoding 实例源码

项目:transistor    文件:SonicAudioProcessor.java   
@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;
  return true;
}
项目:Exoplayer2Radio    文件:SonicAudioProcessor.java   
@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);
  }
  if (this.sampleRateHz == sampleRateHz && this.channelCount == channelCount) {
    return false;
  }
  this.sampleRateHz = sampleRateHz;
  this.channelCount = channelCount;
  return true;
}
项目:Exoplayer2Radio    文件:ChannelMappingAudioProcessor.java   
@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;
}
项目:K-Sonic    文件:ChannelMappingAudioProcessor.java   
@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;
}
项目:transistor    文件:ChannelMappingAudioProcessor.java   
@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;
}
项目:transistor    文件:TrimmingAudioProcessor.java   
@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[trimEndSamples * channelCount * 2];
  endBufferSize = 0;
  pendingTrimStartBytes = trimStartSamples * channelCount * 2;
  boolean wasActive = isActive;
  isActive = trimStartSamples != 0 || trimEndSamples != 0;
  return wasActive != isActive;
}