[SDL] SDL_mixer is recognizing MP3 as MOD

Nikos Chantziaras realnc at arcor.de
Mon Jul 18 04:23:56 PDT 2011


On 07/18/2011 11:48 AM, Ryan C. Gordon wrote:
>
>> So I suppose there's no interest in including this in SDL_mixer?
>
> I think this patch should only check the magic if it needs to, instead
> of filling in the magic based on the requested type.
>
>[...]
>
> The patch is better done like this...
>
> if (want == MUS_NONE)
> {
> // only do i/o and string manipulation if we have to...
> load_magic();
> if (strcmp(magic, "OggS") == 0)
> want = MUS_OGG;
> }
>
> // later...
>
> if (want == MUS_OGG)
> set_up_ogg_stuff();
>
> Otherwise, I think the concept is good. If you clean that up, I'll
> commit the patch.

I went for something minimal.  For doing it "the right way", the patch 
is a bit longer:

The auto-detection is now performed by detect_music_type() (static 
helper).  This is intended to also be used by Mix_LoadMUS() in order to 
avoid the current code duplication.  I didn't change Mix_LoadMUS() 
though; if this patch is good enough to be committed, I will follow with 
another that will deal with Mix_LoadMUS().

I am attaching the new patch.  I'm not sure if the coding style follows 
your preferences, since it seems SDL_mixer's code does not follow a 
single style throughout, but deviates a bit (mostly spacing) so I was 
not sure which one to use.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mustype_support_v2.patch
Type: text/x-patch
Size: 9033 bytes
Desc: not available
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20110718/58ee26f6/attachment-0008.bin>


More information about the SDL mailing list