[FFmpeg-devel] [PATCH 3/4] timecode: support >24h timecode.
Baptiste Coudurier
baptiste.coudurier at gmail.com
Wed Jan 11 02:35:11 CET 2012
On 01/05/2012 12:03 PM, Clément Bœsch wrote:
> From: Clément Bœsch <clement.boesch at smartjog.com>
>
> ---
> libavcodec/timecode.c | 4 ++--
> libavcodec/timecode.h | 5 +++--
> libavcodec/version.h | 2 +-
> 3 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/timecode.c b/libavcodec/timecode.c
> index a8b4242..31bf219 100644
> --- a/libavcodec/timecode.c
> +++ b/libavcodec/timecode.c
> @@ -90,10 +90,10 @@ char *avpriv_timecode_to_string(char *buf, const struct ff_timecode *tc, unsigne
> ff = frame_num % fps;
> ss = frame_num / fps % 60;
> mm = frame_num / (fps*60) % 60;
> - hh = frame_num / (fps*3600) % 24;
> + hh = frame_num / (fps*3600);
> if (ff < 0 || ss < 0 || mm < 0 || hh < 0)
> neg = 1, ff = -ff, ss = -ss, mm = -mm, hh = -hh;
> - snprintf(buf, sizeof("-hh:mm:ss.ff"), "%s%02d:%02d:%02d%c%02d",
> + snprintf(buf, sizeof("-hhh:mm:ss.ff"), "%s%02d:%02d:%02d%c%02d",
> neg ? "-" : "",
> hh, mm, ss, tc->drop ? ';' : ':', ff);
Humm this requires a fixed size buffer and it should be documented in the API,
16 or 32 seems fair.
I think it's better to replace the template string by the documented fixed size
required.
Except that it's fine.
--
Baptiste COUDURIER
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer http://www.ffmpeg.org
More information about the ffmpeg-devel
mailing list