[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
parent
2663b5007d
commit
1f56e5ef5a
|
@ -924,7 +924,7 @@ static uint8_t reverse_bits[0x100];
|
||||||
}
|
}
|
||||||
if(rawDSD) frame /= 8;
|
if(rawDSD) frame /= 8;
|
||||||
AVRational tb = { .num = 1, .den = codecCtx->sample_rate };
|
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);
|
int ret = avformat_seek_file(formatCtx, streamIndex, ts - 1000, ts, ts, 0);
|
||||||
if(!rawDSD)
|
if(!rawDSD)
|
||||||
avcodec_flush_buffers(codecCtx);
|
avcodec_flush_buffers(codecCtx);
|
||||||
|
|
Loading…
Reference in New Issue