I need to split flac file to many pieces. I am using jFLAC library to read flac files
FLACDecoder decoder = new FLACDecoder(inputStream);
then I am trying to decode parent file between to SeekPoints
decoder.decode(seekPointFrom, seekPointTo);
I also don't quite understand how properly to get this seekpoints for seconds value. For example I need first seekpoint from 0 seconds and second to 150 seconds. How to get right seek points objects? Seekpoint cinstructor is
/**
* 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;
}
also decoder have some listener that listen every read chunk action.
@Override
public void processPCM(ByteData pcm) {
try {
outputStream.write(pcm.getData(), 0, pcm.getLen());
} catch (IOException e) {
e.printStackTrace();
}
}
When writing is done I am tying to play new flac file but my player alerts that file incorrect. What I need to do that my flac files will open right? Maybe I need to write some header to this file or something else?