mpd-notification icon indicating copy to clipboard operation
mpd-notification copied to clipboard

add support for formats other than MP3

Open lukaswrz opened this issue 2 years ago • 3 comments

libavformat supports many more formats than just MP3 (see ffmpeg -formats), so I think it makes sense to avoid checking the MIME type of the file. This means that other widely-used formats such as FLAC and Opus would also be supported by mpd-notification.

If the file can't be recognized by libavformat, the call to avformat_open_input would simply fail and the rest of the program can move on. I have tested this and it works for me without any issues.

I'm curious as to why it's looking up the MIME type in the first place... Am I missing something important here?

lukaswrz avatar Mar 08 '22 21:03 lukaswrz

Hmm, did not know that FLAC and Opus do support embedded cover artwork... Will have to look into this myself, can't remember why I used libmagic to limit support for mp3 files...

eworm-de avatar Mar 08 '22 21:03 eworm-de

Hmm, did not know that FLAC and Opus do support embedded cover artwork... Will have to look into this myself, can't remember why I used libmagic to limit support for mp3 files...

It might be a slightly faster way to see if you can load an image, but it doesn't seem neccesary.

fwsmit avatar Mar 12 '22 23:03 fwsmit

It might be a slightly faster way to see if you can load an image

I don't notice any performance difference on my machine (ThinkPad X240).

If anything, the MIME check would only add extra overhead because the file has to be read twice if it's an MP3 file (once to get the MIME type by reading the magic number, and once again to get the cover art with libavformat), regardless of whether or not cover art is present.

lukaswrz avatar Mar 13 '22 13:03 lukaswrz