[FFmpeg] Fix chapter handling and seeking

Fix chapter startup, and chapter seeking.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
swiftingly
Christopher Snowhill 2022-06-25 02:36:14 -07:00
parent 1f56e5ef5a
commit cb2ce5675a
2 changed files with 9 additions and 0 deletions

View File

@ -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;

View File

@ -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) {