1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

ffprobe: directly use va args in print fmt callbacks.

This commit is contained in:
Clément Bœsch 2011-09-01 22:09:15 +02:00
parent 58677d73ed
commit d5d7de7671

View File

@ -132,7 +132,7 @@ struct writer {
const char *header, *footer; const char *header, *footer;
void (*print_header)(const char *); void (*print_header)(const char *);
void (*print_footer)(const char *); void (*print_footer)(const char *);
void (*print_fmt_f)(const char *, const char *, va_list ap); void (*print_fmt_f)(const char *, const char *, ...);
void (*print_int_f)(const char *, int); void (*print_int_f)(const char *, int);
void (*show_tags)(struct writer *w, AVDictionary *dict); void (*show_tags)(struct writer *w, AVDictionary *dict);
}; };
@ -145,10 +145,13 @@ static void default_print_header(const char *section)
printf("[%s]\n", section); printf("[%s]\n", section);
} }
static void default_print_fmt(const char *key, const char *fmt, va_list ap) static void default_print_fmt(const char *key, const char *fmt, ...)
{ {
va_list ap;
va_start(ap, fmt);
printf("%s=", key); printf("%s=", key);
vprintf(fmt, ap); vprintf(fmt, ap);
va_end(ap);
} }
static void default_print_int(const char *key, int value) static void default_print_int(const char *key, int value)
@ -164,19 +167,11 @@ static void default_print_footer(const char *section)
/* Print helpers */ /* Print helpers */
static void print_vfmt0(struct writer *w, const char *key, const char *fmt, ...) #define print_fmt0(k, f, a...) w->print_fmt_f(k, f, ##a)
{
va_list ap;
va_start(ap, fmt);
w->print_fmt_f(key, fmt, ap);
va_end(ap);
}
#define print_fmt0(k, f, a...) print_vfmt0(w, k, f, ##a)
#define print_fmt( k, f, a...) do { \ #define print_fmt( k, f, a...) do { \
if (w->item_sep) \ if (w->item_sep) \
printf("%s", w->item_sep); \ printf("%s", w->item_sep); \
print_vfmt0(w, k, f, ##a); \ w->print_fmt_f(k, f, ##a); \
} while (0) } while (0)
#define print_int0(k, v) w->print_int_f(k, v) #define print_int0(k, v) w->print_int_f(k, v)