Fix T95378: Seek problems when timecodes are used

Function `IMB_indexer_get_seek_pos()` can return non 0 seek position for
frame index 0. This causes seeking to incorrect GOP and scanning ends
with failiure.

Hard-code first frame index seek position to 0.

Differential Revision: https://developer.blender.org/D13974
This commit is contained in:
Richard Antalik 2022-02-01 22:47:22 +01:00
parent a12265f048
commit 95fcb41841
Notes: blender-bot 2023-02-14 01:21:16 +01:00
Referenced by issue #95378, Seek fails within first GOP when using timecodes
1 changed files with 4 additions and 2 deletions

View File

@ -247,8 +247,10 @@ struct anim_index *IMB_indexer_open(const char *name)
uint64_t IMB_indexer_get_seek_pos(struct anim_index *idx, int frame_index)
{
if (frame_index < 0) {
frame_index = 0;
/* This is hard coded, because our current timecode files return non zero seek position for index
* 0. Only when seeking to 0 it is guaranteed, that first packet will be read. */
if (frame_index <= 0) {
return 0;
}
if (frame_index >= idx->num_entries) {
frame_index = idx->num_entries - 1;