Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loadfile,select.lua: print only one bitrate #14621

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions player/loadfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,11 @@ 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->codec->bitrate)
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);
} else if (s && s->hls_bitrate) {
APPEND(b, " %d kbps", (s->hls_bitrate + 500) / 1000);
}
APPEND(b, ")");

bool first = true;
Expand Down
8 changes: 4 additions & 4 deletions player/lua/select.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ local function format_flags(track)
end

local function format_track(track)
local bitrate = track["demux-bitrate"] or track["hls-bitrate"]

return (track.selected and "●" or "○") ..
(track.title and " " .. track.title or "") ..
" (" .. (
Expand All @@ -98,10 +100,8 @@ local function format_track(track)
and track["codec-profile"] .. " " or "") ..
(track["demux-samplerate"] and track["demux-samplerate"] / 1000 ..
" 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 "")
(bitrate and string.format("%.0f", bitrate / 1000) ..
" kbps " or "")
):sub(1, -2) .. ")" .. format_flags(track)
end

Expand Down
Loading