diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2012-09-26 12:30:08 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2012-09-30 12:22:19 +0200 |
commit | 301f6da0397eb8955adf355229521997390d918a (patch) | |
tree | a2f1ee16afaa875573abde388c17b62eeae9beb6 /ffprobe.c | |
parent | 50efde6bcb96315d067ed2b5761b9fbc3e137b42 (diff) | |
download | ffmpeg-301f6da0397eb8955adf355229521997390d918a.tar.gz |
ffprobe: extend disposition printing support
This generalizes the previous work on disposition printing.
Disposition flags are shown in a dedicated section, which should improve
output intellegibility, extensibility and filtering operations.
This breaks output syntax with the recently introduced disposition
printing.
Diffstat (limited to 'ffprobe.c')
-rw-r--r-- | ffprobe.c | 28 |
1 files changed, 22 insertions, 6 deletions
@@ -100,6 +100,7 @@ typedef enum { SECTION_ID_PROGRAM_VERSION, SECTION_ID_ROOT, SECTION_ID_STREAM, + SECTION_ID_STREAM_DISPOSITION, SECTION_ID_STREAMS, SECTION_ID_STREAM_TAGS } SectionID; @@ -119,6 +120,7 @@ static const struct section sections[] = { [SECTION_ID_PROGRAM_VERSION] = { SECTION_ID_PROGRAM_VERSION, "program_version" }, [SECTION_ID_ROOT] = { SECTION_ID_ROOT, "root", SECTION_FLAG_IS_WRAPPER }, [SECTION_ID_STREAM] = { SECTION_ID_STREAM, "stream" }, + [SECTION_ID_STREAM_DISPOSITION] = { SECTION_ID_STREAM_DISPOSITION, "disposition" }, [SECTION_ID_STREAMS] = { SECTION_ID_STREAMS, "streams", SECTION_FLAG_IS_ARRAY }, [SECTION_ID_STREAM_TAGS] = { SECTION_ID_STREAM_TAGS, "tags", SECTION_FLAG_HAS_VARIABLE_FIELDS, .element_name = "tag" }, }; @@ -1682,10 +1684,6 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i print_str("codec_tag_string", val_str); print_fmt("codec_tag", "0x%04x", dec_ctx->codec_tag); - /* Print useful disposition */ - print_int("default", !!(stream->disposition & AV_DISPOSITION_DEFAULT)); - print_int("forced", !!(stream->disposition & AV_DISPOSITION_FORCED)); - switch (dec_ctx->codec_type) { case AVMEDIA_TYPE_VIDEO: print_int("width", dec_ctx->width); @@ -1714,8 +1712,6 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i } else { print_str_opt("timecode", "N/A"); } - print_int("attached_pic", - !!(stream->disposition & AV_DISPOSITION_ATTACHED_PIC)); break; case AVMEDIA_TYPE_AUDIO: @@ -1762,6 +1758,26 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i if (do_show_data) writer_print_data(w, "extradata", dec_ctx->extradata, dec_ctx->extradata_size); + + /* Print disposition information */ +#define PRINT_DISPOSITION(flagname, name) do { \ + print_int(name, !!(stream->disposition & AV_DISPOSITION_##flagname)); \ + } while (0) + + writer_print_section_header(w, SECTION_ID_STREAM_DISPOSITION); + PRINT_DISPOSITION(DEFAULT, "default"); + PRINT_DISPOSITION(DUB, "dub"); + PRINT_DISPOSITION(ORIGINAL, "original"); + PRINT_DISPOSITION(COMMENT, "comment"); + PRINT_DISPOSITION(LYRICS, "lyrics"); + PRINT_DISPOSITION(KARAOKE, "karaoke"); + PRINT_DISPOSITION(FORCED, "forced"); + PRINT_DISPOSITION(HEARING_IMPAIRED, "hearing_impaired"); + PRINT_DISPOSITION(VISUAL_IMPAIRED, "visual_impaired"); + PRINT_DISPOSITION(CLEAN_EFFECTS, "clean_effects"); + PRINT_DISPOSITION(ATTACHED_PIC, "attached_pic"); + writer_print_section_footer(w); + show_tags(w, stream->metadata, SECTION_ID_STREAM_TAGS); writer_print_section_footer(w); |