add new function duration_estimate_name to dump duration estimate method, it's will help to debug some duration issue.
Unified · Split
| @@ -2934,6 +2934,18 @@ skip_duration_calc: · 2933 unmodified lines | ||
| 2934 | 2934 | } |
| 2935 | 2935 | } |
| 2936 | 2936 | |
| 2937 | +/* 1:1 map to AVDurationEstimationMethod */ | |
| 2938 | +static const char *duration_name[] = { | |
| 2939 | + [AVFMT_DURATION_FROM_PTS] = "pts", | |
| 2940 | + [AVFMT_DURATION_FROM_STREAM] = "stream", | |
| 2941 | + [AVFMT_DURATION_FROM_BITRATE] = "bit rate", | |
| 2942 | +}; | |
| 2943 | + | |
| 2944 | +static const char *duration_estimate_name(enum AVDurationEstimationMethod method) | |
| 2945 | +{ | |
| 2946 | + return duration_name[method]; | |
| 2947 | +} | |
| 2948 | + | |
| 2937 | 2949 | static void estimate_timings(AVFormatContext *ic, int64_t old_offset) |
| 2938 | 2950 | { |
| 2939 | 2951 | int64_t file_size; |
| @@ -2979,9 +2991,10 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset) · 39 unmodified lines | ||
| 2979 | 2991 | (double) st->duration * av_q2d(st->time_base)); |
| 2980 | 2992 | } |
| 2981 | 2993 | av_log(ic, AV_LOG_TRACE, |
| 2982 | − "format: start_time: %0.3f duration: %0.3f bitrate=%"PRId64" kb/s\n", | |
| 2994 | + "format: start_time: %0.3f duration: %0.3f (estimate from %s) bitrate=%"PRId64" kb/s\n", | |
| 2983 | 2995 | (double) ic->start_time / AV_TIME_BASE, |
| 2984 | 2996 | (double) ic->duration / AV_TIME_BASE, |
| 2997 | + duration_estimate_name(ic->duration_estimation_method), | |
| 2985 | 2998 | (int64_t)ic->bit_rate / 1000); |
| 2986 | 2999 | } |
| 2987 | 3000 | } |