From 1f56e5ef5a76c548f0544610bc5a1c5cd05830b4 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Sat, 25 Jun 2022 01:43:36 -0700 Subject: [PATCH] [FFmpeg] Seek including skip samples This is essential for chapters, as otherwise, we would be skipping an awful lot of samples every chapter, or every seek within a chapter. Signed-off-by: Christopher Snowhill --- Plugins/FFMPEG/FFMPEGDecoder.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/FFMPEG/FFMPEGDecoder.m b/Plugins/FFMPEG/FFMPEGDecoder.m index 673bdff6d..ca006c1d4 100644 --- a/Plugins/FFMPEG/FFMPEGDecoder.m +++ b/Plugins/FFMPEG/FFMPEGDecoder.m @@ -924,7 +924,7 @@ static uint8_t reverse_bits[0x100]; } if(rawDSD) frame /= 8; AVRational tb = { .num = 1, .den = codecCtx->sample_rate }; - int64_t ts = av_rescale_q(frame, tb, formatCtx->streams[streamIndex]->time_base); + int64_t ts = av_rescale_q(frame + skipSamples, tb, formatCtx->streams[streamIndex]->time_base); int ret = avformat_seek_file(formatCtx, streamIndex, ts - 1000, ts, ts, 0); if(!rawDSD) avcodec_flush_buffers(codecCtx);