Tabnine Logo
AudioFormat
Code IndexAdd Tabnine to your IDE (free)

How to use
AudioFormat
in
javax.media.format

Best Java code snippets using javax.media.format.AudioFormat (Showing top 20 results out of 315)

origin: igniterealtime/Smack

/**
 * Return a JMF AudioFormat for a given Jingle Payload type.
 * Return null if the payload is not supported by this jmf API.
 *
 * @param payloadtype payloadtype
 * @return correspondent audioType
 */
public static AudioFormat getAudioFormat(PayloadType payloadtype) {
  switch (payloadtype.getId()) {
    case 0:
      return new AudioFormat(AudioFormat.ULAW_RTP);
    case 3:
      return new AudioFormat(AudioFormat.GSM_RTP);
    case 4:
      return new AudioFormat(AudioFormat.G723_RTP);
    default:
      return null;
  }
}
origin: jitsi/libjitsi

@Override
public Format[] getSupportedOutputFormats(Format input)
{
  if (input == null)
    return outputFormats;
  else
  {
    if (!(input instanceof AudioFormat))
    {
      return new Format[] {null};
    }
    final AudioFormat inputCast = (AudioFormat) input;
    if (!inputCast.getEncoding().equals(AudioFormat.GSM_RTP))
    {
      return new Format[] {null};
    }
    final AudioFormat result =
        new AudioFormat(
            AudioFormat.GSM,
            inputCast.getSampleRate(),
            inputCast.getSampleSizeInBits(),
            inputCast.getChannels(),
            inputCast.getEndian(),
            inputCast.getSigned(),
            inputCast.getFrameSizeInBits(),
            inputCast.getFrameRate(),
            inputCast.getDataType());
    return new Format[] {result};
  }
}
origin: jitsi/libjitsi

/**
 * Gets an <tt>AudioFormat</tt> instance which matches a specific
 * <tt>AudioFormat</tt> and has 1 channel if the specified
 * <tt>AudioFormat</tt> has its number of channels not specified.
 *
 * @param format the <tt>AudioFormat</tt> to get a match of
 * @return if the specified <tt>format</tt> has a specific number of
 * channels, <tt>format</tt>; otherwise, a new <tt>AudioFormat</tt> instance
 * which matches <tt>format</tt> and has 1 channel
 */
private static AudioFormat fixChannels(AudioFormat format)
{
  if (Format.NOT_SPECIFIED == format.getChannels())
    format
      = (AudioFormat)
        format
          .intersects(
            new AudioFormat(
                format.getEncoding(),
                format.getSampleRate(),
                format.getSampleSizeInBits(),
                1));
  return format;
}
origin: jitsi/libjitsi

@Override
protected Format[] getMatchingOutputFormats(Format inputFormat)
{
  AudioFormat inputAudioFormat = (AudioFormat) inputFormat;
  return
    new AudioFormat[]
        {
          new AudioFormat(
              AudioFormat.LINEAR,
              inputAudioFormat.getSampleRate(),
              16,
              1,
              AudioFormat.LITTLE_ENDIAN,
              AudioFormat.SIGNED)
        };
}
origin: jitsi/libjitsi

int channels = audioFormat.getChannels();
    || (channels <= MediaUtils.MAX_AUDIO_CHANNELS))
  double sampleRate = audioFormat.getSampleRate();
      = audioFormat.getSampleSizeInBits();
origin: jitsi/libjitsi

/**
 * Returns the supported output formats
 * @param in Format
 * @return Format[]
 */
public Format[] getSupportedOutputFormats(Format in)
{
  if (in == null)
  {
    return new Format[]{new AudioFormat(AudioFormat.ALAW)};
  }
  if (matches(in, inputFormats) == null)
  {
    return new Format[1];
  }
  if (! (in instanceof AudioFormat))
  {
    return new Format[]{new AudioFormat(AudioFormat.ALAW)};
  }
  AudioFormat af = (AudioFormat) in;
  return new Format[]
  {
    new AudioFormat(
      AudioFormat.ALAW,
      af.getSampleRate(),
      af.getSampleSizeInBits(),
      af.getChannels())
  };
}
origin: jitsi/libjitsi

@Override
protected Format[] getMatchingOutputFormats(Format in)
{
  AudioFormat af = (AudioFormat) in;
  supportedOutputFormats =
    new AudioFormat[]
    { new AudioFormat(AudioFormat.LINEAR, af.getSampleRate(), 16,
      af.getChannels(), AudioFormat.LITTLE_ENDIAN, // isBigEndian(),
      AudioFormat.SIGNED // isSigned());
    ) };
  return supportedOutputFormats;
}
origin: jitsi/libjitsi

switch (format.getChannels())
            format.getEncoding(),
            format.getSampleRate(),
            format.getSampleSizeInBits(),
            channels,
            AudioFormat.LITTLE_ENDIAN,
            format.getDataType())
      };
origin: jitsi/libjitsi

@Override
public Format[] getSupportedOutputFormats(Format input)
{
  if (input == null)
  {
    return outputFormats;
  } else
  {
    if (!(input instanceof AudioFormat))
    {
      return new Format[]{null};
    }
    final AudioFormat inputCast = (AudioFormat) input;
    final AudioFormat result = new AudioFormat(
        AudioFormat.GSM,
        inputCast.getSampleRate(),
        8,
        1,
        inputCast.getEndian(),
        AudioFormat.SIGNED,
        264,
        inputCast.getFrameRate(),
        Format.byteArray);
    return new Format[]{result};
  }
}
origin: jitsi/libjitsi

