[FFmpeg-devel] [PATCH 8/8] lavf/dump: use av_disposition_write()

Nicolas George george at nsup.org
Fri Apr 28 12:55:08 EEST 2023


It changes the output to have underscores instead of spaces.

Signed-off-by: Nicolas George <george at nsup.org>
---
 libavformat/dump.c | 37 +------------------------------------
 1 file changed, 1 insertion(+), 36 deletions(-)


Note: I consider the change to backspaces good: now we can copy-paste
from dump directly into a command-line.


diff --git a/libavformat/dump.c b/libavformat/dump.c
index 96b364e337..8b55e60b6a 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -584,42 +584,7 @@ static void dump_stream_format(AVWriter wr,
             print_fps(wr, 1 / av_q2d(st->time_base), "tbn");
     }
 
-    if (st->disposition & AV_DISPOSITION_DEFAULT)
-        av_writer_printf(wr, " (default)");
-    if (st->disposition & AV_DISPOSITION_DUB)
-        av_writer_printf(wr, " (dub)");
-    if (st->disposition & AV_DISPOSITION_ORIGINAL)
-        av_writer_printf(wr, " (original)");
-    if (st->disposition & AV_DISPOSITION_COMMENT)
-        av_writer_printf(wr, " (comment)");
-    if (st->disposition & AV_DISPOSITION_LYRICS)
-        av_writer_printf(wr, " (lyrics)");
-    if (st->disposition & AV_DISPOSITION_KARAOKE)
-        av_writer_printf(wr, " (karaoke)");
-    if (st->disposition & AV_DISPOSITION_FORCED)
-        av_writer_printf(wr, " (forced)");
-    if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED)
-        av_writer_printf(wr, " (hearing impaired)");
-    if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED)
-        av_writer_printf(wr, " (visual impaired)");
-    if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS)
-        av_writer_printf(wr, " (clean effects)");
-    if (st->disposition & AV_DISPOSITION_ATTACHED_PIC)
-        av_writer_printf(wr, " (attached pic)");
-    if (st->disposition & AV_DISPOSITION_TIMED_THUMBNAILS)
-        av_writer_printf(wr, " (timed thumbnails)");
-    if (st->disposition & AV_DISPOSITION_CAPTIONS)
-        av_writer_printf(wr, " (captions)");
-    if (st->disposition & AV_DISPOSITION_DESCRIPTIONS)
-        av_writer_printf(wr, " (descriptions)");
-    if (st->disposition & AV_DISPOSITION_METADATA)
-        av_writer_printf(wr, " (metadata)");
-    if (st->disposition & AV_DISPOSITION_DEPENDENT)
-        av_writer_printf(wr, " (dependent)");
-    if (st->disposition & AV_DISPOSITION_STILL_IMAGE)
-        av_writer_printf(wr, " (still image)");
-    if (st->disposition & AV_DISPOSITION_NON_DIEGETIC)
-        av_writer_printf(wr, " (non-diegetic)");
+    av_disposition_write(wr, st->disposition, " (", ")", NULL, 0);
     av_writer_printf(wr, "\n");
 
     dump_metadata(wr, st->metadata, "    ");
-- 
2.39.2



More information about the ffmpeg-devel mailing list