command: print track metadata when changing track

This commit is contained in:
Guido Cella 2024-10-24 15:04:00 +02:00 committed by Kacper Michajłow
parent f0a852cda3
commit ef6eda32a2
1 changed files with 4 additions and 14 deletions

View File

@ -1936,20 +1936,10 @@ static int property_switch_track(void *ctx, struct m_property *prop,
return M_PROPERTY_OK; return M_PROPERTY_OK;
case M_PROPERTY_PRINT: case M_PROPERTY_PRINT:
if (track) { if (track) {
char *lang = track->lang; void *talloc_ctx = talloc_new(NULL);
if (!lang && type != STREAM_VIDEO) { *(char **)arg = talloc_asprintf(NULL, "(%d) %s", track->user_tid,
lang = "unknown"; mp_format_track_metadata(talloc_ctx, track, true));
} else if (!lang) { talloc_free(talloc_ctx);
lang = "";
}
if (track->title) {
*(char **)arg = talloc_asprintf(NULL, "(%d) %s (\"%s\")",
track->user_tid, lang, track->title);
} else {
*(char **)arg = talloc_asprintf(NULL, "(%d) %s",
track->user_tid, lang);
}
} else { } else {
const char *msg = "no"; const char *msg = "no";
if (!mpctx->playback_initialized && if (!mpctx->playback_initialized &&