MusicPlayerDaemon / MPD

Music Player Daemon
https://www.musicpd.org/
GNU General Public License v2.0
2.18k stars 352 forks source link

Read .spc files inside zip archive #1507

Open SeaOrb opened 2 years ago

SeaOrb commented 2 years ago

Feature request

MPD is perfectly capable of playing .spc files using the "game emulator" plugin gme. Most of these files are small and better in an archive like zip. Currently MPD doesn't recognise .spc files inside zip archives.

Thanks

ostrosablin commented 2 years ago

While improvement might seem substantial in percentage (with zip using maximum deflate compression, I get 40% reduction of disk space), in reality, you get a very marginal disk space economy. E.g. for Super Mario RPG, I get 16.8 MB decompressed and 10.3 MB compressed. One decompressed game with 267 .spc files roughly takes as much disk space as single FLAC track.

First of all - it's pretty useless to compress ripped game music into zip archives. For instance, using 7-zip (.7z) archive, i get 387 KB of disk space used. Now this is real space-effective (about 44 times the space reduction, because 7-zip archives leverage similarity not only within same file, but between individual files, too).

Arguably, such feature is not worth the development effort invested, since diskspace today is so cheap, that even SSDs usually come with hundreds of GBs of usable diskspace, zip benefit is rather unimpressive and primary use-case for MPD is playing waveform music that hardly has any benefit from zipped.

But if you're on Linux and have really strict disk space restrictions (e.g. Raspberry Pi with 16 GB SD card) - you can leverage the archivemount or fuse-archive - you can just mount your zip archives (or 7z, or tar.zst) with music as read-only filesystem and MPD will read music files from it entirely transparently, without even knowing that it works with archive, just like it would with a regular folder.

jprjr commented 2 years ago

One issue: SPC uses the GME plugin, which decodes multi-track formats like NSF.

I think you could implement reading SPC from zip files by implementing a stream reader, but I don't think that would extend to NSF, GBS, etc. As far as I can tell, container-type plugins only support local files - I don't see a container scanning method that accepts an InputStream.

Also, assuming one were to implement a stream decoder - NSF/GBS/etc rely heavily on M3U sidecar files. I don't see any decoder plugins that open a side InputStream for sidecar-type data like that.

One idea might be to separate those separate-track-per-file types (SPC, VGM, VGZ, GYM) into a different plugin since those would be safe to decode/scan as streams, and don't rely on sidecar files.