From 5f8ac5b862760f6d78e4a2423dddb3d1f81fca41 Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Thu, 27 Jun 2024 16:33:48 +0200 Subject: [PATCH] loadfile,select.lua: print bitrates of tracks --- player/loadfile.c | 6 ++++-- player/lua/select.lua | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/player/loadfile.c b/player/loadfile.c index 0d504d4466..f819074a2b 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -299,8 +299,10 @@ static void print_stream(struct MPContext *mpctx, struct track *t, bool indent) if (s && s->codec->samplerate) APPEND(b, " %d Hz", s->codec->samplerate); } - if (s && s->hls_bitrate > 0) - APPEND(b, " %d kbps", (s->hls_bitrate + 500) / 1000); + if (s && s->codec->bitrate) + APPEND(b, " %d kbps", (s->codec->bitrate + 500) / 1000); + if (s && s->hls_bitrate) + APPEND(b, " %d HLS kbps", (s->hls_bitrate + 500) / 1000); APPEND(b, ")"); bool first = true; diff --git a/player/lua/select.lua b/player/lua/select.lua index 8947487c69..4daad22161 100644 --- a/player/lua/select.lua +++ b/player/lua/select.lua @@ -97,7 +97,11 @@ local function format_track(track) (track["codec-profile"] and track.type == "audio" and track["codec-profile"] .. " " or "") .. (track["demux-samplerate"] and track["demux-samplerate"] / 1000 .. - " kHz " or "") + " kHz " or "") .. + (track["demux-bitrate"] and string.format("%.0f", track["demux-bitrate"] / 1000) + .. " kbps " or "") .. + (track["hls-bitrate"] and string.format("%.0f", track["hls-bitrate"] / 1000) + .. " HLS kbps " or "") ):sub(1, -2) .. ")" .. format_flags(track) end