1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:37:46 +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

@ -58,6 +58,8 @@ public:
virtual String format_name() = 0;
virtual PcmSampleFormat pcm_format() = 0;
Vector<PictureData> const& pictures() const { return m_pictures; };
protected:
StringView m_path;
OwnPtr<Core::Stream::SeekableStream> m_stream;
@ -83,6 +85,7 @@ public:
u16 num_channels() const { return m_plugin->num_channels(); }
String format_name() const { return m_plugin->format_name(); }
u16 bits_per_sample() const { return pcm_bits_per_sample(m_plugin->pcm_format()); }
Vector<PictureData> const& pictures() const { return m_plugin->pictures(); };
private:
static Result<NonnullOwnPtr<LoaderPlugin>, LoaderError> try_create(StringView path);