[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 <kode54@gmail.com>
swiftingly
Christopher Snowhill 2022-06-25 01:43:36 -07:00
parent 2663b5007d
commit 1f56e5ef5a
1 changed files with 1 additions and 1 deletions

View File

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