mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-29 22:00:58 +02:00
ffprobe: prefer lowercase section names over uppercase ones
This is consistent with chapter names. The default writer section names are converted to uppercase for keeping backward compatibility.
This commit is contained in:
parent
92e36ee567
commit
fbb8468f20
30
ffprobe.c
30
ffprobe.c
@ -336,16 +336,30 @@ static void default_print_chapter_header(WriterContext *wctx, const char *chapte
|
||||
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)
|
||||
@ -550,7 +564,7 @@ static void show_packet(WriterContext *w, AVFormatContext *fmt_ctx, AVPacket *pk
|
||||
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));
|
||||
@ -562,7 +576,7 @@ static void show_packet(WriterContext *w, AVFormatContext *fmt_ctx, AVPacket *pk
|
||||
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);
|
||||
@ -588,7 +602,7 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
|
||||
AVRational display_aspect_ratio;
|
||||
struct print_buf pbuf = {.s = NULL};
|
||||
|
||||
print_section_header("STREAM");
|
||||
print_section_header("stream");
|
||||
|
||||
print_int("index", stream->index);
|
||||
|
||||
@ -651,7 +665,7 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
|
||||
|
||||
show_tags(stream->metadata);
|
||||
|
||||
print_section_footer("STREAM");
|
||||
print_section_footer("stream");
|
||||
av_free(pbuf.s);
|
||||
fflush(stdout);
|
||||
}
|
||||
@ -668,7 +682,7 @@ static void show_format(WriterContext *w, AVFormatContext *fmt_ctx)
|
||||
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);
|
||||
@ -678,7 +692,7 @@ static void show_format(WriterContext *w, AVFormatContext *fmt_ctx)
|
||||
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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user