History

loadfile,select.lua: print only one bitrate

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

Guido Cella committed 2 years ago

Commit 5f768a61 parent 11ed0122 files · +8 −7Browse files

Showing the changes to player/lua/select.lua (1 of 2 files). Show all

Unified · Split

player/lua/select.lua+4−4
@@ -82,6 +82,8 @@ local function format_flags(track) · 81 unmodified lines
82end82end
83 83
84local function format_track(track)84local function format_track(track)
85 local bitrate = track["demux-bitrate"] or track["hls-bitrate"]
86
85 return (track.selected and "●" or "○") ..87 return (track.selected and "●" or "○") ..
86 (track.title and " " .. track.title or "") ..88 (track.title and " " .. track.title or "") ..
87 " (" .. (89 " (" .. (
@@ -98,10 +100,8 @@ local function format_track(track) · 10 unmodified lines
98 and track["codec-profile"] .. " " or "") ..100 and track["codec-profile"] .. " " or "") ..
99 (track["demux-samplerate"] and track["demux-samplerate"] / 1000 ..101 (track["demux-samplerate"] and track["demux-samplerate"] / 1000 ..
100 " kHz " or "") ..102 " kHz " or "") ..
101 (track["demux-bitrate"] and string.format("%.0f", track["demux-bitrate"] / 1000)103 (bitrate and string.format("%.0f", bitrate / 1000) ..
102 .. " kbps " or "") ..104 " kbps " or "")
103 (track["hls-bitrate"] and string.format("%.0f", track["hls-bitrate"] / 1000)
104 .. " HLS kbps " or "")
105 ):sub(1, -2) .. ")" .. format_flags(track)105 ):sub(1, -2) .. ")" .. format_flags(track)
106end106end
107 107

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t