mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/dump: Use int64_t for intermediate time values
Prevents wrap-around to negative values while calculating the duration string. Before: Duration: -411422:-59:-42.17, start: 0.000000, bitrate: 0 kb/s After: Duration: 781623:28:34.17, start: 0.000000, bitrate: 0 kb/s Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
This commit is contained in:
parent
f603d10b1e
commit
5d9ce445ef
|
@ -615,7 +615,7 @@ void av_dump_format(AVFormatContext *ic, int index,
|
||||||
if (!is_output) {
|
if (!is_output) {
|
||||||
av_log(NULL, AV_LOG_INFO, " Duration: ");
|
av_log(NULL, AV_LOG_INFO, " Duration: ");
|
||||||
if (ic->duration != AV_NOPTS_VALUE) {
|
if (ic->duration != AV_NOPTS_VALUE) {
|
||||||
int hours, mins, secs, us;
|
int64_t hours, mins, secs, us;
|
||||||
int64_t duration = ic->duration + (ic->duration <= INT64_MAX - 5000 ? 5000 : 0);
|
int64_t duration = ic->duration + (ic->duration <= INT64_MAX - 5000 ? 5000 : 0);
|
||||||
secs = duration / AV_TIME_BASE;
|
secs = duration / AV_TIME_BASE;
|
||||||
us = duration % AV_TIME_BASE;
|
us = duration % AV_TIME_BASE;
|
||||||
|
@ -623,7 +623,7 @@ void av_dump_format(AVFormatContext *ic, int index,
|
||||||
secs %= 60;
|
secs %= 60;
|
||||||
hours = mins / 60;
|
hours = mins / 60;
|
||||||
mins %= 60;
|
mins %= 60;
|
||||||
av_log(NULL, AV_LOG_INFO, "%02d:%02d:%02d.%02d", hours, mins, secs,
|
av_log(NULL, AV_LOG_INFO, "%02"PRId64":%02"PRId64":%02"PRId64".%02"PRId64"", hours, mins, secs,
|
||||||
(100 * us) / AV_TIME_BASE);
|
(100 * us) / AV_TIME_BASE);
|
||||||
} else {
|
} else {
|
||||||
av_log(NULL, AV_LOG_INFO, "N/A");
|
av_log(NULL, AV_LOG_INFO, "N/A");
|
||||||
|
|
Loading…
Reference in New Issue