[PATCH] ogg/vorbis file can also be named *.oga

According to http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions, files with ogg/vorbis data can alo be found in .oga file. I have discovered this yesterday as sound-juicer create now by default .oga file for ogg/vorbis encoded music.

I have cooked a quick patch against latest svn ( 2138 ) on http://www.zarb.org/~misc/moc.oga_support.diff , and I have tested it, it work fine.

According to the wiki of xiph.org, we can also use .oga to store speex content and ogg/flac, but trying to share the extension between the various plugins doesn't work, I am looking at the issue.

I guess the proper solution would be to check the file with can_decode method before running the decoder ?

Thanks, I've added the extension.

The issue with multiple extensions is deeper. More proper players (like mplayer) split their plugins into two categories: demuxers (handling transport formats) and decoders (handling decoding). OGG vorbis is one of formats that requires this: ogg is just a transport protocol, encapsulation for various formats (vorbis, thora, flac, speex etc.). MOC is not able to handle that.

Partially resolved by SVN r2344 and r2346: PreferredDecoders.

This doesn't solve the containers issue, but it does give you
more control over which decoder is selected to handle it.

May be not only the ogg container.
If ".wav" extension is mp3 codec,moc would be suck when play it.

Yes, it applies to all container types. If you choose to give
MP3s a '.wav' extension, setting the UseMIMEMagic configuration
option might help.

As it happens, some progress towards the handling of container
types has been made in the last day in conjunction with other
developments. It remains to be seen if it's a feasible approach,
but it looks promising.

I've now committed r2443 which adds application/ogg streams back in
the PreferredDecoders. I've done this as most users are doing it
themselves anyway.

I've just found commit r2356 breaks Ogg/Vorbis streams. The commit adds application/ogg() into PreferredDecoders. With this value, ICY streams with application/ogg MIME type cannot be played by moc. Error message reads Format not supported.

Documentations states:

The decoder list may be empty, in which case no decoders will be used
for files (and files with that audio format ignored) while Internet
streams will be assessed on the actual content.

However current code obviously cannot assess on the content. Setting application/ogg(vorbis) or application/ogg(*) makes Vorbis streams working again.

Is this behavior intentional (to force user to select from vorbis or speex) or the content assessment is not yet implemented or is this a bug?

It's intentional (for now, anyway). The issue is that an
application/ogg MIME type may not contain audio, or a mix
of audio and other (e.g., Theora). Streams which contain
only audio should (AFAICT) be audio/ogg, but even that
doesn't necessarily mean Vorbis.

So I've set it to a default of empty to let users specify
it as they see fit. When MOC is able to separate format
from codec then a more appropriate default setting can be
made.