Skip to content

Commit

Permalink
Use outTiming param in avifDecoderNthImageTiming
Browse files Browse the repository at this point in the history
Actually use the outTiming paramter in avifDecoderNthImageTiming(). It
was still using decoder->imageTiming in the copied code.
  • Loading branch information
wantehchang authored and joedrago committed Apr 14, 2020
1 parent 605e471 commit 167e406
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -2306,19 +2306,19 @@ avifResult avifDecoderNthImageTiming(avifDecoder * decoder, uint32_t frameIndex,
return AVIF_RESULT_OK;
}

decoder->imageTiming.timescale = decoder->timescale;
decoder->imageTiming.ptsInTimescales = 0;
outTiming->timescale = decoder->timescale;
outTiming->ptsInTimescales = 0;
for (int imageIndex = 0; imageIndex < (int)frameIndex; ++imageIndex) {
decoder->imageTiming.ptsInTimescales += avifSampleTableGetImageDelta(decoder->data->sourceSampleTable, imageIndex);
outTiming->ptsInTimescales += avifSampleTableGetImageDelta(decoder->data->sourceSampleTable, imageIndex);
}
decoder->imageTiming.durationInTimescales = avifSampleTableGetImageDelta(decoder->data->sourceSampleTable, frameIndex);
outTiming->durationInTimescales = avifSampleTableGetImageDelta(decoder->data->sourceSampleTable, frameIndex);

if (decoder->imageTiming.timescale > 0) {
decoder->imageTiming.pts = (double)decoder->imageTiming.ptsInTimescales / (double)decoder->imageTiming.timescale;
decoder->imageTiming.duration = (double)decoder->imageTiming.durationInTimescales / (double)decoder->imageTiming.timescale;
if (outTiming->timescale > 0) {
outTiming->pts = (double)outTiming->ptsInTimescales / (double)outTiming->timescale;
outTiming->duration = (double)outTiming->durationInTimescales / (double)outTiming->timescale;
} else {
decoder->imageTiming.pts = 0.0;
decoder->imageTiming.duration = 0.0;
outTiming->pts = 0.0;
outTiming->duration = 0.0;
}
return AVIF_RESULT_OK;
}
Expand Down

0 comments on commit 167e406

Please sign in to comment.