]> git.sesse.net Git - ffmpeg/blobdiff - ffprobe.c
mxfenc: use new public timecode API.
[ffmpeg] / ffprobe.c
index bd88267ca4d83392439b4c239f9b8f11da967592..08ee8fd5d713ffa8bddeb750c7222ad29f4e2c47 100644 (file)
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -32,6 +32,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/dict.h"
+#include "libavutil/timecode.h"
 #include "libavdevice/avdevice.h"
 #include "libswscale/swscale.h"
 #include "libswresample/swresample.h"
@@ -106,24 +107,24 @@ static char *value_string(char *buf, int buf_size, struct unit_value uv)
         const char *prefix_string = "";
         int l;
 
-        if (use_value_prefix) {
-        long long int index;
+        if (use_value_prefix && vald > 1) {
+            long long int index;
 
-        if (uv.unit == unit_byte_str && use_byte_value_binary_prefix) {
-            index = (long long int) (log(vald)/log(2)) / 10;
-            index = av_clip(index, 0, FF_ARRAY_ELEMS(binary_unit_prefixes) - 1);
-            vald /= pow(2, index * 10);
-            prefix_string = binary_unit_prefixes[index];
-        } else {
-            index = (long long int) (log10(vald)) / 3;
-            index = av_clip(index, 0, FF_ARRAY_ELEMS(decimal_unit_prefixes) - 1);
-            vald /= pow(10, index * 3);
-            prefix_string = decimal_unit_prefixes[index];
-        }
+            if (uv.unit == unit_byte_str && use_byte_value_binary_prefix) {
+                index = (long long int) (log(vald)/log(2)) / 10;
+                index = av_clip(index, 0, FF_ARRAY_ELEMS(binary_unit_prefixes) - 1);
+                vald /= pow(2, index * 10);
+                prefix_string = binary_unit_prefixes[index];
+            } else {
+                index = (long long int) (log10(vald)) / 3;
+                index = av_clip(index, 0, FF_ARRAY_ELEMS(decimal_unit_prefixes) - 1);
+                vald /= pow(10, index * 3);
+                prefix_string = decimal_unit_prefixes[index];
+            }
         }
 
         if (show_float || (use_value_prefix && vald != (long long int)vald))
-            l = snprintf(buf, buf_size, "%.3f", vald);
+            l = snprintf(buf, buf_size, "%f", vald);
         else
             l = snprintf(buf, buf_size, "%lld", (long long int)vald);
         snprintf(buf+l, buf_size-l, "%s%s%s", *prefix_string || show_value_unit ? " " : "",
@@ -1453,13 +1454,9 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
             else   print_str_opt("pix_fmt", "unknown");
             print_int("level",   dec_ctx->level);
             if (dec_ctx->timecode_frame_start >= 0) {
-                uint32_t tc = dec_ctx->timecode_frame_start;
-                print_fmt("timecode", "%02d:%02d:%02d%c%02d",
-                          tc>>19 & 0x1f,              // hours
-                          tc>>13 & 0x3f,              // minutes
-                          tc>>6  & 0x3f,              // seconds
-                          tc     & 1<<24 ? ';' : ':', // drop
-                          tc     & 0x3f);             // frames
+                char tcbuf[AV_TIMECODE_STR_SIZE];
+                av_timecode_make_mpeg_tc_string(tcbuf, dec_ctx->timecode_frame_start);
+                print_str("timecode", tcbuf);
             } else {
                 print_str_opt("timecode", "N/A");
             }