[FFmpeg-devel] [PATCH v2 2/6] avformat/dump: print language_bcp47 when pressent as language indicator
Marth64
marth64 at proxyid.net
Wed Nov 27 08:09:23 EET 2024
Signed-off-by: Marth64 <marth64 at proxyid.net>
---
libavformat/dump.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/libavformat/dump.c b/libavformat/dump.c
index b7125a652f..1c89e7262d 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -149,7 +149,7 @@ static void dump_dictionary(void *ctx, const AVDictionary *m,
av_log(ctx, log_level, "%s%s:\n", indent, name);
while ((tag = av_dict_iterate(m, tag)))
- if (strcmp("language", tag->key)) {
+ if (strcmp("language", tag->key) && strcmp("language_bcp47", tag->key)) {
const char *p = tag->value;
av_log(ctx, log_level,
"%s %-16s: ", indent, tag->key);
@@ -168,7 +168,8 @@ static void dump_dictionary(void *ctx, const AVDictionary *m,
static void dump_metadata(void *ctx, const AVDictionary *m, const char *indent,
int log_level)
{
- if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0)))
+ if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0) &&
+ av_dict_get(m, "language_bcp47", NULL, 0)))
dump_dictionary(ctx, m, "Metadata", indent, log_level);
}
@@ -601,7 +602,8 @@ static void dump_stream_format(const AVFormatContext *ic, int i,
int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
const AVStream *st = ic->streams[i];
const FFStream *const sti = cffstream(st);
- const AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
+ const AVDictionaryEntry *language = av_dict_get(st->metadata, "language", NULL, 0);
+ const AVDictionaryEntry *language_bcp47 = av_dict_get(st->metadata, "language_bcp47", NULL, 0);
const char *separator = ic->dump_separator;
const char *group_indent = group_index >= 0 ? " " : "";
const char *extra_indent = group_index >= 0 ? " " : " ";
@@ -640,8 +642,12 @@ static void dump_stream_format(const AVFormatContext *ic, int i,
/* XXX: add a generic system */
if (flags & AVFMT_SHOW_IDS)
av_log(NULL, log_level, "[0x%x]", st->id);
- if (lang)
- av_log(NULL, log_level, "(%s)", lang->value);
+
+ if (language_bcp47)
+ av_log(NULL, log_level, "(%s)", language_bcp47->value);
+ else if (language)
+ av_log(NULL, log_level, "(%s)", language->value);
+
av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", sti->codec_info_nb_frames,
st->time_base.num, st->time_base.den);
av_log(NULL, log_level, ": %s", buf);
--
2.34.1
More information about the ffmpeg-devel
mailing list