diff --git a/player/command.c b/player/command.c index e4f7341496f7f..9b2d89af2d53f 100644 --- a/player/command.c +++ b/player/command.c @@ -2102,7 +2102,7 @@ static char *append_track_info(char *res, struct track *track) { res = talloc_strdup_append(res, track->selected ? list_current : list_normal); res = talloc_asprintf_append(res, "(%d) ", track->user_tid); - res = talloc_strdup_append(res, mp_format_track_metadata(res, track)); + res = talloc_strdup_append(res, mp_format_track_metadata(res, track, true)); return res; } @@ -2113,7 +2113,7 @@ static char *append_track_info(char *res, struct track *track) first = false; \ } while(0) -char *mp_format_track_metadata(void *ctx, struct track *t) +char *mp_format_track_metadata(void *ctx, struct track *t, bool add_lang) { struct sh_stream *s = t->stream; bstr dst = {0}; @@ -2122,7 +2122,13 @@ char *mp_format_track_metadata(void *ctx, struct track *t) bstr_xappend_asprintf(ctx, &dst, " '%s'", t->title); const char *codec = s ? s->codec->codec : NULL; - bstr_xappend_asprintf(ctx, &dst, " (%s", codec ? codec : ""); + + bstr_xappend0(ctx, &dst, " ("); + + if (add_lang && t->lang) + bstr_xappend_asprintf(ctx, &dst, "%s ", t->lang); + + bstr_xappend0(ctx, &dst, codec ? codec : ""); if (s && s->codec->codec_profile) bstr_xappend_asprintf(ctx, &dst, " [%s]", s->codec->codec_profile); diff --git a/player/command.h b/player/command.h index 24e3e8f98a6a8..17c62cae96622 100644 --- a/player/command.h +++ b/player/command.h @@ -126,6 +126,6 @@ void mp_abort_cache_dumping(struct MPContext *mpctx); // U+25CF BLACK CIRCLE #define WHITE_CIRCLE "\xe2\x97\x8b" #define BLACK_CIRCLE "\xe2\x97\x8f" -char *mp_format_track_metadata(void *ctx, struct track *t); +char *mp_format_track_metadata(void *ctx, struct track *t, bool add_lang); #endif /* MPLAYER_COMMAND_H */ diff --git a/player/loadfile.c b/player/loadfile.c index d8e29716c22c1..c71f82ba45812 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -272,7 +272,7 @@ static void print_stream(struct MPContext *mpctx, struct track *t, bool indent) } void *ctx = talloc_new(NULL); - APPEND(b, " %s", mp_format_track_metadata(ctx, t)); + APPEND(b, " %s", mp_format_track_metadata(ctx, t, false)); talloc_free(ctx); MP_INFO(mpctx, "%s\n", b);