avformat/mov: fix timecode with counter mode flag set

The current behaviour ends up squaring the avg_frame_rate if the conter mode flag is set.
This messes up the timecode calculation, and looks to me as a regression that
seems to have been introduced 428b4aac.

Upon further testing is seems that no special case is need for having the counter flag set.
av_timecode_init appears to handles the timecode correctly, at least in the sample files
I have.

Here is a sample mov file with the counter flag set
https://www.dropbox.com/s/5l4fucb9lhq523s/timecode_counter_mode.mov

before the patch ffmpeg will report the timecode as:
00:37:11:97 and warns that the timecode framerate is 576000000/1002001

after patch:
14:50:55:02

Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
Mark Reid 2021-01-16 17:48:45 -08:00 committed by Anton Khirnov
parent 1c36e7c1a5
commit a82a052769
1 changed files with 0 additions and 11 deletions

View File

@ -2352,17 +2352,6 @@ FF_DISABLE_DEPRECATION_WARNINGS
st->codec->time_base = av_inv_q(st->avg_frame_rate);
FF_ENABLE_DEPRECATION_WARNINGS
#endif
/* adjust for per frame dur in counter mode */
if (tmcd_ctx->tmcd_flags & 0x0008) {
int timescale = AV_RB32(st->codecpar->extradata + 8);
int framedur = AV_RB32(st->codecpar->extradata + 12);
st->avg_frame_rate = av_mul_q(st->avg_frame_rate, (AVRational){timescale, framedur});
#if FF_API_LAVF_AVCTX
FF_DISABLE_DEPRECATION_WARNINGS
st->codec->time_base = av_mul_q(st->codec->time_base , (AVRational){framedur, timescale});
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
if (size > 30) {
uint32_t len = AV_RB32(st->codecpar->extradata + 18); /* name atom length */
uint32_t format = AV_RB32(st->codecpar->extradata + 22);