add the ability to read the replaygain_{album/track}_{gain/peak} tags
the implementation can succesfully read the tags generated by MediaMonkey
mp4 files are not supported
Details
- Reviewers
mgallien bruns - Commits
- R286:22c0757e6e51: implement reading of the replaygain tags
tests pass
Diff Detail
- Repository
- R286 KFileMetaData
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
I decided to store the values as string, including the "dB" unit. Another possibility would be to store them as floats, but this would require adjustments to baloo first.
"dB" is nothing more than deci-Bel, i.e. 0.1 Bel. You can convert the value to e.g. mB or uB. This looks unfamiliar, but is e.g. also used by the CRDA WiFi compliance tool.
I know what dB is :)
The question here is actually if we want to store the unit within the string as it is stored in the metadata, e.g. "-9.90 dB" or if we go to floats and drop the unit from the property in KFileMetaData
I would just store the value, and document the unit. Then, the formatting can be made typographically correct, e.g. <value><THIN SPACE><unit>.
Some inline comments
src/extractors/taglibextractor.cpp | ||
---|---|---|
254–263 | I am not a fan of the strcmp usage here. Is it not possible to do without them ? | |
468 | This change is unrelated to the patch. Please remove it. | |
662 | same comment | |
986 | Can you remove it ? | |
996 | Could you check if it is not faster to use QLatin1String here ? | |
src/properties.h | ||
333–340 | Please document each entry separately otherwise only the first one will have documentation (as seen on api.kde.org). |
- add documentation, remove unrelated changes and debug info
- get rid of string comparisons for id3v2
src/extractors/taglibextractor.cpp | ||
---|---|---|
996 | At least if my interpretations of callgrind are correct, it's exactly the same. |
src/extractors/taglibextractor.cpp | ||
---|---|---|
252 | You can use a typedef in this scope, makes the long lines easier to read typedef TagLib::ID3v2::UserTextIdentificationFrame IdFrame; auto trackGainFrame = IdFrame::find(mpegFile.ID3v2Tag(), "replaygain_track_gain"); if (trackGainFrame) { ... Using a distinct name for each instance makes it clearer these are independent frames. | |
254 | Remove the extra space inside the parentheses. | |
255 | you can use TStringToQString | |
255 | fieldList() may return an empty list, please add a check |
src/extractors/taglibextractor.cpp | ||
---|---|---|
255 | toCString() was actually completely unnecessary. I removed it since convertWChartsToQString() avoids the UTF16->UTF8->UTF16 conversion of TStringToQString |
src/extractors/taglibextractor.cpp | ||
---|---|---|
50 | This is definitely broken: const wchar_t* TagLib::String::toCWString () const
inline QString QString::fromWCharArray(const wchar_t *string, int size) { return sizeof(wchar_t) == sizeof(QChar) ? fromUtf16(reinterpret_cast<const ushort *>(string), size) : fromUcs4(reinterpret_cast<const uint *>(string), size); } Fortunately, platforms with wchar_t == wchar32_t are uncommon ... | |
249 | Maybe better // Check if there are any User Text Identification Frames (TXXX) at all | |
255 | Stray space in if (...isEmpty() ) |
src/extractors/taglibextractor.cpp | ||
---|---|---|
943 | You should check if the value can be converted to double, and probably also if it is in a sane range. |
src/extractors/taglibextractor.cpp | ||
---|---|---|
50 | Can you do a followup-patch to fix this? |
Thanks for your hard work. This is a really nice addition to audio tags.
I no longer have objections. Please finish to take into account feedback from @bruns.