Package javax.media.format

Examples of javax.media.format.AudioFormat


    }

    public Decoder() {
        super();
        this.inputFormats = new Format[]{
                new AudioFormat(AudioFormat.GSM, 8000, 8, 1, -1, AudioFormat.SIGNED, 264, -1.0, Format.byteArray)
               
        };


    }
View Full Code Here


    @Override
    public Format setOutputFormat(Format format) {
        if (!(format instanceof AudioFormat))
            return null;
        final AudioFormat audioFormat = (AudioFormat) format;
        return super.setOutputFormat(AudioFormatCompleter.complete(audioFormat));
    }
View Full Code Here

        else {
            if (!(input instanceof AudioFormat)) {
                logger.warning(this.getClass().getSimpleName() + ".getSupportedOutputFormats: input format does not match, returning format array of {null} for " + input); // this can cause an NPE in JMF if it ever happens.
                return new Format[]{null};
            }
            final AudioFormat inputCast = (AudioFormat) input;
            if (!inputCast.getEncoding().equals(AudioFormat.GSM) ||
                (inputCast.getSampleSizeInBits() != 8 && inputCast.getSampleSizeInBits() != Format.NOT_SPECIFIED) ||
                (inputCast.getChannels() != 1 && inputCast.getChannels() != Format.NOT_SPECIFIED) ||
                (inputCast.getSigned() != AudioFormat.SIGNED && inputCast.getSigned() != Format.NOT_SPECIFIED) ||
                (inputCast.getFrameSizeInBits() != 264 && inputCast.getFrameSizeInBits() != Format.NOT_SPECIFIED) ||
                (inputCast.getDataType() != null && inputCast.getDataType() != Format.byteArray)
                )
            {
                logger.warning(this.getClass().getSimpleName() + ".getSupportedOutputFormats: input format does not match, returning format array of {null} for " + input); // this can cause an NPE in JMF if it ever happens.
                return new Format[] {null};
            }

            final AudioFormat result = new AudioFormat(AudioFormat.LINEAR, inputCast.getSampleRate(), 16,
                    1, inputCast.getEndian(), AudioFormat.SIGNED, 16,
                    -1, Format.byteArray);

            return new Format[]{result};
        }
View Full Code Here

    }

    public Encoder() {
        super();
        this.inputFormats = new Format[]{
                new AudioFormat(AudioFormat.LINEAR, 8000, 16, 1, AudioFormat.BIG_ENDIAN, AudioFormat.SIGNED, -1, -1.0, Format.byteArray)
        };

    }
View Full Code Here

        } else {
            if (!(input instanceof AudioFormat)) {
                logger.warning(this.getClass().getSimpleName() + ".getSupportedOutputFormats: input format does not match, returning format array of {null} for " + input); // this can cause an NPE in JMF if it ever happens.
                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};
        }
View Full Code Here

  }
 
  @Override
  public Format setInputFormat(Format format, int trackID)
  {
    final AudioFormat af = (AudioFormat) format;
    if (af.getSampleSizeInBits() == 8 && af.getSigned() == AudioFormat.SIGNED)
      return null// 8-bit is always unsigned for Wav.
   
    if (af.getSampleSizeInBits() == 16 && af.getSigned() == AudioFormat.UNSIGNED)
      return null// 16-bit is always signed for Wav.

    return super.setInputFormat(format, trackID);
  }
View Full Code Here

  @Override
  public Format[] getSupportedInputFormats()
  {
    return new Format[] {
        new AudioFormat(AudioFormat.LINEAR, -1, 8, -1, -1, AudioFormat.SIGNED),
        new AudioFormat(AudioFormat.LINEAR, -1, 16, -1, AudioFormat.BIG_ENDIAN, AudioFormat.SIGNED),
        new AudioFormat(AudioFormat.LINEAR, -1, 24, -1, AudioFormat.BIG_ENDIAN, AudioFormat.SIGNED),
        new AudioFormat(AudioFormat.LINEAR, -1, 32, -1, AudioFormat.BIG_ENDIAN, AudioFormat.SIGNED),
        new AudioFormat(AudioFormat.ULAW), // TODO: narrow down
        new AudioFormat(AudioFormat.ALAW) // TODO: narrow down
        };
  }
View Full Code Here

  public Format[] getSupportedInputFormats()
  {
    if (TRACE) System.out.println(getClass().getSimpleName() + " getSupportedInputFormats");
    return new Format[] {
      new AudioFormat(null, -1.0, -1, -1, -1, -1, -1, -1.0, Format.byteArray),
      new VideoFormat(null, null, -1, Format.byteArray, -1.0f)
    };
  }
View Full Code Here

  @Override
  public Format[] getSupportedInputFormats()
  {
    // TODO: query AudioSystem
    return new Format[] {new AudioFormat(AudioFormat.LINEAR)};
  }
View Full Code Here

  @Override
  public Format[] getSupportedInputFormats()
  {
    // TODO: query AudioSystem
    return new Format[] {
        new AudioFormat(AudioFormat.LINEAR, -1, 8, -1, -1, AudioFormat.SIGNED),
        new AudioFormat(AudioFormat.LINEAR, -1, 16, -1, AudioFormat.BIG_ENDIAN, AudioFormat.SIGNED),
        new AudioFormat(AudioFormat.LINEAR, -1, 24, -1, AudioFormat.BIG_ENDIAN, AudioFormat.SIGNED),
        new AudioFormat(AudioFormat.LINEAR, -1, 32, -1, AudioFormat.BIG_ENDIAN, AudioFormat.SIGNED),
        new AudioFormat(AudioFormat.ULAW), // TODO: narrow down
        new AudioFormat(AudioFormat.ALAW) // TODO: narrow down
        };
  }
View Full Code Here

TOP

Related Classes of javax.media.format.AudioFormat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.