Repository: xbmc/xbmc
File: xbmc/music/tags/TagLoaderTagLib.cpp (C++)

Code before:
                           | transform(toChapterFrame) // cast
                           | filter([](auto* p) { return p; }); // keep non‑null

      std::size_t chapNumber = 0;
      for (auto* chapFrame : chapterFrames)
      {
        ChapterDetails chapter;

        // Title - music db will generate a localised "chapter xx" if no title here
        if (auto list = chapFrame->embeddedFrameList("TIT2"); !list.isEmpty())
          chapter.name = list[0]->toString().toCString(true);

        // Timing - all times are in Milliseconds
        const std::chrono::milliseconds startTimeMs(chapFrame->startTime());
        std::chrono::milliseconds endTimeMs(chapFrame->endTime());

        // Make sure the very last chapter runs to EOF
        if (chapNumber == static_cast<std::size_t>(std::ranges::distance(chapterFrames) - 1))
          endTimeMs = totalLenMs;

        chapter.startTimeMs = startTimeMs;
        chapter.endTimeMs = endTimeMs;

        CLog::Log(LOGDEBUG, "CTagLoaderTagLib - Chapter {}, {} start point {}, endpoint {}",
                  chapNumber + 1, chapter.name, startTimeMs.count(), endTimeMs.count());
        chapters.emplace_back(chapter);
        ++chapNumber;
      }

      tag.SetChapterMarks(chapters);
    }
    else if (CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_logLevel == LOG_LEVEL_MAX)
      CLog::Log(LOGDEBUG, "unrecognized ID3 frame detected: {}{}{}{}", it->first[0], it->first[1],
                it->first[2], it->first[3]);
  } // for

  // Process the extracted picture frames; 0 = CoverArt, 1 = Other, 2 = First Found picture
  for (const ID3v2::AttachedPictureFrame* const picture : pictures)
    if (picture)
    {
      std::string  mime =            picture->mimeType().to8Bit(true);
#if (TAGLIB_MAJOR_VERSION >= 2)
      unsigned int size =            picture->picture().size();
#else
      TagLib::uint size =            picture->picture().size();
#endif
      tag.SetCoverArtInfo(size, mime);
      if (art)
        art->Set(reinterpret_cast<const uint8_t*>(picture->picture().data()), size, mime);

      // Stop after we find the first picture for now.

Review comment (suggestion):
Adding a `std::move` here would make me very happy :slightly_smiling_face: 

Code after:
                           | transform(toChapterFrame) // cast
                           | filter([](auto* p) { return p; }); // keep non‑null

      std::size_t chapNumber = 0;
      for (auto* chapFrame : chapterFrames)
      {
        ChapterDetails chapter;

        // Title - music db will generate a localised "chapter xx" if no title here
        if (auto list = chapFrame->embeddedFrameList("TIT2"); !list.isEmpty())
          chapter.name = list[0]->toString().toCString(true);

        // Timing - all times are in Milliseconds
        const std::chrono::milliseconds startTimeMs(chapFrame->startTime());
        std::chrono::milliseconds endTimeMs(chapFrame->endTime());

        // Make sure the very last chapter runs to EOF
        if (chapNumber == static_cast<std::size_t>(std::ranges::distance(chapterFrames) - 1))
          endTimeMs = totalLenMs;

        chapter.startTimeMs = startTimeMs;
        chapter.endTimeMs = endTimeMs;

        CLog::Log(LOGDEBUG, "CTagLoaderTagLib - Chapter {}, {} start point {}, endpoint {}",
                  chapNumber + 1, chapter.name, startTimeMs.count(), endTimeMs.count());
        chapters.emplace_back(std::move(chapter));
        ++chapNumber;
      }

      tag.SetChapterMarks(chapters);
    }
    else if (CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_logLevel == LOG_LEVEL_MAX)
      CLog::Log(LOGDEBUG, "unrecognized ID3 frame detected: {}{}{}{}", it->first[0], it->first[1],
                it->first[2], it->first[3]);
  } // for

  // Process the extracted picture frames; 0 = CoverArt, 1 = Other, 2 = First Found picture
  for (const ID3v2::AttachedPictureFrame* const picture : pictures)
    if (picture)
    {
      std::string  mime =            picture->mimeType().to8Bit(true);
#if (TAGLIB_MAJOR_VERSION >= 2)
      unsigned int size =            picture->picture().size();
#else
      TagLib::uint size =            picture->picture().size();
#endif
      tag.SetCoverArtInfo(size, mime);
      if (art)
        art->Set(reinterpret_cast<const uint8_t*>(picture->picture().data()), size, mime);

      // Stop after we find the first picture for now.