After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 151192 - [PATCH] nsf decoder
[PATCH] nsf decoder
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Low enhancement
: 0.10.4
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 166752 (view as bug list)
Depends on:
Blocks: 138435
 
 
Reported: 2004-08-27 08:20 UTC by Johan (not receiving bugmail) Dahlin
Modified: 2006-07-13 15:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tar.gz, needs configure.in and some Makefile.am updates (49.06 KB, application/octet-stream)
2004-08-27 08:22 UTC, Johan (not receiving bugmail) Dahlin
  Details
fixed version (224.89 KB, patch)
2005-03-26 20:56 UTC, Ronald Bultje
needs-work Details | Review

Description Johan (not receiving bugmail) Dahlin 2004-08-27 08:20:42 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/
Comment 1 Johan (not receiving bugmail) Dahlin 2004-08-27 08:22:23 UTC
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)
Comment 2 Ronald Bultje 2004-08-27 21:54:10 UTC
Sweet. Would you mind if I integrate this into ffmpeg? I'm sure they're pretty
interested in having this, too.
Comment 3 Johan (not receiving bugmail) Dahlin 2004-08-27 21:59:05 UTC
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.
Comment 4 Christian Fredrik Kalager Schaller 2004-11-15 11:17:53 UTC
Ronald what is the status of this? Going into ffmpeg? Going in to GStreamer?
Neither?
Comment 5 Ronald Bultje 2004-11-15 11:34:31 UTC
Not sure yet, it's low-priority. I need time. :).
Comment 6 Richard Hoelscher 2005-02-09 05:18:03 UTC
*** Bug 166752 has been marked as a duplicate of this bug. ***
Comment 7 Ronald Bultje 2005-03-26 20:56:37 UTC
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.
Comment 8 Ronald Bultje 2005-03-26 20:59:14 UTC
Nosefart also shows tags, it'd be nice to add support for that, although I won't
hold applying the patch for that only...
Comment 9 Johan (not receiving bugmail) Dahlin 2005-03-29 13:13:57 UTC
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.
Comment 10 Ronald Bultje 2005-03-29 13:17:34 UTC
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...
Comment 11 Tor-björn Claesson 2005-03-29 14:26:43 UTC
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
Comment 12 Ronald Bultje 2005-03-29 14:44:51 UTC
The lib has options for that, but we don't implement them yet. Feel free to send
us a patch. :).
Comment 13 Tor-björn Claesson 2005-05-05 09:55:18 UTC
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!
Comment 14 Andy Wingo 2006-01-27 16:32:38 UTC
The patch needs updating to 0.10 now...
Comment 15 Wim Taymans 2006-07-13 15:08:00 UTC
        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.