Package javax.media.format

Examples of javax.media.format.AudioFormat


            maxLocation = Long.MAX_VALUE;
        }

        boolean signed = true;
        boolean bigEndian = false;
        format = new AudioFormat(AudioFormat.GSM,
                                 8000// sampleRate,
                                 16,    // sampleSizeInBits,
                                 1,     // channels,
                                 bigEndian ? AudioFormat.BIG_ENDIAN :
                                AudioFormat.LITTLE_ENDIAN,
View Full Code Here


    }
   
    public static AudioFormat convertCodecAudioFormat(AVCodecContext codecCtx)
    {
      // ffmpeg appears to always decode audio into 16 bit samples, regardless of the source.
      return new AudioFormat(AudioFormat.LINEAR, codecCtx.sample_rate, 16, codecCtx.channels)/// TODO: endian, signed?
     
    }
View Full Code Here

        data[revpos++] = 0;
    }
    revpos -= size.width * 6;
      }
  } else { // audio data
      audioFormat = new AudioFormat(AudioFormat.LINEAR,
            8000.0,
            8,
            1,
            Format.NOT_SPECIFIED,
            AudioFormat.SIGNED,
View Full Code Here

    public static void main(String[] args) {
       
      RTPTransmitWizardConfig config = new RTPTransmitWizardConfig();
    // set defaults:
    config.url = "file://samplemedia/gulp2.wav";
    config.trackConfigs = new TrackConfig[] {new TrackConfig(true, new AudioFormat(AudioFormat.ULAW_RTP, 8000.0, 8, 1, AudioFormat.LITTLE_ENDIAN, AudioFormat.SIGNED))};
//    try
//    {
      config.destUrl = "rtp://192.168.1.4:8000/audio/16";//RTPUrlParser.parse("rtp://192.168.1.4:8000/audio/16");
//    } catch (RTPUrlParserException e)
//    {
View Full Code Here

public class FormatArgUtilsTest extends TestCase
{
  public void testAudio() throws ParseException
  {
    test(new AudioFormat(AudioFormat.LINEAR, 44100.0, 16, 2));
    test(new AudioFormat(AudioFormat.LINEAR, 44100.0, 16, 2, AudioFormat.BIG_ENDIAN, AudioFormat.UNSIGNED));
    test(new AudioFormat(AudioFormat.LINEAR, 44100.0, 16, 2, AudioFormat.LITTLE_ENDIAN, AudioFormat.UNSIGNED));
        test(new AudioFormat(AudioFormat.ULAW_RTP, 8000, 8, 1));
        test(new AudioFormat(AudioFormat.GSM_RTP, 8000, Format.NOT_SPECIFIED, 1));
        test(new AudioFormat(AudioFormat.G723_RTP, 8000, Format.NOT_SPECIFIED, 1));
        test(new AudioFormat(AudioFormat.DVI_RTP, 8000, 4, 1));
        test(new AudioFormat(AudioFormat.MPEG_RTP));
        test(new AudioFormat(AudioFormat.G728_RTP, 8000.0, Format.NOT_SPECIFIED, 1));
        test(new AudioFormat(AudioFormat.DVI_RTP, 11025, 4, 1));
        test(new AudioFormat(AudioFormat.DVI_RTP, 22050, 4, 1));
    test(new AudioFormat(AudioFormat.G729_RTP, 8000.0, Format.NOT_SPECIFIED, 1));

  }
View Full Code Here

{

  public void test1() throws JavaSoundUrlParserException
  {
   
    test("javasound://", new AudioFormat(AudioFormat.LINEAR));
   
    test("javasound://44100", new AudioFormat(AudioFormat.LINEAR, 44100.0, AudioFormat.NOT_SPECIFIED, AudioFormat.NOT_SPECIFIED));
    test("javasound://44100/16", new AudioFormat(AudioFormat.LINEAR, 44100.0, 16, AudioFormat.NOT_SPECIFIED));
    test("javasound://44100/16/2", new AudioFormat(AudioFormat.LINEAR, 44100.0, 16, 2));
    test("javasound://44100/16/2/big", new AudioFormat(AudioFormat.LINEAR, 44100.0, 16, 2, AudioFormat.BIG_ENDIAN, AudioFormat.NOT_SPECIFIED));
    test("javasound://44100/16/2/big/signed", new AudioFormat(AudioFormat.LINEAR, 44100.0, 16, 2, AudioFormat.BIG_ENDIAN, AudioFormat.SIGNED));
  }
View Full Code Here

    test("javasound://44100/16/2/big/signed", new AudioFormat(AudioFormat.LINEAR, 44100.0, 16, 2, AudioFormat.BIG_ENDIAN, AudioFormat.SIGNED));
  }
 
  public void test(String str, AudioFormat format) throws JavaSoundUrlParserException
  {
    AudioFormat f = JavaSoundUrlParser.parse(str);
    assertEquals(f, format);
  }
View Full Code Here

      return (long) (pts * 1000000000d);
    }
   
    public static AudioFormat convertCodecAudioFormat(AVCodecContext codecCtx)
    {
      AudioFormat result = null;
      switch (codecCtx.codec_id) {
        case AVCodecLibrary.CODEC_ID_AC3:
            result = new AudioFormat(AudioFormat.DOLBYAC3, codecCtx.sample_rate, 16, codecCtx.channels,
                ListFormats.isBigEndian() ? AudioFormat.BIG_ENDIAN : AudioFormat.LITTLE_ENDIAN, AudioFormat.SIGNED);
          break;
        /* TODO: add DTS to audioformat
        case AVCodecLibrary.CODEC_ID_DTS:
            result = new AudioFormat(AudioFormat.DTS, codecCtx.sample_rate, 16, codecCtx.channels,
                ListFormats.isBigEndian() ? AudioFormat.BIG_ENDIAN : AudioFormat.LITTLE_ENDIAN, AudioFormat.SIGNED);
          break;*/
        default:
            // ffmpeg appears to always decode audio into 16 bit samples, regardless of the source.
          // system endianess and signed
            result = new AudioFormat(AudioFormat.LINEAR, codecCtx.sample_rate, 16, codecCtx.channels,
                ListFormats.isBigEndian() ? AudioFormat.BIG_ENDIAN : AudioFormat.LITTLE_ENDIAN, AudioFormat.SIGNED);
          break;
      }
      return result;
    }
View Full Code Here

          trackConfigs[i].format = config.trackConfigs[i].format;
          trackConfigs[i].enabled = config.trackConfigs[i].enabled;
        }
        else
        // default
          trackConfigs[i].format = new AudioFormat(AudioFormat.ULAW_RTP, 8000.0, 8, 1, AudioFormat.LITTLE_ENDIAN, AudioFormat.SIGNED); // TODO: hard-coded.
          trackConfigs[i].enabled = trackControls[i].isEnabled();
        }
       
        boolean formatOk = false;
        for (int j = 0; j < formats.length; ++j)
View Full Code Here

   
   
    public static AudioFormat convertCodecAudioFormat(com.jcraft.jorbis.Info vi)
    {
    return new AudioFormat(AudioFormat.LINEAR, vi.rate, 16, vi.channels, AudioFormat.LITTLE_ENDIAN, AudioFormat.SIGNED);
    }
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.