私はflacファイルを多くの部分に分割する必要があります。私はjFLACライブラリを使用してflacファイルを読み取ります
FLACDecoder decoder = new FLACDecoder(inputStream);
次に、SeekPoints間で親ファイルをデコードしようとしています
decoder.decode(seekPointFrom, seekPointTo);
また、秒の値でこのシークポイントを取得する方法もよくわかりません。たとえば、0秒から150秒までの最初のシークポイントが必要です。正しいシークポイントオブジェクトを取得する方法は?Seekpointcinstructorは
/**
* The constructor.
* @param sampleNumber The sample number of the target frame
* @param streamOffset The offset, in bytes, of the target frame with respect to beginning of the first frame
* @param frameSamples The number of samples in the target frame
*/
public SeekPoint(long sampleNumber, long streamOffset, int frameSamples) {
this.sampleNumber = sampleNumber;
this.streamOffset = streamOffset;
this.frameSamples = frameSamples;
}
また、デコーダーには、すべての読み取りチャンクアクションをリッスンするリスナーがあります。
@Override
public void processPCM(ByteData pcm) {
try {
outputStream.write(pcm.getData(), 0, pcm.getLen());
} catch (IOException e) {
e.printStackTrace();
}
}
書き込みが完了すると、新しいflacファイルを再生しようとしていますが、プレーヤーはそのファイルが正しくないことを警告します。flacファイルが正しく開くようにするにはどうすればよいですか?たぶん私はこのファイルまたは何か他のものにいくつかのヘッダーを書く必要がありますか?