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
8282 end
8383
8484 local function format_track(track)
85+ local bitrate = track["demux-bitrate"] or track["hls-bitrate"]
86+
8587 return (track.selected and "●" or "○") ..
8688 (track.title and " " .. track.title or "") ..
8789 " (" .. (
@@ -98,10 +100,8 @@ local function format_track(track) · 10 unmodified lines
98100 and track["codec-profile"] .. " " or "") ..
99101 (track["demux-samplerate"] and track["demux-samplerate"] / 1000 ..
100102 " 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 "")
105105 ):sub(1, -2) .. ")" .. format_flags(track)
106106 end
107107

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