[FFmpeg] Fix chapter handling and seeking
Fix chapter startup, and chapter seeking. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
1f56e5ef5a
commit
cb2ce5675a
|
@ -32,6 +32,7 @@ int64_t ffmpeg_seek(void *opaque, int64_t offset, int whence);
|
|||
int subsong;
|
||||
int64_t startTime;
|
||||
int64_t endTime;
|
||||
BOOL seekedToStart;
|
||||
|
||||
@private
|
||||
unsigned char *buffer;
|
||||
|
|
|
@ -463,6 +463,8 @@ static uint8_t reverse_bits[0x100];
|
|||
|
||||
seekable = [s seekable];
|
||||
|
||||
seekedToStart = !seekable;
|
||||
|
||||
artist = @"";
|
||||
albumartist = @"";
|
||||
album = @"";
|
||||
|
@ -684,6 +686,10 @@ static uint8_t reverse_bits[0x100];
|
|||
}
|
||||
|
||||
- (int)readAudio:(void *)buf frames:(UInt32)frames {
|
||||
if(!seekedToStart) {
|
||||
[self seek:0];
|
||||
}
|
||||
|
||||
int frameSize = rawDSD ? channels : channels * (bitsPerSample / 8);
|
||||
int bytesToRead = frames * frameSize;
|
||||
int bytesRead = 0;
|
||||
|
@ -914,6 +920,8 @@ static uint8_t reverse_bits[0x100];
|
|||
if(!totalFrames)
|
||||
return -1;
|
||||
|
||||
seekedToStart = YES;
|
||||
|
||||
prebufferedAudio = 0;
|
||||
|
||||
if(frame >= totalFrames) {
|
||||
|
|
Loading…
Reference in New Issue