Java Code Examples for android.media.MediaCodecInfo.AudioCapabilities#isSampleRateSupported()

The following examples show how to use android.media.MediaCodecInfo.AudioCapabilities#isSampleRateSupported() . 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: MediaCodecInfo.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * Whether the decoder supports audio with a given sample rate.
 * <p>
 * Must not be called if the device SDK version is less than 21.
 *
 * @param sampleRate The sample rate in Hz.
 * @return Whether the decoder supports audio with the given sample rate.
 */
@TargetApi(21)
public boolean isAudioSampleRateSupportedV21(int sampleRate) {
  if (capabilities == null) {
    logNoSupport("sampleRate.caps");
    return false;
  }
  AudioCapabilities audioCapabilities = capabilities.getAudioCapabilities();
  if (audioCapabilities == null) {
    logNoSupport("sampleRate.aCaps");
    return false;
  }
  if (!audioCapabilities.isSampleRateSupported(sampleRate)) {
    logNoSupport("sampleRate.support, " + sampleRate);
    return false;
  }
  return true;
}
 
Example 2
Source File: MediaCodecInfo.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Whether the decoder supports audio with a given sample rate.
 * <p>
 * Must not be called if the device SDK version is less than 21.
 *
 * @param sampleRate The sample rate in Hz.
 * @return Whether the decoder supports audio with the given sample rate.
 */
@TargetApi(21)
public boolean isAudioSampleRateSupportedV21(int sampleRate) {
  if (capabilities == null) {
    logNoSupport("sampleRate.caps");
    return false;
  }
  AudioCapabilities audioCapabilities = capabilities.getAudioCapabilities();
  if (audioCapabilities == null) {
    logNoSupport("sampleRate.aCaps");
    return false;
  }
  if (!audioCapabilities.isSampleRateSupported(sampleRate)) {
    logNoSupport("sampleRate.support, " + sampleRate);
    return false;
  }
  return true;
}
 
Example 3
Source File: MediaCodecInfo.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Whether the decoder supports audio with a given sample rate.
 * <p>
 * Must not be called if the device SDK version is less than 21.
 *
 * @param sampleRate The sample rate in Hz.
 * @return Whether the decoder supports audio with the given sample rate.
 */
@TargetApi(21)
public boolean isAudioSampleRateSupportedV21(int sampleRate) {
  if (capabilities == null) {
    logNoSupport("sampleRate.caps");
    return false;
  }
  AudioCapabilities audioCapabilities = capabilities.getAudioCapabilities();
  if (audioCapabilities == null) {
    logNoSupport("sampleRate.aCaps");
    return false;
  }
  if (!audioCapabilities.isSampleRateSupported(sampleRate)) {
    logNoSupport("sampleRate.support, " + sampleRate);
    return false;
  }
  return true;
}
 
Example 4
Source File: MediaCodecInfo.java    From K-Sonic with MIT License 6 votes vote down vote up
/**
 * Whether the decoder supports audio with a given sample rate.
 * <p>
 * Must not be called if the device SDK version is less than 21.
 *
 * @param sampleRate The sample rate in Hz.
 * @return Whether the decoder supports audio with the given sample rate.
 */
@TargetApi(21)
public boolean isAudioSampleRateSupportedV21(int sampleRate) {
  if (capabilities == null) {
    logNoSupport("sampleRate.caps");
    return false;
  }
  AudioCapabilities audioCapabilities = capabilities.getAudioCapabilities();
  if (audioCapabilities == null) {
    logNoSupport("sampleRate.aCaps");
    return false;
  }
  if (!audioCapabilities.isSampleRateSupported(sampleRate)) {
    logNoSupport("sampleRate.support, " + sampleRate);
    return false;
  }
  return true;
}
 
Example 5
Source File: MediaCodecInfo.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Whether the decoder supports audio with a given sample rate.
 * <p>
 * Must not be called if the device SDK version is less than 21.
 *
 * @param sampleRate The sample rate in Hz.
 * @return Whether the decoder supports audio with the given sample rate.
 */
@TargetApi(21)
public boolean isAudioSampleRateSupportedV21(int sampleRate) {
  if (capabilities == null) {
    logNoSupport("sampleRate.caps");
    return false;
  }
  AudioCapabilities audioCapabilities = capabilities.getAudioCapabilities();
  if (audioCapabilities == null) {
    logNoSupport("sampleRate.aCaps");
    return false;
  }
  if (!audioCapabilities.isSampleRateSupported(sampleRate)) {
    logNoSupport("sampleRate.support, " + sampleRate);
    return false;
  }
  return true;
}
 
Example 6
Source File: MediaCodecInfo.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Whether the decoder supports audio with a given sample rate.
 * <p>
 * Must not be called if the device SDK version is less than 21.
 *
 * @param sampleRate The sample rate in Hz.
 * @return Whether the decoder supports audio with the given sample rate.
 */
@TargetApi(21)
public boolean isAudioSampleRateSupportedV21(int sampleRate) {
  if (capabilities == null) {
    logNoSupport("sampleRate.caps");
    return false;
  }
  AudioCapabilities audioCapabilities = capabilities.getAudioCapabilities();
  if (audioCapabilities == null) {
    logNoSupport("sampleRate.aCaps");
    return false;
  }
  if (!audioCapabilities.isSampleRateSupported(sampleRate)) {
    logNoSupport("sampleRate.support, " + sampleRate);
    return false;
  }
  return true;
}