當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。