1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:27:43 +00:00

SoundPlayer: Load cover image from music files

When the visualization is set to "Album Cover", the player will now try
to load the embedded image. On failure, it defaults to a "Cover" image
file in the directory.

In Player::play_file_path, file_name_changed now needs to be executed
after that the loader have been set, to get the correct image.
This commit is contained in:
Lucas CHOLLET 2022-10-04 01:07:18 +02:00 committed by Andrew Kaster
parent 27539440df
commit 7649feb26f
8 changed files with 58 additions and 10 deletions

View file

@ -14,6 +14,7 @@ class AlbumCoverVisualizationWidget final : public VisualizationWidget {
C_OBJECT(AlbumCoverVisualizationWidget)
public:
AlbumCoverVisualizationWidget(Function<RefPtr<Gfx::Bitmap>()> get_file_cover_from_player);
~AlbumCoverVisualizationWidget() override = default;
void start_new_file(StringView) override;
@ -23,6 +24,9 @@ private:
AlbumCoverVisualizationWidget() = default;
ErrorOr<NonnullRefPtr<Gfx::Bitmap>> get_album_cover(StringView const filename);
Function<RefPtr<Gfx::Bitmap>()> m_get_file_cover_from_player;
RefPtr<Gfx::Bitmap> m_serenity_bg;
RefPtr<Gfx::Bitmap> m_album_cover;
RefPtr<Gfx::Bitmap> m_file_cover;
};