Java 类com.google.android.exoplayer2.util.FlacStreamInfo 实例源码

项目:Komica    文件:FlacDecoder.java   
/**
 * Creates a Flac decoder.
 *
 * @param numInputBuffers The number of input buffers.
 * @param numOutputBuffers The number of output buffers.
 * @param initializationData Codec-specific initialization data. It should contain only one entry
 *    which is the flac file header.
 * @throws FlacDecoderException Thrown if an exception occurs when initializing the decoder.
 */
public FlacDecoder(int numInputBuffers, int numOutputBuffers, List<byte[]> initializationData)
    throws FlacDecoderException {
  super(new DecoderInputBuffer[numInputBuffers], new SimpleOutputBuffer[numOutputBuffers]);
  if (initializationData.size() != 1) {
    throw new FlacDecoderException("Initialization data must be of length 1");
  }
  decoderJni = new FlacDecoderJni();
  decoderJni.setData(ByteBuffer.wrap(initializationData.get(0)));
  FlacStreamInfo streamInfo;
  try {
    streamInfo = decoderJni.decodeMetadata();
  } catch (IOException | InterruptedException e) {
    // Never happens.
    throw new IllegalStateException(e);
  }
  if (streamInfo == null) {
    throw new FlacDecoderException("Metadata decoding failed");
  }

  setInitialInputBufferSize(streamInfo.maxFrameSize);
  maxOutputBufferSize = streamInfo.maxDecodedFrameSize();
}
项目:Jockey    文件:FlacDecoder.java   
/**
 * Creates a Flac decoder.
 *
 * @param numInputBuffers The number of input buffers.
 * @param numOutputBuffers The number of output buffers.
 * @param initializationData Codec-specific initialization data. It should contain only one entry
 *    which is the flac file header.
 * @throws FlacDecoderException Thrown if an exception occurs when initializing the decoder.
 */
public FlacDecoder(int numInputBuffers, int numOutputBuffers, List<byte[]> initializationData)
    throws FlacDecoderException {
  super(new DecoderInputBuffer[numInputBuffers], new SimpleOutputBuffer[numOutputBuffers]);
  if (initializationData.size() != 1) {
    throw new FlacDecoderException("Initialization data must be of length 1");
  }
  decoderJni = new FlacDecoderJni();
  decoderJni.setData(ByteBuffer.wrap(initializationData.get(0)));
  FlacStreamInfo streamInfo;
  try {
    streamInfo = decoderJni.decodeMetadata();
  } catch (IOException | InterruptedException e) {
    // Never happens.
    throw new IllegalStateException(e);
  }
  if (streamInfo == null) {
    throw new FlacDecoderException("Metadata decoding failed");
  }

  setInitialInputBufferSize(streamInfo.maxFrameSize);
  maxOutputBufferSize = streamInfo.maxDecodedFrameSize();
}
项目:transistor    文件:FlacDecoder.java   
/**
 * Creates a Flac decoder.
 *
 * @param numInputBuffers The number of input buffers.
 * @param numOutputBuffers The number of output buffers.
 * @param initializationData Codec-specific initialization data. It should contain only one entry
 *    which is the flac file header.
 * @throws FlacDecoderException Thrown if an exception occurs when initializing the decoder.
 */
public FlacDecoder(int numInputBuffers, int numOutputBuffers, List<byte[]> initializationData)
    throws FlacDecoderException {
  super(new DecoderInputBuffer[numInputBuffers], new SimpleOutputBuffer[numOutputBuffers]);
  if (initializationData.size() != 1) {
    throw new FlacDecoderException("Initialization data must be of length 1");
  }
  decoderJni = new FlacDecoderJni();
  decoderJni.setData(ByteBuffer.wrap(initializationData.get(0)));
  FlacStreamInfo streamInfo;
  try {
    streamInfo = decoderJni.decodeMetadata();
  } catch (IOException | InterruptedException e) {
    // Never happens.
    throw new IllegalStateException(e);
  }
  if (streamInfo == null) {
    throw new FlacDecoderException("Metadata decoding failed");
  }

  setInitialInputBufferSize(streamInfo.maxFrameSize);
  maxOutputBufferSize = streamInfo.maxDecodedFrameSize();
}
项目:Komica    文件:FlacDecoderJni.java   
public FlacStreamInfo decodeMetadata() throws IOException, InterruptedException {
  return flacDecodeMetadata(nativeDecoderContext);
}
项目:Komica    文件:FlacDecoderJni.java   
private native FlacStreamInfo flacDecodeMetadata(long context)
throws IOException, InterruptedException;
项目:Jockey    文件:FlacDecoderJni.java   
public FlacStreamInfo decodeMetadata() throws IOException, InterruptedException {
  return flacDecodeMetadata(nativeDecoderContext);
}
项目:Jockey    文件:FlacDecoderJni.java   
private native FlacStreamInfo flacDecodeMetadata(long context)
throws IOException, InterruptedException;
项目:transistor    文件:FlacDecoderJni.java   
public FlacStreamInfo decodeMetadata() throws IOException, InterruptedException {
  return flacDecodeMetadata(nativeDecoderContext);
}
项目:transistor    文件:FlacDecoderJni.java   
private native FlacStreamInfo flacDecodeMetadata(long context)
throws IOException, InterruptedException;