GNOME Bugzilla – Bug 151192
[PATCH] nsf decoder
Last modified: 2006-07-13 15:08:00 UTC
nsf is a music format used to playback songs from nintendo 8-bit (NES) games. You can find some example songs on http://www.zophar.net/nsf/
Created attachment 31002 [details] tar.gz, needs configure.in and some Makefile.am updates It seems like it's currently broken, but it used to work, but I'm submitting it here anyway so it's not lost. Probably trivial to make it work again. (perhaps a signed issue)
Sweet. Would you mind if I integrate this into ffmpeg? I'm sure they're pretty interested in having this, too.
Not at all. note that I did not write the actual nsf decoder, it's called nosefart and can be downloaded /somewhere/. No official library release though.
Ronald what is the status of this? Going into ffmpeg? Going in to GStreamer? Neither?
Not sure yet, it's low-priority. I need time. :).
*** Bug 166752 has been marked as a duplicate of this bug. ***
Created attachment 39296 [details] [review] fixed version Johan, you added compile fixes for type referencing, but forgot to assign variables. what happens, is that this: char buffer; for (i = 0; i < large_number; i++) { if (16bit) { (*(int16*)buffer)++ = x; } else { (*(uint8*)buffer)++ = (x>>8)^0x80; } } becomes this: char *buffer; for (i = 0; i < large_number; i++) { if (16bit) { int16 *t = buffer; *t++ = x; } else { uint8 *t = buffer; *t++ = (x>>8)^0x80; } } with the side-effect that you continuously write into the first byte of the buffer. Took me a while to figure that out. Anyway, it works now, also in Totem. However, the multi-tune thing is annoying, because apps such as Totem cannot really handle that. Also, it silences after EOS. How do I handle that? I don't want to apply it like this yet.
Nosefart also shows tags, it'd be nice to add support for that, although I won't hold applying the patch for that only...
Ronald: Big thanks for fixing this! I'm obviously clueless about reference counting and tricky pointer management. You could change so when EOS is recieved the next track is played. Beware that it's not uncommon with tracks with an unlimited length. To solve this we need to have a max-length property (or similar) which stops after n seconds. Most other nfs player has a similar property. This is also useful for other console music decoders (sid, spc, etc) with similar "features". I also noticed that a new release of nosefart was released since I wrote that plugin. Perhaps the copied code should be updated to the latest version. I can do this when time permits.
I already looked, there were no interesting code changes. As for EOS: the problem is that there *is* no EOS. Or at least I cannot find it... So we just emit silence for eternity...
This sounds great and you should have a lot of kudos for adding this support. Now a question: When you write down nsf-tunes so that you can play them in your band, it is of great help to be able to mute channels and to change the playback speed. Will this be possible? Have fun and thanks for writing great software! Tor-björn
The lib has options for that, but we don't implement them yet. Feel free to send us a patch. :).
Where can I learn how to do that? I am totally unfamiliar with gstreamer sources, a pointer would be nice. You people are making truly wounderful stuff!
The patch needs updating to 0.10 now...
Based on patches by: Johan Dahlin <johan at gnome dot org> Ronald Bultje <rbultje at ronald dot bitfreak dot net> * configure.ac: * gst/nsf/Makefile.am: * gst/nsf/dis6502.h: * gst/nsf/fds_snd.c: * gst/nsf/fds_snd.h: * gst/nsf/fmopl.c: * gst/nsf/fmopl.h: * gst/nsf/gstnsf.c: * gst/nsf/gstnsf.h: * gst/nsf/log.c: * gst/nsf/log.h: * gst/nsf/memguard.c: * gst/nsf/memguard.h: * gst/nsf/mmc5_snd.c: * gst/nsf/mmc5_snd.h: * gst/nsf/nes6502.c: * gst/nsf/nes6502.h: * gst/nsf/nes_apu.c: * gst/nsf/nes_apu.h: * gst/nsf/nsf.c: * gst/nsf/nsf.h: * gst/nsf/osd.h: * gst/nsf/types.h: * gst/nsf/vrc7_snd.c: * gst/nsf/vrc7_snd.h: * gst/nsf/vrcvisnd.c: * gst/nsf/vrcvisnd.h: Added NSF decoder plugin. Fixes 151192.