Package javax.media.format

Examples of javax.media.format.AudioFormat


    prefs.recentUrls.add("http://towercam.uu.edu/axis-cgi/mjpg/video.cgi"); // sample IP camera, streaming MJPG
    prefs.recentUrls.add("http://www.easylife.org/386dx/smells.mp3"); // just being silly now
     
   
    prefs.rtpTransmitWizardConfig.url = "file://samplemedia/gulp2.wav";
    prefs.rtpTransmitWizardConfig.trackConfigs = new TrackConfig[] {new TrackConfig(true, new AudioFormat(AudioFormat.ULAW_RTP, 8000.0, 8, 1, AudioFormat.LITTLE_ENDIAN, AudioFormat.SIGNED))};
    prefs.rtpTransmitWizardConfig.destUrl = "rtp://192.168.1.4:8000/audio/16"; //RTPUrlParser.parse("rtp://192.168.1.4:8000/audio/16");

    prefs.transcodeWizardConfig.url = "file://samplemedia/gulp2.wav";
    prefs.transcodeWizardConfig.contentDescriptor = new FileTypeDescriptor(FileTypeDescriptor.WAVE);
    prefs.transcodeWizardConfig.trackConfigs = new TrackConfig[] {new TrackConfig(true, new AudioFormat(AudioFormat.LINEAR, 8000.0, 8, 1, -1, AudioFormat.UNSIGNED))};
    prefs.transcodeWizardConfig.destUrl = URLUtils.createUrlStr(new File(PathUtils.getTempPath(), "gulp2-transcoded.wav"));
    // TODO: format
   
    savePrefs();
  
View Full Code Here


  }
 
  public Packetizer()
  {
    super();
    this.inputFormats = new Format[] {new AudioFormat(AudioFormat.ULAW, -1.0, 8, 1, -1, -1, 8, -1.0, Format.byteArray)};
   
  }
View Full Code Here

      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.ULAW) ||
        (inputCast.getSampleSizeInBits() != 8 && inputCast.getSampleSizeInBits() != Format.NOT_SPECIFIED) ||
        (inputCast.getChannels() != 1 && inputCast.getChannels() != Format.NOT_SPECIFIED) ||
        (inputCast.getFrameSizeInBits() != 8 && inputCast.getFrameSizeInBits() != Format.NOT_SPECIFIED)
        )
      { 
        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.ULAW_RTP, inputCast.getSampleRate(), 8,
          1, inputCast.getEndian(), inputCast.getSigned(), 8,
          inputCast.getFrameRate(), inputCast.getDataType());

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

  }
 
  public DePacketizer()
  {
    super();
    this.inputFormats = new Format[] {new AudioFormat(AudioFormat.ULAW_RTP, -1.0, -1, -1, -1, -1, -1, -1.0, Format.byteArray)};
  }
View Full Code Here

      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.ULAW_RTP))
      { 
        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.ULAW, inputCast.getSampleRate(), inputCast.getSampleSizeInBits(),
          inputCast.getChannels(), inputCast.getEndian(), inputCast.getSigned(), inputCast.getFrameSizeInBits(),
          inputCast.getFrameRate(), inputCast.getDataType());

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

 
  public Decoder()
  {
    super();
    this.inputFormats = new Format[] {
        new AudioFormat(AudioFormat.ULAW, -1.0, 8, 1, -1, AudioFormat.SIGNED, 8, -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

      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.ULAW) ||
        (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() != 8 && 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};
      }
     
      // mgodehardt if input is 8Bit, it has no endian, this causes problems with other codecs when you give them 16bit with no endian
      // TODO: it would be nice to have it based on target platform ( is mac big endian ? )
      int endian = inputCast.getEndian();
      if ( inputCast.getSampleSizeInBits() == 8 )
      {
        endian = AudioFormat.LITTLE_ENDIAN;
      }
     
      final AudioFormat result = new AudioFormat(AudioFormat.LINEAR, inputCast.getSampleRate(), 16,
          1, endian, AudioFormat.SIGNED, 16,
          inputCast.getFrameRate(), Format.byteArray);

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

 
  public Encoder()
  {
    super();
    this.inputFormats = new Format[] {
        new AudioFormat(AudioFormat.LINEAR, -1.0, 16, 1, -1, AudioFormat.SIGNED, 16, -1.0, Format.byteArray),
        //new AudioFormat(AudioFormat.LINEAR, -1.0, 8, 1, -1, AudioFormat.SIGNED, 8, -1.0, Format.byteArray) 
        // using 8 bit input is kind of silly, since the whole point of ulaw is to encode 16 bits as 8 bits.
        // the quality will be bad, and we are better off using a rate converter to do all of the rate conversion at once.
        };
   
View Full Code Here

   
      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.LINEAR) ||
        (inputCast.getSampleSizeInBits() != 16 && inputCast.getSampleSizeInBits() != Format.NOT_SPECIFIED) ||
        (inputCast.getChannels() != 1 && inputCast.getChannels() != Format.NOT_SPECIFIED) ||
        (inputCast.getSigned() != AudioFormat.SIGNED && inputCast.getSigned() != Format.NOT_SPECIFIED) ||
        (inputCast.getFrameSizeInBits() != 16 && 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.ULAW, inputCast.getSampleRate(), 8,
          1, -1, AudioFormat.SIGNED, 8, // endian-ness irrelevant for 8 bits
          inputCast.getFrameRate(), Format.byteArray);

      return new Format[] {result};
    }
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.