diff --git a/scanner/scanner-tag/rgtag.cpp b/scanner/scanner-tag/rgtag.cpp index 0b163b4..613d1a3 100644 --- a/scanner/scanner-tag/rgtag.cpp +++ b/scanner/scanner-tag/rgtag.cpp @@ -52,9 +52,8 @@ clear_txxx_tag(TagLib::ID3v2::Tag *tag, TagLib::String const &tag_name, { TagLib::ID3v2::FrameList l = tag->frameList("TXXX"); for (auto *it : l) { - auto *fr = - dynamic_cast( - it); + auto *fr = dynamic_cast(it); if (fr && fr->description().upper() == tag_name) { if (old_content) { *old_content = parse_string_to_float( @@ -334,30 +333,29 @@ tag_vorbis_comment(char const *filename, char const *extension, struct gain_data_strings gds_opus(&gd_opus); if (is_opus) { - TagLib::ByteVector header = - static_cast(p.first)->packet(0); - double opus_header_gain = /**/ (gd->album_mode ? gd->album_gain : gd->track_gain) - 5.0; int16_t opus_header_gain_int = to_opus_gain(opus_header_gain); - double opus_correction_db = -opus_header_gain_int / 256.0; - - gd_opus = *gd; - adjust_gain_data(&gd_opus, opus_correction_db); - int16_t opus_r128_album_gain_int = to_opus_gain( - gd_opus.album_gain - 5.0); - int16_t opus_r128_track_gain_int = to_opus_gain( - gd_opus.track_gain - 5.0); + { + auto *opus_file = /**/ + static_cast(p.first); + TagLib::ByteVector header = opus_file->packet(0); + header[16] = static_cast( + static_cast(opus_header_gain_int) & 0xff); + header[17] = static_cast( + static_cast(opus_header_gain_int) >> 8); + opus_file->setPacket(0, header); + } - header[16] = static_cast( - static_cast(opus_header_gain_int) & 0xff); - header[17] = static_cast( - static_cast(opus_header_gain_int) >> 8); + gd_opus = *gd; + adjust_gain_data(&gd_opus, -opus_header_gain_int / 256.0); - static_cast(p.first)->setPacket(0, - header); + int16_t opus_r128_album_gain_int = /**/ + to_opus_gain(gd_opus.album_gain - 5.0); + int16_t opus_r128_track_gain_int = /**/ + to_opus_gain(gd_opus.track_gain - 5.0); p.second->addField("R128_TRACK_GAIN", std::to_string(opus_r128_track_gain_int));