Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH] fftools/ffprobe: Print dispositions generically
Date: Sat,  2 Mar 2024 20:37:56 +0100
Message-ID: <AS8P250MB0744A7181EEA6F5ADF0210928F5D2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 fftools/ffprobe.c | 39 +++++++++++++++------------------------
 1 file changed, 15 insertions(+), 24 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index ea225f14ab..ac6b92f5d6 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -3039,6 +3039,18 @@ static int read_packets(WriterContext *w, InputFile *ifile)
     return ret;
 }
 
+static void print_dispositions(WriterContext *w, uint32_t disposition, SectionID section_id)
+{
+    writer_print_section_header(w, NULL, section_id);
+    for (int i = 0; i < sizeof(disposition) * CHAR_BIT; i++) {
+        const char *disposition_str = av_disposition_to_string(1U << i);
+
+        if (disposition_str)
+            print_int(disposition_str, !!(disposition & (1U << i)));
+    }
+    writer_print_section_footer(w);
+}
+
 static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_idx, InputStream *ist, int in_program)
 {
     AVStream *stream = ist->st;
@@ -3215,31 +3227,10 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
     }
 
     /* Print disposition information */
-#define PRINT_DISPOSITION(flagname, name) do {                                \
-        print_int(name, !!(stream->disposition & AV_DISPOSITION_##flagname)); \
-    } while (0)
-
     if (do_show_stream_disposition) {
-        writer_print_section_header(w, NULL, in_program ? SECTION_ID_PROGRAM_STREAM_DISPOSITION : 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");
-        PRINT_DISPOSITION(TIMED_THUMBNAILS, "timed_thumbnails");
-        PRINT_DISPOSITION(NON_DIEGETIC,     "non_diegetic");
-        PRINT_DISPOSITION(CAPTIONS,         "captions");
-        PRINT_DISPOSITION(DESCRIPTIONS,     "descriptions");
-        PRINT_DISPOSITION(METADATA,         "metadata");
-        PRINT_DISPOSITION(DEPENDENT,        "dependent");
-        PRINT_DISPOSITION(STILL_IMAGE,      "still_image");
-        writer_print_section_footer(w);
+        print_dispositions(w, stream->disposition,
+                           in_program ? SECTION_ID_PROGRAM_STREAM_DISPOSITION
+                                      : SECTION_ID_STREAM_DISPOSITION);
     }
 
     if (do_show_stream_tags)
-- 
2.40.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

             reply	other threads:[~2024-03-02 19:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-02 19:37 Andreas Rheinhardt [this message]
2024-03-03 14:19 ` James Almer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8P250MB0744A7181EEA6F5ADF0210928F5D2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git