Skip to content

Commit

Permalink
various: print bitrates of tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
guidocella committed Jun 27, 2024
1 parent f43e43a commit ba9258d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion player/loadfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,9 @@ 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)
if (s && s->codec->bitrate)
APPEND(b, " %d kbps", (s->codec->bitrate + 500) / 1000);
if (s && s->hls_bitrate)
APPEND(b, " %d kbps", (s->hls_bitrate + 500) / 1000);
APPEND(b, ")");

Expand Down
5 changes: 4 additions & 1 deletion player/lua/select.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ local function format_track(track)
and track["codec-profile"] .. " " or "") ..
(track["demux-samplerate"] and track["demux-samplerate"] / 1000 ..
" kHz " or "") ..
(track.external and "external " 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)
.. " kbps " or "")
):sub(1, -2) .. ")"
end

Expand Down

0 comments on commit ba9258d

Please sign in to comment.