コード例 #1
0
ファイル: ChannelSplit.java プロジェクト: 2php/jcodec
  @Override
  public void filter(FloatBuffer[] _in, long[] inPos, FloatBuffer[] out) {
    if (_in.length != 1) {
      throw new IllegalArgumentException("Channel split invoked on more then one input");
    }
    if (out.length != format.getChannels()) {
      throw new IllegalArgumentException(
          "Channel split must be supplied with "
              + format.getChannels()
              + " output buffers to hold the channels.");
    }

    FloatBuffer in0 = _in[0];

    int outSampleCount = in0.remaining() / out.length;
    for (int i = 0; i < out.length; i++) {
      if (out[i].remaining() < outSampleCount)
        throw new IllegalArgumentException(
            "Supplied buffer for "
                + i
                + "th channel doesn't have sufficient space to put the samples ( required: "
                + outSampleCount
                + ", actual: "
                + out[i].remaining()
                + ")");
    }

    while (in0.remaining() >= format.getChannels()) {
      for (int i = 0; i < out.length; i++) {
        out[i].put(in0.get());
      }
    }
  }
コード例 #2
0
ファイル: ChannelSplit.java プロジェクト: 2php/jcodec
 @Override
 public int getNOutputs() {
   return format.getChannels();
 }