sailfishos-applications / flowplayer

Music Player for SailfishOS
https://openrepos.net/content/olf/flowplayer
Other
6 stars 7 forks source link

[Suggestion] Add `jpg` and `png` as supported file suffixes for cover art #78

Open Olf0 opened 8 months ago

Olf0 commented 8 months ago

Currently the C++ code only supports the file suffix jpeg and jpg, see https://github.com/search?q=repo%3Asailfishos-applications%2Fflowplayer+path%3A%2F%5Esrc%5C%2F%2F+media-art%2Falbum&type=code

All these location might be altered to also accept png. Note that only this code section is already prepared for this: https://github.com/sailfishos-applications/flowplayer/pull/75/files#diff-380f2b4fb214da5db2e2f6c4d0c1f8d22f2d74b1fbe40671cb3966c6900fc6b6R217-R232

dcaliste commented 8 months ago

One solution would be to transcode the PNG into a JPEG file in the routine looking for cover art. I mean, copy (as done now) if the source file is a JPEG one, and use QImage to transcode into a JPEG if the source file is in a different format.

Olf0 commented 8 months ago

One solution would be to transcode the PNG into a JPEG file in the routine looking for cover art. I mean, copy (as done now) if the source file is a JPEG one, and use QImage to transcode into a JPEG if the source file is in a different format.

Absolutely true, that would alleviate the need to alter many code locations, the only drawback is the loss of image quality, which can become well visible if an image contains high contrast edges.

Olf0 commented 8 months ago

Thinking about it, technically it would be better to transform al cover art into a lossless compressing format: The best candidate is likely PNG.

This still would be not very intrusive (simply exchanging the extension JPEG with PNG at all these locations), but might require a migration function, or discarding and rebuilding the cover art cache.