2012-08-09 3 views
3

flac 파일을 여러 조각으로 분할해야합니다. 나는 또한 매우 초 값이 seekpoints 활용하는 방법을 제대로 이해하지 FLAC 파일 jFLAC. FLAC 파일 분할

FLACDecoder decoder = new FLACDecoder(inputStream); 

다음 내가 SeekPoints

decoder.decode(seekPointFrom, seekPointTo); 

에 사이에 부모 파일을 디코딩하는 것을 시도하고있다을 읽을 수 jFLAC 라이브러리를 사용하고 있습니다 . 예를 들어, 0 초부터 150 초까지의 첫 탐색 지점이 필요합니다. 오른쪽 탐색 객체를 얻는 방법? Seekpoint cinstructor는

/** 
* 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 파일이 제대로 열리려면 어떻게해야합니까? 어쩌면이 파일에 다른 헤더를 써야할까요?

+0

[jFLAC 메일 링리스트] (http://jflac.sourceforge.net/mail-lists.html)에서이 질문을해야합니다. –

답변

0

FLAC SeekPoints와 관련하여 주어진 초에 해당하는 것으로 보장 할 수는 없으며 전체 오디오 파일에 몇 개의 SeekPoints 만있을 수 있습니다. 이와 같이

, 나는 최근에 탐색 기능을 jFLAC 업데이트를 얻으려면 적어도 가까운 오디오 프레임 : 새 파일을 작성에 관해서 https://github.com/nguillaumin/jflac/commit/585940af97157eb11b60c15cc8cb13ef3fc27ce3

는, 디코딩 된 데이터는 원시 PCM 샘플에있을 것입니다 . 따라서 유효한 FLAC 파일을 출력하려면 FLAC 인코더로 파이프해야합니다. 또는 웨이브 헤더를 작성하고 원시 PCM 샘플을 덤프 한 다음 해당 웨이브 파일을 FLAC 파일로 변환 할 수 있습니다.