当前位置: 首页>>代码示例>>Java>>正文


Java Decoder类代码示例

本文整理汇总了Java中net.sourceforge.jaad.aac.Decoder的典型用法代码示例。如果您正苦于以下问题:Java Decoder类的具体用法?Java Decoder怎么用?Java Decoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Decoder类属于net.sourceforge.jaad.aac包,在下文中一共展示了Decoder类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AACDecoder

import net.sourceforge.jaad.aac.Decoder; //导入依赖的package包/类
public AACDecoder(byte[] decoderSpecificInfo, javax.sound.sampled.AudioFormat format) throws AACException {
	this.format = new AudioFormat(
			(int)format.getSampleRate(),
			format.getSampleSizeInBits(),
			format.getChannels(), 
			format.getEncoding() == Encoding.PCM_SIGNED, 
			format.isBigEndian());
	this.decoder = new Decoder(decoderSpecificInfo);
}
 
开发者ID:arisona,项目名称:ether,代码行数:10,代码来源:AACDecoder.java

示例2: decodeAAC

import net.sourceforge.jaad.aac.Decoder; //导入依赖的package包/类
private AudioInputStream decodeAAC(File inputFile) throws IOException {
  ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
  AudioFormat audioFormat;

  try {
    final ADTSDemultiplexer adts = new ADTSDemultiplexer(new FileInputStream(inputFile));
    final Decoder dec = new Decoder(adts.getDecoderSpecificInfo());

    final SampleBuffer buf = new SampleBuffer();
    byte[] b;
    while (true) {
      try {
        b = adts.readNextFrame();
      }
      catch (Exception e) {
        break;
      }

      dec.decodeFrame(b, buf);
      outputStream.write(buf.getData());
    }

    audioFormat = new AudioFormat(buf.getSampleRate(), buf.getBitsPerSample(), buf.getChannels(), true, buf.isBigEndian());

  } finally {
    // nop
  }

  byte[] outputStreamByteArray = outputStream.toByteArray();
  ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStreamByteArray);

  return new AudioInputStream(inputStream, audioFormat, outputStreamByteArray.length);
}
 
开发者ID:nwaldispuehl,项目名称:interval-music-compositor,代码行数:34,代码来源:AacAudioFileDecoder.java

示例3: decodeMP4

import net.sourceforge.jaad.aac.Decoder; //导入依赖的package包/类
private AudioInputStream decodeMP4(File inputFile) throws UnsupportedAudioFileException, IOException {
  ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
  AudioFormat audioFormat;

  try {

    RandomAccessFile randomAccessFile = new RandomAccessFile(inputFile, "r");
    final MP4Container cont = new MP4Container(randomAccessFile);
    final Movie movie = cont.getMovie();
    final List<Track> tracks = movie.getTracks(AudioTrack.AudioCodec.AAC);
    if (tracks.isEmpty()) {
      throw new UnsupportedAudioFileException("Movie does not contain any AAC track");
    }

    final AudioTrack track = (AudioTrack) tracks.get(0);
    final Decoder dec = new Decoder(track.getDecoderSpecificInfo());

    Frame frame;
    final SampleBuffer buf = new SampleBuffer();
    while (track.hasMoreFrames()) {
      frame = track.readNextFrame();
      dec.decodeFrame(frame.getData(), buf);
      outputStream.write(buf.getData());
    }

    audioFormat = new AudioFormat(track.getSampleRate(), track.getSampleSize(), track.getChannelCount(), true, true);
  } finally {
    // nop
  }

  byte[] outputStreamByteArray = outputStream.toByteArray();
  ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStreamByteArray);

  return new AudioInputStream(inputStream, audioFormat, outputStreamByteArray.length);
}
 
开发者ID:nwaldispuehl,项目名称:interval-music-compositor,代码行数:36,代码来源:AacAudioFileDecoder.java

示例4: canDecode

import net.sourceforge.jaad.aac.Decoder; //导入依赖的package包/类
public static boolean canDecode(Profile profile) {
	return Decoder.canDecode(profile);
}
 
开发者ID:arisona,项目名称:ether,代码行数:4,代码来源:AACDecoder.java


注:本文中的net.sourceforge.jaad.aac.Decoder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。