Message ID | 20200516141437.485459-1-derek.buitenhuis@gmail.com |
---|---|
State | Accepted |
Commit | 5d9ce445ef24d915f41e384d4c5916cc568e4458 |
Headers | show |
Series | [FFmpeg-devel] avformat/dump: Use int64_t for intermediate time values | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
Am Sa., 16. Mai 2020 um 16:21 Uhr schrieb Derek Buitenhuis <derek.buitenhuis@gmail.com>: > > 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> > --- > Minimal example file: http://chromashift.org/s/long3.mp4` I believe there is a ticket that this patch fixes, but I won't find it quickly;-( Carl Eugen
On 16/05/2020 16:23, Carl Eugen Hoyos wrote: > I believe there is a ticket that this patch fixes, but I won't find it > quickly;-( A quick search of trac didn't reveal anything to me, either... - Derek
LGTM On 5/16/20, Derek Buitenhuis <derek.buitenhuis@gmail.com> wrote: > 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> > --- > Minimal example file: http://chromashift.org/s/long3.mp4` > --- > libavformat/dump.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavformat/dump.c b/libavformat/dump.c > index 5e9a03185f..06bafc272d 100644 > --- a/libavformat/dump.c > +++ b/libavformat/dump.c > @@ -615,7 +615,7 @@ void av_dump_format(AVFormatContext *ic, int index, > if (!is_output) { > av_log(NULL, AV_LOG_INFO, " Duration: "); > 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); > secs = duration / AV_TIME_BASE; > us = duration % AV_TIME_BASE; > @@ -623,7 +623,7 @@ void av_dump_format(AVFormatContext *ic, int index, > secs %= 60; > hours = 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); > } else { > av_log(NULL, AV_LOG_INFO, "N/A"); > -- > 2.26.2 > > _______________________________________________ > 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".
On 17/05/2020 12:16, Paul B Mahol wrote:
> LGTM
Pushed, thanks.
- Derek
diff --git a/libavformat/dump.c b/libavformat/dump.c index 5e9a03185f..06bafc272d 100644 --- a/libavformat/dump.c +++ b/libavformat/dump.c @@ -615,7 +615,7 @@ void av_dump_format(AVFormatContext *ic, int index, if (!is_output) { av_log(NULL, AV_LOG_INFO, " Duration: "); 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); secs = duration / AV_TIME_BASE; us = duration % AV_TIME_BASE; @@ -623,7 +623,7 @@ void av_dump_format(AVFormatContext *ic, int index, secs %= 60; hours = 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); } else { av_log(NULL, AV_LOG_INFO, "N/A");
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> --- Minimal example file: http://chromashift.org/s/long3.mp4` --- libavformat/dump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)