Package javax.sound.sampled.spi

Examples of javax.sound.sampled.spi.FormatConversionProvider


     * of at least 1, representing the encoding of <code>sourceFormat</code> (no conversion).
     */
    public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat) {


        FormatConversionProvider codecs[] = getFormatConversionProviders();
        Vector encodings = new Vector();

        int size = 0;
        int index = 0;
        AudioFormat.Encoding encs[] = null;
View Full Code Here


     * otherwise <code>false</code>
     */
    public static boolean isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {


        FormatConversionProvider codecs[] = getFormatConversionProviders();

        for(int i=0; i<codecs.length; i++ ) {
            if(codecs[i].isConversionSupported(targetEncoding,sourceFormat) ) {
                return true;
            }
View Full Code Here

     * @see #getAudioInputStream(AudioFormat, AudioInputStream)
     */
    public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding,
                                                       AudioInputStream sourceStream) {

        FormatConversionProvider codecs[] = getFormatConversionProviders();

        //$$fb 2001-08-03: reverse this loop to give external providers more priority (Bug #4487550)
        for(int i = codecs.length-1; i >= 0; i-- ) {
            if( codecs[i].isConversionSupported( targetEncoding, sourceStream.getFormat() ) ) {
                return codecs[i].getAudioInputStream( targetEncoding, sourceStream );
View Full Code Here

     * @return array of formats.  If no formats of the specified
     * encoding are supported, an array of length 0 is returned.
     */
    public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {

        FormatConversionProvider codecs[] = getFormatConversionProviders();
        Vector formats = new Vector();

        int size = 0;
        int index = 0;
        AudioFormat fmts[] = null;
View Full Code Here

     * otherwise <code>false</code>
     */

    public static boolean isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat) {

        FormatConversionProvider codecs[] = getFormatConversionProviders();

        for(int i=0; i<codecs.length; i++ ) {
            if(codecs[i].isConversionSupported(targetFormat, sourceFormat) ) {
                return true;
            }
View Full Code Here

        if (sourceStream.getFormat().matches(targetFormat)) {
            return sourceStream;
        }

        FormatConversionProvider codecs[] = getFormatConversionProviders();

        //$$fb 2001-08-03: reverse this loop to give external providers more priority (Bug #4487550)
        for(int i = codecs.length-1; i >= 0; i-- ) {

            if(codecs[i].isConversionSupported(targetFormat,sourceStream.getFormat()) ) {
View Full Code Here

     * returned.
     */
    private static FormatConversionProvider[] getFormatConversionProviders() {

        Vector v = new Vector();
        FormatConversionProvider varray[];

        try {

            Class.forName( "sun.misc.Service" );

View Full Code Here

  {
    HashSet result = new HashSet();
    Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
    while (i.hasNext())
      {
        FormatConversionProvider prov = (FormatConversionProvider) i.next();
        if (! prov.isConversionSupported(targ, ais.getFormat()))
          continue;
        return prov.getAudioInputStream(targ, ais);
      }
    throw new IllegalArgumentException("encoding not supported for stream");
}
View Full Code Here

  {
    HashSet result = new HashSet();
    Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
    while (i.hasNext())
      {
        FormatConversionProvider prov = (FormatConversionProvider) i.next();
        if (! prov.isConversionSupported(targ, ais.getFormat()))
          continue;
        return prov.getAudioInputStream(targ, ais);
      }
    throw new IllegalArgumentException("format not supported for stream");
   }
View Full Code Here

  {
    HashSet result = new HashSet();
    Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
    while (i.hasNext())
      {
        FormatConversionProvider prov = (FormatConversionProvider) i.next();
        if (! prov.isSourceEncodingSupported(source))
          continue;
        AudioFormat.Encoding[] es = prov.getTargetEncodings();
        for (int j = 0; j < es.length; ++j)
          result.add(es[j]);
      }
    return (AudioFormat.Encoding[]) result.toArray(new AudioFormat.Encoding[result.size()]);
  }
View Full Code Here

TOP

Related Classes of javax.sound.sampled.spi.FormatConversionProvider

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.