deviceUID,
this,
(float) format.getSampleRate(),
format.getChannels(),
format.getSampleSizeInBits(),
false,
format.getEndian() == AudioFormat.BIG_ENDIAN,
false,
true,
origin: jitsi/libjitsi

  if (Format.byteArray.equals(inStreamFormat.getDataType()))
      = sampleCount * (inStreamFormat.getSampleSizeInBits() / 8);
  else if (!lastReadInFormat.matches(inFormat))
int inFormatSigned = inFormat.getSigned();
int inChannels = inFormat.getChannels();
int outChannels = outFormat.getChannels();
double inSampleRate = inFormat.getSampleRate();
double outSampleRate = outFormat.getSampleRate();
  int inSampleSizeInBits = inFormat.getSampleSizeInBits();
  int outSampleSizeInBits = outFormat.getSampleSizeInBits();
origin: jitsi/libjitsi

int inChannels = inAudioFormat.getChannels();
double inSampleRate = inAudioFormat.getSampleRate();
    = (AudioFormat) supportedFormat;
  if (supportedAudioFormat.getChannels() != inChannels)
    continue;
      || (supportedAudioFormat.getSampleRate()
          == inSampleRate))
origin: jitsi/libjitsi

int channels = audioFormat.getChannels();
double sampleRate
  = OSUtils.IS_ANDROID
    ? audioFormat.getSampleRate()
    : Format.NOT_SPECIFIED;
        String encoding = audioFormat.getEncoding();
              && (saf.getChannels() != channels))
            continue;
          if ((Format.NOT_SPECIFIED != sampleRate)
              && (saf.getSampleRate() != sampleRate))
            continue;
origin: jitsi/libjitsi

private void initConverter(AudioFormat inFormat)
  numberOfInputChannels = inFormat.getChannels();
  if (outputFormat != null)
    numberOfOutputChannels = outputFormat.getChannels();
  inputSampleSize = inFormat.getSampleSizeInBits();
  if ((inFormat.getEndian() == AudioFormat.BIG_ENDIAN)
      || (8 == inputSampleSize))
  if (inFormat.getSigned() == AudioFormat.SIGNED)
origin: jitsi/libjitsi

/**
 * Initializes and opens a new instance of {@link #resampler} if the
 * <tt>Format</tt>-related state of this instance deems its existence
 * necessary.
 */
private void maybeOpenResampler()
{
  AudioFormat inFormat = this.effectiveFormat;
  AudioFormat outFormat = this.format;
  // We are able to translate between mono and stereo.
  if ((inFormat.getSampleRate() == outFormat.getSampleRate())
      && (inFormat.getSampleSizeInBits()
          == outFormat.getSampleSizeInBits()))
  {
    return;
  }
  Codec resampler
    = WASAPIRenderer.maybeOpenResampler(inFormat, outFormat);
  if (resampler == null)
  {
    throw new IllegalStateException(
        "Failed to open a codec to resample [" + inFormat
          + "] into [" + outFormat + "].");
  }
  else
    this.resampler = resampler;
}
origin: jitsi/libjitsi

format,
MediaUtils.getRTPPayloadType(
    format.getEncoding(),
    format.getSampleRate()));
origin: jitsi/libjitsi

/**
 * Gets the frame size measured in bytes defined by a specific
 * <tt>Format</tt>.
 *
 * @param format the <tt>Format</tt> to determine the frame size in
 *            bytes of
 * @return the frame size measured in bytes defined by the specified
 *         <tt>Format</tt>
 */
private static int getFrameSizeInBytes(Format format)
{
  AudioFormat audioFormat = (AudioFormat) format;
  int frameSizeInBits = audioFormat.getFrameSizeInBits();
  if (frameSizeInBits <= 0)
    return
      (audioFormat.getSampleSizeInBits() / 8)
        * audioFormat.getChannels();
  return (frameSizeInBits <= 8) ? 1 : (frameSizeInBits / 8);
}
origin: jitsi/libjitsi

/**
 * Gets the clock rate associated with this <tt>MediaFormat</tt>.
 *
 * @return the clock rate associated with this <tt>MediaFormat</tt>
 * @see MediaFormat#getClockRate()
 */
public double getClockRate()
{
  return format.getSampleRate();
}
origin: jitsi/libjitsi

int sampleSizeInBits = audioFormat.getSampleSizeInBits();
      audioFormat.getSampleRate(),
      sampleSizeInBits);
    (audioFormat.getEndian() == AudioFormat.BIG_ENDIAN)
      ? ByteOrder.BIG_ENDIAN
      : ByteOrder.LITTLE_ENDIAN);
origin: jitsi/libjitsi

  = af.getSampleSizeInBits() / 8 * af.getChannels();
= (audioStreamFormat.computeDuration(audioStreamLength)
    + 999999)
  / 1000000;
javax.media.formatAudioFormat

Most used methods

  • <init>
  • getSampleRate
  • computeDuration
  • getChannels
  • getEncoding
  • getSampleSizeInBits
  • getDataType
  • getEndian
  • getFrameRate
  • getFrameSizeInBits
  • getSigned
  • intersects
  • getSigned,
  • intersects,
  • matches

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • notifyDataSetChanged (ArrayAdapter)
  • getSystemService (Context)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Runner (org.openjdk.jmh.runner)
  • Top 12 Jupyter Notebook extensions
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