aboutsummaryrefslogtreecommitdiffstats
path: root/ffprobe.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2011-11-07 15:58:41 +0100
committerStefano Sabatini <stefasab@gmail.com>2011-11-18 10:09:26 +0100
commita7e567905421dfee3609cc98bc90eb20aae176d3 (patch)
treeb1fb3a3ee727fdb8ba8f9a34c3e433aad7e6fd0e /ffprobe.c
parent95d6e5bdd58d5caaa52c57bad1e1d87df59fb7f8 (diff)
downloadffmpeg-a7e567905421dfee3609cc98bc90eb20aae176d3.tar.gz
ffprobe: make writer_print_integer support long long int values
This makes possible to use writer_print_integer for printing int64_t values.
Diffstat (limited to 'ffprobe.c')
-rw-r--r--ffprobe.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/ffprobe.c b/ffprobe.c
index 8864594196..52f07e72ff 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -141,7 +141,7 @@ typedef struct Writer {
void (*print_chapter_footer)(WriterContext *wctx, const char *);
void (*print_section_header)(WriterContext *wctx, const char *);
void (*print_section_footer)(WriterContext *wctx, const char *);
- void (*print_integer) (WriterContext *wctx, const char *, int);
+ void (*print_integer) (WriterContext *wctx, const char *, long long int);
void (*print_string) (WriterContext *wctx, const char *, const char *);
void (*show_tags) (WriterContext *wctx, AVDictionary *dict);
int flags; ///< a combination or WRITER_FLAG_*
@@ -254,7 +254,7 @@ static inline void writer_print_section_footer(WriterContext *wctx,
}
static inline void writer_print_integer(WriterContext *wctx,
- const char *key, int val)
+ const char *key, long long int val)
{
wctx->writer->print_integer(wctx, key, val);
wctx->nb_item++;
@@ -285,13 +285,10 @@ static void writer_print_time(WriterContext *wctx, const char *key,
static void writer_print_ts(WriterContext *wctx, const char *key, int64_t ts)
{
- char buf[128];
-
if (ts == AV_NOPTS_VALUE) {
writer_print_string(wctx, key, "N/A", 1);
} else {
- snprintf(buf, sizeof(buf), "%"PRId64, ts);
- writer_print_string(wctx, key, buf, 0);
+ writer_print_integer(wctx, key, ts);
}
}
@@ -436,9 +433,9 @@ static void default_print_str(WriterContext *wctx, const char *key, const char *
printf("%s=%s\n", key, value);
}
-static void default_print_int(WriterContext *wctx, const char *key, int value)
+static void default_print_int(WriterContext *wctx, const char *key, long long int value)
{
- printf("%s=%d\n", key, value);
+ printf("%s=%lld\n", key, value);
}
static void default_show_tags(WriterContext *wctx, AVDictionary *dict)
@@ -649,14 +646,14 @@ static void compact_print_str(WriterContext *wctx, const char *key, const char *
value, compact->item_sep, wctx));
}
-static void compact_print_int(WriterContext *wctx, const char *key, int value)
+static void compact_print_int(WriterContext *wctx, const char *key, long long int value)
{
CompactContext *compact = wctx->priv;
if (wctx->nb_item) printf("%c", compact->item_sep);
if (!compact->nokey)
printf("%s=", key);
- printf("%d", value);
+ printf("%lld", value);
}
static void compact_show_tags(WriterContext *wctx, AVDictionary *dict)
@@ -825,12 +822,12 @@ static void json_print_str(WriterContext *wctx, const char *key, const char *val
json_print_item_str(wctx, key, value, INDENT);
}
-static void json_print_int(WriterContext *wctx, const char *key, int value)
+static void json_print_int(WriterContext *wctx, const char *key, long long int value)
{
JSONContext *json = wctx->priv;
if (wctx->nb_item) printf(",\n");
- printf(INDENT "\"%s\": %d",
+ printf(INDENT "\"%s\": %lld",
json_escape_str(&json->buf, &json->buf_size, key, wctx), value);
}