Print demux-bitrate if available, else hls-bitrate, not both (as demux-bitrate is generally more reliable). This avoids printing "HLS kbps" which looks weird. Fixes https://github.com/mpv-player/mpv/pull/14453#discussion_r1700550385
Showing the changes to player/lua/select.lua (1 of 2 files). Show all
Unified · Split
| @@ -82,6 +82,8 @@ local function format_flags(track) · 81 unmodified lines | ||
| 82 | 82 | end |
| 83 | 83 | |
| 84 | 84 | local function format_track(track) |
| 85 | + local bitrate = track["demux-bitrate"] or track["hls-bitrate"] | |
| 86 | + | |
| 85 | 87 | return (track.selected and "●" or "○") .. |
| 86 | 88 | (track.title and " " .. track.title or "") .. |
| 87 | 89 | " (" .. ( |
| @@ -98,10 +100,8 @@ local function format_track(track) · 10 unmodified lines | ||
| 98 | 100 | and track["codec-profile"] .. " " or "") .. |
| 99 | 101 | (track["demux-samplerate"] and track["demux-samplerate"] / 1000 .. |
| 100 | 102 | " kHz " or "") .. |
| 101 | − (track["demux-bitrate"] and string.format("%.0f", track["demux-bitrate"] / 1000) | |
| 102 | − .. " kbps " or "") .. | |
| 103 | − (track["hls-bitrate"] and string.format("%.0f", track["hls-bitrate"] / 1000) | |
| 104 | − .. " HLS kbps " or "") | |
| 103 | + (bitrate and string.format("%.0f", bitrate / 1000) .. | |
| 104 | + " kbps " or "") | |
| 105 | 105 | ):sub(1, -2) .. ")" .. format_flags(track) |
| 106 | 106 | end |
| 107 | 107 | |