Message ID | 20200905182217.28037-3-cus@passwd.hu |
---|---|
State | Accepted |
Commit | 535740167134ac6616344261157cf7e2a4ce8a9c |
Headers | show |
Series | [FFmpeg-devel,1/8] avutil/timecode: fix av_timecode_get_smpte_from_framenum with 50/60 fps | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
On Sat, Sep 05, 2020 at 08:22:12PM +0200, Marton Balint wrote: > The function has no way to return error, so let's clip or calculate modulo. > > Signed-off-by: Marton Balint <cus@passwd.hu> > --- > libavutil/timecode.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/libavutil/timecode.c b/libavutil/timecode.c > index c0956adadb..806638ddfc 100644 > --- a/libavutil/timecode.c > +++ b/libavutil/timecode.c > @@ -84,6 +84,11 @@ uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss > ff /= 2; > } > > + hh = hh % 24; > + mm = av_clip(mm, 0, 59); > + ss = av_clip(ss, 0, 59); > + ff = ff % 40; > + > tc |= drop << 30; > tc |= (ff / 10) << 28; > tc |= (ff % 10) << 24; > -- > 2.26.2 lgtm > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff --git a/libavutil/timecode.c b/libavutil/timecode.c index c0956adadb..806638ddfc 100644 --- a/libavutil/timecode.c +++ b/libavutil/timecode.c @@ -84,6 +84,11 @@ uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss ff /= 2; } + hh = hh % 24; + mm = av_clip(mm, 0, 59); + ss = av_clip(ss, 0, 59); + ff = ff % 40; + tc |= drop << 30; tc |= (ff / 10) << 28; tc |= (ff % 10) << 24;
The function has no way to return error, so let's clip or calculate modulo. Signed-off-by: Marton Balint <cus@passwd.hu> --- libavutil/timecode.c | 5 +++++ 1 file changed, 5 insertions(+)