Skip to content

Add basic support for reading average bitrates#371

Open
codedcosmos wants to merge 1 commit intopdeljanov:rel-0.5from
codedcosmos:average-bitrate-support
Open

Add basic support for reading average bitrates#371
codedcosmos wants to merge 1 commit intopdeljanov:rel-0.5from
codedcosmos:average-bitrate-support

Conversation

@codedcosmos
Copy link
Copy Markdown

Bitrate is seemingly missing from all song metadata in this project. Even songs that contain the bitrate in the header (alac, mp3, possibly more?) don't make this information available to the user.

This commit stores the bitrate in CodecParameters as "average_bitrate". This is because some formats like flac have a variable bitrate. It's better to provide something than to promise a constant bitrate and be technically wrong as some decoders do.

This average bitrate is currently only implemented for mp3. But possibly other codecs might want to implement it. This change is fully backwards compatible.

Bitrate is seemingly missing from all song metadata in this
project. Even songs that contain the bitrate in the header (alac,
mp3, possibly more?) don't make this information available to the
user.

This commit stores the bitrate in CodecParameters as
"average_bitrate". This is because some formats like flac have
a variable bitrate. It's better to provide something than to
promise a constant bitrate and be technically wrong as some
decoders do.

This average bitrate is currently only implemented for mp3. But
possibly other codecs might want to implement it. This change
is fully backwards compatible.
@codedcosmos
Copy link
Copy Markdown
Author

Hi 👋
This is honestly my first pull request, so sorry if I have missed something or done something wrong. I'll try to help you resolve anything that I've missed 🙂 , But I did make sure to read the contributing guidelines page first.

I'm not sure if this repo has automated testing, but I'll write here that I I did run cargo test and cargo fmt --all before pushing.

@sscobici
Copy link
Copy Markdown
Contributor

sscobici commented Apr 8, 2025

You might want to consider rebasing this PR onto the dev-0.6 branch.
See details here: #330

@codedcosmos
Copy link
Copy Markdown
Author

I'll take a look, do you mind if I also implement bitrate for other protocols that store that data in the header?

WAV for example stores it as byterate (and can easily enough be divded by 8 to get bitrate).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants