printf("\n");
}
+/* lame uppercasing routine, assumes the string is lower case ASCII */
+static inline char *upcase_string(char *dst, size_t dst_size, const char *src)
+{
+ int i;
+ for (i = 0; src[i] && i < dst_size-1; i++)
+ dst[i] = src[i]-32;
+ dst[i] = 0;
+ return dst;
+}
+
static void default_print_section_header(WriterContext *wctx, const char *section)
{
+ char buf[32];
+
if (wctx->nb_section)
printf("\n");
- printf("[%s]\n", section);
+ printf("[%s]\n", upcase_string(buf, sizeof(buf), section));
}
static void default_print_section_footer(WriterContext *wctx, const char *section)
{
- printf("[/%s]", section);
+ char buf[32];
+
+ printf("[/%s]", upcase_string(buf, sizeof(buf), section));
}
static void default_print_str(WriterContext *wctx, const char *key, const char *value)
AVStream *st = fmt_ctx->streams[pkt->stream_index];
struct print_buf pbuf = {.s = NULL};
- print_section_header("PACKET");
+ print_section_header("packet");
print_str("codec_type", av_x_if_null(av_get_media_type_string(st->codec->codec_type), "unknown"));
print_int("stream_index", pkt->stream_index);
print_str("pts", ts_value_string (val_str, sizeof(val_str), pkt->pts));
print_str("size", value_string (val_str, sizeof(val_str), pkt->size, unit_byte_str));
print_fmt("pos", "%"PRId64, pkt->pos);
print_fmt("flags", "%c", pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_');
- print_section_footer("PACKET");
+ print_section_footer("packet");
av_free(pbuf.s);
fflush(stdout);
AVRational display_aspect_ratio;
struct print_buf pbuf = {.s = NULL};
- print_section_header("STREAM");
+ print_section_header("stream");
print_int("index", stream->index);
show_tags(stream->metadata);
- print_section_footer("STREAM");
+ print_section_footer("stream");
av_free(pbuf.s);
fflush(stdout);
}
char val_str[128];
struct print_buf pbuf = {.s = NULL};
- print_section_header("FORMAT");
+ print_section_header("format");
print_str("filename", fmt_ctx->filename);
print_int("nb_streams", fmt_ctx->nb_streams);
print_str("format_name", fmt_ctx->iformat->name);
print_str("size", value_string(val_str, sizeof(val_str), fmt_ctx->file_size, unit_byte_str));
print_str("bit_rate", value_string(val_str, sizeof(val_str), fmt_ctx->bit_rate, unit_bit_per_second_str));
show_tags(fmt_ctx->metadata);
- print_section_footer("FORMAT");
+ print_section_footer("format");
av_free(pbuf.s);
fflush(stdout);
}