summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am29
-rw-r--r--about.txt5
-rw-r--r--cdumb.c198
-rw-r--r--cgme.c104
-rw-r--r--configure.ac10
-rw-r--r--deadbeef.h68
-rw-r--r--junklib.c1
-rw-r--r--main.c37
-rw-r--r--md5/md5.c886
-rw-r--r--md5/md5.h266
-rw-r--r--md5/md5_loc.h106
-rw-r--r--moduleconf.h1
-rw-r--r--playlist.c505
-rw-r--r--playlist.h66
-rw-r--r--plugins.c81
-rw-r--r--plugins.h12
-rw-r--r--plugins/adplug/adplug-db.cpp134
-rw-r--r--plugins/adplug/plugin.c12
-rw-r--r--plugins/cdda/cdda.c171
-rw-r--r--plugins/ffap/ffap.c187
-rw-r--r--plugins/ffmpeg/ffmpeg.c257
-rw-r--r--plugins/flac/flac.c406
-rw-r--r--plugins/gtkui/callbacks.c5
-rw-r--r--plugins/gtkui/gtkui.c67
-rw-r--r--plugins/lastfm/lastfm.c4
-rw-r--r--plugins/mpgmad/mpgmad.c435
-rw-r--r--plugins/oss/oss.c1
-rw-r--r--plugins/sid/Makefile.am12
-rw-r--r--plugins/sid/csid.cpp (renamed from csid.cpp)249
-rw-r--r--plugins/sid/csid.h39
-rw-r--r--plugins/sid/plugin.c54
-rw-r--r--plugins/sid/sidplay-libs/Makefile.am (renamed from sid/sidplay-libs-2.1.0/Makefile.am)30
-rw-r--r--plugins/sid/sidplay-libs/aclocal.m4 (renamed from sid/sidplay-libs-2.1.0/aclocal.m4)0
-rw-r--r--plugins/sid/sidplay-libs/builders/Makefile.am (renamed from sid/sidplay-libs-2.1.0/builders/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/builders/Makefile.in (renamed from sid/sidplay-libs-2.1.0/builders/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/Makefile.am (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/Makefile.in (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/acinclude.m4 (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/acinclude.m4)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/aclocal.m4 (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/aclocal.m4)0
-rwxr-xr-xplugins/sid/sidplay-libs/builders/resid-builder/configure (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/configure)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/configure.ac (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/configure.ac)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/include/Makefile.am (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/include/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/include/Makefile.in (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/include/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/include/config.h (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/include/config.h)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/Makefile.am (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/include/sidplay/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/Makefile.in (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/include/sidplay/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/builders/Makefile.am (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/include/sidplay/builders/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/builders/Makefile.in (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/include/sidplay/builders/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/builders/resid.h (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/include/sidplay/builders/resid.h)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/src/Makefile.am (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/src/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/src/Makefile.in (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/src/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/src/resid-builder.cpp (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/src/resid-builder.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/src/resid-emu.h (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/src/resid-emu.h)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/src/resid.cpp (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/src/resid.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/unix/Makefile.am (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/unix/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/unix/Makefile.in (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/unix/Makefile.in)0
-rwxr-xr-xplugins/sid/sidplay-libs/builders/resid-builder/unix/config.guess (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/unix/config.guess)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/unix/config.h.in (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/unix/config.h.in)0
-rwxr-xr-xplugins/sid/sidplay-libs/builders/resid-builder/unix/config.sub (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/unix/config.sub)0
-rwxr-xr-xplugins/sid/sidplay-libs/builders/resid-builder/unix/depcomp (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/unix/depcomp)0
-rwxr-xr-xplugins/sid/sidplay-libs/builders/resid-builder/unix/install-sh (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/unix/install-sh)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/unix/ltmain.sh (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/unix/ltmain.sh)0
-rwxr-xr-xplugins/sid/sidplay-libs/builders/resid-builder/unix/missing (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/unix/missing)0
-rwxr-xr-xplugins/sid/sidplay-libs/builders/resid-builder/unix/mkinstalldirs (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/unix/mkinstalldirs)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/unix/my_macros.m4 (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/unix/my_macros.m4)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/unix/sidplay2.m4 (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/unix/sidplay2.m4)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/win/VC/config.h (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/win/VC/config.h)0
-rw-r--r--plugins/sid/sidplay-libs/builders/resid-builder/win/VC/resid_builder.dsp (renamed from sid/sidplay-libs-2.1.0/builders/resid-builder/win/VC/resid_builder.dsp)0
-rwxr-xr-xplugins/sid/sidplay-libs/configure (renamed from sid/sidplay-libs-2.1.0/configure)0
-rw-r--r--plugins/sid/sidplay-libs/configure.ac (renamed from sid/sidplay-libs-2.1.0/configure.ac)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/AUTHORS (renamed from sid/sidplay-libs-2.1.0/libsidplay/AUTHORS)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/COPYING (renamed from sid/sidplay-libs-2.1.0/libsidplay/COPYING)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/ChangeLog (renamed from sid/sidplay-libs-2.1.0/libsidplay/ChangeLog)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/INSTALL (renamed from sid/sidplay-libs-2.1.0/libsidplay/INSTALL)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidplay/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidplay/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/README (renamed from sid/sidplay-libs-2.1.0/libsidplay/README)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/TODO (renamed from sid/sidplay-libs-2.1.0/libsidplay/TODO)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/aclocal.m4 (renamed from sid/sidplay-libs-2.1.0/libsidplay/aclocal.m4)0
-rwxr-xr-xplugins/sid/sidplay-libs/libsidplay/configure (renamed from sid/sidplay-libs-2.1.0/libsidplay/configure)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/configure.ac (renamed from sid/sidplay-libs-2.1.0/libsidplay/configure.ac)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/config.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/config.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidenv.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/sidenv.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidplay/Buffer.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/Buffer.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidplay/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidplay/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidplay/SidTune.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/SidTune.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidplay/SmartPtr.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/SmartPtr.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidplay/c64env.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/c64env.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidplay/component.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/component.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidplay/event.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/event.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidplay/sid2types.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sid2types.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidbuilder.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidbuilder.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidconfig.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidconfig.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidendian.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidendian.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidint.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidint.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidplay2.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidplay2.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidtypes.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidtypes.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidusage.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidusage.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/c64/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/c64/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/c64/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/c64/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/c64/c64cia.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/c64/c64cia.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/c64/c64vic.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/c64/c64vic.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/c64/c64xsid.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/c64/c64xsid.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/config.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/config.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/event.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/event.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/kernal.bin (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/kernal.bin)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mixer.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mixer.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos6510/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos6510/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos6510/conf6510.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/conf6510.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/cycle_based/mos6510c.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.i (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/cycle_based/mos6510c.i)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/sid6510c.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/cycle_based/sid6510c.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/sid6510c.i (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/cycle_based/sid6510c.i)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos6510/mos6510.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/mos6510.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos6510/mos6510.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/mos6510.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos6510/opcodes.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/opcodes.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos6526/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos6526/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos6526/mos6526.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/mos6526.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos6526/mos6526.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/mos6526.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos656x/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos656x/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos656x/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos656x/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos656x/mos656x.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos656x/mos656x.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/mos656x/mos656x.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/mos656x/mos656x.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/nullsid.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/nullsid.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/player.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/player.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/player.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/player.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/poweron.bin (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/poweron.bin)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/psiddrv.a65 (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/psiddrv.a65)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/psiddrv.bin (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/psiddrv.bin)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/psiddrv.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/psiddrv.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/reloc65.c (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/reloc65.c)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sid6526/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sid6526/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sid6526/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sid6526/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sid6526/sid6526.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sid6526/sid6526.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sid6526/sid6526.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sid6526/sid6526.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidplay2.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sidplay2.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/IconInfo.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/IconInfo.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/InfoFile.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/InfoFile.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/MUS.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/MUS.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/PP20.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/PP20.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/PP20.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/PP20.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/PP20_Defs.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/PP20_Defs.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/PSID.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/PSID.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTune.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/SidTune.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneCfg.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/SidTuneCfg.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneTools.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/SidTuneTools.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneTools.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/SidTuneTools.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/xsid/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/xsid/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/xsid/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/xsid/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/xsid/xsid.cpp (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/xsid/xsid.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/src/xsid/xsid.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/src/xsid/xsid.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/unix/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/unix/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/unix/ac_compile_check_sizeof.m4 (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/ac_compile_check_sizeof.m4)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/unix/ac_create_stdint_h.m4 (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/ac_create_stdint_h.m4)0
-rwxr-xr-xplugins/sid/sidplay-libs/libsidplay/unix/config.guess (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/config.guess)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/unix/config.h.in (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/config.h.in)0
-rwxr-xr-xplugins/sid/sidplay-libs/libsidplay/unix/config.sub (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/config.sub)0
-rwxr-xr-xplugins/sid/sidplay-libs/libsidplay/unix/depcomp (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/depcomp)0
-rwxr-xr-xplugins/sid/sidplay-libs/libsidplay/unix/install-sh (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/install-sh)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/unix/libsidplay2.pc.in (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/libsidplay2.pc.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/unix/libsidplay2.spec (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/libsidplay2.spec)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/unix/libsidplay2.spec.in (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/libsidplay2.spec.in)0
-rwxr-xr-xplugins/sid/sidplay-libs/libsidplay/unix/ltmain.sh (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/ltmain.sh)0
-rwxr-xr-xplugins/sid/sidplay-libs/libsidplay/unix/missing (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/missing)0
-rwxr-xr-xplugins/sid/sidplay-libs/libsidplay/unix/mkinstalldirs (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/mkinstalldirs)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/unix/my_macros.m4 (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/my_macros.m4)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/unix/sidconfig.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/sidconfig.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/unix/sidconfig.h.in (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/sidconfig.h.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/unix/sidint.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/unix/sidint.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/win/VC/config.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/win/VC/config.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/win/VC/libsidplay.dsp (renamed from sid/sidplay-libs-2.1.0/libsidplay/win/VC/libsidplay.dsp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/win/VC/sidconfig.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/win/VC/sidconfig.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidplay/win/VC/sidint.h (renamed from sid/sidplay-libs-2.1.0/libsidplay/win/VC/sidint.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/AUTHORS (renamed from sid/sidplay-libs-2.1.0/libsidutils/AUTHORS)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/COPYING (renamed from sid/sidplay-libs-2.1.0/libsidutils/COPYING)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/ChangeLog (renamed from sid/sidplay-libs-2.1.0/libsidutils/ChangeLog)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/INSTALL (renamed from sid/sidplay-libs-2.1.0/libsidutils/INSTALL)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidutils/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidutils/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/README (renamed from sid/sidplay-libs-2.1.0/libsidutils/README)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/TODO (renamed from sid/sidplay-libs-2.1.0/libsidutils/TODO)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/aclocal.m4 (renamed from sid/sidplay-libs-2.1.0/libsidutils/aclocal.m4)0
-rwxr-xr-xplugins/sid/sidplay-libs/libsidutils/configure (renamed from sid/sidplay-libs-2.1.0/libsidutils/configure)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/configure.ac (renamed from sid/sidplay-libs-2.1.0/libsidutils/configure.ac)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/include/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidutils/include/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/include/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidutils/include/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/include/config.h (renamed from sid/sidplay-libs-2.1.0/libsidutils/include/config.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/include/sidplay/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/include/sidplay/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/SidDatabase.h (renamed from sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/SidDatabase.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/SidFilter.h (renamed from sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/SidFilter.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/SidTuneMod.h (renamed from sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/SidTuneMod.h)0
-rwxr-xr-xplugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/SidUsage.h (renamed from sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/SidUsage.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/libini.h (renamed from sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/libini.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/MD5/MD5.cpp (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/MD5/MD5.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/MD5/MD5.h (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/MD5/MD5.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/MD5/MD5_Defs.h (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/MD5/MD5_Defs.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/MD5/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/MD5/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/MD5/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/MD5/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/SidDatabase.cpp (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/SidDatabase.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/SidFilter.cpp (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/SidFilter.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/SidTuneMod.cpp (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/SidTuneMod.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/SidUsage.cpp (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/SidUsage.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/ini/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/ini/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/ini/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/ini/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/ini/headings.h (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/ini/headings.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/ini/headings.i (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/ini/headings.i)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/ini/ini.cpp (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/ini/ini.cpp)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/ini/ini.h (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/ini/ini.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/ini/keys.h (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/ini/keys.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/ini/keys.i (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/ini/keys.i)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/ini/list.h (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/ini/list.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/ini/list.i (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/ini/list.i)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/ini/types.i (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/ini/types.i)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/src/smm0.h (renamed from sid/sidplay-libs-2.1.0/libsidutils/src/smm0.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/unix/Makefile.am (renamed from sid/sidplay-libs-2.1.0/libsidutils/unix/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/unix/Makefile.in (renamed from sid/sidplay-libs-2.1.0/libsidutils/unix/Makefile.in)0
-rwxr-xr-xplugins/sid/sidplay-libs/libsidutils/unix/config.guess (renamed from sid/sidplay-libs-2.1.0/libsidutils/unix/config.guess)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/unix/config.h.in (renamed from sid/sidplay-libs-2.1.0/libsidutils/unix/config.h.in)0
-rwxr-xr-xplugins/sid/sidplay-libs/libsidutils/unix/config.sub (renamed from sid/sidplay-libs-2.1.0/libsidutils/unix/config.sub)0
-rwxr-xr-xplugins/sid/sidplay-libs/libsidutils/unix/depcomp (renamed from sid/sidplay-libs-2.1.0/libsidutils/unix/depcomp)0
-rwxr-xr-xplugins/sid/sidplay-libs/libsidutils/unix/install-sh (renamed from sid/sidplay-libs-2.1.0/libsidutils/unix/install-sh)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/unix/libsidutils.pc.in (renamed from sid/sidplay-libs-2.1.0/libsidutils/unix/libsidutils.pc.in)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/unix/libsidutils.spec (renamed from sid/sidplay-libs-2.1.0/libsidutils/unix/libsidutils.spec)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/unix/libsidutils.spec.in (renamed from sid/sidplay-libs-2.1.0/libsidutils/unix/libsidutils.spec.in)0
-rwxr-xr-xplugins/sid/sidplay-libs/libsidutils/unix/ltmain.sh (renamed from sid/sidplay-libs-2.1.0/libsidutils/unix/ltmain.sh)0
-rwxr-xr-xplugins/sid/sidplay-libs/libsidutils/unix/missing (renamed from sid/sidplay-libs-2.1.0/libsidutils/unix/missing)0
-rwxr-xr-xplugins/sid/sidplay-libs/libsidutils/unix/mkinstalldirs (renamed from sid/sidplay-libs-2.1.0/libsidutils/unix/mkinstalldirs)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/unix/my_macros.m4 (renamed from sid/sidplay-libs-2.1.0/libsidutils/unix/my_macros.m4)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/unix/sidplay2.m4 (renamed from sid/sidplay-libs-2.1.0/libsidutils/unix/sidplay2.m4)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/win/VC/config.h (renamed from sid/sidplay-libs-2.1.0/libsidutils/win/VC/config.h)0
-rw-r--r--plugins/sid/sidplay-libs/libsidutils/win/VC/libsidutils.dsp (renamed from sid/sidplay-libs-2.1.0/libsidutils/win/VC/libsidutils.dsp)0
-rw-r--r--plugins/sid/sidplay-libs/resid/AUTHORS (renamed from sid/sidplay-libs-2.1.0/resid/AUTHORS)0
-rw-r--r--plugins/sid/sidplay-libs/resid/COPYING (renamed from sid/sidplay-libs-2.1.0/resid/COPYING)0
-rw-r--r--plugins/sid/sidplay-libs/resid/ChangeLog (renamed from sid/sidplay-libs-2.1.0/resid/ChangeLog)0
-rw-r--r--plugins/sid/sidplay-libs/resid/INSTALL (renamed from sid/sidplay-libs-2.1.0/resid/INSTALL)0
-rw-r--r--plugins/sid/sidplay-libs/resid/Makefile.am (renamed from sid/sidplay-libs-2.1.0/resid/Makefile.am)0
-rw-r--r--plugins/sid/sidplay-libs/resid/Makefile.in (renamed from sid/sidplay-libs-2.1.0/resid/Makefile.in)0
-rw-r--r--plugins/sid/sidplay-libs/resid/NEWS (renamed from sid/sidplay-libs-2.1.0/resid/NEWS)0
-rw-r--r--plugins/sid/sidplay-libs/resid/README (renamed from sid/sidplay-libs-2.1.0/resid/README)0
-rw-r--r--plugins/sid/sidplay-libs/resid/THANKS (renamed from sid/sidplay-libs-2.1.0/resid/THANKS)0
-rw-r--r--plugins/sid/sidplay-libs/resid/TODO (renamed from sid/sidplay-libs-2.1.0/resid/TODO)0
-rw-r--r--plugins/sid/sidplay-libs/resid/aclocal.m4 (renamed from sid/sidplay-libs-2.1.0/resid/aclocal.m4)0
-rwxr-xr-xplugins/sid/sidplay-libs/resid/config.guess (renamed from sid/sidplay-libs-2.1.0/resid/config.guess)0
-rwxr-xr-xplugins/sid/sidplay-libs/resid/config.sub (renamed from sid/sidplay-libs-2.1.0/resid/config.sub)0
-rwxr-xr-xplugins/sid/sidplay-libs/resid/configure (renamed from sid/sidplay-libs-2.1.0/resid/configure)0
-rw-r--r--plugins/sid/sidplay-libs/resid/configure.in (renamed from sid/sidplay-libs-2.1.0/resid/configure.in)0
-rw-r--r--plugins/sid/sidplay-libs/resid/depcomp (renamed from sid/sidplay-libs-2.1.0/resid/depcomp)0
-rw-r--r--plugins/sid/sidplay-libs/resid/envelope.cc (renamed from sid/sidplay-libs-2.1.0/resid/envelope.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/envelope.h (renamed from sid/sidplay-libs-2.1.0/resid/envelope.h)0
-rw-r--r--plugins/sid/sidplay-libs/resid/extfilt.cc (renamed from sid/sidplay-libs-2.1.0/resid/extfilt.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/extfilt.h (renamed from sid/sidplay-libs-2.1.0/resid/extfilt.h)0
-rw-r--r--plugins/sid/sidplay-libs/resid/filter.cc (renamed from sid/sidplay-libs-2.1.0/resid/filter.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/filter.h (renamed from sid/sidplay-libs-2.1.0/resid/filter.h)0
-rwxr-xr-xplugins/sid/sidplay-libs/resid/install-sh (renamed from sid/sidplay-libs-2.1.0/resid/install-sh)0
-rw-r--r--plugins/sid/sidplay-libs/resid/ltmain.sh (renamed from sid/sidplay-libs-2.1.0/resid/ltmain.sh)0
-rwxr-xr-xplugins/sid/sidplay-libs/resid/missing (renamed from sid/sidplay-libs-2.1.0/resid/missing)0
-rwxr-xr-xplugins/sid/sidplay-libs/resid/mkinstalldirs (renamed from sid/sidplay-libs-2.1.0/resid/mkinstalldirs)0
-rw-r--r--plugins/sid/sidplay-libs/resid/pot.cc (renamed from sid/sidplay-libs-2.1.0/resid/pot.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/pot.h (renamed from sid/sidplay-libs-2.1.0/resid/pot.h)0
-rwxr-xr-xplugins/sid/sidplay-libs/resid/samp2src.pl (renamed from sid/sidplay-libs-2.1.0/resid/samp2src.pl)0
-rw-r--r--plugins/sid/sidplay-libs/resid/sid.cc (renamed from sid/sidplay-libs-2.1.0/resid/sid.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/sid.h (renamed from sid/sidplay-libs-2.1.0/resid/sid.h)0
-rw-r--r--plugins/sid/sidplay-libs/resid/siddefs.h (renamed from sid/sidplay-libs-2.1.0/resid/siddefs.h)0
-rw-r--r--plugins/sid/sidplay-libs/resid/siddefs.h.in (renamed from sid/sidplay-libs-2.1.0/resid/siddefs.h.in)0
-rw-r--r--plugins/sid/sidplay-libs/resid/spline.h (renamed from sid/sidplay-libs-2.1.0/resid/spline.h)0
-rw-r--r--plugins/sid/sidplay-libs/resid/version.cc (renamed from sid/sidplay-libs-2.1.0/resid/version.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/voice.cc (renamed from sid/sidplay-libs-2.1.0/resid/voice.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/voice.h (renamed from sid/sidplay-libs-2.1.0/resid/voice.h)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave.cc (renamed from sid/sidplay-libs-2.1.0/resid/wave.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave.h (renamed from sid/sidplay-libs-2.1.0/resid/wave.h)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave6581_PST.cc (renamed from sid/sidplay-libs-2.1.0/resid/wave6581_PST.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave6581_PST.dat (renamed from sid/sidplay-libs-2.1.0/resid/wave6581_PST.dat)bin4096 -> 4096 bytes
-rw-r--r--plugins/sid/sidplay-libs/resid/wave6581_PS_.cc (renamed from sid/sidplay-libs-2.1.0/resid/wave6581_PS_.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave6581_PS_.dat (renamed from sid/sidplay-libs-2.1.0/resid/wave6581_PS_.dat)bin4096 -> 4096 bytes
-rw-r--r--plugins/sid/sidplay-libs/resid/wave6581_P_T.cc (renamed from sid/sidplay-libs-2.1.0/resid/wave6581_P_T.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave6581_P_T.dat (renamed from sid/sidplay-libs-2.1.0/resid/wave6581_P_T.dat)bin4096 -> 4096 bytes
-rw-r--r--plugins/sid/sidplay-libs/resid/wave6581__ST.cc (renamed from sid/sidplay-libs-2.1.0/resid/wave6581__ST.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave6581__ST.dat (renamed from sid/sidplay-libs-2.1.0/resid/wave6581__ST.dat)bin4096 -> 4096 bytes
-rw-r--r--plugins/sid/sidplay-libs/resid/wave8580_PST.cc (renamed from sid/sidplay-libs-2.1.0/resid/wave8580_PST.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave8580_PST.dat (renamed from sid/sidplay-libs-2.1.0/resid/wave8580_PST.dat)bin4096 -> 4096 bytes
-rw-r--r--plugins/sid/sidplay-libs/resid/wave8580_PS_.cc (renamed from sid/sidplay-libs-2.1.0/resid/wave8580_PS_.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave8580_PS_.dat (renamed from sid/sidplay-libs-2.1.0/resid/wave8580_PS_.dat)bin4096 -> 4096 bytes
-rw-r--r--plugins/sid/sidplay-libs/resid/wave8580_P_T.cc (renamed from sid/sidplay-libs-2.1.0/resid/wave8580_P_T.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave8580_P_T.dat (renamed from sid/sidplay-libs-2.1.0/resid/wave8580_P_T.dat)bin4096 -> 4096 bytes
-rw-r--r--plugins/sid/sidplay-libs/resid/wave8580__ST.cc (renamed from sid/sidplay-libs-2.1.0/resid/wave8580__ST.cc)0
-rw-r--r--plugins/sid/sidplay-libs/resid/wave8580__ST.dat (renamed from sid/sidplay-libs-2.1.0/resid/wave8580__ST.dat)bin4096 -> 4096 bytes
-rwxr-xr-xplugins/sid/sidplay-libs/unix/config.guess (renamed from sid/sidplay-libs-2.1.0/unix/config.guess)0
-rw-r--r--plugins/sid/sidplay-libs/unix/config.h (renamed from sid/sidplay-libs-2.1.0/unix/config.h)0
-rwxr-xr-xplugins/sid/sidplay-libs/unix/config.sub (renamed from sid/sidplay-libs-2.1.0/unix/config.sub)0
-rwxr-xr-xplugins/sid/sidplay-libs/unix/depcomp (renamed from sid/sidplay-libs-2.1.0/unix/depcomp)0
-rwxr-xr-xplugins/sid/sidplay-libs/unix/install-sh (renamed from sid/sidplay-libs-2.1.0/unix/install-sh)0
-rwxr-xr-xplugins/sid/sidplay-libs/unix/ltmain.sh (renamed from sid/sidplay-libs-2.1.0/unix/ltmain.sh)0
-rwxr-xr-xplugins/sid/sidplay-libs/unix/missing (renamed from sid/sidplay-libs-2.1.0/unix/missing)0
-rwxr-xr-xplugins/sid/sidplay-libs/unix/mkinstalldirs (renamed from sid/sidplay-libs-2.1.0/unix/mkinstalldirs)0
-rw-r--r--plugins/sndfile/sndfile.c152
-rw-r--r--plugins/vorbis/vorbis.c217
-rw-r--r--plugins/vtx/vtx.c163
-rw-r--r--plugins/wavpack/wavpack.c131
-rw-r--r--session.c50
-rw-r--r--session.h3
-rw-r--r--streamer.c463
-rw-r--r--streamer.h17
-rw-r--r--vfs.c4
319 files changed, 2809 insertions, 2830 deletions
diff --git a/.gitignore b/.gitignore
index a741d25e..bf040115 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,3 +35,4 @@ m4
*.la
*.lo
deadbeef.desktop
+.vimrc
diff --git a/Makefile.am b/Makefile.am
index ff3363b0..1f2df71e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,30 +1,27 @@
-SUBDIRS = gme/Game_Music_Emu-0.5.2\
+SUBDIRS = ${MPGMAD_DIR}\
+ gme/Game_Music_Emu-0.5.2\
gme/Game_Music_Emu-0.5.2/gme\
- sid/sidplay-libs-2.1.0\
- dumb\
pixmaps\
icons\
- plugins/ffap\
plugins/nullout\
+ plugins/sid\
+ plugins/ffap\
plugins/vtx\
plugins/adplug\
${HOTKEYS_DIR}\
${ALSA_DIR}\
${LFM_DIR}\
- ${MPGMAD_DIR}\
+ ${VFS_CURL_DIR}\
+ ${GTKUI_DIR}\
${VORBIS_DIR}\
+ ${FFMPEG_DIR}\
${FLAC_DIR}\
- ${WAVPACK_DIR}\
${SNDFILE_DIR}\
- ${VFS_CURL_DIR}\
+ ${WAVPACK_DIR}\
${CDDA_DIR}\
- ${GTKUI_DIR}\
- ${FFMPEG_DIR}\
${OSS_DIR}
-# ${NOTIFY_DIR}
dumbpath=@top_srcdir@/dumb
-sidpath=@top_srcdir@/sid/sidplay-libs-2.1.0
gmepath=@top_srcdir@/gme/Game_Music_Emu-0.5.2
bin_PROGRAMS = deadbeef
@@ -36,24 +33,24 @@ deadbeef_SOURCES =\
streamer.c streamer.h\
messagepump.c messagepump.h\
conf.c conf.h\
- cgme.c cdumb.c csid.cpp\
playback.h\
threading_pthread.c threading.h\
- md5/md5.c md5/md5.h md5/md5_loc.h\
volume.c volume.h\
session.h session.c \
junklib.h junklib.c utf8.c utf8.h\
optmath.h\
vfs.c vfs.h vfs_stdio.c\
- timeline.c timeline.h
+ timeline.c timeline.h\
+ cgme.c cdumb.c\
+ md5/md5.c md5/md5.h
sdkdir = $(pkgincludedir)
sdk_HEADERS = deadbeef.h
-deadbeef_LDADD = $(LDADD) $(DEPS_LIBS) $(ICONV_LIB) gme/Game_Music_Emu-0.5.2/gme/libgme.a sid/sidplay-libs-2.1.0/libsidplay2.a dumb/libdumb.a -lstdc++ -lm
+deadbeef_LDADD = $(LDADD) $(DEPS_LIBS) gme/Game_Music_Emu-0.5.2/gme/libgme.a dumb/libdumb.a -lstdc++ -lm
AM_CFLAGS = $(DEPS_CFLAGS) -I$(gmepath) -std=c99
-AM_CPPFLAGS = $(DEPS_CFLAGS) -I$(sidpath)/libsidplay/include -I$(sidpath)/builders/resid-builder/include
+AM_CPPFLAGS = $(DEPS_CFLAGS)
docsdir = $(docdir)
diff --git a/about.txt b/about.txt
index ed21c764..305a375c 100644
--- a/about.txt
+++ b/about.txt
@@ -59,11 +59,6 @@ Game_Music_Emu Version 0.5.2
Copyright © 2003-2006 Shay Green.
-Functions to compute MD5 message digest of files or memory blocks
-Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
-Modified by Gray Watson <http://256.com/gray/>, 1997.
-
-
libsidplay2 - commodore 64 SID emulation library
Copyright © Simon White and other authors.
diff --git a/cdumb.c b/cdumb.c
index 2eee3695..e66761fa 100644
--- a/cdumb.c
+++ b/cdumb.c
@@ -30,9 +30,12 @@
static DB_decoder_t plugin;
static DB_functions_t *deadbeef;
-static int dumb_initialized;
-static DUH *duh;
-static DUH_SIGRENDERER *renderer;
+typedef struct {
+ DB_fileinfo_t info;
+ DUH *duh;
+ DUH_SIGRENDERER *renderer;
+} dumb_info_t;
+
//#define DUMB_RQ_ALIASING
//#define DUMB_RQ_LINEAR
//#define DUMB_RQ_CUBIC
@@ -40,55 +43,18 @@ static DUH_SIGRENDERER *renderer;
extern int dumb_resampling_quality;
extern int dumb_it_max_to_mix;
-static void
-cdumb_free (void);
-
static int
-cdumb_startrenderer (void);
+cdumb_startrenderer (DB_fileinfo_t *_info);
static DUH*
open_module(const char *fname, const char *ext, int *start_order, int *is_it, int *is_dos, const char **filetype);
-static DUMBFILE_SYSTEM dumb_vfs;
-
-static int
-dumb_vfs_skip (void *f, long n) {
- return deadbeef->fseek (f, n, SEEK_CUR);
-}
-
-static int
-dumb_vfs_getc (void *f) {
- uint8_t c;
- deadbeef->fread (&c, 1, 1, f);
- return (int)c;
-}
-
-static long
-dumb_vfs_getnc (char *ptr, long n, void *f) {
- return deadbeef->fread (ptr, 1, n, f);
-}
-
-static void
-dumb_vfs_close (void *f) {
- deadbeef->fclose (f);
-}
-
-static void
-dumb_register_db_vfs (void) {
- dumb_vfs.open = (void *(*)(const char *))deadbeef->fopen;
- dumb_vfs.skip = dumb_vfs_skip;
- dumb_vfs.getc = dumb_vfs_getc;
- dumb_vfs.getnc = dumb_vfs_getnc;
- dumb_vfs.close = dumb_vfs_close;
- register_dumbfile_system (&dumb_vfs);
-}
-
-static int
+static DB_fileinfo_t *
cdumb_init (DB_playItem_t *it) {
- if (!dumb_initialized) {
- atexit (&dumb_exit);
- }
- dumb_register_db_vfs ();
+ trace ("cdumb_init %s\n", it->fname);
+ DB_fileinfo_t *_info = malloc (sizeof (dumb_info_t));
+ dumb_info_t *info = (dumb_info_t *)_info;
+ memset (_info, 0, sizeof (dumb_info_t));
int start_order = 0;
int is_dos, is_it;
@@ -98,36 +64,39 @@ cdumb_init (DB_playItem_t *it) {
}
ext++;
const char *ftype;
- duh = open_module(it->fname, ext, &start_order, &is_it, &is_dos, &ftype);
+ info->duh = open_module(it->fname, ext, &start_order, &is_it, &is_dos, &ftype);
- dumb_it_do_initial_runthrough (duh);
+ dumb_it_do_initial_runthrough (info->duh);
- plugin.info.bps = 16;
- plugin.info.channels = 2;
- plugin.info.samplerate = deadbeef->get_output ()->samplerate ();
- plugin.info.readpos = 0;
+ _info->plugin = &plugin;
+ _info->bps = 16;
+ _info->channels = 2;
+ _info->samplerate = deadbeef->conf_get_int ("synth.samplerate", 48000);
+ _info->readpos = 0;
- if (cdumb_startrenderer () < 0) {
- return -1;
+ if (cdumb_startrenderer (_info) < 0) {
+ plugin.free (_info);
+ return NULL;
}
- return 0;
+ trace ("cdumb_init success (ptr=%p)\n", _info);
+ return _info;
}
static int
-cdumb_startrenderer (void) {
+cdumb_startrenderer (DB_fileinfo_t *_info) {
+ dumb_info_t *info = (dumb_info_t *)_info;
// reopen
- if (renderer) {
- duh_end_sigrenderer (renderer);
- renderer = NULL;
+ if (info->renderer) {
+ duh_end_sigrenderer (info->renderer);
+ info->renderer = NULL;
}
- renderer = duh_start_sigrenderer (duh, 0, 2, 0);
- if (!renderer) {
- cdumb_free ();
+ info->renderer = duh_start_sigrenderer (info->duh, 0, 2, 0);
+ if (!info->renderer) {
return -1;
}
- DUMB_IT_SIGRENDERER *itsr = duh_get_it_sigrenderer (renderer);
+ DUMB_IT_SIGRENDERER *itsr = duh_get_it_sigrenderer (info->renderer);
dumb_it_set_loop_callback (itsr, &dumb_it_callback_terminate, NULL);
dumb_it_set_resampling_quality (itsr, 2);
dumb_it_set_xm_speed_zero_callback (itsr, &dumb_it_callback_terminate, NULL);
@@ -136,37 +105,49 @@ cdumb_startrenderer (void) {
}
static void
-cdumb_free (void) {
- if (renderer) {
- duh_end_sigrenderer (renderer);
- renderer = NULL;
- }
- if (duh) {
- unload_duh (duh);
- duh = NULL;
+cdumb_free (DB_fileinfo_t *_info) {
+ trace ("cdumb_free %p\n", _info);
+ dumb_info_t *info = (dumb_info_t *)_info;
+ if (info) {
+ if (info->renderer) {
+ duh_end_sigrenderer (info->renderer);
+ info->renderer = NULL;
+ }
+ if (info->duh) {
+ unload_duh (info->duh);
+ info->duh = NULL;
+ }
+ free (info);
}
}
static int
-cdumb_read (char *bytes, int size) {
+cdumb_read (DB_fileinfo_t *_info, char *bytes, int size) {
+ trace ("cdumb_read req %d\n", size);
+ dumb_info_t *info = (dumb_info_t *)_info;
int length = size / 4;
long ret;
- ret = duh_render (renderer, 16, 0, 1, 65536.f / plugin.info.samplerate, length, bytes);
- plugin.info.readpos += ret / (float)plugin.info.samplerate;
+ ret = duh_render (info->renderer, 16, 0, 1, 65536.f / _info->samplerate, length, bytes);
+ _info->readpos += ret / (float)_info->samplerate;
+ trace ("cdumb_read %d\n", ret*4);
return ret*4;
}
static int
-cdumb_seek (float time) {
- if (time < plugin.info.readpos) {
- cdumb_startrenderer ();
+cdumb_seek (DB_fileinfo_t *_info, float time) {
+ trace ("cdumb_read seek %f\n", time);
+ dumb_info_t *info = (dumb_info_t *)_info;
+ if (time < _info->readpos) {
+ if (cdumb_startrenderer (_info) < 0) {
+ return -1;
+ }
}
else {
- time -= plugin.info.readpos;
+ time -= _info->readpos;
}
- int pos = time * plugin.info.samplerate;
- duh_sigrenderer_generate_samples (renderer, 0, 65536.0f / plugin.info.samplerate, pos, NULL);
- plugin.info.readpos = duh_sigrenderer_get_position (renderer) / 65536.f;
+ int pos = time * _info->samplerate;
+ duh_sigrenderer_generate_samples (info->renderer, 0, 65536.0f / _info->samplerate, pos, NULL);
+ _info->readpos = duh_sigrenderer_get_position (info->renderer) / 65536.f;
return 0;
}
@@ -778,14 +759,13 @@ cdumb_insert (DB_playItem_t *after, const char *fname) {
int start_order = 0;
int is_it;
int is_dos;
- dumb_register_db_vfs ();
const char *ftype;
DUH* duh = open_module(fname, ext, &start_order, &is_it, &is_dos, &ftype);
if (!duh) {
return NULL;
}
DB_playItem_t *it = deadbeef->pl_item_alloc ();
- it->decoder = &plugin;
+ it->decoder_id = deadbeef->plug_get_decoder_id (plugin.plugin.id);
it->fname = strdup (fname);
DUMB_IT_SIGDATA * itsd = duh_get_it_sigdata(duh);
if (itsd->name[0]) {
@@ -805,13 +785,59 @@ cdumb_insert (DB_playItem_t *after, const char *fname) {
dumb_it_do_initial_runthrough (duh);
deadbeef->pl_set_item_duration (it, duh_get_length (duh)/65536.0f);
it->filetype = ftype;
-// printf ("duration: %f\n", plugin.info.duration);
+// printf ("duration: %f\n", _info->duration);
after = deadbeef->pl_insert_item (after, it);
unload_duh (duh);
return after;
}
+static DUMBFILE_SYSTEM dumb_vfs;
+
+static int
+dumb_vfs_skip (void *f, long n) {
+ return deadbeef->fseek (f, n, SEEK_CUR);
+}
+
+static int
+dumb_vfs_getc (void *f) {
+ uint8_t c;
+ deadbeef->fread (&c, 1, 1, f);
+ return (int)c;
+}
+
+static long
+dumb_vfs_getnc (char *ptr, long n, void *f) {
+ return deadbeef->fread (ptr, 1, n, f);
+}
+
+static void
+dumb_vfs_close (void *f) {
+ deadbeef->fclose (f);
+}
+
+static void
+dumb_register_db_vfs (void) {
+ dumb_vfs.open = (void *(*)(const char *))deadbeef->fopen;
+ dumb_vfs.skip = dumb_vfs_skip;
+ dumb_vfs.getc = dumb_vfs_getc;
+ dumb_vfs.getnc = dumb_vfs_getnc;
+ dumb_vfs.close = dumb_vfs_close;
+ register_dumbfile_system (&dumb_vfs);
+}
+
+int
+cgme_start (void) {
+ dumb_register_db_vfs ();
+ return 0;
+}
+
+int
+cgme_stop (void) {
+ dumb_exit ();
+ return 0;
+}
+
static const char *filetypes[] = { "IT", "XM", "S3M", "STM", "669", "PTM", "PSM", "MTM", "RIFF", "ASY", "MOD", NULL };
// define plugin interface
@@ -820,18 +846,20 @@ static DB_decoder_t plugin = {
.plugin.version_major = 0,
.plugin.version_minor = 1,
.plugin.type = DB_PLUGIN_DECODER,
+ .plugin.id = "stddumb",
.plugin.name = "DUMB module player",
.plugin.descr = "module player based on DUMB library",
.plugin.author = "Alexey Yakovenko",
.plugin.email = "waker@users.sourceforge.net",
.plugin.website = "http://deadbeef.sf.net",
+ .plugin.start = cgme_start,
+ .plugin.stop = cgme_stop,
.init = cdumb_init,
.free = cdumb_free,
.read_int16 = cdumb_read,
.seek = cdumb_seek,
.insert = cdumb_insert,
.exts = exts,
- .id = "stddumb",
.filetypes = filetypes
};
diff --git a/cgme.c b/cgme.c
index 0f72db80..c953f39d 100644
--- a/cgme.c
+++ b/cgme.c
@@ -24,88 +24,86 @@
static DB_decoder_t plugin;
static DB_functions_t *deadbeef;
-static Music_Emu *emu;
-static int reallength;
-static int nzerosamples;
-static uint32_t cgme_voicemask = 0;
-static float duration; // of current song
+typedef struct {
+ DB_fileinfo_t info;
+ Music_Emu *emu;
+ int reallength;
+ uint32_t cgme_voicemask;
+ float duration; // of current song
+} gme_info_t;
-static int
+static DB_fileinfo_t *
cgme_init (DB_playItem_t *it) {
- int samplerate = deadbeef->get_output ()->samplerate ();
- if (gme_open_file (it->fname, &emu, samplerate)) {
- return -1;
+ DB_fileinfo_t *_info = malloc (sizeof (gme_info_t));
+ gme_info_t *info = (gme_info_t*)_info;
+ memset (_info, 0, sizeof (gme_info_t));
+ int samplerate = deadbeef->conf_get_int ("synth.samplerate", 48000);
+ if (gme_open_file (it->fname, &info->emu, samplerate)) {
+ plugin.free (_info);
+ return NULL;
}
- gme_mute_voices (emu, cgme_voicemask);
- gme_start_track (emu, it->tracknum);
+ gme_mute_voices (info->emu, info->cgme_voicemask);
+ gme_start_track (info->emu, it->tracknum);
+
track_info_t inf;
- gme_track_info (emu, &inf, it->tracknum);
- plugin.info.bps = 16;
- plugin.info.channels = 2;
- plugin.info.samplerate = samplerate;
- duration = deadbeef->pl_get_item_duration (it);
- reallength = inf.length;
- nzerosamples = 0;
- plugin.info.readpos = 0;
- return 0;
+
+ gme_track_info (info->emu, &inf, it->tracknum);
+
+ _info->plugin = &plugin;
+ _info->bps = 16;
+ _info->channels = 2;
+ _info->samplerate = samplerate;
+ info->duration = deadbeef->pl_get_item_duration (it);
+ info->reallength = inf.length;
+ _info->readpos = 0;
+ return _info;
}
static void
-cgme_free (void) {
- if (emu) {
- gme_delete (emu);
- emu = NULL;
+cgme_free (DB_fileinfo_t *_info) {
+ gme_info_t *info = (gme_info_t*)_info;
+ if (info->emu) {
+ gme_delete (info->emu);
}
+ free (info);
}
static int
-cgme_read (char *bytes, int size) {
- float t = (size/4) / (float)plugin.info.samplerate;
- if (plugin.info.readpos + t >= duration) {
- t = duration - plugin.info.readpos;
+cgme_read (DB_fileinfo_t *_info, char *bytes, int size) {
+ gme_info_t *info = (gme_info_t*)_info;
+ float t = (size/4) / (float)_info->samplerate;
+ if (_info->readpos + t >= info->duration) {
+ t = info->duration - _info->readpos;
if (t <= 0) {
return 0;
}
// DON'T ajust size, buffer must always be po2
- //size = t * (float)plugin.info.samplerate * 4;
+ //size = t * (float)info->samplerate * 4;
}
- if (gme_play (emu, size/2, (short*)bytes)) {
+ if (gme_play (info->emu, size/2, (short*)bytes)) {
return 0;
}
- plugin.info.readpos += t;
- if (reallength == -1) {
- // check if whole buffer is zeroes
- int i;
- for (i = 0; i < size; i++) {
- if (bytes[i]) {
- break;
- }
- }
- if (i == size) {
- nzerosamples += size / 4;
- if (nzerosamples > plugin.info.samplerate * 4) {
- return 0;
- }
- }
- else {
- nzerosamples = 0;
+ _info->readpos += t;
+ if (info->reallength == -1) {
+ if (gme_track_ended (info->emu)) {
+ return 0;
}
}
return size;
}
static int
-cgme_seek (float time) {
- if (gme_seek (emu, (long)(time * 1000))) {
+cgme_seek (DB_fileinfo_t *_info, float time) {
+ gme_info_t *info = (gme_info_t*)_info;
+ if (gme_seek (info->emu, (long)(time * 1000))) {
return -1;
}
- plugin.info.readpos = time;
+ _info->readpos = time;
return 0;
}
static DB_playItem_t *
cgme_insert (DB_playItem_t *after, const char *fname) {
-// printf ("adding %s chiptune\n", fname);
Music_Emu *emu;
if (!gme_open_file (fname, &emu, gme_info_only)) {
int cnt = gme_track_count (emu);
@@ -114,7 +112,7 @@ cgme_insert (DB_playItem_t *after, const char *fname) {
const char *ret = gme_track_info (emu, &inf, i);
if (!ret) {
DB_playItem_t *it = deadbeef->pl_item_alloc ();
- it->decoder = &plugin;
+ it->decoder_id = deadbeef->plug_get_decoder_id (plugin.plugin.id);
it->fname = strdup (fname);
char str[1024];
if (inf.song[0]) {
@@ -224,6 +222,7 @@ static DB_decoder_t plugin = {
.plugin.version_major = 0,
.plugin.version_minor = 1,
.plugin.type = DB_PLUGIN_DECODER,
+ .plugin.id = "stdgme",
.plugin.name = "Game_Music_Emu decoder",
.plugin.descr = "chiptune music player based on GME",
.plugin.author = "Alexey Yakovenko",
@@ -238,7 +237,6 @@ static DB_decoder_t plugin = {
.seek = cgme_seek,
.insert = cgme_insert,
.exts = exts,
- .id = "stdgme",
.filetypes = exts
};
diff --git a/configure.ac b/configure.ac
index 9de8cf6b..9af176be 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@ AC_INIT
AC_CONFIG_HEADER(config.h)
PACKAGE="deadbeef"
-VERSION="0.3.3"
+VERSION="devel"
AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
@@ -38,8 +38,11 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
dnl INSANE_CFLAGS="-Wcomment -Wchar-subscripts -Wunused-function -Wunused-value -Wuninitialized -Wtype-limits -Wbad-function-cast"
dnl INSANE_CXXFLAGS="-Wcomment -Wchar-subscripts -Wunused-function -Wunused-value -Wuninitialized -Wtype-limits"
+AC_SUBST(INSANE_CFLAGS)
+AC_SUBST(INSANE_CXXFLAGS)
+
CXXFLAGS="$CXXFLAGS $INSANE_CXXFLAGS -D_GNU_SOURCE -DLIBDIR=\\\"$libdir\\\" -DPREFIX=\\\"$prefix\\\" -DDOCDIR=\\\"$docdir\\\""
-CFLAGS="$CFLAGS $INSANE_CFLAGS -D_GNU_SOURCE -DLIBDIR=\\\"$libdir\\\" -DPREFIX=\\\"$prefix\\\" -DDOCDIR=\\\"$docdir\\\""
+CFLAGS="$CFLAGS $INSANE_CFLAGS -D_GNU_SOURCE -DLIBDIR=\\\"$libdir\\\" -DPREFIX=\\\"$prefix\\\" -DDOCDIR=\\\"$docdir\\\" -std=c99"
PKG_CHECK_MODULES(DEPS, samplerate)
PKG_CHECK_MODULES(GTKUI_DEPS, gtk+-2.0 >= 2.12 gthread-2.0 glib-2.0, HAVE_GTK=1, NO_GTK=1)
@@ -297,7 +300,7 @@ pixmaps/Makefile
icons/Makefile
gme/Game_Music_Emu-0.5.2/Makefile
gme/Game_Music_Emu-0.5.2/gme/Makefile
-sid/sidplay-libs-2.1.0/Makefile
+plugins/sid/sidplay-libs/Makefile
dumb/Makefile
plugins/alsa/Makefile
plugins/hotkeys/Makefile
@@ -315,6 +318,7 @@ plugins/nullout/Makefile
plugins/vtx/Makefile
plugins/adplug/Makefile
plugins/ffmpeg/Makefile
+plugins/sid/Makefile
plugins/oss/Makefile
deadbeef.desktop
])
diff --git a/deadbeef.h b/deadbeef.h
index 14404eda..585fe3f2 100644
--- a/deadbeef.h
+++ b/deadbeef.h
@@ -53,6 +53,7 @@ extern "C" {
// DON'T release plugins without DB_PLUGIN_SET_API_VERSION
// api version history:
+// 0.7 -- devel
// 0.6 -- deadbeef-0.3.3
// 0.5 -- deadbeef-0.3.2
// 0.4 -- deadbeef-0.3.0
@@ -61,12 +62,14 @@ extern "C" {
// 0.1 -- deadbeef-0.2.0
#define DB_API_VERSION_MAJOR 0
-#define DB_API_VERSION_MINOR 6
+#define DB_API_VERSION_MINOR 7
#define DB_PLUGIN_SET_API_VERSION\
.plugin.api_vmajor = DB_API_VERSION_MAJOR,\
.plugin.api_vminor = DB_API_VERSION_MINOR,
+#define MAX_DECODER_PLUGINS 50
+
////////////////////////////
// playlist structures
@@ -79,7 +82,8 @@ extern "C" {
// these are "public" fields, available to plugins
typedef struct {
char *fname; // full pathname
- struct DB_decoder_s *decoder; // codec to use with this file
+// struct DB_decoder_s *decoder; // codec to use with this file
+ const char *decoder_id;
int tracknum; // used for stuff like sid, nsf, cue (will be ignored by most codecs)
int startsample; // start sample of track, or -1 for auto
int endsample; // end sample of track, or -1 for auto
@@ -214,6 +218,11 @@ typedef struct {
struct DB_vfs_s *vfs;
} DB_FILE;
+// md5 calc control structure (see md5/md5.h)
+typedef struct DB_md5_s {
+ char data[70];
+} DB_md5_t;
+
// forward decl for plugin struct
struct DB_plugin_s;
@@ -228,6 +237,9 @@ typedef struct {
// md5sum calc
void (*md5) (uint8_t sig[16], const char *in, int len);
void (*md5_to_str) (char *str, const uint8_t sig[16]);
+ void (*md5_init)(DB_md5_t *s);
+ void (*md5_append)(DB_md5_t *s, const uint8_t *data, int nbytes);
+ void (*md5_finish)(DB_md5_t *s, uint8_t digest[16]);
// playback control
struct DB_output_s* (*get_output) (void);
void (*playback_next) (void);
@@ -249,6 +261,7 @@ typedef struct {
int (*streamer_read) (char *bytes, int size);
void (*streamer_set_bitrate) (int bitrate);
int (*streamer_get_apx_bitrate) (void);
+ struct DB_fileinfo_s *(*streamer_get_current_decoder) (void);
// process control
const char *(*get_config_dir) (void);
void (*quit) (void);
@@ -266,7 +279,8 @@ typedef struct {
int (*cond_broadcast) (uintptr_t cond);
// playlist access
DB_playItem_t * (*pl_item_alloc) (void);
- void (*pl_item_free) (DB_playItem_t *it);
+ void (*pl_item_ref) (DB_playItem_t *it);
+ void (*pl_item_unref) (DB_playItem_t *it);
void (*pl_item_copy) (DB_playItem_t *out, DB_playItem_t *in);
int (*pl_add_file) (const char *fname, int (*cb)(DB_playItem_t *it, void *data), void *user_data);
int (*pl_add_dir) (const char *dirname, int (*cb)(DB_playItem_t *it, void *data), void *user_data);
@@ -383,15 +397,8 @@ typedef struct {
struct DB_output_s **(*plug_get_output_list) (void);
struct DB_plugin_s **(*plug_get_list) (void);
int (*plug_activate) (struct DB_plugin_s *p, int activate);
- // exporting plugin conf options for gui
- // all exported options are grouped by plugin, and will be available to user
- // from gui
-// void (*export_plugin_option_string) (DB_plugin_t *plugin, const char *key);
-// void (*export_plugin_option_path) (DB_plugin_t *plugin, const char *key);
-// void (*export_plugin_option_check) (DB_plugin_t *plugin, const char *key);
-// void (*export_plugin_option_radio) (DB_plugin_t *plugin, const char *key);
-// void (*export_plugin_option_combo) (DB_plugin_t *plugin, const char *key);
-// void (*export_plugin_option_comboentry) (DB_plugin_t *plugin, const char *key);
+ const char * (*plug_get_decoder_id) (const char *id);
+ void (*plug_remove_decoder_id) (const char *id);
} DB_functions_t;
// base plugin interface
@@ -408,13 +415,16 @@ typedef struct DB_plugin_s {
int inactive;
// prevent plugin from being dynamically stopped
int nostop;
+
// any of those can be left NULL
// though it's much better to fill them with something useful
- const char *name;
- const char *descr;
- const char *author;
- const char *email;
- const char *website;
+ const char *id; // id used for serialization and runtime binding
+ const char *name; // short name
+ const char *descr; // short description
+ const char *author; // author's name
+ const char *email; // author's email
+ const char *website; // author's website
+
// start is called to start plugin; can be NULL
int (*start) (void);
// stop is called to deinit plugin; can be NULL
@@ -429,7 +439,8 @@ typedef struct DB_plugin_s {
const char *configdialog;
} DB_plugin_t;
-typedef struct {
+typedef struct DB_fileinfo_s {
+ struct DB_decoder_s *plugin;
int bps;
int channels;
int samplerate;
@@ -439,45 +450,42 @@ typedef struct {
// decoder plugin
typedef struct DB_decoder_s {
DB_plugin_t plugin;
- DB_fileinfo_t info;
+// DB_fileinfo_t info;
// init is called to prepare song to be started
- int (*init) (DB_playItem_t *it);
+ DB_fileinfo_t *(*init) (DB_playItem_t *it);
// free is called after decoding is finished
- void (*free) (void);
+ void (*free) (DB_fileinfo_t *info);
// read is called by streamer to decode specified number of bytes
// must return number of bytes that were successfully decoded (sample aligned)
// read_int16 must always output 16 bit signed integer samples
- int (*read_int16) (char *buffer, int size);
+ int (*read_int16) (DB_fileinfo_t *info, char *buffer, int size);
// read_float32 must always output 32 bit floating point samples
- int (*read_float32) (char *buffer, int size);
+ int (*read_float32) (DB_fileinfo_t *info, char *buffer, int size);
- int (*seek) (float seconds);
+ int (*seek) (DB_fileinfo_t *info, float seconds);
// perform seeking in samples (if possible)
// return -1 if failed, or 0 on success
// if -1 is returned, that will mean that streamer must skip that song
- int (*seek_sample) (int sample);
+ int (*seek_sample) (DB_fileinfo_t *info, int sample);
// 'insert' is called to insert new item to playlist
// decoder is responsible to calculate duration, split it into subsongs, load cuesheet, etc
// after==NULL means "prepend before 1st item in playlist"
DB_playItem_t * (*insert) (DB_playItem_t *after, const char *fname);
- int (*numvoices) (void);
- void (*mutevoice) (int voice, int mute);
+ int (*numvoices) (DB_fileinfo_t *info);
+ void (*mutevoice) (DB_fileinfo_t *info, int voice, int mute);
// NULL terminated array of all supported extensions
const char **exts;
// NULL terminated array of all file type names
const char **filetypes;
-
- // codec id used for playlist serialization
- const char *id;
} DB_decoder_t;
// output plugin
diff --git a/junklib.c b/junklib.c
index 73e8a041..11270db4 100644
--- a/junklib.c
+++ b/junklib.c
@@ -311,6 +311,7 @@ convstr_id3v2_2to3 (const unsigned char* str, int sz) {
#endif
char *pout = out;
memset (out, 0, sizeof (out));
+ printf ("%p %s %d %d\n", cd, pin, inbytesleft, outbytesleft);
/*size_t res = */iconv (cd, &pin, &inbytesleft, &pout, &outbytesleft);
iconv_close (cd);
ret = out;
diff --git a/main.c b/main.c
index 08be3f60..0e86a29d 100644
--- a/main.c
+++ b/main.c
@@ -67,7 +67,6 @@
char confdir[1024]; // $HOME/.config
char dbconfdir[1024]; // $HOME/.config/deadbeef
char defpl[1024]; // $HOME/.config/deadbeef/default.dbpl
-char sessfile[1024]; // $HOME/.config/deadbeef/session
// client-side commandline support
// -1 error, program must exit with error code -1
@@ -141,7 +140,8 @@ server_exec_command_line (const char *cmdline, int len, char *sendback, int sbsi
}
if (sendback) {
playItem_t *curr = streamer_get_playing_track ();
- if (curr && curr->decoder) {
+ DB_fileinfo_t *dec = streamer_get_current_decoder ();
+ if (curr && dec) {
const char np[] = "nowplaying ";
memcpy (sendback, np, sizeof (np)-1);
pl_format_title (curr, -1, sendback+sizeof(np)-1, sbsize-sizeof(np)+1, -1, parg);
@@ -153,7 +153,8 @@ server_exec_command_line (const char *cmdline, int len, char *sendback, int sbsi
else {
char out[2048];
playItem_t *curr = streamer_get_playing_track ();
- if (curr && curr->decoder) {
+ DB_fileinfo_t *dec = streamer_get_current_decoder ();
+ if (curr && dec) {
pl_format_title (curr, -1, out, sizeof (out), -1, parg);
}
else {
@@ -360,11 +361,11 @@ player_mainloop (void) {
break;
case M_NEXTSONG:
p_stop ();
- pl_nextsong (1);
+ streamer_move_nextsong (1);
break;
case M_PREVSONG:
p_stop ();
- pl_prevsong ();
+ streamer_move_prevsong ();
break;
case M_PAUSESONG:
if (p_get_state () == OUTPUT_STATE_PAUSED) {
@@ -378,7 +379,7 @@ player_mainloop (void) {
break;
case M_PLAYRANDOM:
p_stop ();
- pl_randomsong ();
+ streamer_move_randomsong ();
break;
case M_PLAYLISTREFRESH:
plug_trigger_event_playlistchanged ();
@@ -446,10 +447,6 @@ main (int argc, char *argv[]) {
fprintf (stderr, "fatal: out of memory while configuring\n");
return -1;
}
- if (snprintf (sessfile, sizeof (sessfile), "%s/deadbeef/session", confdir) > sizeof (sessfile)) {
- fprintf (stderr, "fatal: out of memory while configuring\n");
- return -1;
- }
mkdir (confdir, 0755);
if (snprintf (dbconfdir, sizeof (dbconfdir), "%s/deadbeef", confdir) > sizeof (dbconfdir)) {
fprintf (stderr, "fatal: out of memory while configuring\n");
@@ -575,6 +572,8 @@ main (int argc, char *argv[]) {
messagepump_init (); // required to push messages while handling commandline
plug_load_all (); // required to add files to playlist from commandline
+ plt_add (0, "Default");
+
// execute server commands in local context
int noloadpl = 0;
if (argc > 1) {
@@ -604,7 +603,14 @@ main (int argc, char *argv[]) {
pl_load (defpl);
}
plug_trigger_event_playlistchanged ();
- session_load (sessfile);
+// this is old code left for backwards compatibility
+ {
+ char sessfile[1024]; // $HOME/.config/deadbeef/session
+ if (snprintf (sessfile, sizeof (sessfile), "%s/deadbeef/session", confdir) < sizeof (sessfile)) {
+ session_load (sessfile);
+ }
+ }
+
streamer_init ();
// this runs in main thread (blocks right here)
@@ -613,6 +619,12 @@ main (int argc, char *argv[]) {
// save config
pl_save (defpl);
conf_save ();
+ {
+ char sessfile[1024]; // $HOME/.config/deadbeef/session
+ if (snprintf (sessfile, sizeof (sessfile), "%s/deadbeef/session", confdir) < sizeof (sessfile)) {
+ unlink (sessfile);
+ }
+ }
// stop receiving messages from outside
server_close ();
@@ -628,10 +640,11 @@ main (int argc, char *argv[]) {
plug_unload_all ();
// at this point we can simply do exit(0), but let's clean up for debugging
- session_save (sessfile);
pl_free ();
conf_free ();
messagepump_free ();
+ plt_free ();
+ plug_free_decoder_ids ();
sigterm_handled = 1;
fprintf (stderr, "hej-hej!\n");
return 0;
diff --git a/md5/md5.c b/md5/md5.c
index 52e2d07a..c35d96c5 100644
--- a/md5/md5.c
+++ b/md5/md5.c
@@ -1,559 +1,381 @@
/*
- * Functions to compute MD5 message digest of files or memory blocks
- * according to the definition of MD5 in RFC 1321 from April 1992.
- * Copyright (C) 1995, 1996 Free Software Foundation, Inc. NOTE: The
- * canonical source of this file is maintained with the GNU C Library.
- * Bugs can be reported to bug-glibc@prep.ai.mit.edu.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- * Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
- * Modified by Gray Watson <http://256.com/gray/>, 1997.
- *
- */
-
-/*
- * NOTE: during quick performance tests on a Sun Sparc Ultra 1 and an
- * Alpha 255 300, these functions performed upwards of 3mb/sec
- * including disk I/O time.
- */
-
-/*
- * MD5 Test Suite from RFC1321: http://ds.internic.net:/rfc/rfc1321.txt
- *
- * MD5 ("") = d41d8cd98f00b204e9800998ecf8427e
- * MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661
- * MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72
- * MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0
- * MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b
- * MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =
- * d174ab98d277d9f5a5611c2c9f419d9f
- * MD5 ("123456789012345678901234567890123456789012345678901234567890123456
- * 78901234567890") = 57edf4a22be3c955ac49da2e2107b67a
- */
+ Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved.
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
-#include "md5.h"
-#include "md5_loc.h"
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
-/* version id for the library */
-/* static char *version_id = "$MD5Version: 1.0.0 November-19-1997 $"; */
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
-/****************************** local routines *******************************/
+ L. Peter Deutsch
+ ghost@aladdin.com
-/*
- * process_block
- *
- * DESCRIPTION:
- *
- * Process a block of bytes into a MD5 state structure.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure from which we are getting the result.
- *
- * buffer - A buffer of bytes whose MD5 signature we are calculating.
- *
- * buf_len - The length of the buffer.
*/
-static void process_block(md5_t *md5_p, const void *buffer,
- const unsigned int buf_len)
-{
- md5_uint32 correct[16];
- const void *buf_p = buffer, *end_p;
- unsigned int words_n;
- md5_uint32 A, B, C, D;
-
- words_n = buf_len / sizeof(md5_uint32);
- end_p = (char *)buf_p + words_n * sizeof(md5_uint32);
-
- A = md5_p->md_A;
- B = md5_p->md_B;
- C = md5_p->md_C;
- D = md5_p->md_D;
-
- /*
- * First increment the byte count. RFC 1321 specifies the possible
- * length of the file up to 2^64 bits. Here we only compute the
- * number of bytes with a double word increment. Modified to do
- * this to better avoid overflows in the lower word -- Gray 10/97.
- */
- if (md5_p->md_total[0] > MAX_MD5_UINT32 - buf_len) {
- md5_p->md_total[1]++;
- md5_p->md_total[0] -= (MAX_MD5_UINT32 - buf_len);
- }
- else {
- md5_p->md_total[0] += buf_len;
- }
-
- /*
- * Process all bytes in the buffer with MD5_BLOCK bytes in each
- * round of the loop.
- */
- while (buf_p < end_p) {
- md5_uint32 A_save, B_save, C_save, D_save;
- md5_uint32 *corr_p = correct;
-
- A_save = A;
- B_save = B;
- C_save = C;
- D_save = D;
-
- /*
- * Before we start, one word to the strange constants. They are
- * defined in RFC 1321 as
- *
- * T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..MD5_BLOCK
- */
-
- /* Round 1. */
- OP1 (A, B, C, D, buf_p, corr_p, 7, 0xd76aa478);
- OP1 (D, A, B, C, buf_p, corr_p, 12, 0xe8c7b756);
- OP1 (C, D, A, B, buf_p, corr_p, 17, 0x242070db);
- OP1 (B, C, D, A, buf_p, corr_p, 22, 0xc1bdceee);
- OP1 (A, B, C, D, buf_p, corr_p, 7, 0xf57c0faf);
- OP1 (D, A, B, C, buf_p, corr_p, 12, 0x4787c62a);
- OP1 (C, D, A, B, buf_p, corr_p, 17, 0xa8304613);
- OP1 (B, C, D, A, buf_p, corr_p, 22, 0xfd469501);
- OP1 (A, B, C, D, buf_p, corr_p, 7, 0x698098d8);
- OP1 (D, A, B, C, buf_p, corr_p, 12, 0x8b44f7af);
- OP1 (C, D, A, B, buf_p, corr_p, 17, 0xffff5bb1);
- OP1 (B, C, D, A, buf_p, corr_p, 22, 0x895cd7be);
- OP1 (A, B, C, D, buf_p, corr_p, 7, 0x6b901122);
- OP1 (D, A, B, C, buf_p, corr_p, 12, 0xfd987193);
- OP1 (C, D, A, B, buf_p, corr_p, 17, 0xa679438e);
- OP1 (B, C, D, A, buf_p, corr_p, 22, 0x49b40821);
-
- /* Round 2. */
- OP234 (FG, A, B, C, D, correct[ 1], 5, 0xf61e2562);
- OP234 (FG, D, A, B, C, correct[ 6], 9, 0xc040b340);
- OP234 (FG, C, D, A, B, correct[ 11], 14, 0x265e5a51);
- OP234 (FG, B, C, D, A, correct[ 0], 20, 0xe9b6c7aa);
- OP234 (FG, A, B, C, D, correct[ 5], 5, 0xd62f105d);
- OP234 (FG, D, A, B, C, correct[ 10], 9, 0x02441453);
- OP234 (FG, C, D, A, B, correct[ 15], 14, 0xd8a1e681);
- OP234 (FG, B, C, D, A, correct[ 4], 20, 0xe7d3fbc8);
- OP234 (FG, A, B, C, D, correct[ 9], 5, 0x21e1cde6);
- OP234 (FG, D, A, B, C, correct[ 14], 9, 0xc33707d6);
- OP234 (FG, C, D, A, B, correct[ 3], 14, 0xf4d50d87);
- OP234 (FG, B, C, D, A, correct[ 8], 20, 0x455a14ed);
- OP234 (FG, A, B, C, D, correct[ 13], 5, 0xa9e3e905);
- OP234 (FG, D, A, B, C, correct[ 2], 9, 0xfcefa3f8);
- OP234 (FG, C, D, A, B, correct[ 7], 14, 0x676f02d9);
- OP234 (FG, B, C, D, A, correct[ 12], 20, 0x8d2a4c8a);
-
- /* Round 3. */
- OP234 (FH, A, B, C, D, correct[ 5], 4, 0xfffa3942);
- OP234 (FH, D, A, B, C, correct[ 8], 11, 0x8771f681);
- OP234 (FH, C, D, A, B, correct[ 11], 16, 0x6d9d6122);
- OP234 (FH, B, C, D, A, correct[ 14], 23, 0xfde5380c);
- OP234 (FH, A, B, C, D, correct[ 1], 4, 0xa4beea44);
- OP234 (FH, D, A, B, C, correct[ 4], 11, 0x4bdecfa9);
- OP234 (FH, C, D, A, B, correct[ 7], 16, 0xf6bb4b60);
- OP234 (FH, B, C, D, A, correct[ 10], 23, 0xbebfbc70);
- OP234 (FH, A, B, C, D, correct[ 13], 4, 0x289b7ec6);
- OP234 (FH, D, A, B, C, correct[ 0], 11, 0xeaa127fa);
- OP234 (FH, C, D, A, B, correct[ 3], 16, 0xd4ef3085);
- OP234 (FH, B, C, D, A, correct[ 6], 23, 0x04881d05);
- OP234 (FH, A, B, C, D, correct[ 9], 4, 0xd9d4d039);
- OP234 (FH, D, A, B, C, correct[ 12], 11, 0xe6db99e5);
- OP234 (FH, C, D, A, B, correct[ 15], 16, 0x1fa27cf8);
- OP234 (FH, B, C, D, A, correct[ 2], 23, 0xc4ac5665);
-
- /* Round 4. */
- OP234 (FI, A, B, C, D, correct[ 0], 6, 0xf4292244);
- OP234 (FI, D, A, B, C, correct[ 7], 10, 0x432aff97);
- OP234 (FI, C, D, A, B, correct[ 14], 15, 0xab9423a7);
- OP234 (FI, B, C, D, A, correct[ 5], 21, 0xfc93a039);
- OP234 (FI, A, B, C, D, correct[ 12], 6, 0x655b59c3);
- OP234 (FI, D, A, B, C, correct[ 3], 10, 0x8f0ccc92);
- OP234 (FI, C, D, A, B, correct[ 10], 15, 0xffeff47d);
- OP234 (FI, B, C, D, A, correct[ 1], 21, 0x85845dd1);
- OP234 (FI, A, B, C, D, correct[ 8], 6, 0x6fa87e4f);
- OP234 (FI, D, A, B, C, correct[ 15], 10, 0xfe2ce6e0);
- OP234 (FI, C, D, A, B, correct[ 6], 15, 0xa3014314);
- OP234 (FI, B, C, D, A, correct[ 13], 21, 0x4e0811a1);
- OP234 (FI, A, B, C, D, correct[ 4], 6, 0xf7537e82);
- OP234 (FI, D, A, B, C, correct[ 11], 10, 0xbd3af235);
- OP234 (FI, C, D, A, B, correct[ 2], 15, 0x2ad7d2bb);
- OP234 (FI, B, C, D, A, correct[ 9], 21, 0xeb86d391);
-
- /* Add the starting values of the context. */
- A += A_save;
- B += B_save;
- C += C_save;
- D += D_save;
- }
-
- /* Put checksum in context given as argument. */
- md5_p->md_A = A;
- md5_p->md_B = B;
- md5_p->md_C = C;
- md5_p->md_D = D;
-}
-
+/* $Id: md5.c,v 1.6 2002/04/13 19:20:28 lpd Exp $ */
/*
- * md5_get_result
- *
- * DESCRIPTION:
- *
- * Copy the resulting MD5 signature from MD5_P into the first 16 bytes
- * (MD5_SIZE) of the result buffer.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure from which we are getting the result.
- *
- * result - A 16 byte buffer that will contain the MD5 signature.
+ Independent implementation of MD5 (RFC 1321).
+
+ This code implements the MD5 Algorithm defined in RFC 1321, whose
+ text is available at
+ http://www.ietf.org/rfc/rfc1321.txt
+ The code is derived from the text of the RFC, including the test suite
+ (section A.5) but excluding the rest of Appendix A. It does not include
+ any code or documentation that is identified in the RFC as being
+ copyrighted.
+
+ The original and principal author of md5.c is L. Peter Deutsch
+ <ghost@aladdin.com>. Other authors are noted in the change history
+ that follows (in reverse chronological order):
+
+ 2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order
+ either statically or dynamically; added missing #include <string.h>
+ in library.
+ 2002-03-11 lpd Corrected argument list for main(), and added int return
+ type, in test program and T value program.
+ 2002-02-21 lpd Added missing #include <stdio.h> in test program.
+ 2000-07-03 lpd Patched to eliminate warnings about "constant is
+ unsigned in ANSI C, signed in traditional"; made test program
+ self-checking.
+ 1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
+ 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5).
+ 1999-05-03 lpd Original version.
*/
-static void md5_get_result(const md5_t *md5_p, void *result)
-{
- md5_uint32 hold;
- void *res_p = result;
-
- hold = SWAP(md5_p->md_A);
- memcpy(res_p, &hold, sizeof(md5_uint32));
- res_p = (char *)res_p + sizeof(md5_uint32);
-
- hold = SWAP(md5_p->md_B);
- memcpy(res_p, &hold, sizeof(md5_uint32));
- res_p = (char *)res_p + sizeof(md5_uint32);
- hold = SWAP(md5_p->md_C);
- memcpy(res_p, &hold, sizeof(md5_uint32));
- res_p = (char *)res_p + sizeof(md5_uint32);
-
- hold = SWAP(md5_p->md_D);
- memcpy(res_p, &hold, sizeof(md5_uint32));
-}
-
-/***************************** exported routines *****************************/
-
-/*
- * md5_init
- *
- * DESCRIPTION:
- *
- * Initialize structure containing state of MD5 computation. (RFC 1321,
- * 3.3: Step 3). This is for progressive MD5 calculations only. If
- * you have the complete string available, md5_buffer should be used.
- * md5_process should be called for each bunch of bytes and after the
- * last process call, md5_finish should be called to get the
- * signature.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to md5 structure that we are initializing.
- */
-void md5_init(md5_t *md5_p)
-{
- md5_p->md_A = 0x67452301;
- md5_p->md_B = 0xefcdab89;
- md5_p->md_C = 0x98badcfe;
- md5_p->md_D = 0x10325476;
-
- md5_p->md_total[0] = 0;
- md5_p->md_total[1] = 0;
- md5_p->md_buf_len = 0;
-}
+#include "md5.h"
+#include <string.h>
-/*
- * md5_process
- *
- * DESCRIPTION:
- *
- * This function is used to progressively calculate a MD5 signature some
- * number of bytes at a time. If you have the complete string
- * available, md5_buffer should be used. The MD5 structure should
- * have been initialized with md5_init and after the last process
- * call, md5_finish should be called to get the results.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure which we are progressively updating.
- *
- * buffer - A buffer of bytes whose MD5 signature we are calculating.
- *
- * buf_len - The length of the buffer.
- */
-void md5_process(md5_t *md5_p, const void *buffer,
- const unsigned int buf_len)
+#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */
+#ifdef ARCH_IS_BIG_ENDIAN
+# define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1)
+#else
+# define BYTE_ORDER 0
+#endif
+
+#define T_MASK ((md5_word_t)~0)
+#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87)
+#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9)
+#define T3 0x242070db
+#define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111)
+#define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050)
+#define T6 0x4787c62a
+#define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec)
+#define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe)
+#define T9 0x698098d8
+#define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850)
+#define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e)
+#define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841)
+#define T13 0x6b901122
+#define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c)
+#define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71)
+#define T16 0x49b40821
+#define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d)
+#define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf)
+#define T19 0x265e5a51
+#define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855)
+#define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2)
+#define T22 0x02441453
+#define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e)
+#define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437)
+#define T25 0x21e1cde6
+#define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829)
+#define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278)
+#define T28 0x455a14ed
+#define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa)
+#define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07)
+#define T31 0x676f02d9
+#define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375)
+#define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd)
+#define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e)
+#define T35 0x6d9d6122
+#define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3)
+#define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb)
+#define T38 0x4bdecfa9
+#define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f)
+#define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f)
+#define T41 0x289b7ec6
+#define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805)
+#define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a)
+#define T44 0x04881d05
+#define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6)
+#define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a)
+#define T47 0x1fa27cf8
+#define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a)
+#define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb)
+#define T50 0x432aff97
+#define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58)
+#define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6)
+#define T53 0x655b59c3
+#define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d)
+#define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82)
+#define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e)
+#define T57 0x6fa87e4f
+#define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f)
+#define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb)
+#define T60 0x4e0811a1
+#define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d)
+#define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca)
+#define T63 0x2ad7d2bb
+#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e)
+
+
+static void
+md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
{
- unsigned int len = buf_len;
- unsigned int in_block, add;
-
- /*
- * When we already have some bytes in our internal buffer, copy some
- * from the user to fill the block.
- */
- if (md5_p->md_buf_len > 0) {
-
- in_block = md5_p->md_buf_len;
- if (in_block + len > sizeof(md5_p->md_buffer)) {
- add = sizeof(md5_p->md_buffer) - in_block;
- }
- else {
- add = len;
+ md5_word_t
+ a = pms->abcd[0], b = pms->abcd[1],
+ c = pms->abcd[2], d = pms->abcd[3];
+ md5_word_t t;
+#if BYTE_ORDER > 0
+ /* Define storage only for big-endian CPUs. */
+ md5_word_t X[16];
+#else
+ /* Define storage for little-endian or both types of CPUs. */
+ md5_word_t xbuf[16];
+ const md5_word_t *X;
+#endif
+
+ {
+#if BYTE_ORDER == 0
+ /*
+ * Determine dynamically whether this is a big-endian or
+ * little-endian machine, since we can use a more efficient
+ * algorithm on the latter.
+ */
+ static const int w = 1;
+
+ if (*((const md5_byte_t *)&w)) /* dynamic little-endian */
+#endif
+#if BYTE_ORDER <= 0 /* little-endian */
+ {
+ /*
+ * On little-endian machines, we can process properly aligned
+ * data without copying it.
+ */
+ if (!((data - (const md5_byte_t *)0) & 3)) {
+ /* data are properly aligned */
+ X = (const md5_word_t *)data;
+ } else {
+ /* not aligned */
+ memcpy(xbuf, data, 64);
+ X = xbuf;
+ }
+ }
+#endif
+#if BYTE_ORDER == 0
+ else /* dynamic big-endian */
+#endif
+#if BYTE_ORDER >= 0 /* big-endian */
+ {
+ /*
+ * On big-endian machines, we must arrange the bytes in the
+ * right order.
+ */
+ const md5_byte_t *xp = data;
+ int i;
+
+# if BYTE_ORDER == 0
+ X = xbuf; /* (dynamic only) */
+# else
+# define xbuf X /* (static only) */
+# endif
+ for (i = 0; i < 16; ++i, xp += 4)
+ xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
+ }
+#endif
}
- memcpy (md5_p->md_buffer + in_block, buffer, add);
- md5_p->md_buf_len += add;
- in_block += add;
-
- if (in_block > MD5_BLOCK_SIZE) {
- process_block (md5_p, md5_p->md_buffer, in_block & ~BLOCK_SIZE_MASK);
- /* the regions in the following copy operation will not overlap. */
- memcpy (md5_p->md_buffer,
- md5_p->md_buffer + (in_block & ~BLOCK_SIZE_MASK),
- in_block & BLOCK_SIZE_MASK);
- md5_p->md_buf_len = in_block & BLOCK_SIZE_MASK;
- }
+#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
- buffer = (const char *)buffer + add;
- len -= add;
- }
-
- /* process available complete blocks right from the user buffer */
- if (len > MD5_BLOCK_SIZE) {
- process_block (md5_p, buffer, len & ~BLOCK_SIZE_MASK);
- buffer = (const char *) buffer + (len & ~BLOCK_SIZE_MASK);
- len &= BLOCK_SIZE_MASK;
- }
-
- /* copy remaining bytes into the internal buffer */
- if (len > 0) {
- memcpy (md5_p->md_buffer, buffer, len);
- md5_p->md_buf_len = len;
- }
+ /* Round 1. */
+ /* Let [abcd k s i] denote the operation
+ a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */
+#define F(x, y, z) (((x) & (y)) | (~(x) & (z)))
+#define SET(a, b, c, d, k, s, Ti)\
+ t = a + F(b,c,d) + X[k] + Ti;\
+ a = ROTATE_LEFT(t, s) + b
+ /* Do the following 16 operations. */
+ SET(a, b, c, d, 0, 7, T1);
+ SET(d, a, b, c, 1, 12, T2);
+ SET(c, d, a, b, 2, 17, T3);
+ SET(b, c, d, a, 3, 22, T4);
+ SET(a, b, c, d, 4, 7, T5);
+ SET(d, a, b, c, 5, 12, T6);
+ SET(c, d, a, b, 6, 17, T7);
+ SET(b, c, d, a, 7, 22, T8);
+ SET(a, b, c, d, 8, 7, T9);
+ SET(d, a, b, c, 9, 12, T10);
+ SET(c, d, a, b, 10, 17, T11);
+ SET(b, c, d, a, 11, 22, T12);
+ SET(a, b, c, d, 12, 7, T13);
+ SET(d, a, b, c, 13, 12, T14);
+ SET(c, d, a, b, 14, 17, T15);
+ SET(b, c, d, a, 15, 22, T16);
+#undef SET
+
+ /* Round 2. */
+ /* Let [abcd k s i] denote the operation
+ a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */
+#define G(x, y, z) (((x) & (z)) | ((y) & ~(z)))
+#define SET(a, b, c, d, k, s, Ti)\
+ t = a + G(b,c,d) + X[k] + Ti;\
+ a = ROTATE_LEFT(t, s) + b
+ /* Do the following 16 operations. */
+ SET(a, b, c, d, 1, 5, T17);
+ SET(d, a, b, c, 6, 9, T18);
+ SET(c, d, a, b, 11, 14, T19);
+ SET(b, c, d, a, 0, 20, T20);
+ SET(a, b, c, d, 5, 5, T21);
+ SET(d, a, b, c, 10, 9, T22);
+ SET(c, d, a, b, 15, 14, T23);
+ SET(b, c, d, a, 4, 20, T24);
+ SET(a, b, c, d, 9, 5, T25);
+ SET(d, a, b, c, 14, 9, T26);
+ SET(c, d, a, b, 3, 14, T27);
+ SET(b, c, d, a, 8, 20, T28);
+ SET(a, b, c, d, 13, 5, T29);
+ SET(d, a, b, c, 2, 9, T30);
+ SET(c, d, a, b, 7, 14, T31);
+ SET(b, c, d, a, 12, 20, T32);
+#undef SET
+
+ /* Round 3. */
+ /* Let [abcd k s t] denote the operation
+ a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */
+#define H(x, y, z) ((x) ^ (y) ^ (z))
+#define SET(a, b, c, d, k, s, Ti)\
+ t = a + H(b,c,d) + X[k] + Ti;\
+ a = ROTATE_LEFT(t, s) + b
+ /* Do the following 16 operations. */
+ SET(a, b, c, d, 5, 4, T33);
+ SET(d, a, b, c, 8, 11, T34);
+ SET(c, d, a, b, 11, 16, T35);
+ SET(b, c, d, a, 14, 23, T36);
+ SET(a, b, c, d, 1, 4, T37);
+ SET(d, a, b, c, 4, 11, T38);
+ SET(c, d, a, b, 7, 16, T39);
+ SET(b, c, d, a, 10, 23, T40);
+ SET(a, b, c, d, 13, 4, T41);
+ SET(d, a, b, c, 0, 11, T42);
+ SET(c, d, a, b, 3, 16, T43);
+ SET(b, c, d, a, 6, 23, T44);
+ SET(a, b, c, d, 9, 4, T45);
+ SET(d, a, b, c, 12, 11, T46);
+ SET(c, d, a, b, 15, 16, T47);
+ SET(b, c, d, a, 2, 23, T48);
+#undef SET
+
+ /* Round 4. */
+ /* Let [abcd k s t] denote the operation
+ a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */
+#define I(x, y, z) ((y) ^ ((x) | ~(z)))
+#define SET(a, b, c, d, k, s, Ti)\
+ t = a + I(b,c,d) + X[k] + Ti;\
+ a = ROTATE_LEFT(t, s) + b
+ /* Do the following 16 operations. */
+ SET(a, b, c, d, 0, 6, T49);
+ SET(d, a, b, c, 7, 10, T50);
+ SET(c, d, a, b, 14, 15, T51);
+ SET(b, c, d, a, 5, 21, T52);
+ SET(a, b, c, d, 12, 6, T53);
+ SET(d, a, b, c, 3, 10, T54);
+ SET(c, d, a, b, 10, 15, T55);
+ SET(b, c, d, a, 1, 21, T56);
+ SET(a, b, c, d, 8, 6, T57);
+ SET(d, a, b, c, 15, 10, T58);
+ SET(c, d, a, b, 6, 15, T59);
+ SET(b, c, d, a, 13, 21, T60);
+ SET(a, b, c, d, 4, 6, T61);
+ SET(d, a, b, c, 11, 10, T62);
+ SET(c, d, a, b, 2, 15, T63);
+ SET(b, c, d, a, 9, 21, T64);
+#undef SET
+
+ /* Then perform the following additions. (That is increment each
+ of the four registers by the value it had before this block
+ was started.) */
+ pms->abcd[0] += a;
+ pms->abcd[1] += b;
+ pms->abcd[2] += c;
+ pms->abcd[3] += d;
}
-/*
- * md5_finish
- *
- * DESCRIPTION:
- *
- * Finish a progressing MD5 calculation and copy the resulting MD5
- * signature into the result buffer which should be 16 bytes
- * (MD5_SIZE). After this call, the MD5 structure is invalid.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure which we are finishing.
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- */
-void md5_finish(md5_t *md5_p, void *signature)
+void
+md5_init(md5_state_t *pms)
{
- md5_uint32 bytes, hold;
- int pad;
-
- /* take yet unprocessed bytes into account */
- bytes = md5_p->md_buf_len;
-
- /*
- * Count remaining bytes. Modified to do this to better avoid
- * overflows in the lower word -- Gray 10/97.
- */
- if (md5_p->md_total[0] > MAX_MD5_UINT32 - bytes) {
- md5_p->md_total[1]++;
- md5_p->md_total[0] -= (MAX_MD5_UINT32 - bytes);
- }
- else {
- md5_p->md_total[0] += bytes;
- }
-
- /*
- * Pad the buffer to the next MD5_BLOCK-byte boundary. (RFC 1321,
- * 3.1: Step 1). We need enough room for two size words and the
- * bytes left in the buffer. For some reason even if we are equal
- * to the block-size, we add an addition block of pad bytes.
- */
- pad = MD5_BLOCK_SIZE - (sizeof(md5_uint32) * 2) - bytes;
- if (pad <= 0) {
- pad += MD5_BLOCK_SIZE;
- }
-
- /*
- * Modified from a fixed array to this assignment and memset to be
- * more flexible with block-sizes -- Gray 10/97.
- */
- if (pad > 0) {
- /* some sort of padding start byte */
- md5_p->md_buffer[bytes] = (unsigned char)0x80;
- if (pad > 1) {
- memset (md5_p->md_buffer + bytes + 1, 0, pad - 1);
- }
- bytes += pad;
- }
-
- /* put the 64-bit file length in _bits_ (i.e. *8) at the end of the buffer */
- hold = SWAP(md5_p->md_total[0] << 3);
- memcpy(md5_p->md_buffer + bytes, &hold, sizeof(md5_uint32));
- bytes += sizeof(md5_uint32);
-
- /* shift the high word over by 3 and add in the top 3 bits from the low */
- hold = SWAP((md5_p->md_total[1] << 3) | (md5_p->md_total[0] >> 29));
- memcpy(md5_p->md_buffer + bytes, &hold, sizeof(md5_uint32));
- bytes += sizeof(md5_uint32);
-
- /* process last bytes, the padding chars, and size words */
- process_block(md5_p, md5_p->md_buffer, bytes);
- md5_get_result(md5_p, signature);
+ pms->count[0] = pms->count[1] = 0;
+ pms->abcd[0] = 0x67452301;
+ pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
+ pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301;
+ pms->abcd[3] = 0x10325476;
}
-/*
- * md5_buffer
- *
- * DESCRIPTION:
- *
- * This function is used to calculate a MD5 signature for a buffer of
- * bytes. If you only have part of a buffer that you want to process
- * then md5_init, md5_process, and md5_finish should be used.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * buffer - A buffer of bytes whose MD5 signature we are calculating.
- *
- * buf_len - The length of the buffer.
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- */
-void md5_buffer(const char *buffer, const unsigned int buf_len,
- void *signature)
+void
+md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes)
{
- md5_t md5;
-
- /* initialize the computation context */
- md5_init(&md5);
-
- /* process whole buffer but last buf_len % MD5_BLOCK bytes */
- md5_process(&md5, buffer, buf_len);
+ const md5_byte_t *p = data;
+ int left = nbytes;
+ int offset = (pms->count[0] >> 3) & 63;
+ md5_word_t nbits = (md5_word_t)(nbytes << 3);
+
+ if (nbytes <= 0)
+ return;
+
+ /* Update the message length. */
+ pms->count[1] += nbytes >> 29;
+ pms->count[0] += nbits;
+ if (pms->count[0] < nbits)
+ pms->count[1]++;
+
+ /* Process an initial partial block. */
+ if (offset) {
+ int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
+
+ memcpy(pms->buf + offset, p, copy);
+ if (offset + copy < 64)
+ return;
+ p += copy;
+ left -= copy;
+ md5_process(pms, pms->buf);
+ }
- /* put result in desired memory area */
- md5_finish(&md5, signature);
-}
+ /* Process full blocks. */
+ for (; left >= 64; p += 64, left -= 64)
+ md5_process(pms, p);
-/*
- * md5_sig_to_string
- *
- * DESCRIPTION:
- *
- * Convert a MD5 signature in a 16 byte buffer into a hexadecimal string
- * representation.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * signature - a 16 byte buffer that contains the MD5 signature.
- *
- * str - a string of charactes which should be at least 33 bytes long (2
- * characters per MD5 byte and 1 for the \0).
- *
- * str_len - the length of the string.
- */
-void md5_sig_to_string(void *signature, char *str, const int str_len)
-{
- unsigned char *sig_p;
- char *str_p, *max_p;
- unsigned int high, low;
-
- str_p = str;
- max_p = str + str_len;
-
- for (sig_p = (unsigned char *)signature;
- sig_p < (unsigned char *)signature + MD5_SIZE;
- sig_p++) {
- high = *sig_p / 16;
- low = *sig_p % 16;
- /* account for 2 chars */
- if (str_p + 1 >= max_p) {
- break;
- }
- *str_p++ = HEX_STRING[high];
- *str_p++ = HEX_STRING[low];
- }
- /* account for 2 chars */
- if (str_p < max_p) {
- *str_p++ = '\0';
- }
+ /* Process a final partial block. */
+ if (left)
+ memcpy(pms->buf, p, left);
}
-/*
- * md5_sig_from_string
- *
- * DESCRIPTION:
- *
- * Convert a MD5 signature from a hexadecimal string representation into
- * a 16 byte buffer.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- *
- * str - A string of charactes which _must_ be at least 32 bytes long (2
- * characters per MD5 byte).
- */
-void md5_sig_from_string(void *signature, const char *str)
+void
+md5_finish(md5_state_t *pms, md5_byte_t digest[16])
{
- unsigned char *sig_p;
- const char *str_p;
- char *hex;
- unsigned int high, low, val;
-
- hex = HEX_STRING;
- sig_p = signature;
-
- for (str_p = str; str_p < str + MD5_SIZE * 2; str_p += 2) {
- high = strchr(hex, *str_p) - hex;
- low = strchr(hex, *(str_p + 1)) - hex;
- val = high * 16 + low;
- *sig_p++ = val;
- }
+ static const md5_byte_t pad[64] = {
+ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ md5_byte_t data[8];
+ int i;
+
+ /* Save the length before padding. */
+ for (i = 0; i < 8; ++i)
+ data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3));
+ /* Pad to 56 bytes mod 64. */
+ md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
+ /* Append the length. */
+ md5_append(pms, data, 8);
+ for (i = 0; i < 16; ++i)
+ digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
}
diff --git a/md5/md5.h b/md5/md5.h
index de5ddf39..698c995d 100644
--- a/md5/md5.h
+++ b/md5/md5.h
@@ -1,217 +1,91 @@
/*
- * Declaration of functions and data types used for MD5 sum computing
- * library functions. Copyright (C) 1995, 1996 Free Software
- * Foundation, Inc. NOTE: The canonical source of this file is
- * maintained with the GNU C Library. Bugs can be reported to
- * bug-glibc@prep.ai.mit.edu.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- */
+ Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved.
-/*
- * NOTE: during quick performance tests on a sun ultra and an alpha
- * 255 300, the md5 libraries performed upwards of 3mb/sec. That
- * included disk i/o on bobcat and panther.
- */
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
-#ifndef __MD5_H__
-#define __MD5_H__
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
-/*
- * Size of a standard MD5 signature in bytes. This definition is for
- * external programs only. The MD5 routines themselves reference the
- * signature as 4 unsigned 32-bit integers.
- */
-#define MD5_SIZE 16
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
-/*
- * NOTE: the following is assumed to generate a 32-bit unsigned data
- * type.
- */
-typedef unsigned int md5_uint32;
-#define MAX_MD5_UINT32 ((md5_uint32)4294967295U)
+ L. Peter Deutsch
+ ghost@aladdin.com
-/*
- * The MD5 algorithm works on blocks of characters of 64 bytes. This
- * is an internal value only and is not necessary for external use.
*/
-#define MD5_BLOCK_SIZE 64
-
+/* $Id: md5.h,v 1.4 2002/04/13 19:20:28 lpd Exp $ */
/*
- * Structure to save state of computation between the single steps.
+ Independent implementation of MD5 (RFC 1321).
+
+ This code implements the MD5 Algorithm defined in RFC 1321, whose
+ text is available at
+ http://www.ietf.org/rfc/rfc1321.txt
+ The code is derived from the text of the RFC, including the test suite
+ (section A.5) but excluding the rest of Appendix A. It does not include
+ any code or documentation that is identified in the RFC as being
+ copyrighted.
+
+ The original and principal author of md5.h is L. Peter Deutsch
+ <ghost@aladdin.com>. Other authors are noted in the change history
+ that follows (in reverse chronological order):
+
+ 2002-04-13 lpd Removed support for non-ANSI compilers; removed
+ references to Ghostscript; clarified derivation from RFC 1321;
+ now handles byte order either statically or dynamically.
+ 1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
+ 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
+ added conditionalization for C++ compilation from Martin
+ Purschke <purschke@bnl.gov>.
+ 1999-05-03 lpd Original version.
*/
-typedef struct
-{
- md5_uint32 md_A; /* accumulater 1 */
- md5_uint32 md_B; /* accumulater 2 */
- md5_uint32 md_C; /* accumulater 3 */
- md5_uint32 md_D; /* accumulater 4 */
-
- md5_uint32 md_total[2]; /* totaling storage */
- md5_uint32 md_buf_len; /* length of the storage buffer */
- char md_buffer[MD5_BLOCK_SIZE * 2]; /* character storage buffer */
-} md5_t;
-/*<<<<<<<<<< The below prototypes are auto-generated by fillproto */
+#ifndef md5_INCLUDED
+# define md5_INCLUDED
/*
- * md5_init
- *
- * DESCRIPTION:
- *
- * Initialize structure containing state of MD5 computation. (RFC 1321,
- * 3.3: Step 3). This is for progressive MD5 calculations only. If
- * you have the complete string available, md5_buffer should be used.
- * md5_process should be called for each bunch of bytes and after the
- * last process call, md5_finish should be called to get the
- * signature.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to md5 structure that we are initializing.
+ * This package supports both compile-time and run-time determination of CPU
+ * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be
+ * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is
+ * defined as non-zero, the code will be compiled to run only on big-endian
+ * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to
+ * run on either big- or little-endian CPUs, but will run slightly less
+ * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined.
*/
-extern
-void md5_init(md5_t *md5_p);
-/*
- * md5_process
- *
- * DESCRIPTION:
- *
- * This function is used to progressively calculate a MD5 signature some
- * number of bytes at a time. If you have the complete string
- * available, md5_buffer should be used. The MD5 structure should
- * have been initialized with md5_init and after the last process
- * call, md5_finish should be called to get the results.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure which we are progressively updating.
- *
- * buffer - A buffer of bytes whose MD5 signature we are calculating.
- *
- * buf_len - The length of the buffer.
- */
-extern
-void md5_process(md5_t *md5_p, const void *buffer,
- const unsigned int buf_len);
+typedef unsigned char md5_byte_t; /* 8-bit byte */
+typedef unsigned int md5_word_t; /* 32-bit word */
-/*
- * md5_finish
- *
- * DESCRIPTION:
- *
- * Finish a progressing MD5 calculation and copy the resulting MD5
- * signature into the result buffer which should be 16 bytes
- * (MD5_SIZE). After this call, the MD5 structure is invalid.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure which we are finishing.
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- */
-extern
-void md5_finish(md5_t *md5_p, void *signature);
+/* Define the state of the MD5 Algorithm. */
+typedef struct md5_state_s {
+ md5_word_t count[2]; /* message length in bits, lsw first */
+ md5_word_t abcd[4]; /* digest buffer */
+ md5_byte_t buf[64]; /* accumulate block */
+} md5_state_t;
-/*
- * md5_buffer
- *
- * DESCRIPTION:
- *
- * This function is used to calculate a MD5 signature for a buffer of
- * bytes. If you only have part of a buffer that you want to process
- * then md5_init, md5_process, and md5_finish should be used.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * buffer - A buffer of bytes whose MD5 signature we are calculating.
- *
- * buf_len - The length of the buffer.
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- */
-extern
-void md5_buffer(const char *buffer, const unsigned int buf_len,
- void *signature);
+#ifdef __cplusplus
+extern "C"
+{
+#endif
-/*
- * md5_sig_to_string
- *
- * DESCRIPTION:
- *
- * Convert a MD5 signature in a 16 byte buffer into a hexadecimal string
- * representation.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * signature - a 16 byte buffer that contains the MD5 signature.
- *
- * str - a string of charactes which should be at least 33 bytes long (2
- * characters per MD5 byte and 1 for the \0).
- *
- * str_len - the length of the string.
- */
-extern
-void md5_sig_to_string(void *signature, char *str, const int str_len);
+/* Initialize the algorithm. */
+void md5_init(md5_state_t *pms);
-/*
- * md5_sig_from_string
- *
- * DESCRIPTION:
- *
- * Convert a MD5 signature from a hexadecimal string representation into
- * a 16 byte buffer.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- *
- * str - A string of charactes which _must_ be at least 32 bytes long (2
- * characters per MD5 byte).
- */
-extern
-void md5_sig_from_string(void *signature, const char *str);
+/* Append a string to the message. */
+void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
-/*<<<<<<<<<< This is end of the auto-generated output from fillproto. */
+/* Finish the message and return the digest. */
+void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
-#endif /* ! __MD5_H__ */
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif
+#endif /* md5_INCLUDED */
diff --git a/md5/md5_loc.h b/md5/md5_loc.h
deleted file mode 100644
index c70d965a..00000000
--- a/md5/md5_loc.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Local defines for the md5 functions.
- *
- */
-
-/*
- * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- * rights reserved.
- *
- * License to copy and use this software is granted provided that it is
- * identified as the "RSA Data Security, Inc. MD5 Message-Digest
- * Algorithm" in all material mentioning or referencing this software
- * or this function.
- *
- * License is also granted to make and use derivative works provided that
- * such works are identified as "derived from the RSA Data Security,
- * Inc. MD5 Message-Digest Algorithm" in all material mentioning or
- * referencing the derived work.
- *
- * RSA Data Security, Inc. makes no representations concerning either the
- * merchantability of this software or the suitability of this
- * software for any particular purpose. It is provided "as is" without
- * express or implied warranty of any kind.
- *
- * These notices must be retained in any copies of any part of this
- * documentation and/or software.
- */
-
-#ifndef __MD5_LOC_H__
-#define __MD5_LOC_H__
-
-#define HEX_STRING "0123456789abcdef" /* to convert to hex */
-#define BLOCK_SIZE_MASK (MD5_BLOCK_SIZE - 1)
-
-
-//#include <config.h>
-
-/*
- * Define my endian-ness. Could not do in a portable manner using the
- * include files -- grumble.
- */
-#ifdef WORDS_BIGENDIAN
-/*
- * big endian - big is better
- */
-#define SWAP(n) \
- (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
-#else
-/*
- + * little endian
- + */
-#define SWAP(n) (n)
-#endif
-
-/*
- * These are the four functions used in the four steps of the MD5
- * algorithm and defined in the RFC 1321. The first function is a
- * little bit optimized (as found in Colin Plumbs public domain
- * implementation).
- */
-/* #define FF(b, c, d) ((b & c) | (~b & d)) */
-#define FF(b, c, d) (d ^ (b & (c ^ d)))
-#define FG(b, c, d) FF(d, b, c)
-#define FH(b, c, d) (b ^ c ^ d)
-#define FI(b, c, d) (c ^ (b | ~d))
-
-/*
- * It is unfortunate that C does not provide an operator for cyclic
- * rotation. Hope the C compiler is smart enough. -- Modified to
- * remove the w = at the front - Gray 2/97
- */
-#define CYCLIC(w, s) ((w << s) | (w >> (32 - s)))
-
-/*
- * First Round: using the given function, the context and a constant
- * the next context is computed. Because the algorithms processing
- * unit is a 32-bit word and it is determined to work on words in
- * little endian byte order we perhaps have to change the byte order
- * before the computation. To reduce the work for the next steps we
- * store the swapped words in the array CORRECT_WORDS. -- Modified to
- * fix the handling of unaligned buffer spaces - Gray 7/97
- */
-#define OP1(a, b, c, d, b_p, c_p, s, T) \
- do { \
- memcpy(c_p, b_p, sizeof(md5_uint32)); \
- *c_p = SWAP(*c_p); \
- a += FF (b, c, d) + *c_p + T; \
- a = CYCLIC (a, s); \
- a += b; \
- b_p = (char *)b_p + sizeof(md5_uint32); \
- c_p++; \
- } while (0)
-
-/*
- * Second to Fourth Round: we have the possibly swapped words in
- * CORRECT_WORDS. Redefine the macro to take an additional first
- * argument specifying the function to use.
- */
-#define OP234(FUNC, a, b, c, d, k, s, T) \
- do { \
- a += FUNC (b, c, d) + k + T; \
- a = CYCLIC (a, s); \
- a += b; \
- } while (0)
-
-#endif /* ! __MD5_LOC_H__ */
diff --git a/moduleconf.h b/moduleconf.h
index 4fdc123c..6f9ca732 100644
--- a/moduleconf.h
+++ b/moduleconf.h
@@ -1,4 +1,3 @@
PLUG(gme)
PLUG(dumb)
-PLUG(sid)
PLUG(stdio)
diff --git a/playlist.c b/playlist.c
index 4ee792f6..ac8e31c1 100644
--- a/playlist.c
+++ b/playlist.c
@@ -45,18 +45,13 @@
#define PLAYLIST_MAJOR_VER 1
#define PLAYLIST_MINOR_VER 1
-//#define trace(...) { fprintf(stderr, __VA_ARGS__); }
-#define trace(fmt,...)
+#define trace(...) { fprintf(stderr, __VA_ARGS__); }
+//#define trace(fmt,...)
#define SKIP_BLANK_CUE_TRACKS 1
#define min(x,y) ((x)<(y)?(x):(y))
-playItem_t *playlist_head[PL_MAX_ITERATORS];
-playItem_t *playlist_tail[PL_MAX_ITERATORS];
-int playlist_current_row[PL_MAX_ITERATORS];
-
-playItem_t *playlist_current_ptr;
static int pl_count[2];
static float pl_totaltime = 0;
@@ -64,16 +59,126 @@ static float pl_totaltime = 0;
static playItem_t *playqueue[100];
static int playqueue_count = 0;
+static int playlists_count = 0;
+static playlist_t *playlists_head = NULL;
+static playlist_t *playlist = NULL; // current playlist
+
+static void
+pl_item_free (playItem_t *it);
+
+int
+plt_get_count (void) {
+ return playlists_count;
+}
+
+void
+plt_add (int before, const char *title) {
+ playlist_t *plt = malloc (sizeof (playlist_t));
+ memset (plt, 0, sizeof (playlist_t));
+ plt->title = strdup (title);
+
+ playlist_t *p = NULL;
+
+ if (before > 0) {
+ p = playlists_head;
+ int i;
+ for (i = 0; p && i < before; i++) {
+ p = p->next;
+ }
+ }
+
+ if (!p) {
+ plt->next = playlists_head;
+ playlists_head = plt;
+ }
+ else {
+ playlist_t *next = p->next;
+ p->next = plt;
+ plt->next = next;
+ }
+ if (!playlist) {
+ playlist = plt;
+ }
+ playlists_count++;
+}
+
+void
+plt_remove (int plt) {
+ int i;
+ playlist_t *prev = NULL;
+ playlist_t *p = playlists_head;
+ for (i = 0; p && i < plt; i++) {
+ prev = p;
+ p = p->next;
+ }
+ if (i != plt) {
+ trace ("plt_remove %d failed\n", i);
+ }
+ if (p) {
+ if (!prev) {
+ playlists_head = p->next;
+ }
+ else {
+ prev->next = p->next;
+ }
+ }
+ if (p == playlist) {
+ playlist = NULL;
+ }
+ free (p->title);
+ free (p);
+ playlists_count--;
+}
+
+void
+plt_set_curr (int plt) {
+ int i;
+ playlist_t *p = playlists_head;
+ for (i = 0; p && i <= plt; i++) {
+ p = p->next;
+ }
+ if (i != plt) {
+ trace ("plt_set_curr %d failed\n", i);
+ return;
+ }
+ playlist = p;
+}
+
+int
+plt_get_curr (void) {
+ int i;
+ playlist_t *p = playlists_head;
+ for (i = 0; p && i < playlists_count; i++) {
+ if (p == playlist) {
+ return i;
+ }
+ p = p->next;
+ }
+ return -1;
+}
+
+playlist_t *
+plt_get_curr_ptr (void) {
+ return playlist;
+}
+
+void
+plt_free (void) {
+ while (playlists_head) {
+ plt_remove (0);
+ }
+}
+
void
pl_free (void) {
- while (playlist_head[PL_MAIN]) {
- pl_remove (playlist_head[PL_MAIN]);
+ while (playlist->head[PL_MAIN]) {
+ pl_remove (playlist->head[PL_MAIN]);
}
- if (playlist_current_row[PL_MAIN] >= pl_count[PL_MAIN]) {
- playlist_current_row[PL_MAIN] = pl_count[PL_MAIN]-1;
+ if (playlist->current_row[PL_MAIN] >= pl_count[PL_MAIN]) {
+ playlist->current_row[PL_MAIN] = pl_count[PL_MAIN]-1;
}
- if (playlist_current_row[PL_SEARCH] >= pl_count[PL_SEARCH]) {
- playlist_current_row[PL_SEARCH] = pl_count[PL_SEARCH]-1;
+ if (playlist->current_row[PL_SEARCH] >= pl_count[PL_SEARCH]) {
+ playlist->current_row[PL_SEARCH] = pl_count[PL_SEARCH]-1;
}
}
@@ -155,7 +260,7 @@ pl_cue_parse_time (const char *p) {
}
static playItem_t *
-pl_process_cue_track (playItem_t *after, const char *fname, playItem_t **prev, char *track, char *index00, char *index01, char *pregap, char *title, char *performer, char *albumtitle, char *genre, char *date, struct DB_decoder_s *decoder, const char *ftype, int samplerate) {
+pl_process_cue_track (playItem_t *after, const char *fname, playItem_t **prev, char *track, char *index00, char *index01, char *pregap, char *title, char *performer, char *albumtitle, char *genre, char *date, const char *decoder_id, const char *ftype, int samplerate) {
if (!track[0]) {
return after;
}
@@ -217,9 +322,8 @@ pl_process_cue_track (playItem_t *after, const char *fname, playItem_t **prev, c
*prev = NULL;
return after;
}
- playItem_t *it = malloc (sizeof (playItem_t));
- memset (it, 0, sizeof (playItem_t));
- it->decoder = decoder;
+ playItem_t *it = pl_item_alloc ();
+ it->decoder_id = plug_get_decoder_id (decoder_id);
it->fname = strdup (fname);
it->tracknum = atoi (track);
it->startsample = index01[0] ? f_index01 * samplerate : 0;
@@ -305,7 +409,7 @@ pl_insert_cue_from_buffer (playItem_t *after, playItem_t *origin, const uint8_t
}
else if (!strncmp (p, "TRACK ", 6)) {
// add previous track
- after = pl_process_cue_track (after, origin->fname, &prev, track, index00, index01, pregap, title, performer, albumtitle, genre, date, origin->decoder, origin->filetype, samplerate);
+ after = pl_process_cue_track (after, origin->fname, &prev, track, index00, index01, pregap, title, performer, albumtitle, genre, date, origin->decoder_id, origin->filetype, samplerate);
track[0] = 0;
title[0] = 0;
pregap[0] = 0;
@@ -331,14 +435,14 @@ pl_insert_cue_from_buffer (playItem_t *after, playItem_t *origin, const uint8_t
// fprintf (stderr, "got unknown line:\n%s\n", p);
}
}
- after = pl_process_cue_track (after, origin->fname, &prev, track, index00, index01, pregap, title, performer, albumtitle, genre, date, origin->decoder, origin->filetype, samplerate);
+ after = pl_process_cue_track (after, origin->fname, &prev, track, index00, index01, pregap, title, performer, albumtitle, genre, date, origin->decoder_id, origin->filetype, samplerate);
if (after) {
trace ("last track endsample: %d\n", numsamples-1);
after->endsample = numsamples-1;
pl_set_item_duration (after, (float)(after->endsample - after->startsample + 1) / samplerate);
}
// copy metadata from embedded tags
- playItem_t *first = ins ? ins->next[PL_MAIN] : playlist_head[PL_MAIN];
+ playItem_t *first = ins ? ins->next[PL_MAIN] : playlist->head[PL_MAIN];
junk_copy (origin, first, after);
return after;
}
@@ -604,6 +708,7 @@ pl_insert_pls (playItem_t *after, const char *fname, int *pabort, int (*cb)(play
playItem_t *
pl_insert_file (playItem_t *after, const char *fname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data) {
+ trace ("pl_insert_file %s\n", fname);
if (!fname || !(*fname)) {
return NULL;
}
@@ -658,7 +763,7 @@ pl_insert_file (playItem_t *after, const char *fname, int *pabort, int (*cb)(pla
}
playItem_t *it = pl_item_alloc ();
- it->decoder = NULL;
+ it->decoder_id = NULL;
it->fname = strdup (fname);
it->filetype = "content";
it->_duration = -1;
@@ -673,6 +778,7 @@ pl_insert_file (playItem_t *after, const char *fname, int *pabort, int (*cb)(pla
DB_decoder_t **decoders = plug_get_decoder_list ();
// match by decoder
for (int i = 0; decoders[i]; i++) {
+ trace ("matching decoder %d(%s)...\n", i, decoders[i]->plugin.id);
if (decoders[i]->exts && decoders[i]->insert) {
const char **exts = decoders[i]->exts;
for (int e = 0; exts[e]; e++) {
@@ -743,7 +849,7 @@ pl_insert_dir (playItem_t *after, const char *dirname, int *pabort, int (*cb)(pl
int
pl_add_file (const char *fname, int (*cb)(playItem_t *it, void *data), void *user_data) {
int abort = 0;
- if (pl_insert_file (playlist_tail[PL_MAIN], fname, &abort, cb, user_data)) {
+ if (pl_insert_file (playlist->tail[PL_MAIN], fname, &abort, cb, user_data)) {
return 0;
}
return -1;
@@ -752,7 +858,7 @@ pl_add_file (const char *fname, int (*cb)(playItem_t *it, void *data), void *use
int
pl_add_dir (const char *dirname, int (*cb)(playItem_t *it, void *data), void *user_data) {
int abort = 0;
- if (pl_insert_dir (playlist_tail[PL_MAIN], dirname, &abort, cb, user_data)) {
+ if (pl_insert_dir (playlist->tail[PL_MAIN], dirname, &abort, cb, user_data)) {
return 0;
}
return -1;
@@ -763,27 +869,24 @@ pl_remove (playItem_t *it) {
if (!it)
return -1;
streamer_song_removed_notify (it);
- if (playlist_current_ptr == it) {
- playlist_current_ptr = NULL;
- }
pl_playqueue_remove (it);
// remove from both lists list
for (int iter = PL_MAIN; iter <= PL_SEARCH; iter++) {
- if (it->prev[iter] || it->next[iter] || playlist_head[iter] == it || playlist_tail[iter] == it) {
+ if (it->prev[iter] || it->next[iter] || playlist->head[iter] == it || playlist->tail[iter] == it) {
pl_count[iter]--;
}
if (it->prev[iter]) {
it->prev[iter]->next[iter] = it->next[iter];
}
else {
- playlist_head[iter] = it->next[iter];
+ playlist->head[iter] = it->next[iter];
}
if (it->next[iter]) {
it->next[iter]->prev[iter] = it->prev[iter];
}
else {
- playlist_tail[iter] = it->prev[iter];
+ playlist->tail[iter] = it->prev[iter];
}
}
@@ -794,8 +897,8 @@ pl_remove (playItem_t *it) {
pl_totaltime = 0;
}
}
- pl_item_free (it);
- free (it);
+ pl_item_unref (it);
+ //free (it);
return 0;
}
@@ -808,7 +911,7 @@ int
pl_getselcount (void) {
// FIXME: slow!
int cnt = 0;
- for (playItem_t *it = playlist_head[PL_MAIN]; it; it = it->next[PL_MAIN]) {
+ for (playItem_t *it = playlist->head[PL_MAIN]; it; it = it->next[PL_MAIN]) {
if (it->selected) {
cnt++;
}
@@ -818,7 +921,7 @@ pl_getselcount (void) {
playItem_t *
pl_get_for_idx_and_iter (int idx, int iter) {
- playItem_t *it = playlist_head[iter];
+ playItem_t *it = playlist->head[iter];
while (idx--) {
if (!it)
return NULL;
@@ -834,7 +937,7 @@ pl_get_for_idx (int idx) {
int
pl_get_idx_of (playItem_t *it) {
- playItem_t *c = playlist_head[PL_MAIN];
+ playItem_t *c = playlist->head[PL_MAIN];
int idx = 0;
while (c && c != it) {
c = c->next[PL_MAIN];
@@ -849,15 +952,15 @@ pl_get_idx_of (playItem_t *it) {
playItem_t *
pl_insert_item (playItem_t *after, playItem_t *it) {
if (!after) {
- it->next[PL_MAIN] = playlist_head[PL_MAIN];
+ it->next[PL_MAIN] = playlist->head[PL_MAIN];
it->prev[PL_MAIN] = NULL;
- if (playlist_head[PL_MAIN]) {
- playlist_head[PL_MAIN]->prev[PL_MAIN] = it;
+ if (playlist->head[PL_MAIN]) {
+ playlist->head[PL_MAIN]->prev[PL_MAIN] = it;
}
else {
- playlist_tail[PL_MAIN] = it;
+ playlist->tail[PL_MAIN] = it;
}
- playlist_head[PL_MAIN] = it;
+ playlist->head[PL_MAIN] = it;
}
else {
it->prev[PL_MAIN] = after;
@@ -866,8 +969,8 @@ pl_insert_item (playItem_t *after, playItem_t *it) {
after->next[PL_MAIN]->prev[PL_MAIN] = it;
}
after->next[PL_MAIN] = it;
- if (after == playlist_tail[PL_MAIN]) {
- playlist_tail[PL_MAIN] = it;
+ if (after == playlist->tail[PL_MAIN]) {
+ playlist->tail[PL_MAIN] = it;
}
}
it->in_playlist = 1;
@@ -888,7 +991,7 @@ pl_insert_item (playItem_t *after, playItem_t *it) {
void
pl_item_copy (playItem_t *out, playItem_t *it) {
out->fname = strdup (it->fname);
- out->decoder = it->decoder;
+ out->decoder_id = it->decoder_id;
out->tracknum = it->tracknum;
out->startsample = it->startsample;
out->endsample = it->endsample;
@@ -904,6 +1007,7 @@ pl_item_copy (playItem_t *out, playItem_t *it) {
out->prev[PL_MAIN] = it->prev[PL_MAIN];
out->next[PL_SEARCH] = it->next[PL_SEARCH];
out->prev[PL_SEARCH] = it->prev[PL_SEARCH];
+ out->_refc = 1;
// copy metainfo
metaInfo_t *prev = NULL;
metaInfo_t *meta = it->meta;
@@ -929,10 +1033,16 @@ pl_item_alloc (void) {
memset (it, 0, sizeof (playItem_t));
it->replaygain_album_peak = 1;
it->replaygain_track_peak = 1;
+ it->_refc = 1;
return it;
}
void
+pl_item_ref (playItem_t *it) {
+ it->_refc++;
+}
+
+static void
pl_item_free (playItem_t *it) {
if (it) {
if (it->fname) {
@@ -948,202 +1058,15 @@ pl_item_free (playItem_t *it) {
}
}
-int
-pl_prevsong (void) {
- pl_playqueue_clear ();
- if (!playlist_head[PL_MAIN]) {
- streamer_set_nextsong (-2, 1);
- return 0;
- }
- int pl_order = conf_get_int ("playback.order", 0);
- int pl_loop_mode = conf_get_int ("playback.loop", 0);
- if (pl_order == PLAYBACK_ORDER_SHUFFLE) { // shuffle
- if (!playlist_current_ptr) {
- return pl_nextsong (1);
- }
- else {
- playlist_current_ptr->played = 0;
- // find already played song with maximum shuffle rating below prev song
- int rating = playlist_current_ptr->shufflerating;
- playItem_t *pmax = NULL; // played maximum
- playItem_t *amax = NULL; // absolute maximum
- for (playItem_t *i = playlist_head[PL_MAIN]; i; i = i->next[PL_MAIN]) {
- if (i != playlist_current_ptr && i->played && (!amax || i->shufflerating > amax->shufflerating)) {
- amax = i;
- }
- if (i == playlist_current_ptr || i->shufflerating > rating || !i->played) {
- continue;
- }
- if (!pmax || i->shufflerating > pmax->shufflerating) {
- pmax = i;
- }
- }
- playItem_t *it = pmax;
- if (!it) {
- // that means 1st in playlist, take amax
- if (pl_loop_mode == PLAYBACK_MODE_LOOP_ALL) {
- if (!amax) {
- pl_reshuffle (NULL, &amax);
- }
- it = amax;
- }
- }
-
- if (!it) {
- return -1;
- }
- int r = pl_get_idx_of (it);
- streamer_set_nextsong (r, 1);
- return 0;
- }
- }
- else if (pl_order == PLAYBACK_ORDER_LINEAR) { // linear
- playItem_t *it = NULL;
- if (playlist_current_ptr) {
- it = playlist_current_ptr->prev[PL_MAIN];
- }
- if (!it) {
- if (pl_loop_mode == PLAYBACK_MODE_LOOP_ALL) {
- it = playlist_tail[PL_MAIN];
- }
- }
- if (!it) {
- return -1;
- }
- int r = pl_get_idx_of (it);
- streamer_set_nextsong (r, 1);
- return 0;
- }
- else if (pl_order == PLAYBACK_ORDER_RANDOM) { // random
- pl_randomsong ();
- }
- return -1;
-}
-
-int
-pl_nextsong (int reason) {
- if (playqueue_count > 0) {
- playItem_t *it = playqueue[0];
- pl_playqueue_pop ();
- int r = pl_get_idx_of (it);
- streamer_set_nextsong (r, 1);
- return 0;
- }
-
- playItem_t *curr = streamer_get_streaming_track ();
- if (!playlist_head[PL_MAIN]) {
- streamer_set_nextsong (-2, 1);
- return 0;
- }
- int pl_order = conf_get_int ("playback.order", 0);
- int pl_loop_mode = conf_get_int ("playback.loop", 0);
- if (pl_order == PLAYBACK_ORDER_SHUFFLE) { // shuffle
- if (!curr) {
- // find minimal notplayed
- playItem_t *pmin = NULL; // notplayed minimum
- for (playItem_t *i = playlist_head[PL_MAIN]; i; i = i->next[PL_MAIN]) {
- if (i->played) {
- continue;
- }
- if (!pmin || i->shufflerating < pmin->shufflerating) {
- pmin = i;
- }
- }
- playItem_t *it = pmin;
- if (!it) {
- // all songs played, reshuffle and try again
- if (pl_loop_mode == PLAYBACK_MODE_LOOP_ALL) { // loop
- pl_reshuffle (&it, NULL);
- }
- }
- if (!it) {
- return -1;
- }
- int r = pl_get_idx_of (it);
- streamer_set_nextsong (r, 1);
- return 0;
- }
- else {
- trace ("pl_next_song: reason=%d, loop=%d\n", reason, pl_loop_mode);
- if (reason == 0 && pl_loop_mode == PLAYBACK_MODE_LOOP_SINGLE) { // song finished, loop mode is "loop 1 track"
- int r = pl_get_idx_of (curr);
- streamer_set_nextsong (r, 1);
- return 0;
- }
- // find minimal notplayed above current
- int rating = curr->shufflerating;
- playItem_t *pmin = NULL; // notplayed minimum
- for (playItem_t *i = playlist_head[PL_MAIN]; i; i = i->next[PL_MAIN]) {
- if (i->played || i->shufflerating < rating) {
- continue;
- }
- if (!pmin || i->shufflerating < pmin->shufflerating) {
- pmin = i;
- }
- }
- playItem_t *it = pmin;
- if (!it) {
- trace ("all songs played! reshuffle\n");
- // all songs played, reshuffle and try again
- if (pl_loop_mode == PLAYBACK_MODE_LOOP_ALL) { // loop
- pl_reshuffle (&it, NULL);
- }
- }
- if (!it) {
- return -1;
- }
- int r = pl_get_idx_of (it);
- streamer_set_nextsong (r, 1);
- return 0;
- }
- }
- else if (pl_order == PLAYBACK_ORDER_LINEAR) { // linear
- playItem_t *it = NULL;
- if (curr) {
- if (reason == 0 && pl_loop_mode == PLAYBACK_MODE_LOOP_SINGLE) { // loop same track
- int r = pl_get_idx_of (curr);
- streamer_set_nextsong (r, 1);
- return 0;
- }
- it = curr->next[PL_MAIN];
- }
- if (!it) {
- trace ("pl_nextsong: was last track\n");
- if (pl_loop_mode == PLAYBACK_MODE_LOOP_ALL) {
- it = playlist_head[PL_MAIN];
- }
- else {
- streamer_set_nextsong (-2, 1);
- return 0;
- }
- }
- if (!it) {
- return -1;
- }
- int r = pl_get_idx_of (it);
- streamer_set_nextsong (r, 1);
- return 0;
- }
- else if (pl_order == PLAYBACK_ORDER_RANDOM) { // random
- if (reason == 0 && pl_loop_mode == PLAYBACK_MODE_LOOP_SINGLE && curr) {
- int r = pl_get_idx_of (curr);
- streamer_set_nextsong (r, 1);
- return 0;
- }
- return pl_randomsong ();
+void
+pl_item_unref (playItem_t *it) {
+ it->_refc--;
+ if (it->_refc < 0) {
+ fprintf (stderr, "playlist: bad refcount on item %p\n", it);
}
- return -1;
-}
-
-int
-pl_randomsong (void) {
- int cnt = pl_getcount (PL_MAIN);
- if (!cnt) {
- return -1;
+ if (it->_refc <= 0) {
+ pl_item_free (it);
}
- int r = rand () / (float)RAND_MAX * cnt;
- streamer_set_nextsong (r, 1);
- return 0;
}
void
@@ -1237,7 +1160,7 @@ pl_delete_selected (void) {
int i = 0;
int ret = -1;
playItem_t *next = NULL;
- for (playItem_t *it = playlist_head[PL_MAIN]; it; it = next, i++) {
+ for (playItem_t *it = playlist->head[PL_MAIN]; it; it = next, i++) {
next = it->next[PL_MAIN];
if (it->selected) {
if (ret == -1) {
@@ -1252,7 +1175,7 @@ pl_delete_selected (void) {
void
pl_crop_selected (void) {
playItem_t *next = NULL;
- for (playItem_t *it = playlist_head[PL_MAIN]; it; it = next) {
+ for (playItem_t *it = playlist->head[PL_MAIN]; it; it = next) {
next = it->next[PL_MAIN];
if (!it->selected) {
pl_remove (it);
@@ -1282,7 +1205,7 @@ pl_save (const char *fname) {
if (fwrite (&cnt, 1, 4, fp) != 4) {
goto save_fail;
}
- for (playItem_t *it = playlist_head[PL_MAIN]; it; it = it->next[PL_MAIN]) {
+ for (playItem_t *it = playlist->head[PL_MAIN]; it; it = it->next[PL_MAIN]) {
uint16_t l;
uint8_t ll;
l = strlen (it->fname);
@@ -1292,12 +1215,12 @@ pl_save (const char *fname) {
if (fwrite (it->fname, 1, l, fp) != l) {
goto save_fail;
}
- if (it->decoder) {
- ll = strlen (it->decoder->id);
+ if (it->decoder_id) {
+ ll = strlen (it->decoder_id);
if (fwrite (&ll, 1, 1, fp) != 1) {
goto save_fail;
}
- if (fwrite (it->decoder->id, 1, ll, fp) != ll) {
+ if (fwrite (it->decoder_id, 1, ll, fp) != ll) {
goto save_fail;
}
}
@@ -1382,7 +1305,6 @@ save_fail:
int
pl_load (const char *fname) {
pl_free ();
- DB_decoder_t **decoders = plug_get_decoder_list ();
uint8_t majorver;
uint8_t minorver;
playItem_t *it = NULL;
@@ -1414,11 +1336,10 @@ pl_load (const char *fname) {
goto load_fail;
}
for (uint32_t i = 0; i < cnt; i++) {
- it = malloc (sizeof (playItem_t));
+ it = pl_item_alloc ();
if (!it) {
goto load_fail;
}
- memset (it, 0, sizeof (playItem_t));
uint16_t l;
// fname
if (fread (&l, 1, 2, fp) != 2) {
@@ -1443,17 +1364,13 @@ pl_load (const char *fname) {
goto load_fail;
}
decoder[ll] = 0;
- for (int c = 0; decoders[c]; c++) {
- if (!strcmp (decoder, decoders[c]->id)) {
- it->decoder = decoders[c];
- }
- }
+ it->decoder_id = plug_get_decoder_id (decoder);
// if (!it->decoder) {
// goto load_fail;
// }
}
else {
- it->decoder = NULL;
+ it->decoder_id = NULL;
}
// tracknum
if (fread (&l, 1, 2, fp) != 2) {
@@ -1488,11 +1405,12 @@ pl_load (const char *fname) {
if (!strcmp (ftype, "content")) {
it->filetype = "content";
}
- else {
- if (it->decoder && it->decoder->filetypes) {
- for (int i = 0; it->decoder->filetypes[i]; i++) {
- if (!strcasecmp (it->decoder->filetypes[i], ftype)) {
- it->filetype = it->decoder->filetypes[i];
+ else if (it->decoder_id) {
+ DB_decoder_t *dec = plug_get_decoder_for_id (it->decoder_id);
+ if (dec && dec->filetypes) {
+ for (int i = 0; dec->filetypes[i]; i++) {
+ if (!strcasecmp (dec->filetypes[i], ftype)) {
+ it->filetype = dec->filetypes[i];
break;
}
}
@@ -1571,7 +1489,7 @@ pl_load (const char *fname) {
}
}
}
- pl_insert_item (playlist_tail[PL_MAIN], it);
+ pl_insert_item (playlist->tail[PL_MAIN], it);
}
fclose (fp);
return 0;
@@ -1579,7 +1497,7 @@ load_fail:
fprintf (stderr, "playlist load fail (%s)!\n", fname);
fclose (fp);
if (it) {
- pl_item_free (it);
+ pl_item_unref (it);
}
pl_free ();
return -1;
@@ -1587,7 +1505,7 @@ load_fail:
void
pl_select_all (void) {
- for (playItem_t *it = playlist_head[PL_MAIN]; it; it = it->next[PL_MAIN]) {
+ for (playItem_t *it = playlist->head[PL_MAIN]; it; it = it->next[PL_MAIN]) {
it->selected = 1;
}
}
@@ -1597,7 +1515,7 @@ void
pl_reshuffle (playItem_t **ppmin, playItem_t **ppmax) {
playItem_t *pmin = NULL;
playItem_t *pmax = NULL;
- for (playItem_t *it = playlist_head[PL_MAIN]; it; it = it->next[PL_MAIN]) {
+ for (playItem_t *it = playlist->head[PL_MAIN]; it; it = it->next[PL_MAIN]) {
it->shufflerating = rand ();
if (!pmin || it->shufflerating < pmin->shufflerating) {
pmin = it;
@@ -1898,7 +1816,7 @@ pl_sort (int iter, int id, const char *format, int ascending) {
do {
sorted = 1;
playItem_t *it;
- for (it = playlist_head[iter]; it; it = it->next[iter]) {
+ for (it = playlist->head[iter]; it; it = it->next[iter]) {
playItem_t *next = it->next[iter];
if (!next) {
break;
@@ -1931,7 +1849,7 @@ pl_sort (int iter, int id, const char *format, int ascending) {
// printf ("it->prev->next = it->next\n");
}
else {
- playlist_head[iter] = next;
+ playlist->head[iter] = next;
next->prev[iter] = NULL;
// printf ("head = it->next\n");
}
@@ -1940,7 +1858,7 @@ pl_sort (int iter, int id, const char *format, int ascending) {
// printf ("it->next->next->prev = it\n");
}
else {
- playlist_tail[iter] = it;
+ playlist->tail[iter] = it;
it->next[iter] = NULL;
// printf ("tail = it\n");
}
@@ -1959,7 +1877,7 @@ void
pl_reset_cursor (void) {
int i;
for (i = 0; i < PL_MAX_ITERATORS; i++) {
- playlist_current_row[i] = -1;
+ playlist->current_row[i] = -1;
}
}
@@ -1968,11 +1886,6 @@ pl_get_totaltime (void) {
return pl_totaltime;
}
-playItem_t *
-pl_getcurrent (void) {
- return playlist_current_ptr;
-}
-
void
pl_set_selected (playItem_t *it, int sel) {
it->selected = sel;
@@ -1985,12 +1898,12 @@ pl_is_selected (playItem_t *it) {
playItem_t *
pl_get_first (int iter) {
- return playlist_head[iter];
+ return playlist->head[iter];
}
playItem_t *
pl_get_last (int iter) {
- return playlist_tail[iter];
+ return playlist->tail[iter];
}
playItem_t *
@@ -2005,12 +1918,15 @@ pl_get_prev (playItem_t *it, int iter) {
int
pl_get_cursor (int iter) {
- return playlist_current_row[iter];
+ if (!playlist) {
+ return -1; // FIXME: that's a workaround for crashes in plugins
+ }
+ return playlist->current_row[iter];
}
void
pl_set_cursor (int iter, int cursor) {
- playlist_current_row[iter] = cursor;
+ playlist->current_row[iter] = cursor;
}
// this function must move items in playlist
@@ -2024,20 +1940,20 @@ pl_move_items (int iter, playItem_t *drop_before, uint32_t *indexes, int count)
int processed = 0;
int idx = 0;
playItem_t *next = NULL;
- for (playItem_t *it = playlist_head[iter]; it && processed < count; it = next, idx++) {
+ for (playItem_t *it = playlist->head[iter]; it && processed < count; it = next, idx++) {
next = it->next[iter];
if (idx == indexes[processed]) {
if (it->prev[iter]) {
it->prev[iter]->next[iter] = it->next[iter];
}
else {
- playlist_head[iter] = it->next[iter];
+ playlist->head[iter] = it->next[iter];
}
if (it->next[iter]) {
it->next[iter]->prev[iter] = it->prev[iter];
}
else {
- playlist_tail[iter] = it->prev[iter];
+ playlist->tail[iter] = it->prev[iter];
}
if (tail) {
tail->next[iter] = it;
@@ -2057,7 +1973,7 @@ pl_move_items (int iter, playItem_t *drop_before, uint32_t *indexes, int count)
drop_after = drop_before->prev[iter];
}
else {
- drop_after = playlist_tail[iter];
+ drop_after = playlist->tail[iter];
}
// insert in between
head->prev[iter] = drop_after;
@@ -2065,34 +1981,34 @@ pl_move_items (int iter, playItem_t *drop_before, uint32_t *indexes, int count)
drop_after->next[iter] = head;
}
else {
- playlist_head[iter] = head;
+ playlist->head[iter] = head;
}
tail->next[iter] = drop_before;
if (drop_before) {
drop_before->prev[iter] = tail;
}
else {
- playlist_tail[iter] = tail;
+ playlist->tail[iter] = tail;
}
}
void
pl_search_reset (void) {
- while (playlist_head[PL_SEARCH]) {
- playItem_t *next = playlist_head[PL_SEARCH]->next[PL_SEARCH];
- playlist_head[PL_SEARCH]->selected = 0;
- playlist_head[PL_SEARCH]->next[PL_SEARCH] = NULL;
- playlist_head[PL_SEARCH]->prev[PL_SEARCH] = NULL;
- playlist_head[PL_SEARCH] = next;
- }
- playlist_tail[PL_SEARCH] = NULL;
+ while (playlist->head[PL_SEARCH]) {
+ playItem_t *next = playlist->head[PL_SEARCH]->next[PL_SEARCH];
+ playlist->head[PL_SEARCH]->selected = 0;
+ playlist->head[PL_SEARCH]->next[PL_SEARCH] = NULL;
+ playlist->head[PL_SEARCH]->prev[PL_SEARCH] = NULL;
+ playlist->head[PL_SEARCH] = next;
+ }
+ playlist->tail[PL_SEARCH] = NULL;
pl_count[PL_SEARCH] = 0;
}
void
pl_search_process (const char *text) {
pl_search_reset ();
- for (playItem_t *it = playlist_head[PL_MAIN]; it; it = it->next[PL_MAIN]) {
+ for (playItem_t *it = playlist->head[PL_MAIN]; it; it = it->next[PL_MAIN]) {
it->selected = 0;
if (*text) {
for (metaInfo_t *m = it->meta; m; m = m->next) {
@@ -2101,12 +2017,12 @@ pl_search_process (const char *text) {
//fprintf (stderr, "%s -> %s match (%s.%s)\n", text, m->value, it->fname, m->key);
// add to list
it->next[PL_SEARCH] = NULL;
- if (playlist_tail[PL_SEARCH]) {
- playlist_tail[PL_SEARCH]->next[PL_SEARCH] = it;
- playlist_tail[PL_SEARCH] = it;
+ if (playlist->tail[PL_SEARCH]) {
+ playlist->tail[PL_SEARCH]->next[PL_SEARCH] = it;
+ playlist->tail[PL_SEARCH] = it;
}
else {
- playlist_head[PL_SEARCH] = playlist_tail[PL_SEARCH] = it;
+ playlist->head[PL_SEARCH] = playlist->tail[PL_SEARCH] = it;
}
it->selected = 1;
pl_count[PL_SEARCH]++;
@@ -2181,3 +2097,8 @@ pl_playqueue_getnext (void) {
}
return NULL;
}
+
+int
+pl_playqueue_getcount (void) {
+ return playqueue_count;
+}
diff --git a/playlist.h b/playlist.h
index ac49fa63..c168c4aa 100644
--- a/playlist.h
+++ b/playlist.h
@@ -31,7 +31,8 @@ typedef struct metaInfo_s {
typedef struct playItem_s {
char *fname; // full pathname
- struct DB_decoder_s *decoder; // codec to use with this file
+// struct DB_decoder_s *decoder; // codec to use with this file
+ const char *decoder_id;
int tracknum; // used for stuff like sid, nsf, cue (will be ignored by most codecs)
int startsample;
int endsample;
@@ -45,6 +46,7 @@ typedef struct playItem_s {
float replaygain_track_peak;
// private area, must not be visible to plugins
float _duration; // in seconds
+ int _refc;
struct playItem_s *next[PL_MAX_ITERATORS]; // next item in linked list
struct playItem_s *prev[PL_MAX_ITERATORS]; // prev item in linked list
struct metaInfo_s *meta; // linked list storing metainfo
@@ -53,11 +55,37 @@ typedef struct playItem_s {
unsigned in_playlist : 1; // 1 if item is in playlist
} playItem_t;
-extern playItem_t *playlist_head[PL_MAX_ITERATORS]; // head of linked list
-extern playItem_t *playlist_tail[PL_MAX_ITERATORS]; // tail of linked list
-extern int playlist_current_row[PL_MAX_ITERATORS]; // current row (cursor)
-extern playItem_t *playlist_current_ptr; // pointer to a real current playlist item (or NULL)
+typedef struct playlist_s{
+ char *title;
+ playItem_t *head[PL_MAX_ITERATORS]; // head of linked list
+ playItem_t *tail[PL_MAX_ITERATORS]; // tail of linked list
+ int current_row[PL_MAX_ITERATORS]; // current row (cursor)
+ struct playlist_s *next;
+} playlist_t;
+// playlist management functions
+int
+plt_get_count (void);
+
+void
+plt_add (int before, const char *title);
+
+void
+plt_remove (int plt);
+
+void
+plt_free (void);
+
+void
+plt_set_curr (int plt);
+
+int
+plt_get_curr (void);
+
+playlist_t *
+plt_get_curr_ptr (void);
+
+// playlist access functions
int
pl_add_dir (const char *dirname, int (*cb)(playItem_t *it, void *data), void *user_data);
@@ -80,7 +108,13 @@ playItem_t *
pl_item_alloc (void);
void
-pl_item_free (playItem_t *it);
+pl_item_ref (playItem_t *it);
+
+void
+pl_item_unref (playItem_t *it);
+
+//void
+//pl_item_free (playItem_t *it);
void
pl_item_copy (playItem_t *out, playItem_t *it);
@@ -109,20 +143,6 @@ pl_insert_cue_from_buffer (playItem_t *after, playItem_t *origin, const uint8_t
playItem_t *
pl_insert_cue (playItem_t *after, playItem_t *origin, int numsamples, int samplerate);
-//int
-//pl_set_current (playItem_t *it);
-
-// returns -1 if theres no next song, or playlist finished
-// reason 0 means "song finished", 1 means "user clicked next"
-int
-pl_nextsong (int reason);
-
-int
-pl_prevsong (void);
-
-int
-pl_randomsong (void);
-
void
pl_add_meta (playItem_t *it, const char *key, const char *value);
@@ -175,9 +195,6 @@ pl_reset_cursor (void);
float
pl_get_totaltime (void);
-playItem_t *
-pl_getcurrent (void);
-
void
pl_set_selected (playItem_t *it, int sel);
@@ -233,4 +250,7 @@ pl_playqueue_test (playItem_t *it);
playItem_t *
pl_playqueue_getnext (void);
+int
+pl_playqueue_getcount (void);
+
#endif // __PLAYLIST_H
diff --git a/plugins.c b/plugins.c
index 25f2ff01..ab710e43 100644
--- a/plugins.c
+++ b/plugins.c
@@ -63,6 +63,9 @@ static DB_functions_t deadbeef_api = {
.ev_unsubscribe = plug_ev_unsubscribe,
.md5 = plug_md5,
.md5_to_str = plug_md5_to_str,
+ .md5_init = (void (*)(DB_md5_t *s))md5_init,
+ .md5_append = (void (*)(DB_md5_t *s, const uint8_t *daya, int nbytes))md5_append,
+ .md5_finish = (void (*)(DB_md5_t *s, uint8_t digest[16]))md5_finish,
.get_output = plug_get_output,
.playback_next = plug_playback_next,
.playback_prev = plug_playback_prev,
@@ -82,6 +85,7 @@ static DB_functions_t deadbeef_api = {
.streamer_read = streamer_read,
.streamer_set_bitrate = streamer_set_bitrate,
.streamer_get_apx_bitrate = streamer_get_apx_bitrate,
+ .streamer_get_current_decoder = streamer_get_current_decoder,
// process control
.get_config_dir = plug_get_config_dir,
.quit = plug_quit,
@@ -99,7 +103,8 @@ static DB_functions_t deadbeef_api = {
.cond_broadcast = cond_broadcast,
// playlist access
.pl_item_alloc = (DB_playItem_t* (*)(void))pl_item_alloc,
- .pl_item_free = (void (*)(DB_playItem_t *))pl_item_free,
+ .pl_item_ref = (void (*)(DB_playItem_t *))pl_item_ref,
+ .pl_item_unref = (void (*)(DB_playItem_t *))pl_item_unref,
.pl_item_copy = (void (*)(DB_playItem_t *, DB_playItem_t *))pl_item_copy,
.pl_add_file = (int (*) (const char *, int (*cb)(DB_playItem_t *it, void *data), void *))pl_add_file,
.pl_add_dir = (int (*) (const char *dirname, int (*cb)(DB_playItem_t *it, void *data), void *user_data))pl_add_dir,
@@ -114,7 +119,7 @@ static DB_functions_t deadbeef_api = {
.pl_sort = pl_sort,
.pl_get_totaltime = pl_get_totaltime,
.pl_getcount = pl_getcount,
- .pl_getcurrent = (DB_playItem_t *(*)(void))pl_getcurrent,
+ .pl_getcurrent = (DB_playItem_t *(*)(void))streamer_get_current,
.pl_delete_selected = pl_delete_selected,
.pl_set_cursor = pl_set_cursor,
.pl_get_cursor = pl_get_cursor,
@@ -188,6 +193,8 @@ static DB_functions_t deadbeef_api = {
.plug_get_output_list = plug_get_output_list,
.plug_get_list = plug_get_list,
.plug_activate = plug_activate,
+ .plug_get_decoder_id = plug_get_decoder_id,
+ .plug_remove_decoder_id = plug_remove_decoder_id,
};
DB_functions_t *deadbeef = &deadbeef_api;
@@ -212,7 +219,6 @@ plug_volume_set_amp (float amp) {
#define MAX_PLUGINS 100
DB_plugin_t *g_plugins[MAX_PLUGINS+1];
-#define MAX_DECODER_PLUGINS 50
DB_decoder_t *g_decoder_plugins[MAX_DECODER_PLUGINS+1];
#define MAX_VFS_PLUGINS 10
@@ -224,12 +230,21 @@ DB_output_t *output_plugin = NULL;
void
plug_md5 (uint8_t sig[16], const char *in, int len) {
- md5_buffer (in, len, sig);
+ md5_state_t st;
+ md5_init (&st);
+ md5_append (&st, in, len);
+ md5_finish (&st, sig);
}
void
plug_md5_to_str (char *str, const uint8_t sig[16]) {
- md5_sig_to_string ((char *)sig, str, 33);
+ int i = 0;
+ static const char hex[] = "0123456789abcdef";
+ for (i = 0; i < 16; i++) {
+ *str++ = hex[(sig[i]&0xf0)>>4];
+ *str++ = hex[sig[i]&0xf];
+ }
+ *str = 0;
}
// event handlers
@@ -756,3 +771,59 @@ plug_reinit_sound (void) {
}
}
}
+
+// list of all unique decoder ids used in current session
+static char *decoder_ids[MAX_DECODER_PLUGINS];
+
+const char *
+plug_get_decoder_id (const char *id) {
+ int i;
+ char **lastnull = NULL;
+ for (i = 0; i < MAX_DECODER_PLUGINS; i++) {
+ if (decoder_ids[i] && !strcmp (id, decoder_ids[i])) {
+ return decoder_ids[i];
+ }
+ else if (!lastnull && !decoder_ids[i]) {
+ lastnull = &decoder_ids[i];
+ }
+ }
+ if (!lastnull) {
+ return NULL;
+ }
+ char *newid = strdup (id);
+ *lastnull = newid;
+ return newid;
+}
+
+void
+plug_remove_decoder_id (const char *id) {
+ int i;
+ for (i = 0; i < MAX_DECODER_PLUGINS; i++) {
+ if (decoder_ids[i] && !strcmp (decoder_ids[i], id)) {
+ free (decoder_ids[i]);
+ decoder_ids[i] = NULL;
+ }
+ }
+}
+
+void
+plug_free_decoder_ids (void) {
+ int i;
+ for (i = 0; i < MAX_DECODER_PLUGINS; i++) {
+ if (decoder_ids[i]) {
+ free (decoder_ids[i]);
+ decoder_ids[i] = NULL;
+ }
+ }
+}
+
+DB_decoder_t *
+plug_get_decoder_for_id (const char *id) {
+ DB_decoder_t **plugins = plug_get_decoder_list ();
+ for (int c = 0; plugins[c]; c++) {
+ if (!strcmp (id, plugins[c]->plugin.id)) {
+ return plugins[c];
+ }
+ }
+ return NULL;
+}
diff --git a/plugins.h b/plugins.h
index 5efb593e..39380640 100644
--- a/plugins.h
+++ b/plugins.h
@@ -118,4 +118,16 @@ plug_reinit_sound (void);
int
plug_select_output (void);
+const char *
+plug_get_decoder_id (const char *id);
+
+void
+plug_remove_decoder_id (const char *id);
+
+void
+plug_free_decoder_ids (void);
+
+DB_decoder_t *
+plug_get_decoder_for_id (const char *id);
+
#endif // __PLUGINS_H
diff --git a/plugins/adplug/adplug-db.cpp b/plugins/adplug/adplug-db.cpp
index b28da612..5a285ef4 100644
--- a/plugins/adplug/adplug-db.cpp
+++ b/plugins/adplug/adplug-db.cpp
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include "../../deadbeef.h"
#include "adplug.h"
#include "emuopl.h"
@@ -40,71 +41,84 @@ const char *adplug_exts[] = { "A2M", "ADL", "AMD", "BAM", "CFF", "CMF", "D00", "
const char *adplug_filetypes[] = { "A2M", "ADL", "AMD", "BAM", "CFF", "CMF", "D00", "DFM", "DMO", "DRO", "DTM", "HSC", "HSP", "IMF", "KSM", "LAA", "LDS", "M", "MAD", "MID", "MKJ", "MSC", "MTK", "RAD", "RAW", "RIX", "ROL", "S3M", "SA2", "SAT", "SCI", "SNG", "SNG", "SNG", "XAD", "XMS", "XSM", "JBM", NULL };
-static CEmuopl *opl;
-static CPlayer *decoder;
-static int totalsamples;
-static int currentsample;
-static int subsong;
-static int toadd;
-int
+typedef struct {
+ DB_fileinfo_t info;
+ CEmuopl *opl;
+ CPlayer *decoder;
+ int totalsamples;
+ int currentsample;
+ int subsong;
+ int toadd;
+} adplug_info_t;
+
+DB_fileinfo_t *
adplug_init (DB_playItem_t *it) {
// prepare to decode the track
// return -1 on failure
- int samplerate = deadbeef->get_output ()->samplerate ();
+ adplug_info_t *info = (adplug_info_t *)malloc (sizeof (adplug_info_t));
+ DB_fileinfo_t *_info = (DB_fileinfo_t *)info;
+ memset (info, 0, sizeof (adplug_info_t));
+
+ int samplerate = deadbeef->conf_get_int ("synth.samplerate", 48000);
int bps = deadbeef->get_output ()->bitspersample ();
int channels = 2;
- opl = new CEmuopl (samplerate, true, channels == 2);
+ info->opl = new CEmuopl (samplerate, true, channels == 2);
// opl->settype (Copl::TYPE_OPL2);
- decoder = CAdPlug::factory (it->fname, opl, CAdPlug::players);
- if (!decoder) {
+ info->decoder = CAdPlug::factory (it->fname, info->opl, CAdPlug::players);
+ if (!info->decoder) {
trace ("adplug: failed to open %s\n", it->fname);
- return -1;
+ adplug_plugin.free (_info);
+ return NULL;
}
- subsong = it->tracknum;
- decoder->rewind (subsong);
- totalsamples = decoder->songlength (subsong) * samplerate / 1000;
- currentsample = 0;
- toadd = 0;
+ info->subsong = it->tracknum;
+ info->decoder->rewind (info->subsong);
+ info->totalsamples = info->decoder->songlength (info->subsong) * samplerate / 1000;
+ info->currentsample = 0;
+ info->toadd = 0;
// fill in mandatory plugin fields
- adplug_plugin.info.bps = bps;
- adplug_plugin.info.channels = channels;
- adplug_plugin.info.samplerate = samplerate;
- adplug_plugin.info.readpos = 0;
+ _info->plugin = &adplug_plugin;
+ _info->bps = bps;
+ _info->channels = channels;
+ _info->samplerate = samplerate;
+ _info->readpos = 0;
trace ("adplug_init ok (duration=%f, totalsamples=%d)\n", deadbeef->pl_get_item_duration (it), totalsamples);
- return 0;
+ return _info;
}
void
-adplug_free (void) {
+adplug_free (DB_fileinfo_t *_info) {
// free everything allocated in _init
- if (decoder) {
- delete decoder;
- decoder = NULL;
- }
- if (opl) {
- delete opl;
- opl = NULL;
+ if (_info) {
+ adplug_info_t *info = (adplug_info_t *)_info;
+ if (info->decoder) {
+ delete info->decoder;
+ }
+ if (info->opl) {
+ delete info->opl;
+ }
+ free (info);
}
}
int
-adplug_read_int16 (char *bytes, int size) {
+adplug_read_int16 (DB_fileinfo_t *_info, char *bytes, int size) {
// try decode `size' bytes
// return number of decoded bytes
// return 0 on EOF
+ adplug_info_t *info = (adplug_info_t *)_info;
bool playing = true;
int i;
- int sampsize = (adplug_plugin.info.bps >> 3) * adplug_plugin.info.channels;
+ int sampsize = (_info->bps >> 3) * _info->channels;
- if (currentsample + size/4 >= totalsamples) {
+ if (info->currentsample + size/4 >= info->totalsamples) {
// clip
- size = (totalsamples - currentsample) * sampsize;
+ size = (info->totalsamples - info->currentsample) * sampsize;
trace ("adplug: clipped to %d\n", size);
if (size <= 0) {
return 0;
@@ -118,63 +132,63 @@ adplug_read_int16 (char *bytes, int size) {
while (towrite > 0)
{
- while (toadd < 0)
+ while (info->toadd < 0)
{
- toadd += adplug_plugin.info.samplerate;
- playing = decoder->update ();
+ info->toadd += _info->samplerate;
+ playing = info->decoder->update ();
// decoder->time_ms += 1000 / plr.p->getrefresh ();
}
- i = min (towrite, (long) (toadd / decoder->getrefresh () + 4) & ~3);
- opl->update ((short *) sndbufpos, i);
+ i = min (towrite, (long) (info->toadd / info->decoder->getrefresh () + 4) & ~3);
+ info->opl->update ((short *) sndbufpos, i);
sndbufpos += i * sampsize;
size -= i * sampsize;
- currentsample += i;
+ info->currentsample += i;
towrite -= i;
- toadd -= (long) (decoder->getrefresh () * i);
+ info->toadd -= (long) (info->decoder->getrefresh () * i);
}
- currentsample += size/4;
- adplug_plugin.info.readpos = (float)currentsample / adplug_plugin.info.samplerate;
+ info->currentsample += size/4;
+ _info->readpos = (float)info->currentsample / _info->samplerate;
return initsize-size;
}
int
-adplug_seek_sample (int sample) {
+adplug_seek_sample (DB_fileinfo_t *_info, int sample) {
// seek to specified sample (frame)
// return 0 on success
// return -1 on failure
- if (sample >= totalsamples) {
- trace ("adplug: seek outside bounds (%d of %d)\n", sample, totalsamples);
+ adplug_info_t *info = (adplug_info_t *)_info;
+ if (sample >= info->totalsamples) {
+ trace ("adplug: seek outside bounds (%d of %d)\n", sample, info->totalsamples);
return -1;
}
- decoder->rewind (subsong);
- currentsample = 0;
+ info->decoder->rewind (info->subsong);
+ info->currentsample = 0;
- while (currentsample < sample) {
- decoder->update ();
- int framesize = adplug_plugin.info.samplerate / decoder->getrefresh ();
- currentsample += framesize;
+ while (info->currentsample < sample) {
+ info->decoder->update ();
+ int framesize = _info->samplerate / info->decoder->getrefresh ();
+ info->currentsample += framesize;
}
- if (currentsample >= totalsamples) {
+ if (info->currentsample >= info->totalsamples) {
return -1;
}
- toadd = 0;
- trace ("adplug: new position after seek: %d of %d\n", currentsample, totalsamples);
+ info->toadd = 0;
+ trace ("adplug: new position after seek: %d of %d\n", info->currentsample, info->totalsamples);
- adplug_plugin.info.readpos = (float)currentsample / adplug_plugin.info.samplerate;
+ _info->readpos = (float)info->currentsample / _info->samplerate;
return 0;
}
int
-adplug_seek (float time) {
+adplug_seek (DB_fileinfo_t *_info, float time) {
// seek to specified time in seconds
// return 0 on success
// return -1 on failure
- return adplug_seek_sample (time * adplug_plugin.info.samplerate);
- return 0;
+ return adplug_seek_sample (_info, time * _info->samplerate);
}
static const char *
@@ -214,7 +228,7 @@ adplug_insert (DB_playItem_t *after, const char *fname) {
for (int i = 0; i < subsongs; i++) {
// prepare track for addition
DB_playItem_t *it = deadbeef->pl_item_alloc ();
- it->decoder = &adplug_plugin;
+ it->decoder_id = deadbeef->plug_get_decoder_id (adplug_plugin.plugin.id);
it->fname = strdup (fname);
it->filetype = adplug_get_extension (fname);
it->tracknum = i;
diff --git a/plugins/adplug/plugin.c b/plugins/adplug/plugin.c
index c0cb90d3..6b2a6ca5 100644
--- a/plugins/adplug/plugin.c
+++ b/plugins/adplug/plugin.c
@@ -25,16 +25,16 @@
extern const char *adplug_exts[];
extern const char *adplug_filetypes[];
-int
+DB_fileinfo_t *
adplug_init (DB_playItem_t *it);
void
-adplug_free (void);
+adplug_free (DB_fileinfo_t *);
int
-adplug_read_int16 (char *bytes, int size);
+adplug_read_int16 (DB_fileinfo_t *, char *bytes, int size);
int
-adplug_seek_sample (int sample);
+adplug_seek_sample (DB_fileinfo_t *, int sample);
int
-adplug_seek (float time);
+adplug_seek (DB_fileinfo_t *, float time);
DB_playItem_t *
adplug_insert (DB_playItem_t *after, const char *fname);
int
@@ -48,6 +48,7 @@ DB_decoder_t adplug_plugin = {
.plugin.version_major = 0,
.plugin.version_minor = 1,
.plugin.type = DB_PLUGIN_DECODER,
+ .plugin.id = "adplug",
.plugin.name = "Adplug player",
.plugin.descr = "Adplug player (ADLIB OPL2/OPL3 emulator)",
.plugin.author = "Alexey Yakovenko",
@@ -62,7 +63,6 @@ DB_decoder_t adplug_plugin = {
.seek_sample = adplug_seek_sample,
.insert = adplug_insert,
.exts = adplug_exts,
- .id = "adplug",
.filetypes = adplug_filetypes
};
diff --git a/plugins/cdda/cdda.c b/plugins/cdda/cdda.c
index a93fcf26..b7bc2598 100644
--- a/plugins/cdda/cdda.c
+++ b/plugins/cdda/cdda.c
@@ -32,6 +32,11 @@
#define trace(...) { fprintf (stderr, __VA_ARGS__); }
//#define trace(fmt,...)
+#define DEFAULT_SERVER "freedb.org"
+#define DEFAULT_PORT 888
+#define DEFAULT_USE_CDDB 1
+#define DEFAULT_PROTOCOL 1
+
#define SECTORSIZE CDIO_CD_FRAMESIZE_RAW //2352
#define SAMPLESIZE 4 //bytes
#define BUFSIZE (CDIO_CD_FRAMESIZE_RAW * 2)
@@ -39,22 +44,19 @@
static DB_decoder_t plugin;
static DB_functions_t *deadbeef;
-static CdIo_t* cdio = NULL;
-static lsn_t first_sector;
-static unsigned int sector_count;
-static uint8_t tail [SECTORSIZE];
-static unsigned int tail_len;
-static int current_sector;
-static unsigned int current_sample = 0;
+typedef struct {
+ DB_fileinfo_t info;
+ CdIo_t* cdio;
+ lsn_t first_sector;
+ unsigned int sector_count;
+ uint8_t tail [SECTORSIZE];
+ unsigned int tail_len;
+ int current_sector;
+ unsigned int current_sample;
+} cdda_info_t;
+
static uintptr_t mutex;
static intptr_t cddb_tid;
-
-#define DEFAULT_SERVER "freedb.org"
-#define DEFAULT_PORT 888
-#define DEFAULT_USE_CDDB 1
-#define DEFAULT_PROTOCOL 1
-
-
struct cddb_thread_params
{
DB_playItem_t *items[100];
@@ -66,9 +68,13 @@ min (int a, int b) {
return a < b ? a : b;
}
-static int
+static DB_fileinfo_t *
cda_init (DB_playItem_t *it) {
-// trace ("CDA: initing %s\n", it->fname);
+ DB_fileinfo_t *_info = malloc (sizeof (cdda_info_t));
+ cdda_info_t *info = (cdda_info_t *)_info;
+ memset (info, 0, sizeof (cdda_info_t));
+
+ trace ("cdda: init %s\n", it->fname);
size_t l = strlen (it->fname);
char location[l+1];
@@ -79,125 +85,133 @@ cda_init (DB_playItem_t *it) {
*nr = 0; nr++;
}
else {
- trace ("malformed cdaudio track filename\n");
- return -1;
+ trace ("cdda: bad name: %s\n", it->fname);
+ plugin.free (_info);
+ return NULL;
}
int track_nr = atoi (nr);
char *fname = (*location) ? location : NULL; //NULL if empty string; means pysical CD drive
- cdio = cdio_open (fname, DRIVER_UNKNOWN);
- if (!cdio)
+ info->cdio = cdio_open (fname, DRIVER_UNKNOWN);
+ if (!info->cdio)
{
- trace ("Could not open CD\n");
- return -1;
+ trace ("cdda: Could not open CD\n");
+ plugin.free (_info);
+ return NULL;
}
- if (TRACK_FORMAT_AUDIO != cdio_get_track_format (cdio, track_nr))
+ if (TRACK_FORMAT_AUDIO != cdio_get_track_format (info->cdio, track_nr))
{
- trace ("Not an audio track (%d)\n", track_nr);
- return -1;
+ trace ("cdda: Not an audio track (%d)\n", track_nr);
+ plugin.free (_info);
+ return NULL;
}
- plugin.info.bps = 16,
- plugin.info.channels = 2,
- plugin.info.samplerate = 44100,
- plugin.info.readpos = 0;
-
- first_sector = cdio_get_track_lsn (cdio, track_nr);
- sector_count = cdio_get_track_sec_count (cdio, track_nr);
- current_sector = first_sector;
- tail_len = 0;
- current_sample = 0;
- return 0;
+ _info->plugin = &plugin;
+ _info->bps = 16,
+ _info->channels = 2,
+ _info->samplerate = 44100,
+ _info->readpos = 0;
+
+ info->first_sector = cdio_get_track_lsn (info->cdio, track_nr);
+ info->sector_count = cdio_get_track_sec_count (info->cdio, track_nr);
+ info->current_sector = info->first_sector;
+ info->tail_len = 0;
+ info->current_sample = 0;
+ return _info;
}
int
-cda_read_int16 (char *bytes, int size) {
+cda_read_int16 (DB_fileinfo_t *_info, char *bytes, int size) {
+ cdda_info_t *info = (cdda_info_t *)_info;
int extrasize = 0;
- if (tail_len > 0)
+ if (info->tail_len > 0)
{
- if (tail_len >= size)
+ if (info->tail_len >= size)
{
// trace ("Easy case\n");
- memcpy (bytes, tail, size);
- tail_len -= size;
- memmove (tail, tail+size, tail_len);
+ memcpy (bytes, info->tail, size);
+ info->tail_len -= size;
+ memmove (info->tail, info->tail+size, info->tail_len);
return size;
}
// trace ("Prepending with tail of %d bytes\n", tail_len);
- extrasize = tail_len;
- memcpy (bytes, tail, tail_len);
- bytes += tail_len;
- size -= tail_len;
- tail_len = 0;
+ extrasize = info->tail_len;
+ memcpy (bytes, info->tail, info->tail_len);
+ bytes += info->tail_len;
+ size -= info->tail_len;
+ info->tail_len = 0;
}
int sectors_to_read = size / SECTORSIZE + 1;
int end = 0;
- if (current_sector + sectors_to_read > first_sector + sector_count) //we reached end of track
+ if (info->current_sector + sectors_to_read > info->first_sector + info->sector_count) // reached end of track
{
end = 1;
- sectors_to_read = first_sector + sector_count - current_sector;
-// trace ("We reached end of track\n");
+ sectors_to_read = info->first_sector + info->sector_count - info->current_sector;
+// trace ("cdda: reached end of track\n");
}
int bufsize = sectors_to_read * SECTORSIZE;
- tail_len = end ? 0 : bufsize - size;
+ info->tail_len = end ? 0 : bufsize - size;
char *buf = alloca (bufsize);
- driver_return_code_t ret = cdio_read_audio_sectors (cdio, buf, current_sector, sectors_to_read);
+ driver_return_code_t ret = cdio_read_audio_sectors (info->cdio, buf, info->current_sector, sectors_to_read);
if (ret != DRIVER_OP_SUCCESS)
return 0;
- current_sector += sectors_to_read;
+ info->current_sector += sectors_to_read;
int retsize = end ? bufsize : size;
memcpy (bytes, buf, retsize);
if (!end)
- memcpy (tail, buf+retsize, tail_len);
+ memcpy (info->tail, buf+retsize, info->tail_len);
retsize += extrasize;
// trace ("requested: %d; tail_len: %d; size: %d; sectors_to_read: %d; return: %d\n", initsize, tail_len, size, sectors_to_read, retsize);
- current_sample += retsize / SAMPLESIZE;
- plugin.info.readpos = current_sample / 44100;
+ info->current_sample += retsize / SAMPLESIZE;
+ _info->readpos = (float)info->current_sample / _info->samplerate;
return retsize;
}
static void
-cda_free ()
+cda_free (DB_fileinfo_t *_info)
{
- if (cdio)
- {
- cdio_destroy (cdio);
- cdio = NULL;
+ if (_info) {
+ cdda_info_t *info = (cdda_info_t *)_info;
+ if (info->cdio) {
+ cdio_destroy (info->cdio);
+ }
+ free (_info);
}
}
static int
-cda_seek_sample (int sample)
+cda_seek_sample (DB_fileinfo_t *_info, int sample)
{
- int sector = sample / (SECTORSIZE / SAMPLESIZE) + first_sector;
+ cdda_info_t *info = (cdda_info_t *)_info;
+ int sector = sample / (SECTORSIZE / SAMPLESIZE) + info->first_sector;
int offset = (sample % (SECTORSIZE / SAMPLESIZE)) * SAMPLESIZE; //in bytes
char buf [SECTORSIZE];
- driver_return_code_t ret = cdio_read_audio_sector (cdio, buf, sector);
+ driver_return_code_t ret = cdio_read_audio_sector (info->cdio, buf, sector);
if (ret != DRIVER_OP_SUCCESS)
return -1;
- memcpy (tail, buf + offset, SECTORSIZE - offset );
- current_sector = sector;
- current_sample = sample;
- plugin.info.readpos = current_sample / 44100;
+ memcpy (info->tail, buf + offset, SECTORSIZE - offset);
+ info->current_sector = sector;
+ info->current_sample = sample;
+ _info->readpos = (float)info->current_sample / _info->samplerate;
return 0;
}
static int
-cda_seek (float sec)
+cda_seek (DB_fileinfo_t *_info, float sec)
{
- return cda_seek_sample (sec * 44100);
+ return cda_seek_sample (_info, sec * _info->samplerate);
}
cddb_disc_t*
@@ -219,8 +233,6 @@ resolve_disc (CdIo_t *cdio)
cddb_track_set_frame_offset (track, offset);
cddb_disc_add_track (disc, track);
}
- cdio_destroy (cdio);
-
cddb_conn_t *conn = NULL;
conn = cddb_new();
@@ -265,10 +277,10 @@ insert_single_track (CdIo_t* cdio, DB_playItem_t *after, const char* file, int t
return NULL;
}
- sector_count = cdio_get_track_sec_count (cdio, track_nr);
+ int sector_count = cdio_get_track_sec_count (cdio, track_nr);
DB_playItem_t *it = deadbeef->pl_item_alloc ();
- it->decoder = &plugin;
+ it->decoder_id = deadbeef->plug_get_decoder_id (plugin.plugin.id);
it->fname = strdup (tmp);
it->filetype = "cdda";
deadbeef->pl_set_item_duration (it, (float)sector_count / 75.0);
@@ -296,6 +308,9 @@ cddb_thread (void *items_i)
if (!disc)
{
trace ("disc not resolved\n");
+ if (params->cdio) {
+ cdio_destroy (params->cdio);
+ }
free (params);
return;
}
@@ -330,6 +345,9 @@ cddb_thread (void *items_i)
}
cddb_disc_destroy (disc);
deadbeef->mutex_unlock (mutex);
+ if (params->cdio) {
+ cdio_destroy (params->cdio);
+ }
free (params);
cddb_tid = 0;
}
@@ -337,7 +355,7 @@ cddb_thread (void *items_i)
static DB_playItem_t *
cda_insert (DB_playItem_t *after, const char *fname) {
// trace ("CDA insert: %s\n", fname);
-
+ CdIo_t* cdio = NULL;
int track_nr;
DB_playItem_t *res;
@@ -430,6 +448,7 @@ static DB_decoder_t plugin = {
.plugin.version_major = 0,
.plugin.version_minor = 1,
.plugin.type = DB_PLUGIN_DECODER,
+ .plugin.id = "cda",
.plugin.name = "Audio CD player",
.plugin.descr = "using libcdio, includes .nrg image support",
.plugin.author = "Viktor Semykin, Alexey Yakovenko",
@@ -445,14 +464,12 @@ static DB_decoder_t plugin = {
.seek_sample = cda_seek_sample,
.insert = cda_insert,
.exts = exts,
- .id = "cda",
.filetypes = filetypes,
};
DB_plugin_t *
cdda_load (DB_functions_t *api) {
deadbeef = api;
-// read_config();
return DB_PLUGIN (&plugin);
}
diff --git a/plugins/ffap/ffap.c b/plugins/ffap/ffap.c
index b8457099..23daa170 100644
--- a/plugins/ffap/ffap.c
+++ b/plugins/ffap/ffap.c
@@ -48,9 +48,6 @@
static DB_decoder_t plugin;
static DB_functions_t *deadbeef;
-static int startsample;
-static int endsample;
-
#define PACKET_BUFFER_SIZE 100000
#define min(x,y) ((x)<(y)?(x):(y))
@@ -269,7 +266,14 @@ typedef struct APEContext {
int error;
} APEContext;
-APEContext ape_ctx;
+typedef struct {
+ DB_fileinfo_t info;
+ int startsample;
+ int endsample;
+ APEContext ape_ctx;
+ DB_FILE *fp;
+} ape_info_t;
+
inline static int
read_uint16(DB_FILE *fp, uint16_t* x)
@@ -654,68 +658,81 @@ ape_free_ctx (APEContext *ape_ctx) {
}
static void
-ffap_free (void)
+ffap_free (DB_fileinfo_t *_info)
{
- ape_free_ctx (&ape_ctx);
+ ape_info_t *info = (ape_info_t *)_info;
+ ape_free_ctx (&info->ape_ctx);
+ if (info->fp) {
+ deadbeef->fclose (info->fp);
+ }
+ free (info);
}
-static DB_FILE *fp;
-
-static int
+static DB_fileinfo_t *
ffap_init(DB_playItem_t *it)
{
- fp = deadbeef->fopen (it->fname);
- if (!fp) {
- return -1;
+ DB_fileinfo_t *_info = malloc (sizeof (ape_info_t));
+ ape_info_t *info = (ape_info_t*)_info;
+ memset (info, 0, sizeof (ape_info_t));
+
+ info->fp = deadbeef->fopen (it->fname);
+ if (!info->fp) {
+ plugin.free (_info);
+ return NULL;
}
- memset (&ape_ctx, 0, sizeof (ape_ctx));
- ape_read_header (fp, &ape_ctx);
+ memset (&info->ape_ctx, 0, sizeof (info->ape_ctx));
+ ape_read_header (info->fp, &info->ape_ctx);
int i;
- if (ape_ctx.channels > 2) {
+ if (info->ape_ctx.channels > 2) {
fprintf (stderr, "ape: Only mono and stereo is supported\n");
- return -1;
+ plugin.free (_info);
+ return NULL;
}
#if ENABLE_DEBUG
- fprintf (stderr, "ape: Compression Level: %d - Flags: %d\n", ape_ctx.compressiontype, ape_ctx.formatflags);
+ fprintf (stderr, "ape: Compression Level: %d - Flags: %d\n", info->ape_ctx.compressiontype, info->ape_ctx.formatflags);
#endif
- if (ape_ctx.compressiontype % 1000 || ape_ctx.compressiontype > COMPRESSION_LEVEL_INSANE) {
- fprintf (stderr, "ape: Incorrect compression level %d\n", ape_ctx.compressiontype);
- return -1;
+ if (info->ape_ctx.compressiontype % 1000 || info->ape_ctx.compressiontype > COMPRESSION_LEVEL_INSANE) {
+ fprintf (stderr, "ape: Incorrect compression level %d\n", info->ape_ctx.compressiontype);
+ plugin.free (_info);
+ return NULL;
}
- ape_ctx.fset = ape_ctx.compressiontype / 1000 - 1;
+ info->ape_ctx.fset = info->ape_ctx.compressiontype / 1000 - 1;
for (i = 0; i < APE_FILTER_LEVELS; i++) {
- if (!ape_filter_orders[ape_ctx.fset][i])
+ if (!ape_filter_orders[info->ape_ctx.fset][i])
break;
- int err = posix_memalign ((void **)&ape_ctx.filterbuf[i], 16, (ape_filter_orders[ape_ctx.fset][i] * 3 + HISTORY_SIZE) * 4);
+ int err = posix_memalign ((void **)&info->ape_ctx.filterbuf[i], 16, (ape_filter_orders[info->ape_ctx.fset][i] * 3 + HISTORY_SIZE) * 4);
if (err) {
trace ("ffap: out of memory (posix_memalign)\n");
- return -1;
+ plugin.free (_info);
+ return NULL;
}
}
- plugin.info.bps = ape_ctx.bps;
- plugin.info.samplerate = ape_ctx.samplerate;
- plugin.info.channels = ape_ctx.channels;
- plugin.info.readpos = 0;
+ _info->plugin = &plugin;
+ _info->bps = info->ape_ctx.bps;
+ _info->samplerate = info->ape_ctx.samplerate;
+ _info->channels = info->ape_ctx.channels;
+ _info->readpos = 0;
if (it->endsample > 0) {
- startsample = it->startsample;
- endsample = it->endsample;
- plugin.seek_sample (0);
+ info->startsample = it->startsample;
+ info->endsample = it->endsample;
+ plugin.seek_sample (_info, 0);
//trace ("start: %d/%f, end: %d/%f\n", startsample, timestart, endsample, timeend);
}
else {
- startsample = 0;
- endsample = ape_ctx.totalsamples-1;
+ info->startsample = 0;
+ info->endsample = info->ape_ctx.totalsamples-1;
}
- ape_ctx.packet_data = malloc (PACKET_BUFFER_SIZE);
- if (!ape_ctx.packet_data) {
+ info->ape_ctx.packet_data = malloc (PACKET_BUFFER_SIZE);
+ if (!info->ape_ctx.packet_data) {
fprintf (stderr, "ape: failed to allocate memory for packet data\n");
- return -1;
+ plugin.free (_info);
+ return NULL;
}
- return 0;
+ return _info;
}
/**
@@ -1525,14 +1542,16 @@ static void ape_unpack_stereo(APEContext * ctx, int count)
}
static int
-ape_decode_frame(APEContext *s, void *data, int *data_size)
+ape_decode_frame(DB_fileinfo_t *_info, void *data, int *data_size)
{
+ ape_info_t *info = (ape_info_t*)_info;
+ APEContext *s = &info->ape_ctx;
int16_t *samples = data;
int nblocks;
int i, n;
int blockstodecode;
int bytes_used;
- int samplesize = plugin.info.bps>>3;
+ int samplesize = _info->bps>>3;
/* should not happen but who knows */
if (BLOCKS_PER_LOOP * samplesize * s->channels > *data_size) {
@@ -1549,7 +1568,7 @@ ape_decode_frame(APEContext *s, void *data, int *data_size)
// fprintf (stderr, "start reading packet %d\n", ape_ctx.currentframe);
assert (s->samples == 0); // all samples from prev packet must have been read
// start new packet
- if (ape_read_packet (fp, &ape_ctx) < 0) {
+ if (ape_read_packet (info->fp, s) < 0) {
fprintf (stderr, "ape: error reading packet\n");
return -1;
}
@@ -1588,7 +1607,7 @@ ape_decode_frame(APEContext *s, void *data, int *data_size)
sz = min (sz, s->packet_sizeleft);
sz = sz&~3;
uint8_t *p = s->packet_data + s->packet_remaining;
- int r = deadbeef->fread (p, 1, sz, fp);
+ int r = deadbeef->fread (p, 1, sz, info->fp);
bswap_buf((uint32_t*)p, (const uint32_t*)p, r >> 2);
s->packet_sizeleft -= r;
s->packet_remaining += r;
@@ -1633,9 +1652,9 @@ ape_decode_frame(APEContext *s, void *data, int *data_size)
i = skip;
for (; i < blockstodecode; i++) {
- *samples++ = (int16_t)(s->decoded0[i]>>(plugin.info.bps-16));
+ *samples++ = (int16_t)(s->decoded0[i]>>(_info->bps-16));
if(s->channels == 2) {
- *samples++ = (int16_t)(s->decoded1[i]>>(plugin.info.bps-16));
+ *samples++ = (int16_t)(s->decoded1[i]>>(_info->bps-16));
}
}
@@ -1682,7 +1701,7 @@ ffap_insert (DB_playItem_t *after, const char *fname) {
float duration = ape_ctx.totalsamples / (float)ape_ctx.samplerate;
DB_playItem_t *it = NULL;
it = deadbeef->pl_item_alloc ();
- it->decoder = &plugin;
+ it->decoder_id = deadbeef->plug_get_decoder_id (plugin.plugin.id);
it->fname = strdup (fname);
it->filetype = "APE";
deadbeef->pl_set_item_duration (it, duration);
@@ -1702,7 +1721,7 @@ ffap_insert (DB_playItem_t *after, const char *fname) {
DB_playItem_t *cue = deadbeef->pl_insert_cue (after, it, ape_ctx.totalsamples, ape_ctx.samplerate);
if (cue) {
- deadbeef->pl_item_free (it);
+ deadbeef->pl_item_unref (it);
return cue;
}
@@ -1711,7 +1730,7 @@ ffap_insert (DB_playItem_t *after, const char *fname) {
if (cuesheet) {
cue = deadbeef->pl_insert_cue_from_buffer (after, it, cuesheet, strlen (cuesheet), ape_ctx.totalsamples, ape_ctx.samplerate);
if (cue) {
- deadbeef->pl_item_free (it);
+ deadbeef->pl_item_unref (it);
return cue;
}
}
@@ -1723,79 +1742,81 @@ ffap_insert (DB_playItem_t *after, const char *fname) {
}
static int
-ffap_read_int16 (char *buffer, int size) {
- if (ape_ctx.currentsample + size / (2 * ape_ctx.channels) > endsample) {
- size = (endsample - ape_ctx.currentsample + 1) * 2 * ape_ctx.channels;
- trace ("size truncated to %d bytes, cursample=%d, endsample=%d, totalsamples=%d\n", size, ape_ctx.currentsample, endsample, ape_ctx.totalsamples);
+ffap_read_int16 (DB_fileinfo_t *_info, char *buffer, int size) {
+ ape_info_t *info = (ape_info_t*)_info;
+ if (info->ape_ctx.currentsample + size / (2 * info->ape_ctx.channels) > info->endsample) {
+ size = (info->endsample - info->ape_ctx.currentsample + 1) * 2 * info->ape_ctx.channels;
+ trace ("size truncated to %d bytes, cursample=%d, info->endsample=%d, totalsamples=%d\n", size, info->ape_ctx.currentsample, info->endsample, info->ape_ctx.totalsamples);
if (size <= 0) {
return 0;
}
}
int inits = size;
while (size > 0) {
- if (ape_ctx.remaining > 0) {
- int sz = min (size, ape_ctx.remaining);
- memcpy (buffer, ape_ctx.buffer, sz);
+ if (info->ape_ctx.remaining > 0) {
+ int sz = min (size, info->ape_ctx.remaining);
+ memcpy (buffer, info->ape_ctx.buffer, sz);
buffer += sz;
size -= sz;
- if (ape_ctx.remaining > sz) {
- memmove (ape_ctx.buffer, ape_ctx.buffer + sz, ape_ctx.remaining-sz);
+ if (info->ape_ctx.remaining > sz) {
+ memmove (info->ape_ctx.buffer, info->ape_ctx.buffer + sz, info->ape_ctx.remaining-sz);
}
- ape_ctx.remaining -= sz;
+ info->ape_ctx.remaining -= sz;
continue;
}
int s = BLOCKS_PER_LOOP * 2 * 2 * 2;
- assert (ape_ctx.remaining <= s/2);
- s -= ape_ctx.remaining;
- uint8_t *buf = ape_ctx.buffer + ape_ctx.remaining;
- int n = ape_decode_frame (&ape_ctx, buf, &s);
+ assert (info->ape_ctx.remaining <= s/2);
+ s -= info->ape_ctx.remaining;
+ uint8_t *buf = info->ape_ctx.buffer + info->ape_ctx.remaining;
+ int n = ape_decode_frame (_info, buf, &s);
if (n == -1) {
break;
}
- ape_ctx.remaining += s;
+ info->ape_ctx.remaining += s;
- int sz = min (size, ape_ctx.remaining);
- memcpy (buffer, ape_ctx.buffer, sz);
+ int sz = min (size, info->ape_ctx.remaining);
+ memcpy (buffer, info->ape_ctx.buffer, sz);
buffer += sz;
size -= sz;
- if (ape_ctx.remaining > sz) {
- memmove (ape_ctx.buffer, ape_ctx.buffer + sz, ape_ctx.remaining-sz);
+ if (info->ape_ctx.remaining > sz) {
+ memmove (info->ape_ctx.buffer, info->ape_ctx.buffer + sz, info->ape_ctx.remaining-sz);
}
- ape_ctx.remaining -= sz;
+ info->ape_ctx.remaining -= sz;
}
- ape_ctx.currentsample += (inits - size) / (2 * ape_ctx.channels);
- plugin.info.readpos = (ape_ctx.currentsample-startsample) / (float)plugin.info.samplerate;
+ info->ape_ctx.currentsample += (inits - size) / (2 * info->ape_ctx.channels);
+ _info->readpos = (info->ape_ctx.currentsample-info->startsample) / (float)_info->samplerate;
return inits - size;
}
static int
-ffap_seek_sample (int sample) {
- sample += startsample;
- trace ("seeking to %d/%d\n", sample, ape_ctx.totalsamples);
+ffap_seek_sample (DB_fileinfo_t *_info, int sample) {
+ ape_info_t *info = (ape_info_t*)_info;
+ sample += info->startsample;
+ trace ("seeking to %d/%d\n", sample, info->ape_ctx.totalsamples);
uint32_t newsample = sample;
- if (newsample > ape_ctx.totalsamples) {
+ if (newsample > info->ape_ctx.totalsamples) {
trace ("eof\n");
return -1;
}
- int nframe = newsample / ape_ctx.blocksperframe;
- if (nframe >= ape_ctx.totalframes) {
+ int nframe = newsample / info->ape_ctx.blocksperframe;
+ if (nframe >= info->ape_ctx.totalframes) {
trace ("eof2\n");
return -1;
}
- ape_ctx.currentframe = nframe;
- ape_ctx.samplestoskip = newsample - nframe * ape_ctx.blocksperframe;
+ info->ape_ctx.currentframe = nframe;
+ info->ape_ctx.samplestoskip = newsample - nframe * info->ape_ctx.blocksperframe;
// reset decoder
- ape_ctx.packet_remaining = 0;
- ape_ctx.samples = 0;
- ape_ctx.currentsample = newsample;
- plugin.info.readpos = (float)(newsample-startsample)/ape_ctx.samplerate;
+ info->ape_ctx.packet_remaining = 0;
+ info->ape_ctx.samples = 0;
+ info->ape_ctx.currentsample = newsample;
+ _info->readpos = (float)(newsample-info->startsample)/info->ape_ctx.samplerate;
return 0;
}
static int
-ffap_seek (float seconds) {
- return ffap_seek_sample (seconds * plugin.info.samplerate);
+ffap_seek (DB_fileinfo_t *_info, float seconds) {
+ return ffap_seek_sample (_info, seconds * _info->samplerate);
}
static const char *exts[] = { "ape", NULL };
@@ -1806,6 +1827,7 @@ static DB_decoder_t plugin = {
.plugin.version_major = 0,
.plugin.version_minor = 1,
.plugin.type = DB_PLUGIN_DECODER,
+ .plugin.id = "ffap",
.plugin.name = "Monkey's Audio (APE) decoder",
.plugin.descr = "APE player based on code from libavc and rockbox",
.plugin.author = "Alexey Yakovenko",
@@ -1818,7 +1840,6 @@ static DB_decoder_t plugin = {
.seek_sample = ffap_seek_sample,
.insert = ffap_insert,
.exts = exts,
- .id = "ffap",
.filetypes = filetypes
};
diff --git a/plugins/ffmpeg/ffmpeg.c b/plugins/ffmpeg/ffmpeg.c
index 4f1fec0f..289f0ae0 100644
--- a/plugins/ffmpeg/ffmpeg.c
+++ b/plugins/ffmpeg/ffmpeg.c
@@ -71,24 +71,31 @@ static const char *filetypes[] = { "M4A", "MusePack", "WMA", "Shorten", "atrac3"
#define FF_PROTOCOL_NAME "deadbeef"
-static AVCodec *codec;
-static AVCodecContext *ctx;
-static AVFormatContext *fctx;
-static AVPacket pkt;
-static int stream_id;
-
-static int left_in_packet;
-static int have_packet;
-
-static char *buffer; // must be AVCODEC_MAX_AUDIO_FRAME_SIZE
-static int left_in_buffer;
-
-static int startsample;
-static int endsample;
-static int currentsample;
-
-static int
+typedef struct {
+ DB_fileinfo_t info;
+ AVCodec *codec;
+ AVCodecContext *ctx;
+ AVFormatContext *fctx;
+ AVPacket pkt;
+ int stream_id;
+
+ int left_in_packet;
+ int have_packet;
+
+ char *buffer; // must be AVCODEC_MAX_AUDIO_FRAME_SIZE
+ int left_in_buffer;
+
+ int startsample;
+ int endsample;
+ int currentsample;
+} ffmpeg_info_t;
+
+static DB_fileinfo_t *
ffmpeg_init (DB_playItem_t *it) {
+ DB_fileinfo_t *_info = malloc (sizeof (ffmpeg_info_t));
+ ffmpeg_info_t *info = (ffmpeg_info_t*)_info;
+ memset (info, 0, sizeof (ffmpeg_info_t));
+
// prepare to decode the track
// return -1 on failure
@@ -105,116 +112,114 @@ ffmpeg_init (DB_playItem_t *it) {
trace ("ffmpeg: uri: %s\n", uri);
// open file
- if ((ret = av_open_input_file(&fctx, uri, NULL, 0, NULL)) < 0) {
- trace ("fctx is %p, ret %d/%s\n", fctx, ret, strerror(-ret));
- return -1;
+ if ((ret = av_open_input_file(&info->fctx, uri, NULL, 0, NULL)) < 0) {
+ trace ("info->fctx is %p, ret %d/%s\n", info->fctx, ret, strerror(-ret));
+ plugin.free (_info);
+ return NULL;
}
- stream_id = -1;
- av_find_stream_info(fctx);
- for (i = 0; i < fctx->nb_streams; i++)
+ info->stream_id = -1;
+ av_find_stream_info(info->fctx);
+ for (i = 0; i < info->fctx->nb_streams; i++)
{
- ctx = fctx->streams[i]->codec;
- if (ctx->codec_type == CODEC_TYPE_AUDIO)
+ info->ctx = info->fctx->streams[i]->codec;
+ if (info->ctx->codec_type == CODEC_TYPE_AUDIO)
{
- codec = avcodec_find_decoder(ctx->codec_id);
- if (codec != NULL) {
- stream_id = i;
+ info->codec = avcodec_find_decoder (info->ctx->codec_id);
+ if (info->codec != NULL) {
+ info->stream_id = i;
break;
}
}
}
- if (codec == NULL)
+ if (info->codec == NULL)
{
trace ("ffmpeg can't decode %s\n", it->fname);
- av_close_input_file(fctx);
- return -1;
+ plugin.free (_info);
+ return NULL;
}
trace ("ffmpeg can decode %s\n", it->fname);
- trace ("ffmpeg: codec=%s, stream=%d\n", codec->name, i);
+ trace ("ffmpeg: codec=%s, stream=%d\n", info->codec->name, i);
- if (avcodec_open (ctx, codec) < 0) {
+ if (avcodec_open (info->ctx, info->codec) < 0) {
trace ("ffmpeg: avcodec_open failed\n");
- av_close_input_file(fctx);
- return -1;
+ plugin.free (_info);
+ return NULL;
}
- int bps = av_get_bits_per_sample_format (ctx->sample_fmt);
- int samplerate = ctx->sample_rate;
- float duration = fctx->duration / (float)AV_TIME_BASE;
+ int bps = av_get_bits_per_sample_format (info->ctx->sample_fmt);
+ int samplerate = info->ctx->sample_rate;
+ float duration = info->fctx->duration / (float)AV_TIME_BASE;
trace ("ffmpeg: bits per sample is %d\n", bps);
trace ("ffmpeg: samplerate is %d\n", samplerate);
- trace ("ffmpeg: duration is %lld/%fsec\n", fctx->duration, duration);
+ trace ("ffmpeg: duration is %lld/%fsec\n", info->fctx->duration, duration);
- int totalsamples = fctx->duration * samplerate / AV_TIME_BASE;
- left_in_packet = 0;
- left_in_buffer = 0;
+ int totalsamples = info->fctx->duration * samplerate / AV_TIME_BASE;
+ info->left_in_packet = 0;
+ info->left_in_buffer = 0;
- memset (&pkt, 0, sizeof (pkt));
- have_packet = 0;
+ memset (&info->pkt, 0, sizeof (info->pkt));
+ info->have_packet = 0;
- int err = posix_memalign ((void **)&buffer, 16, AVCODEC_MAX_AUDIO_FRAME_SIZE);
+ int err = posix_memalign ((void **)&info->buffer, 16, AVCODEC_MAX_AUDIO_FRAME_SIZE);
if (err) {
fprintf (stderr, "ffmpeg: failed to allocate buffer memory\n");
- return -1;
+ plugin.free (_info);
+ return NULL;
}
// fill in mandatory plugin fields
- plugin.info.readpos = 0;
- plugin.info.bps = bps;
- plugin.info.channels = ctx->channels;
- plugin.info.samplerate = samplerate;
+ _info->plugin = &plugin;
+ _info->readpos = 0;
+ _info->bps = bps;
+ _info->channels = info->ctx->channels;
+ _info->samplerate = samplerate;
// subtrack info
- currentsample = 0;
+ info->currentsample = 0;
if (it->endsample > 0) {
- startsample = it->startsample;
- endsample = it->endsample;
- plugin.seek_sample (0);
+ info->startsample = it->startsample;
+ info->endsample = it->endsample;
+ plugin.seek_sample (_info, 0);
}
else {
- startsample = 0;
- endsample = totalsamples - 1;
+ info->startsample = 0;
+ info->endsample = totalsamples - 1;
}
- return 0;
+ return _info;
}
static void
-ffmpeg_free (void) {
- if (buffer) {
- free (buffer);
- buffer = NULL;
- }
- // free everything allocated in _init and _read_int16
- if (have_packet) {
- av_free_packet (&pkt);
- have_packet = 0;
- }
- left_in_buffer = 0;
- left_in_packet = 0;
- stream_id = -1;
-
- if (fctx) {
- av_close_input_file(fctx);
- fctx = NULL;
- }
- if (ctx) {
- avcodec_close (ctx);
- ctx = NULL;
+ffmpeg_free (DB_fileinfo_t *_info) {
+ ffmpeg_info_t *info = (ffmpeg_info_t*)_info;
+ if (info) {
+ if (info->buffer) {
+ free (info->buffer);
+ }
+ // free everything allocated in _init and _read_int16
+ if (info->have_packet) {
+ av_free_packet (&info->pkt);
+ }
+ if (info->fctx) {
+ av_close_input_file (info->fctx);
+ }
+ if (info->ctx) {
+ avcodec_close (info->ctx);
+ }
+ free (info);
}
-
- codec = NULL;
}
static int
-ffmpeg_read_int16 (char *bytes, int size) {
+ffmpeg_read_int16 (DB_fileinfo_t *_info, char *bytes, int size) {
+ ffmpeg_info_t *info = (ffmpeg_info_t*)_info;
// try decode `size' bytes
// return number of decoded bytes
// return 0 on EOF
- if (currentsample + size / (2 * plugin.info.channels) > endsample) {
- size = (endsample - currentsample + 1) * 2 * plugin.info.channels;
+ if (info->currentsample + size / (2 * _info->channels) > info->endsample) {
+ size = (info->endsample - info->currentsample + 1) * 2 * _info->channels;
if (size <= 0) {
return 0;
}
@@ -227,25 +232,25 @@ ffmpeg_read_int16 (char *bytes, int size) {
while (size > 0) {
- if (left_in_buffer > 0) {
- int sz = min (size, left_in_buffer);
- memcpy (bytes, buffer, sz);
- if (sz != left_in_buffer) {
- memmove (buffer, buffer+sz, left_in_buffer-sz);
+ if (info->left_in_buffer > 0) {
+ int sz = min (size, info->left_in_buffer);
+ memcpy (bytes, info->buffer, sz);
+ if (sz != info->left_in_buffer) {
+ memmove (info->buffer, info->buffer+sz, info->left_in_buffer-sz);
}
- left_in_buffer -= sz;
+ info->left_in_buffer -= sz;
size -= sz;
bytes += sz;
}
- while (left_in_packet > 0 && size > 0) {
+ while (info->left_in_packet > 0 && size > 0) {
int out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
int len;
// trace ("in: out_size=%d(%d), size=%d\n", out_size, AVCODEC_MAX_AUDIO_FRAME_SIZE, size);
#if (LIBAVCODEC_VERSION_MAJOR <= 52) && (LIBAVCODEC_VERSION_MINOR <= 25)
- len = avcodec_decode_audio2(ctx, (int16_t *)buffer, &out_size, pkt.data, pkt.size);
+ len = avcodec_decode_audio2 (info->ctx, (int16_t *)info->buffer, &out_size, info->pkt.data, info->pkt.size);
#else
- len = avcodec_decode_audio3(ctx, (int16_t *)buffer, &out_size, &pkt);
+ len = avcodec_decode_audio3 (info->ctx, (int16_t *)info->buffer, &out_size, &info->pkt);
#endif
// trace ("out: out_size=%d, len=%d\n", out_size, len);
if (len <= 0) {
@@ -253,22 +258,22 @@ ffmpeg_read_int16 (char *bytes, int size) {
}
encsize += len;
decsize += out_size;
- left_in_packet -= len;
- left_in_buffer = out_size;
+ info->left_in_packet -= len;
+ info->left_in_buffer = out_size;
}
if (size == 0) {
break;
}
// read next packet
- if (have_packet) {
- av_free_packet (&pkt);
- have_packet = 0;
+ if (info->have_packet) {
+ av_free_packet (&info->pkt);
+ info->have_packet = 0;
}
int errcount = 0;
for (;;) {
int ret;
- if ((ret = av_read_frame(fctx, &pkt)) < 0) {
+ if ((ret = av_read_frame (info->fctx, &info->pkt)) < 0) {
trace ("ffmpeg: error %d\n", ret);
if (ret == AVERROR_EOF || ret == -1) {
ret = -1;
@@ -292,18 +297,18 @@ ffmpeg_read_int16 (char *bytes, int size) {
break;
}
// trace ("idx:%d, stream:%d\n", pkt.stream_index, stream_id);
- if (pkt.stream_index != stream_id) {
- av_free_packet (&pkt);
+ if (info->pkt.stream_index != info->stream_id) {
+ av_free_packet (&info->pkt);
continue;
}
// trace ("got packet: size=%d\n", pkt.size);
- have_packet = 1;
- left_in_packet = pkt.size;
+ info->have_packet = 1;
+ info->left_in_packet = info->pkt.size;
- if (pkt.duration > 0) {
- AVRational *time_base = &fctx->streams[stream_id]->time_base;
- float sec = (float)pkt.duration * time_base->num / time_base->den;
- int bitrate = pkt.size/sec;
+ if (info->pkt.duration > 0) {
+ AVRational *time_base = &info->fctx->streams[info->stream_id]->time_base;
+ float sec = (float)info->pkt.duration * time_base->num / time_base->den;
+ int bitrate = info->pkt.size/sec;
if (bitrate > 0) {
// FIXME: seems like duration translation is wrong
deadbeef->streamer_set_bitrate (bitrate / 100);
@@ -312,48 +317,50 @@ ffmpeg_read_int16 (char *bytes, int size) {
break;
}
- if (!have_packet) {
+ if (!info->have_packet) {
break;
}
}
- currentsample += (initsize-size) / (2 * plugin.info.channels);
- plugin.info.readpos = (float)currentsample / plugin.info.samplerate;
+ info->currentsample += (initsize-size) / (2 * _info->channels);
+ _info->readpos = (float)info->currentsample / _info->samplerate;
return initsize-size;
}
static int
-ffmpeg_seek_sample (int sample) {
+ffmpeg_seek_sample (DB_fileinfo_t *_info, int sample) {
+ ffmpeg_info_t *info = (ffmpeg_info_t*)_info;
// seek to specified sample (frame)
// return 0 on success
// return -1 on failure
- if (have_packet) {
- av_free_packet (&pkt);
- have_packet = 0;
+ if (info->have_packet) {
+ av_free_packet (&info->pkt);
+ info->have_packet = 0;
}
- sample += startsample;
- int64_t tm = (int64_t)sample/ plugin.info.samplerate * AV_TIME_BASE;
+ sample += info->startsample;
+ int64_t tm = (int64_t)sample/ _info->samplerate * AV_TIME_BASE;
trace ("ffmpeg: seek to sample: %d, t: %d\n", sample, (int)tm);
- left_in_packet = 0;
- left_in_buffer = 0;
- if (av_seek_frame(fctx, -1, tm, AVSEEK_FLAG_ANY) < 0) {
+ info->left_in_packet = 0;
+ info->left_in_buffer = 0;
+ if (av_seek_frame (info->fctx, -1, tm, AVSEEK_FLAG_ANY) < 0) {
trace ("ffmpeg: seek error\n");
return -1;
}
// update readpos
- currentsample = sample;
- plugin.info.readpos = (float)(sample-startsample) / plugin.info.samplerate;
+ info->currentsample = sample;
+ _info->readpos = (float)(sample - info->startsample) / _info->samplerate;
return 0;
}
static int
-ffmpeg_seek (float time) {
+ffmpeg_seek (DB_fileinfo_t *_info, float time) {
+ ffmpeg_info_t *info = (ffmpeg_info_t*)_info;
// seek to specified time in seconds
// return 0 on success
// return -1 on failure
- return ffmpeg_seek_sample (time * plugin.info.samplerate);
+ return ffmpeg_seek_sample (_info, time * _info->samplerate);
}
static DB_playItem_t *
@@ -456,7 +463,7 @@ ffmpeg_insert (DB_playItem_t *after, const char *fname) {
}
DB_playItem_t *it = deadbeef->pl_item_alloc ();
- it->decoder = &plugin;
+ it->decoder_id = deadbeef->plug_get_decoder_id (plugin.plugin.id);
it->fname = strdup (fname);
it->filetype = filetype;
@@ -493,7 +500,7 @@ ffmpeg_insert (DB_playItem_t *after, const char *fname) {
// external cuesheet
DB_playItem_t *cue = deadbeef->pl_insert_cue (after, it, totalsamples, samplerate);
if (cue) {
- deadbeef->pl_item_free (it);
+ deadbeef->pl_item_unref (it);
return cue;
}
// now the track is ready, insert into playlist
@@ -589,6 +596,7 @@ static DB_decoder_t plugin = {
.plugin.version_major = 0,
.plugin.version_minor = 1,
.plugin.type = DB_PLUGIN_DECODER,
+ .plugin.id = "ffmpeg",
.plugin.name = "FFMPEG audio player",
.plugin.descr = "decodes audio formats using FFMPEG libavcodec",
.plugin.author = "Alexey Yakovenko",
@@ -604,7 +612,6 @@ static DB_decoder_t plugin = {
.seek_sample = ffmpeg_seek_sample,
.insert = ffmpeg_insert,
.exts = exts,
- .id = "ffmpeg",
.filetypes = filetypes
};
diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c
index 82656795..173df64c 100644
--- a/plugins/flac/flac.c
+++ b/plugins/flac/flac.c
@@ -30,35 +30,34 @@ static DB_functions_t *deadbeef;
#define min(x,y) ((x)<(y)?(x):(y))
#define max(x,y) ((x)>(y)?(x):(y))
-static FLAC__StreamDecoder *decoder = 0;
#define BUFFERSIZE 100000
-static char *buffer; // this buffer always has float samples
-static int remaining; // bytes remaining in buffer from last read
-static int startsample;
-static int endsample;
-static int currentsample;
-static int flac_critical_error;
typedef struct {
+ DB_fileinfo_t info;
+ FLAC__StreamDecoder *decoder;
+ char *buffer; // this buffer always has float samples
+ int remaining; // bytes remaining in buffer from last read
+ int startsample;
+ int endsample;
+ int currentsample;
+ int totalsamples;
+ int flac_critical_error;
+ int init_stop_decoding;
+ int bytesread;
DB_FILE *file;
+
+ // used only on insert
DB_playItem_t *after;
DB_playItem_t *last;
DB_playItem_t *it;
const char *fname;
- int samplerate;
- int channels;
- int totalsamples;
- int bps;
- int bytesread;
-} cue_cb_data_t;
-
-static cue_cb_data_t flac_callbacks;
+} flac_info_t;
// callbacks
FLAC__StreamDecoderReadStatus flac_read_cb (const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) {
- cue_cb_data_t *cb = (cue_cb_data_t *)client_data;
- size_t r = deadbeef->fread (buffer, 1, *bytes, cb->file);
- cb->bytesread += r;
+ flac_info_t *info = (flac_info_t *)client_data;
+ size_t r = deadbeef->fread (buffer, 1, *bytes, info->file);
+ info->bytesread += r;
*bytes = r;
if (r == 0) {
return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
@@ -67,8 +66,8 @@ FLAC__StreamDecoderReadStatus flac_read_cb (const FLAC__StreamDecoder *decoder,
}
FLAC__StreamDecoderSeekStatus flac_seek_cb (const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) {
- cue_cb_data_t *cb = (cue_cb_data_t *)client_data;
- int r = deadbeef->fseek (cb->file, absolute_byte_offset, SEEK_SET);
+ flac_info_t *info = (flac_info_t *)client_data;
+ int r = deadbeef->fseek (info->file, absolute_byte_offset, SEEK_SET);
if (r) {
return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
}
@@ -76,18 +75,18 @@ FLAC__StreamDecoderSeekStatus flac_seek_cb (const FLAC__StreamDecoder *decoder,
}
FLAC__StreamDecoderTellStatus flac_tell_cb (const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) {
- cue_cb_data_t *cb = (cue_cb_data_t *)client_data;
- size_t r = deadbeef->ftell (cb->file);
+ flac_info_t *info = (flac_info_t *)client_data;
+ size_t r = deadbeef->ftell (info->file);
*absolute_byte_offset = r;
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
FLAC__StreamDecoderLengthStatus flac_lenght_cb (const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) {
- cue_cb_data_t *cb = (cue_cb_data_t *)client_data;
- size_t pos = deadbeef->ftell (cb->file);
- deadbeef->fseek (cb->file, 0, SEEK_END);
- *stream_length = deadbeef->ftell (cb->file);
- deadbeef->fseek (cb->file, pos, SEEK_SET);
+ flac_info_t *info = (flac_info_t *)client_data;
+ size_t pos = deadbeef->ftell (info->file);
+ deadbeef->fseek (info->file, 0, SEEK_END);
+ *stream_length = deadbeef->ftell (info->file);
+ deadbeef->fseek (info->file, pos, SEEK_SET);
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
@@ -97,37 +96,40 @@ FLAC__bool flac_eof_cb (const FLAC__StreamDecoder *decoder, void *client_data) {
static FLAC__StreamDecoderWriteStatus
cflac_write_callback (const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const inputbuffer[], void *client_data) {
- cue_cb_data_t *cb = (cue_cb_data_t *)client_data;
+ flac_info_t *info = (flac_info_t *)client_data;
+ DB_fileinfo_t *_info = &info->info;
if (frame->header.blocksize == 0) {
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
+ //DB_fileinfo_t *_info = info->info;
+ //flac_info_t *info = (flac_info_t *)_info;
int bitrate = -1;
float sec = ((float)frame->header.blocksize / frame->header.sample_rate);
- if (cb->bytesread != 0 && sec > 0) {
- bitrate = cb->bytesread / sec * 8;
+ if (info->bytesread != 0 && sec > 0) {
+ bitrate = info->bytesread / sec * 8;
}
- cb->bytesread = 0;
+ info->bytesread = 0;
if (bitrate > 0) {
deadbeef->streamer_set_bitrate (bitrate/1000);
}
- int bufsize = BUFFERSIZE-remaining;
- int bufsamples = bufsize / (plugin.info.channels * plugin.info.bps / 8);
+ int bufsize = BUFFERSIZE - info->remaining;
+ int bufsamples = bufsize / (_info->channels * _info->bps / 8);
int nsamples = min (bufsamples, frame->header.blocksize);
- char *bufptr = &buffer[remaining];
- float mul = 1.f/ ((1 << (plugin.info.bps-1))-1);
+ char *bufptr = &info->buffer[info->remaining];
+ float mul = 1.f/ ((1 << (_info->bps-1))-1);
- int channels = plugin.info.channels;
+ int channels = _info->channels;
if (channels > 2) {
channels = 2;
}
- int readbytes = frame->header.blocksize * channels * plugin.info.bps / 8;
+ int readbytes = frame->header.blocksize * channels * _info->bps / 8;
for (int i = 0; i < nsamples; i++) {
for (int c = 0; c < channels; c++) {
int32_t sample = inputbuffer[c][i];
*((float*)bufptr) = sample * mul;
bufptr += sizeof (float);
- remaining += sizeof (float);
+ info->remaining += sizeof (float);
}
}
if (readbytes > bufsize) {
@@ -139,42 +141,49 @@ cflac_write_callback (const FLAC__StreamDecoder *decoder, const FLAC__Frame *fra
static void
cflac_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) {
- cue_cb_data_t *cb = (cue_cb_data_t *)client_data;
- cb->totalsamples = metadata->data.stream_info.total_samples;
- cb->samplerate = metadata->data.stream_info.sample_rate;
- cb->channels = metadata->data.stream_info.channels;
- cb->bps = metadata->data.stream_info.bits_per_sample;
+ DB_fileinfo_t *_info = (DB_fileinfo_t *)client_data;
+ flac_info_t *info = (flac_info_t *)_info;
+ info->totalsamples = metadata->data.stream_info.total_samples;
+ _info->samplerate = metadata->data.stream_info.sample_rate;
+ _info->channels = metadata->data.stream_info.channels;
+ _info->bps = metadata->data.stream_info.bits_per_sample;
}
static void
cflac_error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) {
+ DB_fileinfo_t *_info = (DB_fileinfo_t *)client_data;
+ flac_info_t *info = (flac_info_t *)_info;
if (status != FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC) {
trace ("cflac: got error callback: %s\n", FLAC__StreamDecoderErrorStatusString[status]);
- flac_critical_error = 1;
+ info->flac_critical_error = 1;
}
}
-static int cflac_init_stop_decoding;
-
static void
cflac_init_error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) {
if (status != FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC) {
+ DB_fileinfo_t *_info = (DB_fileinfo_t *)client_data;
+ flac_info_t *info = (flac_info_t *)_info;
fprintf(stderr, "cflac: got error callback: %s\n", FLAC__StreamDecoderErrorStatusString[status]);
- cflac_init_stop_decoding = 1;
+ info->init_stop_decoding = 1;
}
}
-static int
+static DB_fileinfo_t *
cflac_init (DB_playItem_t *it) {
trace ("cflac_init %s\n", it->fname);
- memset (&flac_callbacks, 0, sizeof (flac_callbacks));
- flac_callbacks.file = deadbeef->fopen (it->fname);
- if (!flac_callbacks.file) {
+ DB_fileinfo_t *_info = malloc (sizeof (flac_info_t));
+ flac_info_t *info = (flac_info_t *)_info;
+ memset (info, 0, sizeof (flac_info_t));
+
+ info->file = deadbeef->fopen (it->fname);
+ if (!info->file) {
trace ("cflac_init failed to open file\n");
- return -1;
+ plugin.free (_info);
+ return NULL;
}
- flac_critical_error = 0;
+ info->flac_critical_error = 0;
const char *ext = it->fname + strlen (it->fname);
while (ext > it->fname && *ext != '/' && *ext != '.') {
@@ -190,126 +199,133 @@ cflac_init (DB_playItem_t *it) {
int isogg = 0;
int skip = 0;
if (ext && !strcasecmp (ext, "flac")) {
- skip = deadbeef->junk_get_leading_size (flac_callbacks.file);
+ skip = deadbeef->junk_get_leading_size (info->file);
if (skip > 0) {
- deadbeef->fseek (flac_callbacks.file, skip, SEEK_SET);
+ deadbeef->fseek (info->file, skip, SEEK_SET);
}
char sign[4];
- if (deadbeef->fread (sign, 1, 4, flac_callbacks.file) != 4) {
- plugin.free ();
+ if (deadbeef->fread (sign, 1, 4, info->file) != 4) {
trace ("cflac_init failed to read signature\n");
- return -1;
+ plugin.free (_info);
+ return NULL;
}
if (strncmp (sign, "fLaC", 4)) {
- plugin.free ();
trace ("cflac_init bad signature\n");
- return -1;
+ plugin.free (_info);
+ return NULL;
}
- deadbeef->fseek (flac_callbacks.file, -4, SEEK_CUR);
+ deadbeef->fseek (info->file, -4, SEEK_CUR);
}
else if (!FLAC_API_SUPPORTS_OGG_FLAC) {
trace ("flac: ogg transport support is not compiled into FLAC library\n");
- plugin.free ();
- return -1;
+ plugin.free (_info);
+ return NULL;
}
else {
isogg = 1;
}
FLAC__StreamDecoderInitStatus status;
- decoder = FLAC__stream_decoder_new();
- if (!decoder) {
+ info->decoder = FLAC__stream_decoder_new ();
+ if (!info->decoder) {
trace ("FLAC__stream_decoder_new failed\n");
- return -1;
+ plugin.free (_info);
+ return NULL;
}
- FLAC__stream_decoder_set_md5_checking(decoder, 0);
+ FLAC__stream_decoder_set_md5_checking (info->decoder, 0);
if (isogg) {
- status = FLAC__stream_decoder_init_ogg_stream (decoder, flac_read_cb, flac_seek_cb, flac_tell_cb, flac_lenght_cb, flac_eof_cb, cflac_write_callback, cflac_metadata_callback, cflac_error_callback, &flac_callbacks);
+ status = FLAC__stream_decoder_init_ogg_stream (info->decoder, flac_read_cb, flac_seek_cb, flac_tell_cb, flac_lenght_cb, flac_eof_cb, cflac_write_callback, cflac_metadata_callback, cflac_error_callback, info);
}
else {
- status = FLAC__stream_decoder_init_stream (decoder, flac_read_cb, flac_seek_cb, flac_tell_cb, flac_lenght_cb, flac_eof_cb, cflac_write_callback, cflac_metadata_callback, cflac_error_callback, &flac_callbacks);
+ status = FLAC__stream_decoder_init_stream (info->decoder, flac_read_cb, flac_seek_cb, flac_tell_cb, flac_lenght_cb, flac_eof_cb, cflac_write_callback, cflac_metadata_callback, cflac_error_callback, info);
}
if (status != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
- plugin.free ();
trace ("cflac_init bad decoder status\n");
- return -1;
+ plugin.free (_info);
+ return NULL;
}
- //plugin.info.samplerate = -1;
- if (!FLAC__stream_decoder_process_until_end_of_metadata (decoder)) {
- plugin.free ();
+ //_info->samplerate = -1;
+ if (!FLAC__stream_decoder_process_until_end_of_metadata (info->decoder)) {
trace ("cflac_init metadata failed\n");
- return -1;
+ plugin.free (_info);
+ return NULL;
}
- plugin.info.samplerate = flac_callbacks.samplerate;
- plugin.info.channels = flac_callbacks.channels;
- plugin.info.bps = flac_callbacks.bps;
- plugin.info.readpos = 0;
- if (plugin.info.samplerate == -1) { // not a FLAC stream
- plugin.free ();
+
+ // bps/samplerate/channels were set by callbacks
+ _info->plugin = &plugin;
+ _info->readpos = 0;
+
+ if (_info->samplerate == -1) { // not a FLAC stream
trace ("cflac_init not a flac stream\n");
- return -1;
+ plugin.free (_info);
+ return NULL;
}
- buffer = malloc (BUFFERSIZE);
+ info->buffer = malloc (BUFFERSIZE);
if (it->endsample > 0) {
- startsample = it->startsample;
- endsample = it->endsample;
- if (plugin.seek_sample (0) < 0) {
- plugin.free ();
+ info->startsample = it->startsample;
+ info->endsample = it->endsample;
+ if (plugin.seek_sample (_info, 0) < 0) {
trace ("cflac_init failed to seek to sample 0\n");
- return -1;
+ plugin.free (_info);
+ return NULL;
}
- trace ("flac(cue): startsample=%d, endsample=%d, totalsamples=%d, currentsample=%d\n", startsample, endsample, flac_callbacks.totalsamples, currentsample);
+ trace ("flac(cue): startsample=%d, endsample=%d, totalsamples=%d, currentsample=%d\n", info->startsample, info->endsample, info->totalsamples, info->currentsample);
}
else {
- startsample = 0;
- endsample = flac_callbacks.totalsamples-1;
- currentsample = 0;
- trace ("flac: startsample=%d, endsample=%d, totalsamples=%d\n", startsample, endsample, flac_callbacks.totalsamples);
+ info->startsample = 0;
+ info->endsample = info->totalsamples-1;
+ info->currentsample = 0;
+ trace ("flac: startsample=%d, endsample=%d, totalsamples=%d\n", info->startsample, info->endsample, info->totalsamples);
}
- if (flac_critical_error) {
- return -1;
+ if (info->flac_critical_error) {
+ trace ("flac: critical error while initializing\n");
+ plugin.free (_info);
+ return NULL;
}
- remaining = 0;
- return 0;
+ info->remaining = 0;
+ return _info;
}
static void
-cflac_free (void) {
- if (decoder) {
- FLAC__stream_decoder_delete(decoder);
- decoder = NULL;
- }
- if (buffer) {
- free (buffer);
- buffer = NULL;
+cflac_free (DB_fileinfo_t *_info) {
+ if (_info) {
+ flac_info_t *info = (flac_info_t *)_info;
+ if (info->decoder) {
+ FLAC__stream_decoder_delete (info->decoder);
+ }
+ if (info->buffer) {
+ free (info->buffer);
+ }
+ free (_info);
}
}
static int
-cflac_read_int16 (char *bytes, int size) {
- if (size / (2 * plugin.info.channels) + currentsample > endsample) {
- size = (endsample - currentsample + 1) * 2 * plugin.info.channels;
- trace ("size truncated to %d bytes, cursample=%d, endsample=%d\n", size, currentsample, endsample);
+cflac_read_int16 (DB_fileinfo_t *_info, char *bytes, int size) {
+ flac_info_t *info = (flac_info_t *)_info;
+ if (size / (2 * _info->channels) + info->currentsample > info->endsample) {
+ size = (info->endsample - info->currentsample + 1) * 2 * _info->channels;
+ trace ("size truncated to %d bytes, cursample=%d, endsample=%d\n", size, info->currentsample, info->endsample);
if (size <= 0) {
return 0;
}
}
- int n_output_channels = plugin.info.channels;
+ int n_output_channels = _info->channels;
if (n_output_channels > 2) {
n_output_channels = 2;
}
int initsize = size;
do {
- if (remaining) {
- int n_input_frames = remaining / sizeof (float) / n_output_channels;
+ if (info->remaining) {
+ int n_input_frames = info->remaining / sizeof (float) / n_output_channels;
int n_output_frames = size / n_output_channels / sizeof (int16_t);
int n = min (n_input_frames, n_output_frames);
trace ("flac: [1] if=%d, of=%d, n=%d, rem=%d, size=%d\n", n_input_frames, n_output_frames, n, remaining, size);
// convert from float to int16
- float *in = (float *)buffer;
+ float *in = (float *)info->buffer;
for (int i = 0; i < n; i++) {
*((int16_t *)bytes) = (int16_t)((*in) * 0x7fff);
size -= sizeof (int16_t);
@@ -322,26 +338,27 @@ cflac_read_int16 (char *bytes, int size) {
in += n_output_channels;
}
int sz = n * sizeof (float) * n_output_channels;
- if (sz < remaining) {
- memmove (buffer, &buffer[sz], remaining-sz);
+ if (sz < info->remaining) {
+ memmove (info->buffer, &info->buffer[sz], info->remaining - sz);
}
- remaining -= sz;
- currentsample += n;
- plugin.info.readpos += (float)n / plugin.info.samplerate;
- trace ("flac: [2] if=%d, of=%d, n=%d, rem=%d, size=%d\n", n_input_frames, n_output_frames, n, remaining, size);
+ info->remaining -= sz;
+ info->currentsample += n;
+ _info->readpos += (float)n / _info->samplerate;
+ trace ("flac: [2] if=%d, of=%d, n=%d, rem=%d, size=%d\n", n_input_frames, n_output_frames, n, info->remaining, size);
}
if (!size) {
break;
}
- if (!FLAC__stream_decoder_process_single (decoder)) {
+ if (!FLAC__stream_decoder_process_single (info->decoder)) {
trace ("FLAC__stream_decoder_process_single error\n");
break;
}
- if (FLAC__stream_decoder_get_state (decoder) == FLAC__STREAM_DECODER_END_OF_STREAM) {
+ if (FLAC__stream_decoder_get_state (info->decoder) == FLAC__STREAM_DECODER_END_OF_STREAM) {
trace ("FLAC__stream_decoder_get_state error\n");
break;
}
- if (flac_critical_error) {
+ if (info->flac_critical_error) {
+ trace ("flac: got critical error while decoding\n");
return 0;
}
} while (size > 0);
@@ -350,26 +367,27 @@ cflac_read_int16 (char *bytes, int size) {
}
static int
-cflac_read_float32 (char *bytes, int size) {
- if (size / (4 * plugin.info.channels) + currentsample > endsample) {
- size = (endsample - currentsample + 1) * 4 * plugin.info.channels;
- trace ("size truncated to %d bytes, cursample=%d, endsample=%d\n", size, currentsample, endsample);
+cflac_read_float32 (DB_fileinfo_t *_info, char *bytes, int size) {
+ flac_info_t *info = (flac_info_t *)_info;
+ if (size / (4 * _info->channels) + info->currentsample > info->endsample) {
+ size = (info->endsample - info->currentsample + 1) * 4 * _info->channels;
+ trace ("size truncated to %d bytes, cursample=%d, endsample=%d\n", size, info->currentsample, info->endsample);
if (size <= 0) {
return 0;
}
}
- int n_output_channels = plugin.info.channels;
+ int n_output_channels = _info->channels;
if (n_output_channels > 2) {
n_output_channels = 2;
}
int initsize = size;
do {
- if (remaining) {
- int n_input_frames = remaining / sizeof (float) / n_output_channels;
+ if (info->remaining) {
+ int n_input_frames = info->remaining / sizeof (float) / n_output_channels;
int n_output_frames = size / n_output_channels / sizeof (float);
int n = min (n_input_frames, n_output_frames);
- float *in = (float *)buffer;
+ float *in = (float *)info->buffer;
for (int i = 0; i < n; i++) {
*((float *)bytes) = *in;
size -= sizeof (float);
@@ -382,25 +400,26 @@ cflac_read_float32 (char *bytes, int size) {
in += n_output_channels;
}
int sz = n * sizeof (float) * n_output_channels;
- if (sz < remaining) {
- memmove (buffer, &buffer[sz], remaining-sz);
+ if (sz < info->remaining) {
+ memmove (info->buffer, &info->buffer[sz], info->remaining-sz);
}
- remaining -= sz;
- currentsample += n;
- plugin.info.readpos += (float)n / plugin.info.samplerate;
+ info->remaining -= sz;
+ info->currentsample += n;
+ _info->readpos += (float)n / _info->samplerate;
}
if (!size) {
break;
}
- if (!FLAC__stream_decoder_process_single (decoder)) {
+ if (!FLAC__stream_decoder_process_single (info->decoder)) {
trace ("FLAC__stream_decoder_process_single error\n");
break;
}
- if (FLAC__stream_decoder_get_state (decoder) == FLAC__STREAM_DECODER_END_OF_STREAM) {
+ if (FLAC__stream_decoder_get_state (info->decoder) == FLAC__STREAM_DECODER_END_OF_STREAM) {
trace ("FLAC__stream_decoder_get_state eof\n");
break;
}
- if (flac_critical_error) {
+ if (info->flac_critical_error) {
+ trace ("flac: got critical error while decoding\n");
return 0;
}
} while (size > 0);
@@ -409,25 +428,27 @@ cflac_read_float32 (char *bytes, int size) {
}
static int
-cflac_seek_sample (int sample) {
- sample += startsample;
- if (!FLAC__stream_decoder_seek_absolute (decoder, (FLAC__uint64)(sample))) {
+cflac_seek_sample (DB_fileinfo_t *_info, int sample) {
+ flac_info_t *info = (flac_info_t *)_info;
+ sample += info->startsample;
+ if (!FLAC__stream_decoder_seek_absolute (info->decoder, (FLAC__uint64)(sample))) {
return -1;
}
- remaining = 0;
- currentsample = sample;
- plugin.info.readpos = (float)(sample - startsample)/ plugin.info.samplerate;
+ info->remaining = 0;
+ info->currentsample = sample;
+ _info->readpos = (float)(sample - info->startsample)/ _info->samplerate;
return 0;
}
static int
-cflac_seek (float time) {
- return cflac_seek_sample (time * plugin.info.samplerate);
+cflac_seek (DB_fileinfo_t *_info, float time) {
+ return cflac_seek_sample (_info, time * _info->samplerate);
}
static FLAC__StreamDecoderWriteStatus
cflac_init_write_callback (const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const inputbuffer[], void *client_data) {
- if (frame->header.blocksize == 0 || cflac_init_stop_decoding) {
+ flac_info_t *info = (flac_info_t *)client_data;
+ if (frame->header.blocksize == 0 || info->init_stop_decoding) {
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
@@ -443,28 +464,29 @@ cflac_init_cue_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC_
cue_cb_data_t *cb = (cue_cb_data_t *)client_data;
if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {
trace ("flac: cflac_init_cue_metadata_callback: got FLAC__METADATA_TYPE_STREAMINFO\n");
- cb->samplerate = metadata->data.stream_info.sample_rate;
- cb->channels = metadata->data.stream_info.channels;
- //cb->duration = metadata->data.stream_info.total_samples / (float)metadata->data.stream_info.sample_rate;
- cb->totalsamples = metadata->data.stream_info.total_samples;
+ info->samplerate = metadata->data.stream_info.sample_rate;
+ info->channels = metadata->data.stream_info.channels;
+ //info->duration = metadata->data.stream_info.total_samples / (float)metadata->data.stream_info.sample_rate;
+ info->totalsamples = metadata->data.stream_info.total_samples;
}
}
#endif
static void
cflac_init_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) {
- if (cflac_init_stop_decoding) {
+ flac_info_t *info = (flac_info_t *)client_data;
+ DB_fileinfo_t *_info = &info->info;
+ if (info->init_stop_decoding) {
trace ("error flag is set, ignoring init_metadata callback..\n");
return;
}
- cue_cb_data_t *cb = (cue_cb_data_t *)client_data;
- DB_playItem_t *it = cb->it;
+ DB_playItem_t *it = info->it;
//it->tracknum = 0;
if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {
trace ("flac: samplerate=%d, channels=%d\n", metadata->data.stream_info.sample_rate, metadata->data.stream_info.channels);
- cb->samplerate = metadata->data.stream_info.sample_rate;
- cb->channels = metadata->data.stream_info.channels;
- cb->totalsamples = metadata->data.stream_info.total_samples;
+ _info->samplerate = metadata->data.stream_info.sample_rate;
+ _info->channels = metadata->data.stream_info.channels;
+ info->totalsamples = metadata->data.stream_info.total_samples;
deadbeef->pl_set_item_duration (it, metadata->data.stream_info.total_samples / (float)metadata->data.stream_info.sample_rate);
}
else if (metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
@@ -500,7 +522,7 @@ cflac_init_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__Str
}
if (!strncasecmp (s, "CUESHEET=", 9)) {
deadbeef->pl_add_meta (it, "cuesheet", s + 9);
-// cb->last = deadbeef->pl_insert_cue_from_buffer (cb->after, cb->fname, s+9, c->length-9, &plugin, "FLAC", cb->totalsamples, cb->samplerate);
+// info->last = deadbeef->pl_insert_cue_from_buffer (info->after, info->fname, s+9, c->length-9, &plugin, "FLAC", info->totalsamples, info->samplerate);
}
else if (!strncasecmp (s, "replaygain_album_gain=", 22)) {
it->replaygain_album_gain = atof (s + 22);
@@ -530,13 +552,13 @@ cflac_insert (DB_playItem_t *after, const char *fname) {
trace ("flac: inserting %s\n", fname);
DB_playItem_t *it = NULL;
FLAC__StreamDecoder *decoder = NULL;
- cue_cb_data_t cb = {
- .fname = fname,
- .after = after,
- .last = after
- };
- cb.file = deadbeef->fopen (fname);
- if (!cb.file) {
+ flac_info_t info;
+ memset (&info, 0, sizeof (info));
+ info.fname = fname;
+ info.after = after;
+ info.last = after;
+ info.file = deadbeef->fopen (fname);
+ if (!info.file) {
goto cflac_insert_fail;
}
@@ -555,12 +577,12 @@ cflac_insert (DB_playItem_t *after, const char *fname) {
int skip = 0;
if (ext && !strcasecmp (ext, "flac")) {
// skip id3 junk and verify fLaC signature
- skip = deadbeef->junk_get_leading_size (cb.file);
+ skip = deadbeef->junk_get_leading_size (info.file);
if (skip > 0) {
- deadbeef->fseek (cb.file, skip, SEEK_SET);
+ deadbeef->fseek (info.file, skip, SEEK_SET);
}
char sign[4];
- if (deadbeef->fread (sign, 1, 4, cb.file) != 4) {
+ if (deadbeef->fread (sign, 1, 4, info.file) != 4) {
trace ("flac: failed to read signature\n");
goto cflac_insert_fail;
}
@@ -568,7 +590,7 @@ cflac_insert (DB_playItem_t *after, const char *fname) {
trace ("flac: file signature is not fLaC\n");
goto cflac_insert_fail;
}
- deadbeef->fseek (cb.file, -4, SEEK_CUR);
+ deadbeef->fseek (info.file, -4, SEEK_CUR);
}
else if (!FLAC_API_SUPPORTS_OGG_FLAC) {
trace ("flac: ogg transport support is not compiled into FLAC library\n");
@@ -577,7 +599,7 @@ cflac_insert (DB_playItem_t *after, const char *fname) {
else {
isogg = 1;
}
- cflac_init_stop_decoding = 0;
+ info.init_stop_decoding = 0;
// open decoder for metadata reading
FLAC__StreamDecoderInitStatus status;
@@ -609,27 +631,27 @@ cflac_insert (DB_playItem_t *after, const char *fname) {
FLAC__stream_decoder_set_md5_checking(decoder, 0);
FLAC__stream_decoder_set_metadata_respond_all (decoder);
it = deadbeef->pl_item_alloc ();
- it->decoder = &plugin;
+ it->decoder_id = deadbeef->plug_get_decoder_id (plugin.plugin.id);
it->fname = strdup (fname);
- cb.it = it;
+ info.it = it;
if (skip > 0) {
- deadbeef->fseek (cb.file, skip, SEEK_SET);
+ deadbeef->fseek (info.file, skip, SEEK_SET);
}
else {
- deadbeef->rewind (cb.file);
+ deadbeef->rewind (info.file);
}
- deadbeef->fseek (cb.file, -4, SEEK_CUR);
+ deadbeef->fseek (info.file, -4, SEEK_CUR);
if (isogg) {
- status = FLAC__stream_decoder_init_ogg_stream (decoder, flac_read_cb, flac_seek_cb, flac_tell_cb, flac_lenght_cb, flac_eof_cb, cflac_init_write_callback, cflac_init_metadata_callback, cflac_init_error_callback, &cb);
+ status = FLAC__stream_decoder_init_ogg_stream (decoder, flac_read_cb, flac_seek_cb, flac_tell_cb, flac_lenght_cb, flac_eof_cb, cflac_init_write_callback, cflac_init_metadata_callback, cflac_init_error_callback, &info);
}
else {
- status = FLAC__stream_decoder_init_stream (decoder, flac_read_cb, flac_seek_cb, flac_tell_cb, flac_lenght_cb, flac_eof_cb, cflac_init_write_callback, cflac_init_metadata_callback, cflac_init_error_callback, &cb);
+ status = FLAC__stream_decoder_init_stream (decoder, flac_read_cb, flac_seek_cb, flac_tell_cb, flac_lenght_cb, flac_eof_cb, cflac_init_write_callback, cflac_init_metadata_callback, cflac_init_error_callback, &info);
}
- if (status != FLAC__STREAM_DECODER_INIT_STATUS_OK || cflac_init_stop_decoding) {
+ if (status != FLAC__STREAM_DECODER_INIT_STATUS_OK || info.init_stop_decoding) {
trace ("flac: FLAC__stream_decoder_init_stream [2] failed\n");
goto cflac_insert_fail;
}
- if (!FLAC__stream_decoder_process_until_end_of_metadata (decoder) || cflac_init_stop_decoding) {
+ if (!FLAC__stream_decoder_process_until_end_of_metadata (decoder) || info.init_stop_decoding) {
trace ("flac: FLAC__stream_decoder_process_until_end_of_metadata [2] failed\n");
goto cflac_insert_fail;
}
@@ -640,43 +662,43 @@ cflac_insert (DB_playItem_t *after, const char *fname) {
// try embedded cue
const char *cuesheet = deadbeef->pl_find_meta (it, "cuesheet");
if (cuesheet) {
- DB_playItem_t *last = deadbeef->pl_insert_cue_from_buffer (after, it, cuesheet, strlen (cuesheet), cb.totalsamples, cb.samplerate);
+ DB_playItem_t *last = deadbeef->pl_insert_cue_from_buffer (after, it, cuesheet, strlen (cuesheet), info.totalsamples, info.info.samplerate);
if (last) {
- deadbeef->pl_item_free (it);
+ deadbeef->pl_item_unref (it);
return last;
}
}
// try external cue
- DB_playItem_t *cue_after = deadbeef->pl_insert_cue (after, it, cb.totalsamples, cb.samplerate);
+ DB_playItem_t *cue_after = deadbeef->pl_insert_cue (after, it, info.totalsamples, info.info.samplerate);
if (cue_after) {
- if (cb.file) {
- deadbeef->fclose (cb.file);
+ if (info.file) {
+ deadbeef->fclose (info.file);
}
trace ("flac: loaded external cuesheet\n");
return cue_after;
}
decoder = FLAC__stream_decoder_new();
if (!decoder) {
- if (cb.file) {
- deadbeef->fclose (cb.file);
+ if (info.file) {
+ deadbeef->fclose (info.file);
}
goto cflac_insert_fail;
}
after = deadbeef->pl_insert_item (after, it);
- if (cb.file) {
- deadbeef->fclose (cb.file);
+ if (info.file) {
+ deadbeef->fclose (info.file);
}
return after;
cflac_insert_fail:
if (it) {
- deadbeef->pl_item_free (it);
+ deadbeef->pl_item_unref (it);
}
if (decoder) {
FLAC__stream_decoder_delete(decoder);
}
- if (cb.file) {
- deadbeef->fclose (cb.file);
+ if (info.file) {
+ deadbeef->fclose (info.file);
}
return NULL;
}
@@ -691,6 +713,7 @@ static DB_decoder_t plugin = {
.plugin.version_major = 0,
.plugin.version_minor = 1,
.plugin.type = DB_PLUGIN_DECODER,
+ .plugin.id = "stdflac",
.plugin.name = "FLAC decoder",
.plugin.descr = "FLAC decoder using libFLAC",
.plugin.author = "Alexey Yakovenko",
@@ -704,7 +727,6 @@ static DB_decoder_t plugin = {
.seek_sample = cflac_seek_sample,
.insert = cflac_insert,
.exts = exts,
- .id = "stdflac",
.filetypes = filetypes
};
diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c
index 23db9d91..393a1b27 100644
--- a/plugins/gtkui/callbacks.c
+++ b/plugins/gtkui/callbacks.c
@@ -1011,7 +1011,8 @@ seekbar_draw (GtkWidget *widget) {
return;
}
DB_playItem_t *trk = deadbeef->streamer_get_playing_track ();
- if (!trk->decoder || deadbeef->pl_get_item_duration (trk) < 0) {
+ DB_fileinfo_t *dec = deadbeef->streamer_get_current_decoder ();
+ if (!dec || deadbeef->pl_get_item_duration (trk) < 0) {
clearlooks_rounded_rectangle (cr, 2, widget->allocation.height/2-4, widget->allocation.width-4, 8, 4, 0xff);
theme_set_cairo_source_rgb (cr, COLO_SEEKBAR_FRONT);
cairo_stroke (cr);
@@ -1030,7 +1031,7 @@ seekbar_draw (GtkWidget *widget) {
pos = x;
}
else {
- if (trk->decoder && deadbeef->pl_get_item_duration (trk) > 0) {
+ if (dec && deadbeef->pl_get_item_duration (trk) > 0) {
pos = deadbeef->streamer_get_playpos () / deadbeef->pl_get_item_duration (trk);
pos *= widget->allocation.width;
}
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index c4c305f9..954a7781 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -91,43 +91,44 @@ update_songinfo (gpointer ctx) {
snprintf (sbtext_new, sizeof (sbtext_new), "Stopped | %d tracks | %s total playtime", deadbeef->pl_getcount (PL_MAIN), totaltime_str);
songpos = 0;
}
- else if (track->decoder) {
-// codec_lock ();
- DB_decoder_t *c = track->decoder;
- float playpos = deadbeef->streamer_get_playpos ();
- int minpos = playpos / 60;
- int secpos = playpos - minpos * 60;
- int mindur = duration / 60;
- int secdur = duration - mindur * 60;
-
- const char *mode = c->info.channels == 1 ? "Mono" : "Stereo";
- int samplerate = c->info.samplerate;
- int bitspersample = c->info.bps;
- songpos = playpos;
-// codec_unlock ();
-
- char t[100];
- if (duration >= 0) {
- snprintf (t, sizeof (t), "%d:%02d", mindur, secdur);
- }
- else {
- strcpy (t, "-:--");
- }
-
- struct timeval tm;
- gettimeofday (&tm, NULL);
- if (tm.tv_sec - last_br_update.tv_sec + (tm.tv_usec - last_br_update.tv_usec) / 1000000.0 >= 0.3) {
- memcpy (&last_br_update, &tm, sizeof (tm));
- int bitrate = deadbeef->streamer_get_apx_bitrate ();
- if (bitrate > 0) {
- snprintf (sbitrate, sizeof (sbitrate), "| %4d kbps ", bitrate);
+ else {
+ DB_fileinfo_t *c = deadbeef->streamer_get_current_decoder ();
+ if (c) {
+ float playpos = deadbeef->streamer_get_playpos ();
+ int minpos = playpos / 60;
+ int secpos = playpos - minpos * 60;
+ int mindur = duration / 60;
+ int secdur = duration - mindur * 60;
+
+ const char *mode = c->channels == 1 ? "Mono" : "Stereo";
+ int samplerate = c->samplerate;
+ int bitspersample = c->bps;
+ songpos = playpos;
+ // codec_unlock ();
+
+ char t[100];
+ if (duration >= 0) {
+ snprintf (t, sizeof (t), "%d:%02d", mindur, secdur);
}
else {
- sbitrate[0] = 0;
+ strcpy (t, "-:--");
+ }
+
+ struct timeval tm;
+ gettimeofday (&tm, NULL);
+ if (tm.tv_sec - last_br_update.tv_sec + (tm.tv_usec - last_br_update.tv_usec) / 1000000.0 >= 0.3) {
+ memcpy (&last_br_update, &tm, sizeof (tm));
+ int bitrate = deadbeef->streamer_get_apx_bitrate ();
+ if (bitrate > 0) {
+ snprintf (sbitrate, sizeof (sbitrate), "| %4d kbps ", bitrate);
+ }
+ else {
+ sbitrate[0] = 0;
+ }
}
+ const char *spaused = deadbeef->get_output ()->state () == OUTPUT_STATE_PAUSED ? "Paused | " : "";
+ snprintf (sbtext_new, sizeof (sbtext_new), "%s%s %s| %dHz | %d bit | %s | %d:%02d / %s | %d tracks | %s total playtime", spaused, track->filetype ? track->filetype:"-", sbitrate, samplerate, bitspersample, mode, minpos, secpos, t, deadbeef->pl_getcount (PL_MAIN), totaltime_str);
}
- const char *spaused = deadbeef->get_output ()->state () == OUTPUT_STATE_PAUSED ? "Paused | " : "";
- snprintf (sbtext_new, sizeof (sbtext_new), "%s%s %s| %dHz | %d bit | %s | %d:%02d / %s | %d tracks | %s total playtime", spaused, track->filetype ? track->filetype:"-", sbitrate, samplerate, bitspersample, mode, minpos, secpos, t, deadbeef->pl_getcount (PL_MAIN), totaltime_str);
}
if (strcmp (sbtext_new, sb_text)) {
diff --git a/plugins/lastfm/lastfm.c b/plugins/lastfm/lastfm.c
index 6bd293e5..a91e016a 100644
--- a/plugins/lastfm/lastfm.c
+++ b/plugins/lastfm/lastfm.c
@@ -621,7 +621,7 @@ lfm_send_submissions (void) {
deadbeef->mutex_lock (lfm_mutex);
for (i = 0; i < LFM_SUBMISSION_QUEUE_SIZE; i++) {
if (lfm_subm_queue[i]) {
- deadbeef->pl_item_free (lfm_subm_queue[i]);
+ deadbeef->pl_item_unref (lfm_subm_queue[i]);
lfm_subm_queue[i] = NULL;
}
}
@@ -636,7 +636,7 @@ lfm_send_submissions (void) {
deadbeef->mutex_lock (lfm_mutex);
for (i = 0; i < LFM_SUBMISSION_QUEUE_SIZE; i++) {
if (lfm_subm_queue[i]) {
- deadbeef->pl_item_free (lfm_subm_queue[i]);
+ deadbeef->pl_item_unref (lfm_subm_queue[i]);
lfm_subm_queue[i] = NULL;
}
}
diff --git a/plugins/mpgmad/mpgmad.c b/plugins/mpgmad/mpgmad.c
index 6ad884e4..9a925304 100644
--- a/plugins/mpgmad/mpgmad.c
+++ b/plugins/mpgmad/mpgmad.c
@@ -90,10 +90,14 @@ typedef struct {
int last_comment_update;
} buffer_t;
-static buffer_t buffer;
-static struct mad_stream stream;
-static struct mad_frame frame;
-static struct mad_synth synth;
+typedef struct {
+ DB_fileinfo_t info;
+ buffer_t buffer;
+ struct mad_stream stream;
+ struct mad_frame frame;
+ struct mad_synth synth;
+} mpgmad_info_t;
+
static uint32_t
extract_i32 (unsigned char *buf)
@@ -541,48 +545,52 @@ cmp3_scan_stream (buffer_t *buffer, int sample) {
}
-static int
+static DB_fileinfo_t *
cmp3_init (DB_playItem_t *it) {
- memset (&buffer, 0, sizeof (buffer));
- buffer.file = deadbeef->fopen (it->fname);
- if (!buffer.file) {
- return -1;
+ DB_fileinfo_t *_info = malloc (sizeof (mpgmad_info_t));
+ mpgmad_info_t *info = (mpgmad_info_t *)_info;
+ memset (info, 0, sizeof (mpgmad_info_t));
+ _info->plugin = &plugin;
+ memset (&info->buffer, 0, sizeof (info->buffer));
+ info->buffer.file = deadbeef->fopen (it->fname);
+ if (!info->buffer.file) {
+ return NULL;
}
- buffer.it = it;
- plugin.info.readpos = 0;
- if (!buffer.file->vfs->streaming) {
- int skip = deadbeef->junk_get_leading_size (buffer.file);
+ info->buffer.it = it;
+ info->info.readpos = 0;
+ if (!info->buffer.file->vfs->streaming) {
+ int skip = deadbeef->junk_get_leading_size (info->buffer.file);
if (skip > 0) {
trace ("mpgmad: skipping %d bytes of junk\n", skip);
- deadbeef->fseek(buffer.file, skip, SEEK_SET);
+ deadbeef->fseek (info->buffer.file, skip, SEEK_SET);
}
- cmp3_scan_stream (&buffer, -1); // scan entire stream, calc duration
+ cmp3_scan_stream (&info->buffer, -1); // scan entire stream, calc duration
if (it->endsample > 0) {
- buffer.startsample = it->startsample;
- buffer.endsample = it->endsample;
+ info->buffer.startsample = it->startsample;
+ info->buffer.endsample = it->endsample;
// that comes from cue, don't calc duration, just seek and play
- plugin.seek_sample (0);
+ plugin.seek_sample (_info, 0);
}
else {
- deadbeef->pl_set_item_duration (it, buffer.duration);
- buffer.startsample = 0;
- buffer.endsample = buffer.totalsamples-1;
- buffer.skipsamples = buffer.startdelay;
- buffer.currentsample = buffer.startdelay;
- deadbeef->fseek (buffer.file, buffer.startoffset, SEEK_SET);
+ deadbeef->pl_set_item_duration (it, info->buffer.duration);
+ info->buffer.startsample = 0;
+ info->buffer.endsample = info->buffer.totalsamples-1;
+ info->buffer.skipsamples = info->buffer.startdelay;
+ info->buffer.currentsample = info->buffer.startdelay;
+ deadbeef->fseek (info->buffer.file, info->buffer.startoffset, SEEK_SET);
}
}
else {
- buffer.it->filetype = NULL;
- int len = deadbeef->fgetlength (buffer.file);
- const char *name = deadbeef->fget_content_name (buffer.file);
- const char *genre = deadbeef->fget_content_genre (buffer.file);
+ info->buffer.it->filetype = NULL;
+ int len = deadbeef->fgetlength (info->buffer.file);
+ const char *name = deadbeef->fget_content_name (info->buffer.file);
+ const char *genre = deadbeef->fget_content_genre (info->buffer.file);
if (len > 0) {
deadbeef->pl_delete_all_meta (it);
- int v2err = deadbeef->junk_read_id3v2 (it, buffer.file);
+ int v2err = deadbeef->junk_read_id3v2 (it, info->buffer.file);
deadbeef->pl_add_meta (it, "title", NULL);
if (v2err != 0) {
- deadbeef->fseek (buffer.file, 0, SEEK_SET);
+ deadbeef->fseek (info->buffer.file, 0, SEEK_SET);
}
}
else {
@@ -597,46 +605,46 @@ cmp3_init (DB_playItem_t *it) {
deadbeef->pl_add_meta (it, "genre", genre);
}
}
- int res = cmp3_scan_stream (&buffer, 0);
+ int res = cmp3_scan_stream (&info->buffer, 0);
if (res < 0) {
trace ("mpgmad: cmp3_init: initial cmp3_scan_stream failed\n");
- plugin.free ();
- return -1;
+ plugin.free (_info);
+ return NULL;
}
- deadbeef->pl_set_item_duration (it, buffer.duration);
- if (buffer.duration >= 0) {
- buffer.endsample = buffer.totalsamples - 1;
+ deadbeef->pl_set_item_duration (it, info->buffer.duration);
+ if (info->buffer.duration >= 0) {
+ info->buffer.endsample = info->buffer.totalsamples - 1;
}
else {
-// buffer.duration = 200;
-// buffer.totalsamples = 10000000;
-// buffer.endsample = buffer.totalsamples-1;
- buffer.endsample = -1;
- buffer.totalsamples = -1;
+// info->buffer.duration = 200;
+// info->buffer.totalsamples = 10000000;
+// info->buffer.endsample = info->buffer.totalsamples-1;
+ info->buffer.endsample = -1;
+ info->buffer.totalsamples = -1;
}
- buffer.skipsamples = 0;
- buffer.currentsample = 0;
- if (buffer.duration < 0) {
- buffer.duration = -1;
- buffer.totalsamples = -1;
- buffer.endsample = -1;
+ info->buffer.skipsamples = 0;
+ info->buffer.currentsample = 0;
+ if (info->buffer.duration < 0) {
+ info->buffer.duration = -1;
+ info->buffer.totalsamples = -1;
+ info->buffer.endsample = -1;
}
- trace ("duration=%f, endsample=%d, totalsamples=%d\n", buffer.duration, buffer.endsample, buffer.totalsamples);
+ trace ("duration=%f, endsample=%d, totalsamples=%d\n", info->buffer.duration, info->buffer.endsample, info->buffer.totalsamples);
}
- if (buffer.samplerate == 0) {
+ if (info->buffer.samplerate == 0) {
trace ("bad mpeg file: %f\n", it->fname);
- plugin.free ();
- return -1;
+ plugin.free (_info);
+ return NULL;
}
- plugin.info.bps = buffer.bitspersample;
- plugin.info.samplerate = buffer.samplerate;
- plugin.info.channels = buffer.channels;
+ _info->bps = info->buffer.bitspersample;
+ _info->samplerate = info->buffer.samplerate;
+ _info->channels = info->buffer.channels;
- mad_stream_init(&stream);
- mad_frame_init(&frame);
- mad_synth_init(&synth);
+ mad_stream_init(&info->stream);
+ mad_frame_init(&info->frame);
+ mad_synth_init(&info->synth);
- return 0;
+ return _info;
}
/****************************************************************************
@@ -686,90 +694,90 @@ MadFixedToFloat (mad_fixed_t Fixed) {
// cuts readsize if it's beyond boundaries
static int
-cmp3_decode_cut (int framesize) {
- if (buffer.duration >= 0) {
- if (unlikely (!buffer.channels || buffer.channels > 2)) {
- trace ("mpgmad: got frame with invalid number of channels (%d)\n", buffer.channels);
+cmp3_decode_cut (mpgmad_info_t *info, int framesize) {
+ if (info->buffer.duration >= 0) {
+ if (unlikely (!info->buffer.channels || info->buffer.channels > 2)) {
+ trace ("mpgmad: got frame with invalid number of channels (%d)\n", info->buffer.channels);
return 1;
}
- if (buffer.currentsample + buffer.readsize / (framesize * buffer.channels) > buffer.endsample) {
- int sz = (buffer.endsample - buffer.currentsample + 1) * framesize * buffer.channels;
- trace ("size truncated to %d bytes, cursample=%d, endsample=%d, totalsamples=%d\n", buffer.readsize, buffer.currentsample, buffer.endsample, buffer.totalsamples);
+ if (info->buffer.currentsample + info->buffer.readsize / (framesize * info->buffer.channels) > info->buffer.endsample) {
+ int sz = (info->buffer.endsample - info->buffer.currentsample + 1) * framesize * info->buffer.channels;
+ trace ("size truncated to %d bytes, cursample=%d, endsample=%d, totalsamples=%d\n", info->buffer.readsize, info->buffer.currentsample, info->buffer.endsample, info->buffer.totalsamples);
if (sz <= 0) {
return 1;
}
- buffer.readsize = sz;
+ info->buffer.readsize = sz;
}
}
return 0;
}
static inline void
-cmp3_skip (void) {
- if (buffer.skipsamples > 0) {
- int skip = min (buffer.skipsamples, buffer.decode_remaining);
- buffer.skipsamples -= skip;
- buffer.decode_remaining -= skip;
+cmp3_skip (mpgmad_info_t *info) {
+ if (info->buffer.skipsamples > 0) {
+ int skip = min (info->buffer.skipsamples, info->buffer.decode_remaining);
+ info->buffer.skipsamples -= skip;
+ info->buffer.decode_remaining -= skip;
}
}
// decoded requested number of samples to int16 format
static void
-cmp3_decode_requested_int16 (void) {
- cmp3_skip ();
+cmp3_decode_requested_int16 (mpgmad_info_t *info) {
+ cmp3_skip (info);
// copy synthesized samples into readbuffer
- int idx = synth.pcm.length-buffer.decode_remaining;
- while (buffer.decode_remaining > 0 && buffer.readsize > 0) {
- *((int16_t*)buffer.out) = MadFixedToSshort (synth.pcm.samples[0][idx]);
- buffer.readsize -= 2;
- buffer.out += 2;
- if (MAD_NCHANNELS(&frame.header) == 2) {
- *((int16_t*)buffer.out) = MadFixedToSshort (synth.pcm.samples[1][idx]);
- buffer.readsize -= 2;
- buffer.out += 2;
+ int idx = info->synth.pcm.length-info->buffer.decode_remaining;
+ while (info->buffer.decode_remaining > 0 && info->buffer.readsize > 0) {
+ *((int16_t*)info->buffer.out) = MadFixedToSshort (info->synth.pcm.samples[0][idx]);
+ info->buffer.readsize -= 2;
+ info->buffer.out += 2;
+ if (MAD_NCHANNELS(&info->frame.header) == 2) {
+ *((int16_t*)info->buffer.out) = MadFixedToSshort (info->synth.pcm.samples[1][idx]);
+ info->buffer.readsize -= 2;
+ info->buffer.out += 2;
}
- buffer.decode_remaining--;
+ info->buffer.decode_remaining--;
idx++;
}
- assert (buffer.readsize >= 0);
+ assert (info->buffer.readsize >= 0);
}
// decoded requested number of samples to int16 format
static void
-cmp3_decode_requested_float32 (void) {
- cmp3_skip ();
- // copy synthesized samples into readbuffer
- int idx = synth.pcm.length-buffer.decode_remaining;
- while (buffer.decode_remaining > 0 && buffer.readsize > 0) {
- *((float*)buffer.out) = MadFixedToFloat (synth.pcm.samples[0][idx]);
- buffer.readsize -= 4;
- buffer.out += 4;
- if (MAD_NCHANNELS(&frame.header) == 2) {
- *((float*)buffer.out) = MadFixedToFloat (synth.pcm.samples[1][idx]);
- buffer.readsize -= 4;
- buffer.out += 4;
+cmp3_decode_requested_float32 (mpgmad_info_t *info) {
+ cmp3_skip (info);
+ // copy synthesized samples into readinfo->buffer
+ int idx = info->synth.pcm.length-info->buffer.decode_remaining;
+ while (info->buffer.decode_remaining > 0 && info->buffer.readsize > 0) {
+ *((float*)info->buffer.out) = MadFixedToFloat (info->synth.pcm.samples[0][idx]);
+ info->buffer.readsize -= 4;
+ info->buffer.out += 4;
+ if (MAD_NCHANNELS(&info->frame.header) == 2) {
+ *((float*)info->buffer.out) = MadFixedToFloat (info->synth.pcm.samples[1][idx]);
+ info->buffer.readsize -= 4;
+ info->buffer.out += 4;
}
- buffer.decode_remaining--;
+ info->buffer.decode_remaining--;
idx++;
}
- assert (buffer.readsize >= 0);
+ assert (info->buffer.readsize >= 0);
}
static int
-cmp3_stream_frame (void) {
+cmp3_stream_frame (mpgmad_info_t *info) {
int eof = 0;
- while (!eof && (stream.buffer == NULL || buffer.decode_remaining <= 0)) {
+ while (!eof && (info->stream.buffer == NULL || info->buffer.decode_remaining <= 0)) {
// read more MPEG data if needed
- if(stream.buffer==NULL || stream.error==MAD_ERROR_BUFLEN) {
+ if(info->stream.buffer==NULL || info->stream.error==MAD_ERROR_BUFLEN) {
// copy part of last frame to beginning
- if (stream.next_frame != NULL) {
- buffer.remaining = stream.bufend - stream.next_frame;
- memmove (buffer.input, stream.next_frame, buffer.remaining);
+ if (info->stream.next_frame != NULL) {
+ info->buffer.remaining = info->stream.bufend - info->stream.next_frame;
+ memmove (info->buffer.input, info->stream.next_frame, info->buffer.remaining);
}
- int size = READBUFFER - buffer.remaining;
+ int size = READBUFFER - info->buffer.remaining;
int bytesread = 0;
- uint8_t *bytes = buffer.input + buffer.remaining;
- bytesread = deadbeef->fread (bytes, 1, size, buffer.file);
+ uint8_t *bytes = info->buffer.input + info->buffer.remaining;
+ bytesread = deadbeef->fread (bytes, 1, size, info->buffer.file);
if (!bytesread) {
// add guard
eof = 1;
@@ -781,73 +789,73 @@ cmp3_stream_frame (void) {
size -= bytesread;
bytes += bytesread;
}
- bytesread += buffer.remaining;
- mad_stream_buffer(&stream,buffer.input,bytesread);
- if (stream.buffer==NULL) {
+ bytesread += info->buffer.remaining;
+ mad_stream_buffer(&info->stream,info->buffer.input,bytesread);
+ if (info->stream.buffer==NULL) {
// check sync bits
if (bytes[0] != 0xff || (bytes[1]&(3<<5)) != (3<<5)) {
trace ("mpgmad: read didn't start at frame boundary!\ncmp3_scan_stream is broken\n");
}
}
}
- stream.error=0;
+ info->stream.error=0;
// decode next frame
- if(mad_frame_decode(&frame,&stream))
+ if(mad_frame_decode(&info->frame,&info->stream))
{
- if(MAD_RECOVERABLE(stream.error))
+ if(MAD_RECOVERABLE(info->stream.error))
{
#if 0
- if(stream.error!=MAD_ERROR_LOSTSYNC) {
+ if(info->stream.error!=MAD_ERROR_LOSTSYNC) {
trace ("mpgmad: recoverable frame level error (%s)\n", MadErrorString(&stream));
}
#endif
continue;
}
else {
- if(stream.error==MAD_ERROR_BUFLEN) {
+ if(info->stream.error==MAD_ERROR_BUFLEN) {
continue;
}
else
{
- trace ("mpgmad: unrecoverable frame level error (%s).\n", MadErrorString(&stream));
+ trace ("mpgmad: unrecoverable frame level error (%s).\n", MadErrorString(&info->stream));
return -1; // fatal error
}
}
}
- if (!buffer.it->filetype) {
- int layer = frame.header.layer;
+ if (!info->buffer.it->filetype) {
+ int layer = info->frame.header.layer;
if (layer >= 1 && layer <= 3) {
- buffer.it->filetype = plugin.filetypes[layer-1];
+ info->buffer.it->filetype = plugin.filetypes[layer-1];
}
}
- plugin.info.samplerate = frame.header.samplerate;
- plugin.info.channels = MAD_NCHANNELS(&frame.header);
+ info->info.samplerate = info->frame.header.samplerate;
+ info->info.channels = MAD_NCHANNELS(&info->frame.header);
// synthesize single frame
- mad_synth_frame(&synth,&frame);
- buffer.decode_remaining = synth.pcm.length;
- deadbeef->streamer_set_bitrate (frame.header.bitrate/1000);
+ mad_synth_frame(&info->synth,&info->frame);
+ info->buffer.decode_remaining = info->synth.pcm.length;
+ deadbeef->streamer_set_bitrate (info->frame.header.bitrate/1000);
break;
}
if (!eof) {
- if (buffer.file->vfs->streaming && buffer.currentsample - buffer.last_comment_update > 5 * plugin.info.samplerate) {
- int idx = deadbeef->pl_get_idx_of (buffer.it);
+ if (info->buffer.file->vfs->streaming && info->buffer.currentsample - info->buffer.last_comment_update > 5 * info->info.samplerate) {
+ int idx = deadbeef->pl_get_idx_of (info->buffer.it);
if (idx >= 0) {
- buffer.last_comment_update = buffer.currentsample;
- const char *vfs_tit = deadbeef->fget_content_name (buffer.file);
+ info->buffer.last_comment_update = info->buffer.currentsample;
+ const char *vfs_tit = deadbeef->fget_content_name (info->buffer.file);
if (vfs_tit) {
const char *cs = deadbeef->junk_detect_charset (vfs_tit);
if (cs) {
char out[1024];
deadbeef->junk_recode (vfs_tit, strlen (vfs_tit), out, sizeof (out), cs);
- deadbeef->pl_replace_meta (buffer.it, "title", out);
+ deadbeef->pl_replace_meta (info->buffer.it, "title", out);
deadbeef->sendmessage (M_TRACKCHANGED, 0, idx, 0);
}
else {
- deadbeef->pl_replace_meta (buffer.it, "title", vfs_tit);
+ deadbeef->pl_replace_meta (info->buffer.it, "title", vfs_tit);
deadbeef->sendmessage (M_TRACKCHANGED, 0, idx, 0);
}
}
@@ -859,16 +867,16 @@ cmp3_stream_frame (void) {
}
static int
-cmp3_decode_int16 (void) {
- if (cmp3_decode_cut (4)) {
+cmp3_decode_int16 (mpgmad_info_t *info) {
+ if (cmp3_decode_cut (info, 4)) {
return 0;
}
int eof = 0;
while (!eof) {
- eof = cmp3_stream_frame ();
- if (buffer.decode_remaining > 0) {
- cmp3_decode_requested_int16 ();
- if (buffer.readsize == 0) {
+ eof = cmp3_stream_frame (info);
+ if (info->buffer.decode_remaining > 0) {
+ cmp3_decode_requested_int16 (info);
+ if (info->buffer.readsize == 0) {
return 0;
}
}
@@ -877,17 +885,17 @@ cmp3_decode_int16 (void) {
}
static int
-cmp3_decode_float32 (void) {
- if (cmp3_decode_cut (8)) {
+cmp3_decode_float32 (mpgmad_info_t *info) {
+ if (cmp3_decode_cut (info, 8)) {
trace ("read request ignored (end of track passed)\n");
return 0;
}
int eof = 0;
while (!eof) {
- eof = cmp3_stream_frame ();
- if (buffer.decode_remaining > 0) {
- cmp3_decode_requested_float32 ();
- if (buffer.readsize == 0) {
+ eof = cmp3_stream_frame (info);
+ if (info->buffer.decode_remaining > 0) {
+ cmp3_decode_requested_float32 (info);
+ if (info->buffer.readsize == 0) {
return 0;
}
}
@@ -896,73 +904,78 @@ cmp3_decode_float32 (void) {
}
static void
-cmp3_free (void) {
- if (buffer.file) {
- deadbeef->fclose (buffer.file);
- buffer.file = NULL;
- mad_synth_finish (&synth);
- mad_frame_finish (&frame);
- mad_stream_finish (&stream);
+cmp3_free (DB_fileinfo_t *_info) {
+ mpgmad_info_t *info = (mpgmad_info_t *)_info;
+ if (info->buffer.file) {
+ deadbeef->fclose (info->buffer.file);
+ info->buffer.file = NULL;
+ mad_synth_finish (&info->synth);
+ mad_frame_finish (&info->frame);
+ mad_stream_finish (&info->stream);
}
+ free (info);
}
static int
-cmp3_read_int16 (char *bytes, int size) {
- buffer.readsize = size;
- buffer.out = bytes;
- cmp3_decode_int16 ();
- buffer.currentsample += (size - buffer.readsize) / 4;
- plugin.info.readpos = (float)(buffer.currentsample - buffer.startsample) / buffer.samplerate;
- return size - buffer.readsize;
+cmp3_read_int16 (DB_fileinfo_t *_info, char *bytes, int size) {
+ mpgmad_info_t *info = (mpgmad_info_t *)_info;
+ info->buffer.readsize = size;
+ info->buffer.out = bytes;
+ cmp3_decode_int16 (info);
+ info->buffer.currentsample += (size - info->buffer.readsize) / 4;
+ _info->readpos = (float)(info->buffer.currentsample - info->buffer.startsample) / info->buffer.samplerate;
+ return size - info->buffer.readsize;
}
static int
-cmp3_read_float32 (char *bytes, int size) {
- buffer.readsize = size;
- buffer.out = bytes;
- cmp3_decode_float32 ();
- buffer.currentsample += (size - buffer.readsize) / 8;
- plugin.info.readpos = (float)(buffer.currentsample - buffer.startsample) / buffer.samplerate;
- return size - buffer.readsize;
+cmp3_read_float32 (DB_fileinfo_t *_info, char *bytes, int size) {
+ mpgmad_info_t *info = (mpgmad_info_t *)_info;
+ info->buffer.readsize = size;
+ info->buffer.out = bytes;
+ cmp3_decode_float32 (info);
+ info->buffer.currentsample += (size - info->buffer.readsize) / 8;
+ _info->readpos = (float)(info->buffer.currentsample - info->buffer.startsample) / info->buffer.samplerate;
+ return size - info->buffer.readsize;
}
static int
-cmp3_seek_sample (int sample) {
- if (!buffer.file) {
+cmp3_seek_sample (DB_fileinfo_t *_info, int sample) {
+ mpgmad_info_t *info = (mpgmad_info_t *)_info;
+ if (!info->buffer.file) {
return -1;
}
- if (buffer.file->vfs->streaming) {
- if (buffer.totalsamples > 0 && buffer.avg_samples_per_frame && buffer.avg_packetlength) { // that means seekable remote stream, like podcast
+ if (info->buffer.file->vfs->streaming) {
+ if (info->buffer.totalsamples > 0 && info->buffer.avg_samples_per_frame && info->buffer.avg_packetlength) { // that means seekable remote stream, like podcast
trace ("seeking is possible!\n");
// get length excluding id3v2
- int64_t l = deadbeef->fgetlength (buffer.file) - buffer.startoffset;
+ int64_t l = deadbeef->fgetlength (info->buffer.file) - info->buffer.startoffset;
int r;
// seek to beginning of the frame
- int frm = sample / buffer.avg_samples_per_frame;
- r = deadbeef->fseek (buffer.file, frm * buffer.avg_packetlength, SEEK_SET);
+ int frm = sample / info->buffer.avg_samples_per_frame;
+ r = deadbeef->fseek (info->buffer.file, frm * info->buffer.avg_packetlength, SEEK_SET);
// l = l * sample / buffer.totalsamples;
// r = deadbeef->fseek (buffer.file, l, SEEK_SET);
if (!r) {
trace ("seek successful!\n");
- buffer.skipsamples = sample - frm * buffer.avg_samples_per_frame;
+ info->buffer.skipsamples = sample - frm * info->buffer.avg_samples_per_frame;
- buffer.currentsample = sample;
- plugin.info.readpos = (float)(buffer.currentsample - buffer.startsample) / buffer.samplerate;
+ info->buffer.currentsample = sample;
+ _info->readpos = (float)(info->buffer.currentsample - info->buffer.startsample) / info->buffer.samplerate;
// reset mad
- mad_synth_finish (&synth);
- mad_frame_finish (&frame);
- mad_stream_finish (&stream);
- buffer.remaining = 0;
- buffer.decode_remaining = 0;
- mad_stream_init(&stream);
- mad_frame_init(&frame);
- mad_synth_init(&synth);
+ mad_synth_finish (&info->synth);
+ mad_frame_finish (&info->frame);
+ mad_stream_finish (&info->stream);
+ info->buffer.remaining = 0;
+ info->buffer.decode_remaining = 0;
+ mad_stream_init(&info->stream);
+ mad_frame_init(&info->frame);
+ mad_synth_init(&info->synth);
return 0;
}
@@ -973,47 +986,48 @@ cmp3_seek_sample (int sample) {
return 0;
}
- sample += buffer.startsample + buffer.startdelay;
- if (sample > buffer.endsample) {
- trace ("seek sample %d is beyond end of track (%d)\n", sample, buffer.endsample);
+ sample += info->buffer.startsample + info->buffer.startdelay;
+ if (sample > info->buffer.endsample) {
+ trace ("seek sample %d is beyond end of track (%d)\n", sample, info->buffer.endsample);
return -1; // eof
}
// restart file, and load until we hit required pos
- deadbeef->fseek (buffer.file, 0, SEEK_SET);
- int skip = deadbeef->junk_get_leading_size (buffer.file);
+ deadbeef->fseek (info->buffer.file, 0, SEEK_SET);
+ int skip = deadbeef->junk_get_leading_size (info->buffer.file);
if (skip > 0) {
- deadbeef->fseek(buffer.file, skip, SEEK_SET);
+ deadbeef->fseek (info->buffer.file, skip, SEEK_SET);
}
- mad_synth_finish (&synth);
- mad_frame_finish (&frame);
- mad_stream_finish (&stream);
- buffer.remaining = 0;
- buffer.readsize = 0;
- buffer.decode_remaining = 0;
+ mad_synth_finish (&info->synth);
+ mad_frame_finish (&info->frame);
+ mad_stream_finish (&info->stream);
+ info->buffer.remaining = 0;
+ info->buffer.readsize = 0;
+ info->buffer.decode_remaining = 0;
if (sample == 0) {
- plugin.info.readpos = 0;
- buffer.currentsample = 0;
- buffer.skipsamples = buffer.startdelay;
+ _info->readpos = 0;
+ info->buffer.currentsample = 0;
+ info->buffer.skipsamples = info->buffer.startdelay;
return 0;
}
- if (cmp3_scan_stream (&buffer, sample) == -1) {
+ if (cmp3_scan_stream (&info->buffer, sample) == -1) {
trace ("failed to seek to sample %d\n", sample);
- plugin.info.readpos = 0;
+ _info->readpos = 0;
return -1;
}
- mad_stream_init(&stream);
- mad_frame_init(&frame);
- mad_synth_init(&synth);
- plugin.info.readpos = (float)(buffer.currentsample - buffer.startsample) / buffer.samplerate;
+ mad_stream_init(&info->stream);
+ mad_frame_init(&info->frame);
+ mad_synth_init(&info->synth);
+ _info->readpos = (float)(info->buffer.currentsample - info->buffer.startsample) / info->buffer.samplerate;
return 0;
}
static int
-cmp3_seek (float time) {
- int sample = time * buffer.samplerate;
- return cmp3_seek_sample (sample);
+cmp3_seek (DB_fileinfo_t *_info, float time) {
+ mpgmad_info_t *info = (mpgmad_info_t *)_info;
+ int sample = time * info->buffer.samplerate;
+ return cmp3_seek_sample (_info, sample);
}
static const char *filetypes[] = {
@@ -1022,13 +1036,15 @@ static const char *filetypes[] = {
static DB_playItem_t *
cmp3_insert (DB_playItem_t *after, const char *fname) {
+ trace ("cmp3_insert %s\n", fname);
DB_FILE *fp = deadbeef->fopen (fname);
if (!fp) {
+ trace ("failed to open file %s\n", fname);
return NULL;
}
if (fp->vfs->streaming) {
DB_playItem_t *it = deadbeef->pl_item_alloc ();
- it->decoder = &plugin;
+ it->decoder_id = deadbeef->plug_get_decoder_id (plugin.plugin.id);
it->fname = strdup (fname);
deadbeef->fclose (fp);
deadbeef->pl_add_meta (it, "title", NULL);
@@ -1047,6 +1063,7 @@ cmp3_insert (DB_playItem_t *after, const char *fname) {
// calc approx. mp3 duration
int res = cmp3_scan_stream (&buffer, 0);
if (res < 0) {
+ trace ("mpgmad: cmp3_scan_stream returned error\n");
deadbeef->fclose (fp);
return NULL;
}
@@ -1092,7 +1109,7 @@ cmp3_insert (DB_playItem_t *after, const char *fname) {
}
}
DB_playItem_t *it = deadbeef->pl_item_alloc ();
- it->decoder = &plugin;
+ it->decoder_id = deadbeef->plug_get_decoder_id (plugin.plugin.id);
it->fname = strdup (fname);
deadbeef->rewind (fp);
@@ -1107,7 +1124,7 @@ cmp3_insert (DB_playItem_t *after, const char *fname) {
// FIXME! bad numsamples passed to cue
DB_playItem_t *cue_after = deadbeef->pl_insert_cue (after, it, buffer.duration*buffer.samplerate, buffer.samplerate);
if (cue_after) {
- deadbeef->pl_item_free (it);
+ deadbeef->pl_item_unref (it);
return cue_after;
}
@@ -1125,6 +1142,7 @@ static DB_decoder_t plugin = {
.plugin.version_major = 0,
.plugin.version_minor = 1,
.plugin.type = DB_PLUGIN_DECODER,
+ .plugin.id = "stdmpg",
.plugin.name = "MPEG decoder",
.plugin.descr = "MPEG v1/2 layer1/2/3 decoder based on libmad",
.plugin.author = "Alexey Yakovenko",
@@ -1138,7 +1156,6 @@ static DB_decoder_t plugin = {
.seek_sample = cmp3_seek_sample,
.insert = cmp3_insert,
.exts = exts,
- .id = "stdmpg",
.filetypes = filetypes
};
diff --git a/plugins/oss/oss.c b/plugins/oss/oss.c
index a7d716da..9bd59c2a 100644
--- a/plugins/oss/oss.c
+++ b/plugins/oss/oss.c
@@ -299,6 +299,7 @@ static DB_output_t plugin = {
.plugin.version_minor = 1,
.plugin.nostop = 0,
.plugin.type = DB_PLUGIN_OUTPUT,
+ .plugin.id = "oss",
.plugin.name = "OSS output plugin",
.plugin.descr = "plays sound via OSS API",
.plugin.author = "Alexey Yakovenko",
diff --git a/plugins/sid/Makefile.am b/plugins/sid/Makefile.am
new file mode 100644
index 00000000..b7d35943
--- /dev/null
+++ b/plugins/sid/Makefile.am
@@ -0,0 +1,12 @@
+sidpath=@top_srcdir@/plugins/sid/sidplay-libs
+SUBDIRS = sidplay-libs
+
+pkglib_LTLIBRARIES = sid.la
+sid_la_SOURCES = plugin.c csid.cpp csid.h
+
+sid_la_LIBADD = $(sidpath)/libsidplay2.a -lstdc++
+sid_la_LDFLAGS = -module
+
+AM_CFLAGS = $(CFLAGS) -std=c99 -I$(sidpath)/libsidplay/include -I$(sidpath)/builders/resid-builder/include -fPIC
+AM_CPPFLAGS = $(CXXFLAGS) -I$(sidpath)/libsidplay/include -I$(sidpath)/builders/resid-builder/include -fPIC
+
diff --git a/csid.cpp b/plugins/sid/csid.cpp
index e6bb611b..9a21c1eb 100644
--- a/csid.cpp
+++ b/plugins/sid/csid.cpp
@@ -25,85 +25,32 @@
#endif
#include "sidplay/sidplay2.h"
#include "sidplay/builders/resid.h"
-// #include "md5/MD5.h" // include those 2 files if you want to use md5 impl from libsidplay2
+//#include "md5.h"
// #include "sidplay/sidendian.h"
#include "deadbeef.h"
+#include "csid.h"
+
+extern DB_decoder_t sid_plugin;
//#define trace(...) { fprintf(stderr, __VA_ARGS__); }
#define trace(fmt,...)
-extern "C" {
-#include "md5/md5.h"
-#include "conf.h"
-}
-
-// forward decls
-extern "C" {
- int csid_init (DB_playItem_t *it);
- void csid_free (void);
- int csid_read (char *bytes, int size);
- int csid_seek (float time);
- DB_playItem_t *csid_insert (DB_playItem_t *after, const char *fname);
- int csid_numvoices (void);
- void csid_mutevoice (int voice, int mute);
- int csid_stop (void);
-}
-
-static const char *exts[] = { "sid",NULL };
-const char *filetypes[] = { "SID", NULL };
-
-static const char settings_dlg[] =
- "property \"Enable HVSC\" checkbox hvsc_enable 0;\n"
- "property \"HVSC path\" file hvsc_path \"\";\n"
-;
-
-// define plugin interface
-static DB_decoder_t plugin = {
- { // plugin
- // C macro won't work here, so do it by hand
- /* .plugin.type = */DB_PLUGIN_DECODER,
- /* .api_vmajor = */DB_API_VERSION_MAJOR,
- /* .api_vminor = */DB_API_VERSION_MINOR,
- /* .plugin.version_major = */0,
- /* .plugin.version_minor = */1,
- /* .inactive = */0,
- /* .plugin.nostop = */0,
- /* .plugin.name = */"SID decoder",
- /* .plugin.descr = */"SID player based on libsidplay2",
- /* .plugin.author = */"Alexey Yakovenko",
- /* .plugin.email = */"waker@users.sourceforge.net",
- /* .plugin.website = */"http://deadbeef.sf.net",
- /* .plugin.start = */NULL,
- /* .plugin.stop = */csid_stop,
- /* .plugin.exec_cmdline = */NULL,
- /* .plugin.configdialog = */settings_dlg,
- },
- { // info
- /* .info.bps = */0,
- /* .info.channels = */0,
- /* .info.samplerate = */0,
- /* .info.readpos = */0,
- },
- /* .init = */csid_init,
- /* .free = */csid_free,
- /* .read_int16 = */csid_read,
- /* .read_float32 = */NULL,
- /* .seek = */csid_seek,
- /* .seek_sample = */NULL,
- /* .insert = */csid_insert,
- /* .numvoices = */csid_numvoices,
- /* .mutevoice = */csid_mutevoice,
- /* .exts = */exts,
- /* .filetypes = */filetypes,
- /* .id = */"stdsid"
-};
-
static DB_functions_t *deadbeef;
#define min(x,y) ((x)<(y)?(x):(y))
#define max(x,y) ((x)>(y)?(x):(y))
+typedef struct {
+ DB_fileinfo_t info;
+ sidplay2 *sidplay;
+ ReSIDBuilder *resid;
+ SidTune *tune;
+ float duration; // of the current song
+} sid_info_t;
+
+static uint32_t csid_voicemask;
+
static inline void
le_int16 (int16_t in, unsigned char *out) {
char *pin = (char *)&in;
@@ -116,12 +63,6 @@ le_int16 (int16_t in, unsigned char *out) {
#endif
}
-static sidplay2 *sidplay;
-static ReSIDBuilder *resid;
-static SidTune *tune;
-static float duration; // of the current song
-static uint32_t csid_voicemask = 0;
-
// SLDB support costs ~1M!!!
// current hvsc sldb size is ~35k songs
#define SLDB_MAX_SONGS 40000
@@ -138,18 +79,19 @@ static int sldb_loaded;
static sldb_t *sldb;
static int sldb_disable;
-static void sldb_load()
+static void
+sldb_load()
{
if (sldb_disable) {
return;
}
trace ("sldb_load\n");
- int conf_hvsc_enable = conf_get_int ("hvsc_enable", 0);
+ int conf_hvsc_enable = deadbeef->conf_get_int ("hvsc_enable", 0);
if (sldb_loaded || !conf_hvsc_enable) {
sldb_disable = 1;
return;
}
- const char *conf_hvsc_path = conf_get_str ("hvsc_path", NULL);
+ const char *conf_hvsc_path = deadbeef->conf_get_str ("hvsc_path", NULL);
if (!conf_hvsc_path) {
sldb_disable = 1;
return;
@@ -330,42 +272,53 @@ sldb_find (const uint8_t *digest) {
return -1;
}
-extern "C" int
+DB_fileinfo_t *
csid_init (DB_playItem_t *it) {
+ DB_fileinfo_t *_info = (DB_fileinfo_t *)malloc (sizeof (sid_info_t));
+ memset (_info, 0, sizeof (sid_info_t));
+ sid_info_t *info = (sid_info_t *)_info;
+
// libsidplay crashes if file doesn't exist
// so i have to check it here
FILE *fp = fopen (it->fname, "rb");
if (!fp ){
- return -1;
+ return NULL;
}
fclose (fp);
- sidplay = new sidplay2;
- resid = new ReSIDBuilder ("wtf");
- resid->create (sidplay->info ().maxsids);
+
+ info->sidplay = new sidplay2;
+ info->resid = new ReSIDBuilder ("wtf");
+ info->resid->create (info->sidplay->info ().maxsids);
// resid->create (1);
- resid->filter (true);
- resid->sampling (deadbeef->get_output ()->samplerate ());
- duration = deadbeef->pl_get_item_duration (it);
- tune = new SidTune (it->fname);
+ info->resid->filter (true);
+
+ int samplerate = deadbeef->conf_get_int ("synth.samplerate", 48000);
+ int bps = deadbeef->get_output ()->bitspersample ();
+
+ info->resid->sampling (samplerate);
+ info->duration = deadbeef->pl_get_item_duration (it);
+ info->tune = new SidTune (it->fname);
- tune->selectSong (it->tracknum+1);
- plugin.info.channels = tune->isStereo () ? 2 : 1;
+ info->tune->selectSong (it->tracknum+1);
sid2_config_t conf;
- conf = sidplay->config ();
- conf.frequency = deadbeef->get_output ()->samplerate ();
- conf.precision = 16;
- conf.playback = plugin.info.channels == 2 ? sid2_stereo : sid2_mono;
- conf.sidEmulation = resid;
+ conf = info->sidplay->config ();
+ conf.frequency = samplerate;
+ conf.precision = bps;
+ conf.playback = info->tune->isStereo () ? sid2_stereo : sid2_mono;
+ conf.sidEmulation = info->resid;
conf.optimisation = 0;
- sidplay->config (conf);
- sidplay->load (tune);
- plugin.info.bps = 16;
- plugin.info.samplerate = conf.frequency;
- plugin.info.readpos = 0;
+ info->sidplay->config (conf);
+ info->sidplay->load (info->tune);
- int maxsids = sidplay->info ().maxsids;
+ _info->plugin = &sid_plugin;
+ _info->channels = info->tune->isStereo () ? 2 : 1;
+ _info->bps = bps;
+ _info->samplerate = conf.frequency;
+ _info->readpos = 0;
+
+ int maxsids = info->sidplay->info ().maxsids;
for (int k = 0; k < maxsids; k++) {
- sidemu *emu = resid->getsidemu (k);
+ sidemu *emu = info->resid->getsidemu (k);
if (emu) {
for (int i = 0; i < 3; i++) {
bool mute = csid_voicemask & (1 << i) ? true : false;
@@ -373,30 +326,32 @@ csid_init (DB_playItem_t *it) {
}
}
}
- return 0;
+ return _info;
}
-extern "C" void
-csid_free (void) {
- delete sidplay;
- sidplay = 0;
- delete resid;
- resid = 0;
- delete tune;
- tune = 0;
+void
+csid_free (DB_fileinfo_t *_info) {
+ sid_info_t *info = (sid_info_t *)_info;
+ if (info) {
+ delete info->sidplay;
+ delete info->resid;
+ delete info->tune;
+ free (info);
+ }
}
-extern "C" int
-csid_read (char *bytes, int size) {
- if (plugin.info.readpos > duration) {
+int
+csid_read (DB_fileinfo_t *_info, char *bytes, int size) {
+ sid_info_t *info = (sid_info_t *)_info;
+ if (_info->readpos > info->duration) {
return 0;
}
- int rd = sidplay->play (bytes, size/plugin.info.channels);
- plugin.info.readpos += size/plugin.info.channels/2 / (float)plugin.info.samplerate;
+ int rd = info->sidplay->play (bytes, size/_info->channels);
+ _info->readpos += size/_info->channels/2 / (float)_info->samplerate;
#if WORDS_BIGENDIAN
// convert samples from le to be
- int n = rd * plugin.info.channels/2;
+ int n = rd * _info->channels/2;
int16_t *ptr = (int16_t *)bytes;
while (n > 0) {
int16_t out;
@@ -406,34 +361,35 @@ csid_read (char *bytes, int size) {
n--;
}
#endif
- return rd * plugin.info.channels;
+ return rd * _info->channels;
}
-extern "C" int
-csid_seek (float time) {
+int
+csid_seek (DB_fileinfo_t *_info, float time) {
+ sid_info_t *info = (sid_info_t *)_info;
float t = time;
- if (t < plugin.info.readpos) {
+ if (t < _info->readpos) {
// reinit
- sidplay->load (tune);
+ info->sidplay->load (info->tune);
}
else {
- t -= plugin.info.readpos;
+ t -= _info->readpos;
}
- resid->filter (false);
- int samples = t * plugin.info.samplerate;
- samples *= 2 * plugin.info.channels;
- uint16_t buffer[4096 * plugin.info.channels];
+ info->resid->filter (false);
+ int samples = t * _info->samplerate;
+ samples *= 2 * _info->channels;
+ uint16_t buffer[2048 * _info->channels];
while (samples > 0) {
- int n = min (samples, 4096) * plugin.info.channels;
- int done = sidplay->play (buffer, n);
+ int n = min (samples, 2048) * _info->channels;
+ int done = info->sidplay->play (buffer, n);
if (done < n) {
trace ("sid seek failure\n");
return -1;
}
samples -= done;
}
- resid->filter (true);
- plugin.info.readpos = time;
+ info->resid->filter (true);
+ _info->readpos = time;
return 0;
}
@@ -472,26 +428,27 @@ csid_insert (DB_playItem_t *after, const char *fname) {
int tunes = tune->getInfo ().songs;
uint8_t sig[16];
unsigned char tmp[2];
- md5_t md5;
- md5_init (&md5);
- md5_process (&md5, (const char *)tune->cache.get () + tune->fileOffset, tune->getInfo ().c64dataLen);
+#if 1
+ DB_md5_t md5;
+ deadbeef->md5_init (&md5);
+ deadbeef->md5_append (&md5, (const uint8_t *)tune->cache.get () + tune->fileOffset, tune->getInfo ().c64dataLen);
le_int16 (tune->getInfo ().initAddr, tmp);
- md5_process (&md5, tmp, 2);
+ deadbeef->md5_append (&md5, tmp, 2);
le_int16 (tune->getInfo ().playAddr, tmp);
- md5_process (&md5, tmp, 2);
+ deadbeef->md5_append (&md5, tmp, 2);
le_int16 (tune->getInfo ().songs, tmp);
- md5_process (&md5, tmp, 2);
+ deadbeef->md5_append (&md5, tmp, 2);
for (int s = 1; s <= tunes; s++)
{
tune->selectSong (s);
// songspeed is uint8_t, so no need for byteswap
- md5_process (&md5, &tune->getInfo ().songSpeed, 1);
+ deadbeef->md5_append (&md5, &tune->getInfo ().songSpeed, 1);
}
if (tune->getInfo ().clockSpeed == SIDTUNE_CLOCK_NTSC) {
- md5_process (&md5, &tune->getInfo ().clockSpeed, sizeof (tune->getInfo ().clockSpeed));
+ deadbeef->md5_append (&md5, &tune->getInfo ().clockSpeed, sizeof (tune->getInfo ().clockSpeed));
}
- md5_finish (&md5, sig);
-#if 0
+ deadbeef->md5_finish (&md5, sig);
+#else
// md5 calc from libsidplay2
MD5 myMD5;
myMD5.append ((const char *)tune->cache.get() + tune->fileOffset, tune->getInfo ().c64dataLen);
@@ -533,7 +490,7 @@ csid_insert (DB_playItem_t *after, const char *fname) {
for (int s = 0; s < tunes; s++) {
if (tune->selectSong (s+1)) {
DB_playItem_t *it = deadbeef->pl_item_alloc ();
- it->decoder = &plugin;
+ it->decoder_id = deadbeef->plug_get_decoder_id (sid_plugin.plugin.id);
it->fname = strdup (fname);
it->tracknum = s;
SidTuneInfo sidinfo;
@@ -595,18 +552,19 @@ csid_insert (DB_playItem_t *after, const char *fname) {
}
int
-csid_numvoices (void) {
+csid_numvoices (DB_fileinfo_t *_info) {
return 3;
}
void
-csid_mutevoice (int voice, int mute) {
+csid_mutevoice (DB_fileinfo_t *_info, int voice, int mute) {
+ sid_info_t *info = (sid_info_t *)_info;
csid_voicemask &= ~ (1<<voice);
csid_voicemask |= ((mute ? 1 : 0) << voice);
- if (resid) {
- int maxsids = sidplay->info ().maxsids;
+ if (info->resid) {
+ int maxsids = info->sidplay->info ().maxsids;
for (int k = 0; k < maxsids; k++) {
- sidemu *emu = resid->getsidemu (k);
+ sidemu *emu = info->resid->getsidemu (k);
if (emu) {
for (int i = 0; i < 3; i++) {
bool mute = csid_voicemask & (1 << i) ? true : false;
@@ -630,5 +588,6 @@ csid_stop (void) {
extern "C" DB_plugin_t *
sid_load (DB_functions_t *api) {
deadbeef = api;
- return DB_PLUGIN (&plugin);
+ return DB_PLUGIN (&sid_plugin);
}
+
diff --git a/plugins/sid/csid.h b/plugins/sid/csid.h
new file mode 100644
index 00000000..8ef8ecc5
--- /dev/null
+++ b/plugins/sid/csid.h
@@ -0,0 +1,39 @@
+/*
+ DeaDBeeF - ultimate music player for GNU/Linux systems with X11
+ Copyright (C) 2009-2010 Alexey Yakovenko <waker@users.sourceforge.net>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __CSID_H
+#define __CSID_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+DB_fileinfo_t *csid_init (DB_playItem_t *it);
+void csid_free (DB_fileinfo_t *);
+int csid_read (DB_fileinfo_t *, char *bytes, int size);
+int csid_seek (DB_fileinfo_t *, float time);
+DB_playItem_t *csid_insert (DB_playItem_t *after, const char *fname);
+int csid_numvoices (DB_fileinfo_t *);
+void csid_mutevoice (DB_fileinfo_t *, int voice, int mute);
+int csid_stop (void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/plugins/sid/plugin.c b/plugins/sid/plugin.c
new file mode 100644
index 00000000..8fd6854e
--- /dev/null
+++ b/plugins/sid/plugin.c
@@ -0,0 +1,54 @@
+/*
+ DeaDBeeF - ultimate music player for GNU/Linux systems with X11
+ Copyright (C) 2009-2010 Alexey Yakovenko <waker@users.sourceforge.net>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#include "../../deadbeef.h"
+#include "csid.h"
+
+static const char *exts[] = { "sid",NULL };
+const char *filetypes[] = { "SID", NULL };
+
+static const char settings_dlg[] =
+ "property \"Enable HVSC\" checkbox hvsc_enable 0;\n"
+ "property \"HVSC path\" file hvsc_path \"\";\n"
+;
+
+// define plugin interface
+DB_decoder_t sid_plugin = {
+ DB_PLUGIN_SET_API_VERSION
+ .plugin.type = DB_PLUGIN_DECODER,
+ .plugin.version_major = 0,
+ .plugin.version_minor = 1,
+ .plugin.name = "SID decoder",
+ .plugin.descr = "SID player based on libsidplay2",
+ .plugin.author = "Alexey Yakovenko",
+ .plugin.email = "waker@users.sourceforge.net",
+ .plugin.website = "http://deadbeef.sf.net",
+ .plugin.start = NULL,
+ .plugin.stop = csid_stop,
+ .plugin.configdialog = settings_dlg,
+ .plugin.id = "stdsid",
+ .init = csid_init,
+ .free = csid_free,
+ .read_int16 = csid_read,
+ .seek = csid_seek,
+ .seek_sample = NULL,
+ .insert = csid_insert,
+ .numvoices = csid_numvoices,
+ .mutevoice = csid_mutevoice,
+ .exts = exts,
+ .filetypes = filetypes,
+};
diff --git a/sid/sidplay-libs-2.1.0/Makefile.am b/plugins/sid/sidplay-libs/Makefile.am
index d6bdcf94..7f4ea0b7 100644
--- a/sid/sidplay-libs-2.1.0/Makefile.am
+++ b/plugins/sid/sidplay-libs/Makefile.am
@@ -1,13 +1,13 @@
noinst_LIBRARIES = libsidplay2.a
-sidpath=@top_srcdir@/sid/sidplay-libs-2.1.0
+sidpath=@top_srcdir@/plugins/sid/sidplay-libs
EXTRA_DIST = \
$(sidpath)/libsidutils/README $(sidpath)/libsidplay/README $(sidpath)/resid/README\
$(sidpath)/libsidutils/COPYING $(sidpath)/libsidplay/COPYING $(sidpath)/resid/COPYING\
$(sidpath)/libsidutils/AUTHORS $(sidpath)/libsidplay/AUTHORS $(sidpath)/resid/AUTHORS
-AM_CPPFLAGS = $(CXXFLAGS) -DHAVEUNIX -DHAVE_STRNCASECMP -DHAVE_STRCASECMP -I$(sidpath)/libsidplay -I$(sidpath)/libsidplay/include -I$(sidpath)/libsidplay/include/sidplay -I$(sidpath)/libsidutils/include/sidplay/utils -I$(sidpath)/builders/resid-builder/include/sidplay/builders -I$(sidpath)/builders/resid-builder/include
+AM_CPPFLAGS = $(INSANE_CXXFLAGS) -DHAVE_UNIX -I$(sidpath)/unix -I$(sidpath)/libsidplay -I$(sidpath)/libsidplay/include -I$(sidpath)/libsidplay/include/sidplay -I$(sidpath)/libsidutils/include/sidplay/utils -I$(sidpath)/builders/resid-builder/include/sidplay/builders -I$(sidpath)/builders/resid-builder/include -fPIC
libsidplay2_a_SOURCES = \
libsidplay/src/mixer.cpp\
@@ -105,29 +105,3 @@ libsidplay/src/mos6510/cycle_based/sid6510c.i\
libsidplay/src/kernal.bin\
libsidplay/src/psiddrv.bin\
libsidplay/src/poweron.bin
-
-
-#libsidutils/win/VC/config.h
-#libsidutils/src/ini/keys.h
-#libsidutils/src/ini/list.h
-#libsidutils/src/ini/ini.h
-#libsidutils/src/ini/headings.h
-#libsidutils/src/MD5/MD5_Defs.h
-#libsidutils/src/MD5/MD5.h
-#libsidutils/src/smm0.h
-#libsidutils/include/sidplay/utils/SidTuneMod.h
-#libsidutils/include/sidplay/utils/libini.h
-#libsidutils/include/sidplay/utils/SidFilter.h
-#libsidutils/include/sidplay/utils/SidDatabase.h
-#libsidutils/include/sidplay/utils/SidUsage.h
-#libsidutils/include/config.h
-#libsidutils/src/SidDatabase.cpp
-#libsidutils/src/SidFilter.cpp
-#libsidutils/src/SidTuneMod.cpp
-#libsidutils/src/MD5/MD5.cpp
-#libsidutils/src/SidUsage.cpp
-#libsidutils/src/ini/ini.cpp
-#libsidutils/src/ini/headings.i
-#libsidutils/src/ini/list.i
-#libsidutils/src/ini/keys.i
-#libsidutils/src/ini/types.i
diff --git a/sid/sidplay-libs-2.1.0/aclocal.m4 b/plugins/sid/sidplay-libs/aclocal.m4
index 1821b632..1821b632 100644
--- a/sid/sidplay-libs-2.1.0/aclocal.m4
+++ b/plugins/sid/sidplay-libs/aclocal.m4
diff --git a/sid/sidplay-libs-2.1.0/builders/Makefile.am b/plugins/sid/sidplay-libs/builders/Makefile.am
index 5ba945a7..5ba945a7 100644
--- a/sid/sidplay-libs-2.1.0/builders/Makefile.am
+++ b/plugins/sid/sidplay-libs/builders/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/builders/Makefile.in b/plugins/sid/sidplay-libs/builders/Makefile.in
index d5047fcf..d5047fcf 100644
--- a/sid/sidplay-libs-2.1.0/builders/Makefile.in
+++ b/plugins/sid/sidplay-libs/builders/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/Makefile.am b/plugins/sid/sidplay-libs/builders/resid-builder/Makefile.am
index bc2fe8f8..bc2fe8f8 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/Makefile.am
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/Makefile.in b/plugins/sid/sidplay-libs/builders/resid-builder/Makefile.in
index a77bf557..a77bf557 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/Makefile.in
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/acinclude.m4 b/plugins/sid/sidplay-libs/builders/resid-builder/acinclude.m4
index 5fcfce10..5fcfce10 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/acinclude.m4
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/acinclude.m4
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/aclocal.m4 b/plugins/sid/sidplay-libs/builders/resid-builder/aclocal.m4
index 225a39e4..225a39e4 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/aclocal.m4
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/aclocal.m4
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/configure b/plugins/sid/sidplay-libs/builders/resid-builder/configure
index 974f641c..974f641c 100755
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/configure
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/configure
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/configure.ac b/plugins/sid/sidplay-libs/builders/resid-builder/configure.ac
index 79fc8301..79fc8301 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/configure.ac
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/configure.ac
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/include/Makefile.am b/plugins/sid/sidplay-libs/builders/resid-builder/include/Makefile.am
index 1c58b3b9..1c58b3b9 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/include/Makefile.am
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/include/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/include/Makefile.in b/plugins/sid/sidplay-libs/builders/resid-builder/include/Makefile.in
index 0d13e311..0d13e311 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/include/Makefile.in
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/include/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/include/config.h b/plugins/sid/sidplay-libs/builders/resid-builder/include/config.h
index ebe9c82f..ebe9c82f 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/include/config.h
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/include/config.h
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/include/sidplay/Makefile.am b/plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/Makefile.am
index 82b48e43..82b48e43 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/include/sidplay/Makefile.am
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/include/sidplay/Makefile.in b/plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/Makefile.in
index 49d409e8..49d409e8 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/include/sidplay/Makefile.in
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/include/sidplay/builders/Makefile.am b/plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/builders/Makefile.am
index 4a35e9a7..4a35e9a7 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/include/sidplay/builders/Makefile.am
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/builders/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/include/sidplay/builders/Makefile.in b/plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/builders/Makefile.in
index 17314249..17314249 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/include/sidplay/builders/Makefile.in
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/builders/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/include/sidplay/builders/resid.h b/plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/builders/resid.h
index aa6ccffa..aa6ccffa 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/include/sidplay/builders/resid.h
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/include/sidplay/builders/resid.h
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/src/Makefile.am b/plugins/sid/sidplay-libs/builders/resid-builder/src/Makefile.am
index 74272c4f..74272c4f 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/src/Makefile.am
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/src/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/src/Makefile.in b/plugins/sid/sidplay-libs/builders/resid-builder/src/Makefile.in
index 9debbaf3..9debbaf3 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/src/Makefile.in
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/src/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/src/resid-builder.cpp b/plugins/sid/sidplay-libs/builders/resid-builder/src/resid-builder.cpp
index 4c7650f6..4c7650f6 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/src/resid-builder.cpp
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/src/resid-builder.cpp
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/src/resid-emu.h b/plugins/sid/sidplay-libs/builders/resid-builder/src/resid-emu.h
index fc4e25bc..fc4e25bc 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/src/resid-emu.h
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/src/resid-emu.h
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/src/resid.cpp b/plugins/sid/sidplay-libs/builders/resid-builder/src/resid.cpp
index 41cbdc39..41cbdc39 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/src/resid.cpp
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/src/resid.cpp
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/Makefile.am b/plugins/sid/sidplay-libs/builders/resid-builder/unix/Makefile.am
index dcb940b2..dcb940b2 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/Makefile.am
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/unix/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/Makefile.in b/plugins/sid/sidplay-libs/builders/resid-builder/unix/Makefile.in
index d655acf8..d655acf8 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/Makefile.in
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/unix/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/config.guess b/plugins/sid/sidplay-libs/builders/resid-builder/unix/config.guess
index f1657bbc..f1657bbc 100755
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/config.guess
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/unix/config.guess
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/config.h.in b/plugins/sid/sidplay-libs/builders/resid-builder/unix/config.h.in
index 8c158a66..8c158a66 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/config.h.in
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/unix/config.h.in
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/config.sub b/plugins/sid/sidplay-libs/builders/resid-builder/unix/config.sub
index 1dea9b79..1dea9b79 100755
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/config.sub
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/unix/config.sub
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/depcomp b/plugins/sid/sidplay-libs/builders/resid-builder/unix/depcomp
index 807b991f..807b991f 100755
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/depcomp
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/unix/depcomp
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/install-sh b/plugins/sid/sidplay-libs/builders/resid-builder/unix/install-sh
index 11870f1b..11870f1b 100755
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/install-sh
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/unix/install-sh
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/ltmain.sh b/plugins/sid/sidplay-libs/builders/resid-builder/unix/ltmain.sh
index c4538260..c4538260 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/ltmain.sh
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/unix/ltmain.sh
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/missing b/plugins/sid/sidplay-libs/builders/resid-builder/unix/missing
index 6a37006e..6a37006e 100755
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/missing
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/unix/missing
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/mkinstalldirs b/plugins/sid/sidplay-libs/builders/resid-builder/unix/mkinstalldirs
index d2d5f21b..d2d5f21b 100755
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/mkinstalldirs
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/unix/mkinstalldirs
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/my_macros.m4 b/plugins/sid/sidplay-libs/builders/resid-builder/unix/my_macros.m4
index bd607f73..bd607f73 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/my_macros.m4
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/unix/my_macros.m4
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/sidplay2.m4 b/plugins/sid/sidplay-libs/builders/resid-builder/unix/sidplay2.m4
index 123575c6..123575c6 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/unix/sidplay2.m4
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/unix/sidplay2.m4
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/win/VC/config.h b/plugins/sid/sidplay-libs/builders/resid-builder/win/VC/config.h
index 87d75e5c..87d75e5c 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/win/VC/config.h
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/win/VC/config.h
diff --git a/sid/sidplay-libs-2.1.0/builders/resid-builder/win/VC/resid_builder.dsp b/plugins/sid/sidplay-libs/builders/resid-builder/win/VC/resid_builder.dsp
index 7ee15fad..7ee15fad 100644
--- a/sid/sidplay-libs-2.1.0/builders/resid-builder/win/VC/resid_builder.dsp
+++ b/plugins/sid/sidplay-libs/builders/resid-builder/win/VC/resid_builder.dsp
diff --git a/sid/sidplay-libs-2.1.0/configure b/plugins/sid/sidplay-libs/configure
index 72305412..72305412 100755
--- a/sid/sidplay-libs-2.1.0/configure
+++ b/plugins/sid/sidplay-libs/configure
diff --git a/sid/sidplay-libs-2.1.0/configure.ac b/plugins/sid/sidplay-libs/configure.ac
index e85773a6..e85773a6 100644
--- a/sid/sidplay-libs-2.1.0/configure.ac
+++ b/plugins/sid/sidplay-libs/configure.ac
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/AUTHORS b/plugins/sid/sidplay-libs/libsidplay/AUTHORS
index e2fbdfba..e2fbdfba 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/AUTHORS
+++ b/plugins/sid/sidplay-libs/libsidplay/AUTHORS
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/COPYING b/plugins/sid/sidplay-libs/libsidplay/COPYING
index eeb586b3..eeb586b3 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/COPYING
+++ b/plugins/sid/sidplay-libs/libsidplay/COPYING
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/ChangeLog b/plugins/sid/sidplay-libs/libsidplay/ChangeLog
index 7a11e01a..7a11e01a 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/ChangeLog
+++ b/plugins/sid/sidplay-libs/libsidplay/ChangeLog
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/INSTALL b/plugins/sid/sidplay-libs/libsidplay/INSTALL
index 02a4a074..02a4a074 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/INSTALL
+++ b/plugins/sid/sidplay-libs/libsidplay/INSTALL
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/Makefile.am b/plugins/sid/sidplay-libs/libsidplay/Makefile.am
index bc2fe8f8..bc2fe8f8 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidplay/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/Makefile.in b/plugins/sid/sidplay-libs/libsidplay/Makefile.in
index ad6c5db8..ad6c5db8 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidplay/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/README b/plugins/sid/sidplay-libs/libsidplay/README
index afea8f07..afea8f07 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/README
+++ b/plugins/sid/sidplay-libs/libsidplay/README
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/TODO b/plugins/sid/sidplay-libs/libsidplay/TODO
index 6de32a74..6de32a74 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/TODO
+++ b/plugins/sid/sidplay-libs/libsidplay/TODO
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/aclocal.m4 b/plugins/sid/sidplay-libs/libsidplay/aclocal.m4
index c5b8eaad..c5b8eaad 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/aclocal.m4
+++ b/plugins/sid/sidplay-libs/libsidplay/aclocal.m4
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/configure b/plugins/sid/sidplay-libs/libsidplay/configure
index 631d3a38..631d3a38 100755
--- a/sid/sidplay-libs-2.1.0/libsidplay/configure
+++ b/plugins/sid/sidplay-libs/libsidplay/configure
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/configure.ac b/plugins/sid/sidplay-libs/libsidplay/configure.ac
index 0667bf55..0667bf55 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/configure.ac
+++ b/plugins/sid/sidplay-libs/libsidplay/configure.ac
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/Makefile.am b/plugins/sid/sidplay-libs/libsidplay/include/Makefile.am
index 9ccc23eb..9ccc23eb 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidplay/include/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/Makefile.in b/plugins/sid/sidplay-libs/libsidplay/include/Makefile.in
index 16cc3cde..16cc3cde 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidplay/include/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/config.h b/plugins/sid/sidplay-libs/libsidplay/include/config.h
index 2e5c8ba4..2e5c8ba4 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/config.h
+++ b/plugins/sid/sidplay-libs/libsidplay/include/config.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/sidenv.h b/plugins/sid/sidplay-libs/libsidplay/include/sidenv.h
index 0f02e31c..0f02e31c 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/sidenv.h
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidenv.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/Buffer.h b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/Buffer.h
index 8e766e1c..8e766e1c 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/Buffer.h
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/Buffer.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/Makefile.am b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/Makefile.am
index adb87b6a..adb87b6a 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/Makefile.in b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/Makefile.in
index f19799ca..f19799ca 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/SidTune.h b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/SidTune.h
index f544afb6..f544afb6 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/SidTune.h
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/SidTune.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/SmartPtr.h b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/SmartPtr.h
index 0cc7c046..0cc7c046 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/SmartPtr.h
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/SmartPtr.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/c64env.h b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/c64env.h
index 044dd0d0..044dd0d0 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/c64env.h
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/c64env.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/component.h b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/component.h
index ee8a76c1..ee8a76c1 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/component.h
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/component.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/event.h b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/event.h
index b89af24e..b89af24e 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/event.h
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/event.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sid2types.h b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/sid2types.h
index 55cbe75c..55cbe75c 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sid2types.h
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/sid2types.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidbuilder.h b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidbuilder.h
index 8dde0548..8dde0548 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidbuilder.h
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidbuilder.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidconfig.h b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidconfig.h
index f158dc9a..f158dc9a 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidconfig.h
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidconfig.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidendian.h b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidendian.h
index 9fa8582d..9fa8582d 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidendian.h
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidendian.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidint.h b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidint.h
index 7f26ccea..7f26ccea 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidint.h
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidint.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidplay2.h b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidplay2.h
index ccb54bca..ccb54bca 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidplay2.h
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidplay2.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidtypes.h b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidtypes.h
index 788c21ab..788c21ab 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidtypes.h
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidtypes.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidusage.h b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidusage.h
index 7d35e676..7d35e676 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/include/sidplay/sidusage.h
+++ b/plugins/sid/sidplay-libs/libsidplay/include/sidplay/sidusage.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/Makefile.am b/plugins/sid/sidplay-libs/libsidplay/src/Makefile.am
index 8c586b8b..8c586b8b 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidplay/src/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/Makefile.in b/plugins/sid/sidplay-libs/libsidplay/src/Makefile.in
index 5475c200..5475c200 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidplay/src/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/c64/Makefile.am b/plugins/sid/sidplay-libs/libsidplay/src/c64/Makefile.am
index 94d8e182..94d8e182 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/c64/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidplay/src/c64/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/c64/Makefile.in b/plugins/sid/sidplay-libs/libsidplay/src/c64/Makefile.in
index a9a93154..a9a93154 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/c64/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidplay/src/c64/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/c64/c64cia.h b/plugins/sid/sidplay-libs/libsidplay/src/c64/c64cia.h
index b9626405..b9626405 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/c64/c64cia.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/c64/c64cia.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/c64/c64vic.h b/plugins/sid/sidplay-libs/libsidplay/src/c64/c64vic.h
index d9b2f934..d9b2f934 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/c64/c64vic.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/c64/c64vic.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/c64/c64xsid.h b/plugins/sid/sidplay-libs/libsidplay/src/c64/c64xsid.h
index e8385adb..e8385adb 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/c64/c64xsid.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/c64/c64xsid.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/config.cpp b/plugins/sid/sidplay-libs/libsidplay/src/config.cpp
index 0b4a71da..0b4a71da 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/config.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/config.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/event.cpp b/plugins/sid/sidplay-libs/libsidplay/src/event.cpp
index ced11c38..ced11c38 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/event.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/event.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/kernal.bin b/plugins/sid/sidplay-libs/libsidplay/src/kernal.bin
index 301badb1..301badb1 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/kernal.bin
+++ b/plugins/sid/sidplay-libs/libsidplay/src/kernal.bin
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mixer.cpp b/plugins/sid/sidplay-libs/libsidplay/src/mixer.cpp
index c7703dc1..c7703dc1 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mixer.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mixer.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/Makefile.am b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/Makefile.am
index 27acc569..27acc569 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/Makefile.in b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/Makefile.in
index 9af93a74..9af93a74 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/conf6510.h b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/conf6510.h
index 6a1ea0bd..6a1ea0bd 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/conf6510.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/conf6510.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/cycle_based/mos6510c.h b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.h
index 9a046d2e..9a046d2e 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/cycle_based/mos6510c.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/cycle_based/mos6510c.i b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.i
index 78d57ba6..78d57ba6 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/cycle_based/mos6510c.i
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/mos6510c.i
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/cycle_based/sid6510c.h b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/sid6510c.h
index 49d96dd6..49d96dd6 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/cycle_based/sid6510c.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/sid6510c.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/cycle_based/sid6510c.i b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/sid6510c.i
index bc573d3b..bc573d3b 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/cycle_based/sid6510c.i
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/cycle_based/sid6510c.i
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/mos6510.cpp b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/mos6510.cpp
index 74b09c95..74b09c95 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/mos6510.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/mos6510.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/mos6510.h b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/mos6510.h
index e7ad1a3f..e7ad1a3f 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/mos6510.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/mos6510.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/opcodes.h b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/opcodes.h
index e4d44acd..e4d44acd 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6510/opcodes.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos6510/opcodes.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/Makefile.am b/plugins/sid/sidplay-libs/libsidplay/src/mos6526/Makefile.am
index e5029df5..e5029df5 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos6526/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/Makefile.in b/plugins/sid/sidplay-libs/libsidplay/src/mos6526/Makefile.in
index 8f1667ec..8f1667ec 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos6526/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/mos6526.cpp b/plugins/sid/sidplay-libs/libsidplay/src/mos6526/mos6526.cpp
index 32b6f1f2..32b6f1f2 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/mos6526.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos6526/mos6526.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/mos6526.h b/plugins/sid/sidplay-libs/libsidplay/src/mos6526/mos6526.h
index 5fa11bcf..5fa11bcf 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos6526/mos6526.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos6526/mos6526.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos656x/Makefile.am b/plugins/sid/sidplay-libs/libsidplay/src/mos656x/Makefile.am
index 7a228bca..7a228bca 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos656x/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos656x/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos656x/Makefile.in b/plugins/sid/sidplay-libs/libsidplay/src/mos656x/Makefile.in
index eeeea606..eeeea606 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos656x/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos656x/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos656x/mos656x.cpp b/plugins/sid/sidplay-libs/libsidplay/src/mos656x/mos656x.cpp
index a7e03642..a7e03642 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos656x/mos656x.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos656x/mos656x.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/mos656x/mos656x.h b/plugins/sid/sidplay-libs/libsidplay/src/mos656x/mos656x.h
index 7cf9867e..7cf9867e 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/mos656x/mos656x.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/mos656x/mos656x.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/nullsid.h b/plugins/sid/sidplay-libs/libsidplay/src/nullsid.h
index 7865d9e9..7865d9e9 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/nullsid.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/nullsid.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/player.cpp b/plugins/sid/sidplay-libs/libsidplay/src/player.cpp
index 38b612c0..38b612c0 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/player.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/player.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/player.h b/plugins/sid/sidplay-libs/libsidplay/src/player.h
index 7c0a024c..7c0a024c 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/player.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/player.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/poweron.bin b/plugins/sid/sidplay-libs/libsidplay/src/poweron.bin
index b5850151..b5850151 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/poweron.bin
+++ b/plugins/sid/sidplay-libs/libsidplay/src/poweron.bin
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/psiddrv.a65 b/plugins/sid/sidplay-libs/libsidplay/src/psiddrv.a65
index 8d269662..8d269662 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/psiddrv.a65
+++ b/plugins/sid/sidplay-libs/libsidplay/src/psiddrv.a65
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/psiddrv.bin b/plugins/sid/sidplay-libs/libsidplay/src/psiddrv.bin
index a7e8ae05..a7e8ae05 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/psiddrv.bin
+++ b/plugins/sid/sidplay-libs/libsidplay/src/psiddrv.bin
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/psiddrv.cpp b/plugins/sid/sidplay-libs/libsidplay/src/psiddrv.cpp
index 5a8cf894..5a8cf894 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/psiddrv.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/psiddrv.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/reloc65.c b/plugins/sid/sidplay-libs/libsidplay/src/reloc65.c
index 3c732a39..3c732a39 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/reloc65.c
+++ b/plugins/sid/sidplay-libs/libsidplay/src/reloc65.c
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sid6526/Makefile.am b/plugins/sid/sidplay-libs/libsidplay/src/sid6526/Makefile.am
index 8b282820..8b282820 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sid6526/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sid6526/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sid6526/Makefile.in b/plugins/sid/sidplay-libs/libsidplay/src/sid6526/Makefile.in
index ef5bdb03..ef5bdb03 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sid6526/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sid6526/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sid6526/sid6526.cpp b/plugins/sid/sidplay-libs/libsidplay/src/sid6526/sid6526.cpp
index 8737f7f0..8737f7f0 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sid6526/sid6526.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sid6526/sid6526.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sid6526/sid6526.h b/plugins/sid/sidplay-libs/libsidplay/src/sid6526/sid6526.h
index d92c230c..d92c230c 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sid6526/sid6526.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sid6526/sid6526.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sidplay2.cpp b/plugins/sid/sidplay-libs/libsidplay/src/sidplay2.cpp
index e3535ddb..e3535ddb 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sidplay2.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidplay2.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/IconInfo.cpp b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/IconInfo.cpp
index 30df20b4..30df20b4 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/IconInfo.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/IconInfo.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/InfoFile.cpp b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/InfoFile.cpp
index 0c03b23c..0c03b23c 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/InfoFile.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/InfoFile.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/MUS.cpp b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/MUS.cpp
index 16ea8fe9..16ea8fe9 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/MUS.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/MUS.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/Makefile.am b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/Makefile.am
index e1c06822..e1c06822 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/Makefile.in b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/Makefile.in
index bb5a7c27..bb5a7c27 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/PP20.cpp b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/PP20.cpp
index 8bec5cfe..8bec5cfe 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/PP20.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/PP20.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/PP20.h b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/PP20.h
index 74e7f5f7..74e7f5f7 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/PP20.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/PP20.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/PP20_Defs.h b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/PP20_Defs.h
index 9e3b345b..9e3b345b 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/PP20_Defs.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/PP20_Defs.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/PSID.cpp b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/PSID.cpp
index 0cc96969..0cc96969 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/PSID.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/PSID.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/SidTune.cpp b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTune.cpp
index 29638775..29638775 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/SidTune.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTune.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/SidTuneCfg.h b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneCfg.h
index 088c906e..088c906e 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/SidTuneCfg.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneCfg.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/SidTuneTools.cpp b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneTools.cpp
index 450795b9..450795b9 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/SidTuneTools.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneTools.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/SidTuneTools.h b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneTools.h
index 5a06046b..5a06046b 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/sidtune/SidTuneTools.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/sidtune/SidTuneTools.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/xsid/Makefile.am b/plugins/sid/sidplay-libs/libsidplay/src/xsid/Makefile.am
index 4c7caf6a..4c7caf6a 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/xsid/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidplay/src/xsid/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/xsid/Makefile.in b/plugins/sid/sidplay-libs/libsidplay/src/xsid/Makefile.in
index aafad807..aafad807 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/xsid/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidplay/src/xsid/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/xsid/xsid.cpp b/plugins/sid/sidplay-libs/libsidplay/src/xsid/xsid.cpp
index 29b5c909..29b5c909 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/xsid/xsid.cpp
+++ b/plugins/sid/sidplay-libs/libsidplay/src/xsid/xsid.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/src/xsid/xsid.h b/plugins/sid/sidplay-libs/libsidplay/src/xsid/xsid.h
index 98171d73..98171d73 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/src/xsid/xsid.h
+++ b/plugins/sid/sidplay-libs/libsidplay/src/xsid/xsid.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/Makefile.am b/plugins/sid/sidplay-libs/libsidplay/unix/Makefile.am
index 804c3d38..804c3d38 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/Makefile.in b/plugins/sid/sidplay-libs/libsidplay/unix/Makefile.in
index 6102c2f7..6102c2f7 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/ac_compile_check_sizeof.m4 b/plugins/sid/sidplay-libs/libsidplay/unix/ac_compile_check_sizeof.m4
index 8ada30a5..8ada30a5 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/ac_compile_check_sizeof.m4
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/ac_compile_check_sizeof.m4
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/ac_create_stdint_h.m4 b/plugins/sid/sidplay-libs/libsidplay/unix/ac_create_stdint_h.m4
index 0e807324..0e807324 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/ac_create_stdint_h.m4
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/ac_create_stdint_h.m4
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/config.guess b/plugins/sid/sidplay-libs/libsidplay/unix/config.guess
index f1657bbc..f1657bbc 100755
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/config.guess
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/config.guess
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/config.h.in b/plugins/sid/sidplay-libs/libsidplay/unix/config.h.in
index 1f42ded5..1f42ded5 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/config.h.in
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/config.h.in
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/config.sub b/plugins/sid/sidplay-libs/libsidplay/unix/config.sub
index 1dea9b79..1dea9b79 100755
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/config.sub
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/config.sub
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/depcomp b/plugins/sid/sidplay-libs/libsidplay/unix/depcomp
index 807b991f..807b991f 100755
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/depcomp
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/depcomp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/install-sh b/plugins/sid/sidplay-libs/libsidplay/unix/install-sh
index 11870f1b..11870f1b 100755
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/install-sh
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/install-sh
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/libsidplay2.pc.in b/plugins/sid/sidplay-libs/libsidplay/unix/libsidplay2.pc.in
index 33596988..33596988 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/libsidplay2.pc.in
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/libsidplay2.pc.in
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/libsidplay2.spec b/plugins/sid/sidplay-libs/libsidplay/unix/libsidplay2.spec
index 7f6859f4..7f6859f4 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/libsidplay2.spec
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/libsidplay2.spec
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/libsidplay2.spec.in b/plugins/sid/sidplay-libs/libsidplay/unix/libsidplay2.spec.in
index 518c9973..518c9973 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/libsidplay2.spec.in
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/libsidplay2.spec.in
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/ltmain.sh b/plugins/sid/sidplay-libs/libsidplay/unix/ltmain.sh
index c4538260..c4538260 100755
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/ltmain.sh
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/ltmain.sh
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/missing b/plugins/sid/sidplay-libs/libsidplay/unix/missing
index 6a37006e..6a37006e 100755
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/missing
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/missing
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/mkinstalldirs b/plugins/sid/sidplay-libs/libsidplay/unix/mkinstalldirs
index e6826388..e6826388 100755
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/mkinstalldirs
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/mkinstalldirs
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/my_macros.m4 b/plugins/sid/sidplay-libs/libsidplay/unix/my_macros.m4
index bd607f73..bd607f73 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/my_macros.m4
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/my_macros.m4
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/sidconfig.h b/plugins/sid/sidplay-libs/libsidplay/unix/sidconfig.h
index 6a111853..6a111853 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/sidconfig.h
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/sidconfig.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/sidconfig.h.in b/plugins/sid/sidplay-libs/libsidplay/unix/sidconfig.h.in
index b9c82441..b9c82441 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/sidconfig.h.in
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/sidconfig.h.in
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/unix/sidint.h b/plugins/sid/sidplay-libs/libsidplay/unix/sidint.h
index 9110ca49..9110ca49 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/unix/sidint.h
+++ b/plugins/sid/sidplay-libs/libsidplay/unix/sidint.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/win/VC/config.h b/plugins/sid/sidplay-libs/libsidplay/win/VC/config.h
index 553737ed..553737ed 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/win/VC/config.h
+++ b/plugins/sid/sidplay-libs/libsidplay/win/VC/config.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/win/VC/libsidplay.dsp b/plugins/sid/sidplay-libs/libsidplay/win/VC/libsidplay.dsp
index 7722eb4c..7722eb4c 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/win/VC/libsidplay.dsp
+++ b/plugins/sid/sidplay-libs/libsidplay/win/VC/libsidplay.dsp
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/win/VC/sidconfig.h b/plugins/sid/sidplay-libs/libsidplay/win/VC/sidconfig.h
index 024aeeac..024aeeac 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/win/VC/sidconfig.h
+++ b/plugins/sid/sidplay-libs/libsidplay/win/VC/sidconfig.h
diff --git a/sid/sidplay-libs-2.1.0/libsidplay/win/VC/sidint.h b/plugins/sid/sidplay-libs/libsidplay/win/VC/sidint.h
index b0776d16..b0776d16 100644
--- a/sid/sidplay-libs-2.1.0/libsidplay/win/VC/sidint.h
+++ b/plugins/sid/sidplay-libs/libsidplay/win/VC/sidint.h
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/AUTHORS b/plugins/sid/sidplay-libs/libsidutils/AUTHORS
index 86de71c6..86de71c6 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/AUTHORS
+++ b/plugins/sid/sidplay-libs/libsidutils/AUTHORS
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/COPYING b/plugins/sid/sidplay-libs/libsidutils/COPYING
index aa0aea5b..aa0aea5b 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/COPYING
+++ b/plugins/sid/sidplay-libs/libsidutils/COPYING
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/ChangeLog b/plugins/sid/sidplay-libs/libsidutils/ChangeLog
index 555ef0b9..555ef0b9 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/ChangeLog
+++ b/plugins/sid/sidplay-libs/libsidutils/ChangeLog
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/INSTALL b/plugins/sid/sidplay-libs/libsidutils/INSTALL
index 02a4a074..02a4a074 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/INSTALL
+++ b/plugins/sid/sidplay-libs/libsidutils/INSTALL
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/Makefile.am b/plugins/sid/sidplay-libs/libsidutils/Makefile.am
index bc2fe8f8..bc2fe8f8 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidutils/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/Makefile.in b/plugins/sid/sidplay-libs/libsidutils/Makefile.in
index e39aed30..e39aed30 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidutils/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/README b/plugins/sid/sidplay-libs/libsidutils/README
index b23614bd..b23614bd 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/README
+++ b/plugins/sid/sidplay-libs/libsidutils/README
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/TODO b/plugins/sid/sidplay-libs/libsidutils/TODO
index 688b0746..688b0746 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/TODO
+++ b/plugins/sid/sidplay-libs/libsidutils/TODO
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/aclocal.m4 b/plugins/sid/sidplay-libs/libsidutils/aclocal.m4
index 7b718771..7b718771 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/aclocal.m4
+++ b/plugins/sid/sidplay-libs/libsidutils/aclocal.m4
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/configure b/plugins/sid/sidplay-libs/libsidutils/configure
index 7c226169..7c226169 100755
--- a/sid/sidplay-libs-2.1.0/libsidutils/configure
+++ b/plugins/sid/sidplay-libs/libsidutils/configure
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/configure.ac b/plugins/sid/sidplay-libs/libsidutils/configure.ac
index 845c2630..845c2630 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/configure.ac
+++ b/plugins/sid/sidplay-libs/libsidutils/configure.ac
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/include/Makefile.am b/plugins/sid/sidplay-libs/libsidutils/include/Makefile.am
index 1c58b3b9..1c58b3b9 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/include/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidutils/include/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/include/Makefile.in b/plugins/sid/sidplay-libs/libsidutils/include/Makefile.in
index 20bc9137..20bc9137 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/include/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidutils/include/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/include/config.h b/plugins/sid/sidplay-libs/libsidutils/include/config.h
index 21653356..21653356 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/include/config.h
+++ b/plugins/sid/sidplay-libs/libsidutils/include/config.h
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/Makefile.am b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/Makefile.am
index 97b7b2b3..97b7b2b3 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/Makefile.in b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/Makefile.in
index bcb71602..bcb71602 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/Makefile.am b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/Makefile.am
index 5337a9a2..5337a9a2 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/Makefile.in b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/Makefile.in
index 223aada3..223aada3 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/SidDatabase.h b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/SidDatabase.h
index e16932a2..e16932a2 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/SidDatabase.h
+++ b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/SidDatabase.h
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/SidFilter.h b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/SidFilter.h
index db52aa01..db52aa01 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/SidFilter.h
+++ b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/SidFilter.h
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/SidTuneMod.h b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/SidTuneMod.h
index 4355f3a0..4355f3a0 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/SidTuneMod.h
+++ b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/SidTuneMod.h
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/SidUsage.h b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/SidUsage.h
index 77e63708..77e63708 100755
--- a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/SidUsage.h
+++ b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/SidUsage.h
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/libini.h b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/libini.h
index 798dfe8e..798dfe8e 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/include/sidplay/utils/libini.h
+++ b/plugins/sid/sidplay-libs/libsidutils/include/sidplay/utils/libini.h
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/MD5/MD5.cpp b/plugins/sid/sidplay-libs/libsidutils/src/MD5/MD5.cpp
index acb7e42f..acb7e42f 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/MD5/MD5.cpp
+++ b/plugins/sid/sidplay-libs/libsidutils/src/MD5/MD5.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/MD5/MD5.h b/plugins/sid/sidplay-libs/libsidutils/src/MD5/MD5.h
index 7ced54f7..7ced54f7 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/MD5/MD5.h
+++ b/plugins/sid/sidplay-libs/libsidutils/src/MD5/MD5.h
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/MD5/MD5_Defs.h b/plugins/sid/sidplay-libs/libsidutils/src/MD5/MD5_Defs.h
index 77dca881..77dca881 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/MD5/MD5_Defs.h
+++ b/plugins/sid/sidplay-libs/libsidutils/src/MD5/MD5_Defs.h
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/MD5/Makefile.am b/plugins/sid/sidplay-libs/libsidutils/src/MD5/Makefile.am
index 010f6f79..010f6f79 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/MD5/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidutils/src/MD5/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/MD5/Makefile.in b/plugins/sid/sidplay-libs/libsidutils/src/MD5/Makefile.in
index c72e248b..c72e248b 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/MD5/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidutils/src/MD5/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/Makefile.am b/plugins/sid/sidplay-libs/libsidutils/src/Makefile.am
index 448412ed..448412ed 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidutils/src/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/Makefile.in b/plugins/sid/sidplay-libs/libsidutils/src/Makefile.in
index 5e35304b..5e35304b 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidutils/src/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/SidDatabase.cpp b/plugins/sid/sidplay-libs/libsidutils/src/SidDatabase.cpp
index 20dd20b3..20dd20b3 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/SidDatabase.cpp
+++ b/plugins/sid/sidplay-libs/libsidutils/src/SidDatabase.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/SidFilter.cpp b/plugins/sid/sidplay-libs/libsidutils/src/SidFilter.cpp
index 1d9b35ea..1d9b35ea 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/SidFilter.cpp
+++ b/plugins/sid/sidplay-libs/libsidutils/src/SidFilter.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/SidTuneMod.cpp b/plugins/sid/sidplay-libs/libsidutils/src/SidTuneMod.cpp
index 6af33350..6af33350 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/SidTuneMod.cpp
+++ b/plugins/sid/sidplay-libs/libsidutils/src/SidTuneMod.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/SidUsage.cpp b/plugins/sid/sidplay-libs/libsidutils/src/SidUsage.cpp
index abeb085d..abeb085d 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/SidUsage.cpp
+++ b/plugins/sid/sidplay-libs/libsidutils/src/SidUsage.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/Makefile.am b/plugins/sid/sidplay-libs/libsidutils/src/ini/Makefile.am
index 9afbd7db..9afbd7db 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidutils/src/ini/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/Makefile.in b/plugins/sid/sidplay-libs/libsidutils/src/ini/Makefile.in
index a7e5247f..a7e5247f 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidutils/src/ini/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/headings.h b/plugins/sid/sidplay-libs/libsidutils/src/ini/headings.h
index 2f7fcf74..2f7fcf74 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/headings.h
+++ b/plugins/sid/sidplay-libs/libsidutils/src/ini/headings.h
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/headings.i b/plugins/sid/sidplay-libs/libsidutils/src/ini/headings.i
index 11833a99..11833a99 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/headings.i
+++ b/plugins/sid/sidplay-libs/libsidutils/src/ini/headings.i
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/ini.cpp b/plugins/sid/sidplay-libs/libsidutils/src/ini/ini.cpp
index b7d39362..b7d39362 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/ini.cpp
+++ b/plugins/sid/sidplay-libs/libsidutils/src/ini/ini.cpp
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/ini.h b/plugins/sid/sidplay-libs/libsidutils/src/ini/ini.h
index bc622cba..bc622cba 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/ini.h
+++ b/plugins/sid/sidplay-libs/libsidutils/src/ini/ini.h
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/keys.h b/plugins/sid/sidplay-libs/libsidutils/src/ini/keys.h
index 2bef0ff4..2bef0ff4 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/keys.h
+++ b/plugins/sid/sidplay-libs/libsidutils/src/ini/keys.h
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/keys.i b/plugins/sid/sidplay-libs/libsidutils/src/ini/keys.i
index 5507b95d..5507b95d 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/keys.i
+++ b/plugins/sid/sidplay-libs/libsidutils/src/ini/keys.i
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/list.h b/plugins/sid/sidplay-libs/libsidutils/src/ini/list.h
index 9e7f88e4..9e7f88e4 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/list.h
+++ b/plugins/sid/sidplay-libs/libsidutils/src/ini/list.h
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/list.i b/plugins/sid/sidplay-libs/libsidutils/src/ini/list.i
index 57f6011d..57f6011d 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/list.i
+++ b/plugins/sid/sidplay-libs/libsidutils/src/ini/list.i
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/types.i b/plugins/sid/sidplay-libs/libsidutils/src/ini/types.i
index a59d0dbf..a59d0dbf 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/ini/types.i
+++ b/plugins/sid/sidplay-libs/libsidutils/src/ini/types.i
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/src/smm0.h b/plugins/sid/sidplay-libs/libsidutils/src/smm0.h
index fca61092..fca61092 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/src/smm0.h
+++ b/plugins/sid/sidplay-libs/libsidutils/src/smm0.h
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/unix/Makefile.am b/plugins/sid/sidplay-libs/libsidutils/unix/Makefile.am
index 0297d7f8..0297d7f8 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/unix/Makefile.am
+++ b/plugins/sid/sidplay-libs/libsidutils/unix/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/unix/Makefile.in b/plugins/sid/sidplay-libs/libsidutils/unix/Makefile.in
index 69c47c44..69c47c44 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/unix/Makefile.in
+++ b/plugins/sid/sidplay-libs/libsidutils/unix/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/unix/config.guess b/plugins/sid/sidplay-libs/libsidutils/unix/config.guess
index f1657bbc..f1657bbc 100755
--- a/sid/sidplay-libs-2.1.0/libsidutils/unix/config.guess
+++ b/plugins/sid/sidplay-libs/libsidutils/unix/config.guess
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/unix/config.h.in b/plugins/sid/sidplay-libs/libsidutils/unix/config.h.in
index 5e123d10..5e123d10 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/unix/config.h.in
+++ b/plugins/sid/sidplay-libs/libsidutils/unix/config.h.in
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/unix/config.sub b/plugins/sid/sidplay-libs/libsidutils/unix/config.sub
index 1dea9b79..1dea9b79 100755
--- a/sid/sidplay-libs-2.1.0/libsidutils/unix/config.sub
+++ b/plugins/sid/sidplay-libs/libsidutils/unix/config.sub
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/unix/depcomp b/plugins/sid/sidplay-libs/libsidutils/unix/depcomp
index 807b991f..807b991f 100755
--- a/sid/sidplay-libs-2.1.0/libsidutils/unix/depcomp
+++ b/plugins/sid/sidplay-libs/libsidutils/unix/depcomp
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/unix/install-sh b/plugins/sid/sidplay-libs/libsidutils/unix/install-sh
index 11870f1b..11870f1b 100755
--- a/sid/sidplay-libs-2.1.0/libsidutils/unix/install-sh
+++ b/plugins/sid/sidplay-libs/libsidutils/unix/install-sh
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/unix/libsidutils.pc.in b/plugins/sid/sidplay-libs/libsidutils/unix/libsidutils.pc.in
index bb2fed73..bb2fed73 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/unix/libsidutils.pc.in
+++ b/plugins/sid/sidplay-libs/libsidutils/unix/libsidutils.pc.in
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/unix/libsidutils.spec b/plugins/sid/sidplay-libs/libsidutils/unix/libsidutils.spec
index 4337cd46..4337cd46 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/unix/libsidutils.spec
+++ b/plugins/sid/sidplay-libs/libsidutils/unix/libsidutils.spec
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/unix/libsidutils.spec.in b/plugins/sid/sidplay-libs/libsidutils/unix/libsidutils.spec.in
index 7ce8b921..7ce8b921 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/unix/libsidutils.spec.in
+++ b/plugins/sid/sidplay-libs/libsidutils/unix/libsidutils.spec.in
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/unix/ltmain.sh b/plugins/sid/sidplay-libs/libsidutils/unix/ltmain.sh
index c4538260..c4538260 100755
--- a/sid/sidplay-libs-2.1.0/libsidutils/unix/ltmain.sh
+++ b/plugins/sid/sidplay-libs/libsidutils/unix/ltmain.sh
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/unix/missing b/plugins/sid/sidplay-libs/libsidutils/unix/missing
index 6a37006e..6a37006e 100755
--- a/sid/sidplay-libs-2.1.0/libsidutils/unix/missing
+++ b/plugins/sid/sidplay-libs/libsidutils/unix/missing
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/unix/mkinstalldirs b/plugins/sid/sidplay-libs/libsidutils/unix/mkinstalldirs
index d2d5f21b..d2d5f21b 100755
--- a/sid/sidplay-libs-2.1.0/libsidutils/unix/mkinstalldirs
+++ b/plugins/sid/sidplay-libs/libsidutils/unix/mkinstalldirs
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/unix/my_macros.m4 b/plugins/sid/sidplay-libs/libsidutils/unix/my_macros.m4
index bd607f73..bd607f73 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/unix/my_macros.m4
+++ b/plugins/sid/sidplay-libs/libsidutils/unix/my_macros.m4
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/unix/sidplay2.m4 b/plugins/sid/sidplay-libs/libsidutils/unix/sidplay2.m4
index 123575c6..123575c6 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/unix/sidplay2.m4
+++ b/plugins/sid/sidplay-libs/libsidutils/unix/sidplay2.m4
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/win/VC/config.h b/plugins/sid/sidplay-libs/libsidutils/win/VC/config.h
index be69c2bc..be69c2bc 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/win/VC/config.h
+++ b/plugins/sid/sidplay-libs/libsidutils/win/VC/config.h
diff --git a/sid/sidplay-libs-2.1.0/libsidutils/win/VC/libsidutils.dsp b/plugins/sid/sidplay-libs/libsidutils/win/VC/libsidutils.dsp
index ae408746..ae408746 100644
--- a/sid/sidplay-libs-2.1.0/libsidutils/win/VC/libsidutils.dsp
+++ b/plugins/sid/sidplay-libs/libsidutils/win/VC/libsidutils.dsp
diff --git a/sid/sidplay-libs-2.1.0/resid/AUTHORS b/plugins/sid/sidplay-libs/resid/AUTHORS
index d22e33d5..d22e33d5 100644
--- a/sid/sidplay-libs-2.1.0/resid/AUTHORS
+++ b/plugins/sid/sidplay-libs/resid/AUTHORS
diff --git a/sid/sidplay-libs-2.1.0/resid/COPYING b/plugins/sid/sidplay-libs/resid/COPYING
index eeb586b3..eeb586b3 100644
--- a/sid/sidplay-libs-2.1.0/resid/COPYING
+++ b/plugins/sid/sidplay-libs/resid/COPYING
diff --git a/sid/sidplay-libs-2.1.0/resid/ChangeLog b/plugins/sid/sidplay-libs/resid/ChangeLog
index c1735aaf..c1735aaf 100644
--- a/sid/sidplay-libs-2.1.0/resid/ChangeLog
+++ b/plugins/sid/sidplay-libs/resid/ChangeLog
diff --git a/sid/sidplay-libs-2.1.0/resid/INSTALL b/plugins/sid/sidplay-libs/resid/INSTALL
index 9f743ca4..9f743ca4 100644
--- a/sid/sidplay-libs-2.1.0/resid/INSTALL
+++ b/plugins/sid/sidplay-libs/resid/INSTALL
diff --git a/sid/sidplay-libs-2.1.0/resid/Makefile.am b/plugins/sid/sidplay-libs/resid/Makefile.am
index f83377a0..f83377a0 100644
--- a/sid/sidplay-libs-2.1.0/resid/Makefile.am
+++ b/plugins/sid/sidplay-libs/resid/Makefile.am
diff --git a/sid/sidplay-libs-2.1.0/resid/Makefile.in b/plugins/sid/sidplay-libs/resid/Makefile.in
index 6c6001f6..6c6001f6 100644
--- a/sid/sidplay-libs-2.1.0/resid/Makefile.in
+++ b/plugins/sid/sidplay-libs/resid/Makefile.in
diff --git a/sid/sidplay-libs-2.1.0/resid/NEWS b/plugins/sid/sidplay-libs/resid/NEWS
index 2f9f3c42..2f9f3c42 100644
--- a/sid/sidplay-libs-2.1.0/resid/NEWS
+++ b/plugins/sid/sidplay-libs/resid/NEWS
diff --git a/sid/sidplay-libs-2.1.0/resid/README b/plugins/sid/sidplay-libs/resid/README
index 8967f5d2..8967f5d2 100644
--- a/sid/sidplay-libs-2.1.0/resid/README
+++ b/plugins/sid/sidplay-libs/resid/README
diff --git a/sid/sidplay-libs-2.1.0/resid/THANKS b/plugins/sid/sidplay-libs/resid/THANKS
index f65a075f..f65a075f 100644
--- a/sid/sidplay-libs-2.1.0/resid/THANKS
+++ b/plugins/sid/sidplay-libs/resid/THANKS
diff --git a/sid/sidplay-libs-2.1.0/resid/TODO b/plugins/sid/sidplay-libs/resid/TODO
index 4527dfa5..4527dfa5 100644
--- a/sid/sidplay-libs-2.1.0/resid/TODO
+++ b/plugins/sid/sidplay-libs/resid/TODO
diff --git a/sid/sidplay-libs-2.1.0/resid/aclocal.m4 b/plugins/sid/sidplay-libs/resid/aclocal.m4
index 7a0844fe..7a0844fe 100644
--- a/sid/sidplay-libs-2.1.0/resid/aclocal.m4
+++ b/plugins/sid/sidplay-libs/resid/aclocal.m4
diff --git a/sid/sidplay-libs-2.1.0/resid/config.guess b/plugins/sid/sidplay-libs/resid/config.guess
index ba661651..ba661651 100755
--- a/sid/sidplay-libs-2.1.0/resid/config.guess
+++ b/plugins/sid/sidplay-libs/resid/config.guess
diff --git a/sid/sidplay-libs-2.1.0/resid/config.sub b/plugins/sid/sidplay-libs/resid/config.sub
index a06a480a..a06a480a 100755
--- a/sid/sidplay-libs-2.1.0/resid/config.sub
+++ b/plugins/sid/sidplay-libs/resid/config.sub
diff --git a/sid/sidplay-libs-2.1.0/resid/configure b/plugins/sid/sidplay-libs/resid/configure
index 769ba94b..769ba94b 100755
--- a/sid/sidplay-libs-2.1.0/resid/configure
+++ b/plugins/sid/sidplay-libs/resid/configure
diff --git a/sid/sidplay-libs-2.1.0/resid/configure.in b/plugins/sid/sidplay-libs/resid/configure.in
index 2d3413be..2d3413be 100644
--- a/sid/sidplay-libs-2.1.0/resid/configure.in
+++ b/plugins/sid/sidplay-libs/resid/configure.in
diff --git a/sid/sidplay-libs-2.1.0/resid/depcomp b/plugins/sid/sidplay-libs/resid/depcomp
index 65899658..65899658 100644
--- a/sid/sidplay-libs-2.1.0/resid/depcomp
+++ b/plugins/sid/sidplay-libs/resid/depcomp
diff --git a/sid/sidplay-libs-2.1.0/resid/envelope.cc b/plugins/sid/sidplay-libs/resid/envelope.cc
index a4bbd511..a4bbd511 100644
--- a/sid/sidplay-libs-2.1.0/resid/envelope.cc
+++ b/plugins/sid/sidplay-libs/resid/envelope.cc
diff --git a/sid/sidplay-libs-2.1.0/resid/envelope.h b/plugins/sid/sidplay-libs/resid/envelope.h
index d0b528ff..d0b528ff 100644
--- a/sid/sidplay-libs-2.1.0/resid/envelope.h
+++ b/plugins/sid/sidplay-libs/resid/envelope.h
diff --git a/sid/sidplay-libs-2.1.0/resid/extfilt.cc b/plugins/sid/sidplay-libs/resid/extfilt.cc
index 461cdaf7..461cdaf7 100644
--- a/sid/sidplay-libs-2.1.0/resid/extfilt.cc
+++ b/plugins/sid/sidplay-libs/resid/extfilt.cc
diff --git a/sid/sidplay-libs-2.1.0/resid/extfilt.h b/plugins/sid/sidplay-libs/resid/extfilt.h
index 84c204ef..84c204ef 100644
--- a/sid/sidplay-libs-2.1.0/resid/extfilt.h
+++ b/plugins/sid/sidplay-libs/resid/extfilt.h
diff --git a/sid/sidplay-libs-2.1.0/resid/filter.cc b/plugins/sid/sidplay-libs/resid/filter.cc
index 9ca793e0..9ca793e0 100644
--- a/sid/sidplay-libs-2.1.0/resid/filter.cc
+++ b/plugins/sid/sidplay-libs/resid/filter.cc
diff --git a/sid/sidplay-libs-2.1.0/resid/filter.h b/plugins/sid/sidplay-libs/resid/filter.h
index 7db4f31c..7db4f31c 100644
--- a/sid/sidplay-libs-2.1.0/resid/filter.h
+++ b/plugins/sid/sidplay-libs/resid/filter.h
diff --git a/sid/sidplay-libs-2.1.0/resid/install-sh b/plugins/sid/sidplay-libs/resid/install-sh
index e9de2384..e9de2384 100755
--- a/sid/sidplay-libs-2.1.0/resid/install-sh
+++ b/plugins/sid/sidplay-libs/resid/install-sh
diff --git a/sid/sidplay-libs-2.1.0/resid/ltmain.sh b/plugins/sid/sidplay-libs/resid/ltmain.sh
index 2393e14d..2393e14d 100644
--- a/sid/sidplay-libs-2.1.0/resid/ltmain.sh
+++ b/plugins/sid/sidplay-libs/resid/ltmain.sh
diff --git a/sid/sidplay-libs-2.1.0/resid/missing b/plugins/sid/sidplay-libs/resid/missing
index d46f79f6..d46f79f6 100755
--- a/sid/sidplay-libs-2.1.0/resid/missing
+++ b/plugins/sid/sidplay-libs/resid/missing
diff --git a/sid/sidplay-libs-2.1.0/resid/mkinstalldirs b/plugins/sid/sidplay-libs/resid/mkinstalldirs
index 4f58503e..4f58503e 100755
--- a/sid/sidplay-libs-2.1.0/resid/mkinstalldirs
+++ b/plugins/sid/sidplay-libs/resid/mkinstalldirs
diff --git a/sid/sidplay-libs-2.1.0/resid/pot.cc b/plugins/sid/sidplay-libs/resid/pot.cc
index 805f9a7c..805f9a7c 100644
--- a/sid/sidplay-libs-2.1.0/resid/pot.cc
+++ b/plugins/sid/sidplay-libs/resid/pot.cc
diff --git a/sid/sidplay-libs-2.1.0/resid/pot.h b/plugins/sid/sidplay-libs/resid/pot.h
index e61c2238..e61c2238 100644
--- a/sid/sidplay-libs-2.1.0/resid/pot.h
+++ b/plugins/sid/sidplay-libs/resid/pot.h
diff --git a/sid/sidplay-libs-2.1.0/resid/samp2src.pl b/plugins/sid/sidplay-libs/resid/samp2src.pl
index 0313e1df..0313e1df 100755
--- a/sid/sidplay-libs-2.1.0/resid/samp2src.pl
+++ b/plugins/sid/sidplay-libs/resid/samp2src.pl
diff --git a/sid/sidplay-libs-2.1.0/resid/sid.cc b/plugins/sid/sidplay-libs/resid/sid.cc
index f3cd02a3..f3cd02a3 100644
--- a/sid/sidplay-libs-2.1.0/resid/sid.cc
+++ b/plugins/sid/sidplay-libs/resid/sid.cc
diff --git a/sid/sidplay-libs-2.1.0/resid/sid.h b/plugins/sid/sidplay-libs/resid/sid.h
index 33754547..33754547 100644
--- a/sid/sidplay-libs-2.1.0/resid/sid.h
+++ b/plugins/sid/sidplay-libs/resid/sid.h
diff --git a/sid/sidplay-libs-2.1.0/resid/siddefs.h b/plugins/sid/sidplay-libs/resid/siddefs.h
index c4eaea6e..c4eaea6e 100644
--- a/sid/sidplay-libs-2.1.0/resid/siddefs.h
+++ b/plugins/sid/sidplay-libs/resid/siddefs.h
diff --git a/sid/sidplay-libs-2.1.0/resid/siddefs.h.in b/plugins/sid/sidplay-libs/resid/siddefs.h.in
index e5634924..e5634924 100644
--- a/sid/sidplay-libs-2.1.0/resid/siddefs.h.in
+++ b/plugins/sid/sidplay-libs/resid/siddefs.h.in
diff --git a/sid/sidplay-libs-2.1.0/resid/spline.h b/plugins/sid/sidplay-libs/resid/spline.h
index a4871a3c..a4871a3c 100644
--- a/sid/sidplay-libs-2.1.0/resid/spline.h
+++ b/plugins/sid/sidplay-libs/resid/spline.h
diff --git a/sid/sidplay-libs-2.1.0/resid/version.cc b/plugins/sid/sidplay-libs/resid/version.cc
index ebb0e607..ebb0e607 100644
--- a/sid/sidplay-libs-2.1.0/resid/version.cc
+++ b/plugins/sid/sidplay-libs/resid/version.cc
diff --git a/sid/sidplay-libs-2.1.0/resid/voice.cc b/plugins/sid/sidplay-libs/resid/voice.cc
index 049e0530..049e0530 100644
--- a/sid/sidplay-libs-2.1.0/resid/voice.cc
+++ b/plugins/sid/sidplay-libs/resid/voice.cc
diff --git a/sid/sidplay-libs-2.1.0/resid/voice.h b/plugins/sid/sidplay-libs/resid/voice.h
index 77f8b443..77f8b443 100644
--- a/sid/sidplay-libs-2.1.0/resid/voice.h
+++ b/plugins/sid/sidplay-libs/resid/voice.h
diff --git a/sid/sidplay-libs-2.1.0/resid/wave.cc b/plugins/sid/sidplay-libs/resid/wave.cc
index 6f5ec5dd..6f5ec5dd 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave.cc
+++ b/plugins/sid/sidplay-libs/resid/wave.cc
diff --git a/sid/sidplay-libs-2.1.0/resid/wave.h b/plugins/sid/sidplay-libs/resid/wave.h
index 6d4f90ed..6d4f90ed 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave.h
+++ b/plugins/sid/sidplay-libs/resid/wave.h
diff --git a/sid/sidplay-libs-2.1.0/resid/wave6581_PST.cc b/plugins/sid/sidplay-libs/resid/wave6581_PST.cc
index 37b54734..37b54734 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave6581_PST.cc
+++ b/plugins/sid/sidplay-libs/resid/wave6581_PST.cc
diff --git a/sid/sidplay-libs-2.1.0/resid/wave6581_PST.dat b/plugins/sid/sidplay-libs/resid/wave6581_PST.dat
index 5afe75e2..5afe75e2 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave6581_PST.dat
+++ b/plugins/sid/sidplay-libs/resid/wave6581_PST.dat
Binary files differ
diff --git a/sid/sidplay-libs-2.1.0/resid/wave6581_PS_.cc b/plugins/sid/sidplay-libs/resid/wave6581_PS_.cc
index 9304df8c..9304df8c 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave6581_PS_.cc
+++ b/plugins/sid/sidplay-libs/resid/wave6581_PS_.cc
diff --git a/sid/sidplay-libs-2.1.0/resid/wave6581_PS_.dat b/plugins/sid/sidplay-libs/resid/wave6581_PS_.dat
index ea2fb9c5..ea2fb9c5 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave6581_PS_.dat
+++ b/plugins/sid/sidplay-libs/resid/wave6581_PS_.dat
Binary files differ
diff --git a/sid/sidplay-libs-2.1.0/resid/wave6581_P_T.cc b/plugins/sid/sidplay-libs/resid/wave6581_P_T.cc
index 35a246af..35a246af 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave6581_P_T.cc
+++ b/plugins/sid/sidplay-libs/resid/wave6581_P_T.cc
diff --git a/sid/sidplay-libs-2.1.0/resid/wave6581_P_T.dat b/plugins/sid/sidplay-libs/resid/wave6581_P_T.dat
index 1cc8874d..1cc8874d 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave6581_P_T.dat
+++ b/plugins/sid/sidplay-libs/resid/wave6581_P_T.dat
Binary files differ
diff --git a/sid/sidplay-libs-2.1.0/resid/wave6581__ST.cc b/plugins/sid/sidplay-libs/resid/wave6581__ST.cc
index 55ec36b7..55ec36b7 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave6581__ST.cc
+++ b/plugins/sid/sidplay-libs/resid/wave6581__ST.cc
diff --git a/sid/sidplay-libs-2.1.0/resid/wave6581__ST.dat b/plugins/sid/sidplay-libs/resid/wave6581__ST.dat
index 2e5d9872..2e5d9872 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave6581__ST.dat
+++ b/plugins/sid/sidplay-libs/resid/wave6581__ST.dat
Binary files differ
diff --git a/sid/sidplay-libs-2.1.0/resid/wave8580_PST.cc b/plugins/sid/sidplay-libs/resid/wave8580_PST.cc
index 5141f0f7..5141f0f7 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave8580_PST.cc
+++ b/plugins/sid/sidplay-libs/resid/wave8580_PST.cc
diff --git a/sid/sidplay-libs-2.1.0/resid/wave8580_PST.dat b/plugins/sid/sidplay-libs/resid/wave8580_PST.dat
index 22706cf2..22706cf2 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave8580_PST.dat
+++ b/plugins/sid/sidplay-libs/resid/wave8580_PST.dat
Binary files differ
diff --git a/sid/sidplay-libs-2.1.0/resid/wave8580_PS_.cc b/plugins/sid/sidplay-libs/resid/wave8580_PS_.cc
index 15de9f9a..15de9f9a 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave8580_PS_.cc
+++ b/plugins/sid/sidplay-libs/resid/wave8580_PS_.cc
diff --git a/sid/sidplay-libs-2.1.0/resid/wave8580_PS_.dat b/plugins/sid/sidplay-libs/resid/wave8580_PS_.dat
index 9a20a9ee..9a20a9ee 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave8580_PS_.dat
+++ b/plugins/sid/sidplay-libs/resid/wave8580_PS_.dat
Binary files differ
diff --git a/sid/sidplay-libs-2.1.0/resid/wave8580_P_T.cc b/plugins/sid/sidplay-libs/resid/wave8580_P_T.cc
index f3a3d835..f3a3d835 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave8580_P_T.cc
+++ b/plugins/sid/sidplay-libs/resid/wave8580_P_T.cc
diff --git a/sid/sidplay-libs-2.1.0/resid/wave8580_P_T.dat b/plugins/sid/sidplay-libs/resid/wave8580_P_T.dat
index 5423dd9a..5423dd9a 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave8580_P_T.dat
+++ b/plugins/sid/sidplay-libs/resid/wave8580_P_T.dat
Binary files differ
diff --git a/sid/sidplay-libs-2.1.0/resid/wave8580__ST.cc b/plugins/sid/sidplay-libs/resid/wave8580__ST.cc
index 08e7c5a8..08e7c5a8 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave8580__ST.cc
+++ b/plugins/sid/sidplay-libs/resid/wave8580__ST.cc
diff --git a/sid/sidplay-libs-2.1.0/resid/wave8580__ST.dat b/plugins/sid/sidplay-libs/resid/wave8580__ST.dat
index f30002ce..f30002ce 100644
--- a/sid/sidplay-libs-2.1.0/resid/wave8580__ST.dat
+++ b/plugins/sid/sidplay-libs/resid/wave8580__ST.dat
Binary files differ
diff --git a/sid/sidplay-libs-2.1.0/unix/config.guess b/plugins/sid/sidplay-libs/unix/config.guess
index f1657bbc..f1657bbc 100755
--- a/sid/sidplay-libs-2.1.0/unix/config.guess
+++ b/plugins/sid/sidplay-libs/unix/config.guess
diff --git a/sid/sidplay-libs-2.1.0/unix/config.h b/plugins/sid/sidplay-libs/unix/config.h
index ee1de9e8..ee1de9e8 100644
--- a/sid/sidplay-libs-2.1.0/unix/config.h
+++ b/plugins/sid/sidplay-libs/unix/config.h
diff --git a/sid/sidplay-libs-2.1.0/unix/config.sub b/plugins/sid/sidplay-libs/unix/config.sub
index 1dea9b79..1dea9b79 100755
--- a/sid/sidplay-libs-2.1.0/unix/config.sub
+++ b/plugins/sid/sidplay-libs/unix/config.sub
diff --git a/sid/sidplay-libs-2.1.0/unix/depcomp b/plugins/sid/sidplay-libs/unix/depcomp
index 807b991f..807b991f 100755
--- a/sid/sidplay-libs-2.1.0/unix/depcomp
+++ b/plugins/sid/sidplay-libs/unix/depcomp
diff --git a/sid/sidplay-libs-2.1.0/unix/install-sh b/plugins/sid/sidplay-libs/unix/install-sh
index 11870f1b..11870f1b 100755
--- a/sid/sidplay-libs-2.1.0/unix/install-sh
+++ b/plugins/sid/sidplay-libs/unix/install-sh
diff --git a/sid/sidplay-libs-2.1.0/unix/ltmain.sh b/plugins/sid/sidplay-libs/unix/ltmain.sh
index c4538260..c4538260 100755
--- a/sid/sidplay-libs-2.1.0/unix/ltmain.sh
+++ b/plugins/sid/sidplay-libs/unix/ltmain.sh
diff --git a/sid/sidplay-libs-2.1.0/unix/missing b/plugins/sid/sidplay-libs/unix/missing
index 6a37006e..6a37006e 100755
--- a/sid/sidplay-libs-2.1.0/unix/missing
+++ b/plugins/sid/sidplay-libs/unix/missing
diff --git a/sid/sidplay-libs-2.1.0/unix/mkinstalldirs b/plugins/sid/sidplay-libs/unix/mkinstalldirs
index e6826388..e6826388 100755
--- a/sid/sidplay-libs-2.1.0/unix/mkinstalldirs
+++ b/plugins/sid/sidplay-libs/unix/mkinstalldirs
diff --git a/plugins/sndfile/sndfile.c b/plugins/sndfile/sndfile.c
index 2b33d8ce..d44b8e16 100644
--- a/plugins/sndfile/sndfile.c
+++ b/plugins/sndfile/sndfile.c
@@ -33,27 +33,25 @@ static DB_decoder_t plugin;
static DB_functions_t *deadbeef;
typedef struct {
+ DB_fileinfo_t info;
SNDFILE *ctx;
DB_FILE *file;
int startsample;
int endsample;
int currentsample;
int bitrate;
-} sndfilectx_t;
-
-static sndfilectx_t sfctx;
-
+} sndfile_info_t;
// vfs wrapper for sf
static sf_count_t
sf_vfs_get_filelen (void *user_data) {
- sndfilectx_t *ctx = user_data;
+ sndfile_info_t *ctx = user_data;
return deadbeef->fgetlength (ctx->file);
}
static sf_count_t
sf_vfs_read (void *ptr, sf_count_t count, void *user_data) {
- sndfilectx_t *ctx = user_data;
+ sndfile_info_t *ctx = user_data;
return deadbeef->fread (ptr, 1, count, ctx->file);
}
@@ -64,7 +62,7 @@ sf_vfs_write (const void *ptr, sf_count_t count, void *user_data) {
static sf_count_t
sf_vfs_seek (sf_count_t offset, int whence, void *user_data) {
- sndfilectx_t *ctx = user_data;
+ sndfile_info_t *ctx = user_data;
int ret = deadbeef->fseek (ctx->file, offset, whence);
if (!ret) {
return offset;
@@ -74,7 +72,7 @@ sf_vfs_seek (sf_count_t offset, int whence, void *user_data) {
static sf_count_t
sf_vfs_tell (void *user_data) {
- sndfilectx_t *ctx = user_data;
+ sndfile_info_t *ctx = user_data;
return deadbeef->ftell (ctx->file);
}
@@ -86,137 +84,149 @@ static SF_VIRTUAL_IO vfs = {
.tell = sf_vfs_tell
};
-static int
+static DB_fileinfo_t *
sndfile_init (DB_playItem_t *it) {
- memset (&sfctx, 0, sizeof (sfctx));
+ DB_fileinfo_t *_info = malloc (sizeof (sndfile_info_t));
+ sndfile_info_t *info = (sndfile_info_t*)_info;
+ memset (info, 0, sizeof (sndfile_info_t));
+
SF_INFO inf;
DB_FILE *fp = deadbeef->fopen (it->fname);
if (!fp) {
trace ("sndfile: failed to open %s\n", it->fname);
- return -1;
+ plugin.free (_info);
+ return NULL;
}
int fsize = deadbeef->fgetlength (fp);
- sfctx.file = fp;
- sfctx.ctx = sf_open_virtual (&vfs, SFM_READ, &inf, &sfctx);
- if (!sfctx.ctx) {
- return -1;
+ info->file = fp;
+ info->ctx = sf_open_virtual (&vfs, SFM_READ, &inf, info);
+ if (!info->ctx) {
+ trace ("sndfile: %s: unsupported file format\n");
+ plugin.free (_info);
+ return NULL;
}
- plugin.info.bps = 16;
- plugin.info.channels = inf.channels;
- plugin.info.samplerate = inf.samplerate;
- plugin.info.readpos = 0;
+ _info->plugin = &plugin;
+ _info->bps = 16;
+ _info->channels = inf.channels;
+ _info->samplerate = inf.samplerate;
+ _info->readpos = 0;
if (it->endsample > 0) {
- sfctx.startsample = it->startsample;
- sfctx.endsample = it->endsample;
- if (plugin.seek_sample (0) < 0) {
- plugin.free ();
- return -1;
+ info->startsample = it->startsample;
+ info->endsample = it->endsample;
+ if (plugin.seek_sample (_info, 0) < 0) {
+ plugin.free (_info);
+ return NULL;
}
}
else {
- sfctx.startsample = 0;
- sfctx.endsample = inf.frames-1;
+ info->startsample = 0;
+ info->endsample = inf.frames-1;
}
// hack bitrate
- float sec = (float)(sfctx.endsample-sfctx.startsample) / inf.samplerate;
+ float sec = (float)(info->endsample-info->startsample) / inf.samplerate;
if (sec > 0) {
- sfctx.bitrate = fsize / sec * 8 / 1000;
+ info->bitrate = fsize / sec * 8 / 1000;
}
else {
- sfctx.bitrate = -1;
+ info->bitrate = -1;
}
- return 0;
+ return _info;
}
static void
-sndfile_free (void) {
- if (sfctx.ctx) {
- sf_close (sfctx.ctx);
+sndfile_free (DB_fileinfo_t *_info) {
+ sndfile_info_t *info = (sndfile_info_t*)_info;
+ if (info->ctx) {
+ sf_close (info->ctx);
}
- if (sfctx.file) {
- deadbeef->fclose (sfctx.file);
+ if (info->file) {
+ deadbeef->fclose (info->file);
}
- memset (&sfctx, 0, sizeof (sfctx));
+ memset (&info, 0, sizeof (info));
}
static int
-sndfile_read_int16 (char *bytes, int size) {
- if (size / (2 * plugin.info.channels) + sfctx.currentsample > sfctx.endsample) {
- size = (sfctx.endsample - sfctx.currentsample + 1) * 2 * plugin.info.channels;
- trace ("wv: size truncated to %d bytes, cursample=%d, endsample=%d\n", size, sfctx.currentsample, sfctx.endsample);
+sndfile_read_int16 (DB_fileinfo_t *_info, char *bytes, int size) {
+ sndfile_info_t *info = (sndfile_info_t*)_info;
+ if (size / (2 * _info->channels) + info->currentsample > info->endsample) {
+ size = (info->endsample - info->currentsample + 1) * 2 * _info->channels;
+ trace ("wv: size truncated to %d bytes, cursample=%d, endsample=%d\n", size, info->currentsample, info->endsample);
if (size <= 0) {
return 0;
}
}
- int n = sf_readf_short (sfctx.ctx, (short *)bytes, size/(2*plugin.info.channels));
- sfctx.currentsample += n;
- size = n * 2 * plugin.info.channels;
- plugin.info.readpos = (float)(sfctx.currentsample-sfctx.startsample)/plugin.info.samplerate;
- if (sfctx.bitrate > 0) {
- deadbeef->streamer_set_bitrate (sfctx.bitrate);
+ int n = sf_readf_short (info->ctx, (short *)bytes, size/(2*_info->channels));
+ info->currentsample += n;
+ size = n * 2 * _info->channels;
+ _info->readpos = (float)(info->currentsample-info->startsample)/_info->samplerate;
+ if (info->bitrate > 0) {
+ deadbeef->streamer_set_bitrate (info->bitrate);
}
return size;
}
static int
-sndfile_read_float32 (char *bytes, int size) {
- if (size / (4 * plugin.info.channels) + sfctx.currentsample > sfctx.endsample) {
- size = (sfctx.endsample - sfctx.currentsample + 1) * 4 * plugin.info.channels;
- trace ("wv: size truncated to %d bytes, cursample=%d, endsample=%d\n", size, sfctx.currentsample, sfctx.endsample);
+sndfile_read_float32 (DB_fileinfo_t *_info, char *bytes, int size) {
+ sndfile_info_t *info = (sndfile_info_t*)_info;
+ if (size / (4 * _info->channels) + info->currentsample > info->endsample) {
+ size = (info->endsample - info->currentsample + 1) * 4 * _info->channels;
+ trace ("wv: size truncated to %d bytes, cursample=%d, endsample=%d\n", size, info->currentsample, info->endsample);
if (size <= 0) {
return 0;
}
}
- int n = sf_readf_float (sfctx.ctx, (float *)bytes, size/(4*plugin.info.channels));
- sfctx.currentsample += n;
- size = n * 4 * plugin.info.channels;
- plugin.info.readpos = (float)(sfctx.currentsample-sfctx.startsample)/plugin.info.samplerate;
- if (sfctx.bitrate > 0) {
- deadbeef->streamer_set_bitrate (sfctx.bitrate);
+ int n = sf_readf_float (info->ctx, (float *)bytes, size/(4*_info->channels));
+ info->currentsample += n;
+ size = n * 4 * _info->channels;
+ _info->readpos = (float)(info->currentsample-info->startsample)/_info->samplerate;
+ if (info->bitrate > 0) {
+ deadbeef->streamer_set_bitrate (info->bitrate);
}
return size;
}
static int
-sndfile_seek_sample (int sample) {
- int ret = sf_seek (sfctx.ctx, sample + sfctx.startsample, SEEK_SET);
+sndfile_seek_sample (DB_fileinfo_t *_info, int sample) {
+ sndfile_info_t *info = (sndfile_info_t*)_info;
+ int ret = sf_seek (info->ctx, sample + info->startsample, SEEK_SET);
if (ret < 0) {
return -1;
}
- sfctx.currentsample = ret;
- plugin.info.readpos = (float)(sfctx.currentsample - sfctx.startsample) / plugin.info.samplerate;
+ info->currentsample = ret;
+ _info->readpos = (float)(info->currentsample - info->startsample) / _info->samplerate;
return 0;
}
static int
-sndfile_seek (float sec) {
- return sndfile_seek_sample (sec * plugin.info.samplerate);
+sndfile_seek (DB_fileinfo_t *_info, float sec) {
+ return sndfile_seek_sample (_info, sec * _info->samplerate);
}
static DB_playItem_t *
sndfile_insert (DB_playItem_t *after, const char *fname) {
SF_INFO inf;
- sndfilectx_t sfctx;
- sfctx.file = deadbeef->fopen (fname);
- if (!sfctx.file) {
+ sndfile_info_t info;
+ memset (&info, 0, sizeof (info));
+ info.file = deadbeef->fopen (fname);
+ if (!info.file) {
trace ("sndfile: failed to open %s\n", fname);
return NULL;
}
- sfctx.ctx = sf_open_virtual (&vfs, SFM_READ, &inf, &sfctx);
- if (!sfctx.ctx) {
+ info.ctx = sf_open_virtual (&vfs, SFM_READ, &inf, &info);
+ if (!info.ctx) {
trace ("sndfile: sf_open failed");
return NULL;
}
int totalsamples = inf.frames;
int samplerate = inf.samplerate;
- sf_close (sfctx.ctx);
- deadbeef->fclose (sfctx.file);
+ sf_close (info.ctx);
+ deadbeef->fclose (info.file);
float duration = (float)totalsamples / samplerate;
DB_playItem_t *it = deadbeef->pl_item_alloc ();
- it->decoder = &plugin;
+ it->decoder_id = deadbeef->plug_get_decoder_id (plugin.plugin.id);
it->fname = strdup (fname);
it->filetype = "wav";
deadbeef->pl_set_item_duration (it, duration);
@@ -243,6 +253,7 @@ static DB_decoder_t plugin = {
.plugin.version_major = 0,
.plugin.version_minor = 1,
.plugin.type = DB_PLUGIN_DECODER,
+ .plugin.id = "sndfile",
.plugin.name = "pcm player",
.plugin.descr = "wav/aiff player using libsndfile",
.plugin.author = "Alexey Yakovenko",
@@ -256,7 +267,6 @@ static DB_decoder_t plugin = {
.seek_sample = sndfile_seek_sample,
.insert = sndfile_insert,
.exts = exts,
- .id = "sndfile",
.filetypes = filetypes
};
diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c
index 8ac17540..96b25933 100644
--- a/plugins/vorbis/vorbis.c
+++ b/plugins/vorbis/vorbis.c
@@ -34,18 +34,18 @@
static DB_decoder_t plugin;
static DB_functions_t *deadbeef;
-static DB_FILE *file;
-static OggVorbis_File vorbis_file;
-static vorbis_info *vi;
-static int cur_bit_stream;
-static int startsample;
-static int endsample;
-static int currentsample;
-static int last_comment_update;
-static DB_playItem_t *ptrack;
-
-static void
-cvorbis_free (void);
+typedef struct {
+ DB_fileinfo_t info;
+ DB_FILE *file;
+ OggVorbis_File vorbis_file;
+ vorbis_info *vi;
+ int cur_bit_stream;
+ int startsample;
+ int endsample;
+ int currentsample;
+ int last_comment_update;
+ DB_playItem_t *ptrack;
+} ogg_info_t;
static size_t
cvorbis_fread (void *ptr, size_t size, size_t nmemb, void *datasource) {
@@ -121,21 +121,25 @@ update_vorbis_comments (DB_playItem_t *it, vorbis_comment *vc) {
deadbeef->pl_add_meta (it, "title", NULL);
}
-static int
+static DB_fileinfo_t *
cvorbis_init (DB_playItem_t *it) {
- file = NULL;
- vi = NULL;
- cur_bit_stream = -1;
- ptrack = it;
-
- file = deadbeef->fopen (it->fname);
- if (!file) {
- return -1;
+ DB_fileinfo_t *_info = malloc (sizeof (ogg_info_t));
+ ogg_info_t *info = (ogg_info_t *)_info;
+ memset (info, 0, sizeof (ogg_info_t));
+ info->file = NULL;
+ info->vi = NULL;
+ info->cur_bit_stream = -1;
+ info->ptrack = it;
+ deadbeef->pl_item_ref (it);
+
+ info->file = deadbeef->fopen (it->fname);
+ if (!info->file) {
+ trace ("ogg: failed to open file %s\n", it->fname);
+ plugin.free (_info);
+ return NULL;
}
- memset (&plugin.info, 0, sizeof (plugin.info));
-
- int ln = deadbeef->fgetlength (file);
- if (file->vfs->streaming && ln == -1) {
+ int ln = deadbeef->fgetlength (info->file);
+ if (info->file->vfs->streaming && ln == -1) {
ov_callbacks ovcb = {
.read_func = cvorbis_fread,
.seek_func = NULL,
@@ -144,11 +148,11 @@ cvorbis_init (DB_playItem_t *it) {
};
trace ("calling ov_open_callbacks\n");
- int err = ov_open_callbacks (file, &vorbis_file, NULL, 0, ovcb);
+ int err = ov_open_callbacks (info->file, &info->vorbis_file, NULL, 0, ovcb);
if (err != 0) {
trace ("ov_open_callbacks returned %d\n", err);
- plugin.free ();
- return -1;
+ plugin.free (_info);
+ return NULL;
}
deadbeef->pl_set_item_duration (it, -1);
}
@@ -162,90 +166,96 @@ cvorbis_init (DB_playItem_t *it) {
};
trace ("calling ov_open_callbacks\n");
- int err = ov_open_callbacks (file, &vorbis_file, NULL, 0, ovcb);
+ int err = ov_open_callbacks (info->file, &info->vorbis_file, NULL, 0, ovcb);
if (err != 0) {
trace ("ov_open_callbacks returned %d\n", err);
- plugin.free ();
- return -1;
+ plugin.free (_info);
+ return NULL;
}
// deadbeef->pl_set_item_duration (it, ov_time_total (&vorbis_file, -1));
}
- vi = ov_info (&vorbis_file, -1);
- if (!vi) { // not a vorbis stream
- cvorbis_free ();
+ info->vi = ov_info (&info->vorbis_file, -1);
+ if (!info->vi) { // not a vorbis stream
trace ("not a vorbis stream\n");
- return -1;
+ plugin.free (_info);
+ return NULL;
}
- if (vi->rate <= 0) {
- cvorbis_free ();
+ if (info->vi->rate <= 0) {
trace ("vorbis: bad samplerate\n");
- return -1;
+ plugin.free (_info);
+ return NULL;
}
- plugin.info.bps = 16;
- //plugin.info.dataSize = ov_pcm_total (&vorbis_file, -1) * vi->channels * 2;
- plugin.info.channels = vi->channels;
- plugin.info.samplerate = vi->rate;
- plugin.info.readpos = 0;
- currentsample = 0;
- if (!file->vfs->streaming) {
+ _info->plugin = &plugin;
+ _info->bps = 16;
+ //_info->dataSize = ov_pcm_total (&vorbis_file, -1) * vi->channels * 2;
+ _info->channels = info->vi->channels;
+ _info->samplerate = info->vi->rate;
+ _info->readpos = 0;
+ info->currentsample = 0;
+ if (!info->file->vfs->streaming) {
if (it->endsample > 0) {
- startsample = it->startsample;
- endsample = it->endsample;
- plugin.seek_sample (0);
+ info->startsample = it->startsample;
+ info->endsample = it->endsample;
+ plugin.seek_sample (_info, 0);
}
else {
- startsample = 0;
- endsample = ov_pcm_total (&vorbis_file, -1)-1;
+ info->startsample = 0;
+ info->endsample = ov_pcm_total (&info->vorbis_file, -1)-1;
}
}
else {
- startsample = 0;
+ info->startsample = 0;
if (deadbeef->pl_get_item_duration (it) < 0) {
- endsample = -1;
+ info->endsample = -1;
}
else {
- endsample = ov_pcm_total (&vorbis_file, -1)-1;
+ info->endsample = ov_pcm_total (&info->vorbis_file, -1)-1;
}
- vorbis_comment *vc = ov_comment (&vorbis_file, -1);
+ vorbis_comment *vc = ov_comment (&info->vorbis_file, -1);
update_vorbis_comments (it, vc);
}
- return 0;
+ return _info;
}
static void
-cvorbis_free (void) {
- if (file) {
- ptrack = NULL;
- ov_clear (&vorbis_file);
- //fclose (file); //-- ov_clear closes it
- file = NULL;
- vi = NULL;
+cvorbis_free (DB_fileinfo_t *_info) {
+ ogg_info_t *info = (ogg_info_t *)_info;
+ if (info) {
+ if (info->file) {
+ if (info->ptrack) {
+ deadbeef->pl_item_unref (info->ptrack);
+ }
+ ov_clear (&info->vorbis_file);
+ //fclose (file); //-- ov_clear closes it
+ }
+ free (info);
}
}
static int
-cvorbis_read (char *bytes, int size) {
+cvorbis_read (DB_fileinfo_t *_info, char *bytes, int size) {
+ ogg_info_t *info = (ogg_info_t *)_info;
// trace ("cvorbis_read %d bytes\n", size);
- if (!file->vfs->streaming) {
- if (currentsample + size / (2 * plugin.info.channels) > endsample) {
- size = (endsample - currentsample + 1) * 2 * plugin.info.channels;
- trace ("size truncated to %d bytes, cursample=%d, endsample=%d, totalsamples=%d\n", size, currentsample, endsample, ov_pcm_total (&vorbis_file, -1));
+ if (!info->file->vfs->streaming) {
+ if (info->currentsample + size / (2 * _info->channels) > info->endsample) {
+ size = (info->endsample - info->currentsample + 1) * 2 * _info->channels;
+ trace ("size truncated to %d bytes, cursample=%d, info->endsample=%d, totalsamples=%d\n", size, info->currentsample, info->endsample, ov_pcm_total (&vorbis_file, -1));
if (size <= 0) {
return 0;
}
}
}
else {
- if (ptrack && currentsample - last_comment_update > 5 * plugin.info.samplerate) {
- int idx = deadbeef->pl_get_idx_of (ptrack);
+ if (info->ptrack && info->currentsample - info->last_comment_update > 5 * _info->samplerate) {
+ int idx = deadbeef->pl_get_idx_of (info->ptrack);
if (idx >= 0) {
- last_comment_update = currentsample;
- vorbis_comment *vc = ov_comment (&vorbis_file, -1);
- update_vorbis_comments (ptrack, vc);
+ info->last_comment_update = info->currentsample;
+ vorbis_comment *vc = ov_comment (&info->vorbis_file, -1);
+ update_vorbis_comments (info->ptrack, vc);
deadbeef->sendmessage (M_TRACKCHANGED, 0, idx, 0);
}
else {
- ptrack = NULL;
+ info->ptrack = NULL;
}
}
}
@@ -259,7 +269,7 @@ cvorbis_read (char *bytes, int size) {
#if WORDS_BIGENDIAN
endianess = 1;
#endif
- ret=ov_read (&vorbis_file, bytes, size, endianess, 2, 1, &cur_bit_stream);
+ ret=ov_read (&info->vorbis_file, bytes, size, endianess, 2, 1, &info->cur_bit_stream);
if (ret <= 0)
{
if (ret < 0) {
@@ -284,52 +294,54 @@ cvorbis_read (char *bytes, int size) {
}
else if (ret < size)
{
- currentsample += ret / (vi->channels * 2);
+ info->currentsample += ret / (info->vi->channels * 2);
size -= ret;
bytes += ret;
}
else {
- currentsample += ret / (vi->channels * 2);
+ info->currentsample += ret / (info->vi->channels * 2);
size = 0;
break;
}
}
- plugin.info.readpos = (float)(ov_pcm_tell(&vorbis_file)-startsample)/vi->rate;
- trace ("cvorbis_read got %d bytes, readpos %f, currentsample %d, ret %d\n", initsize-size, plugin.info.readpos, currentsample, ret);
- deadbeef->streamer_set_bitrate (ov_bitrate_instant (&vorbis_file)/1000);
+ _info->readpos = (float)(ov_pcm_tell(&info->vorbis_file)-info->startsample)/info->vi->rate;
+ trace ("cvorbis_read got %d bytes, readpos %f, info->currentsample %d, ret %d\n", initsize-size, _info->readpos, info->currentsample, ret);
+ deadbeef->streamer_set_bitrate (ov_bitrate_instant (&info->vorbis_file)/1000);
return initsize - size;
}
static int
-cvorbis_seek_sample (int sample) {
+cvorbis_seek_sample (DB_fileinfo_t *_info, int sample) {
+ ogg_info_t *info = (ogg_info_t *)_info;
if (sample < 0) {
trace ("vorbis: negative seek sample - ignored, but it is a bug!\n");
return -1;
}
- if (!file) {
+ if (!info->file) {
trace ("vorbis: file is NULL on seek\n");
return -1;
}
trace ("vorbis: seek to sample %d\n");
- sample += startsample;
- int res = ov_pcm_seek (&vorbis_file, sample);
+ sample += info->startsample;
+ int res = ov_pcm_seek (&info->vorbis_file, sample);
if (res != 0 && res != OV_ENOSEEK) {
trace ("vorbis: error %x seeking to sample %d\n", sample);
return -1;
}
- int tell = ov_pcm_tell (&vorbis_file);
+ int tell = ov_pcm_tell (&info->vorbis_file);
if (tell != sample) {
trace ("oggvorbis: failed to do sample-accurate seek (%d->%d)\n", sample, tell);
}
trace ("vorbis: seek successful\n")
- currentsample = sample;
- plugin.info.readpos = (float)(ov_pcm_tell(&vorbis_file) - startsample)/vi->rate;
+ info->currentsample = sample;
+ _info->readpos = (float)(ov_pcm_tell(&info->vorbis_file) - info->startsample)/info->vi->rate;
return 0;
}
static int
-cvorbis_seek (float time) {
- return cvorbis_seek_sample (time * vi->rate);
+cvorbis_seek (DB_fileinfo_t *_info, float time) {
+ ogg_info_t *info = (ogg_info_t *)_info;
+ return cvorbis_seek_sample (_info, time * info->vi->rate);
}
static DB_playItem_t *
@@ -342,7 +354,6 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) {
}
if (fp->vfs->streaming) {
DB_playItem_t *it = deadbeef->pl_item_alloc ();
- it->decoder = &plugin;
it->fname = strdup (fname);
it->filetype = "OggVorbis";
deadbeef->pl_set_item_duration (it, -1);
@@ -372,7 +383,7 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) {
int totalsamples = ov_pcm_total (&vorbis_file, -1);
DB_playItem_t *it = deadbeef->pl_item_alloc ();
- it->decoder = &plugin;
+ it->decoder_id = deadbeef->plug_get_decoder_id (plugin.plugin.id);
it->fname = strdup (fname);
it->filetype = "OggVorbis";
deadbeef->pl_set_item_duration (it, duration);
@@ -385,7 +396,7 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) {
DB_playItem_t *cue = deadbeef->pl_insert_cue (after, it, totalsamples, samplerate);
if (cue) {
- deadbeef->pl_item_free (it);
+ deadbeef->pl_item_unref (it);
return cue;
}
@@ -394,7 +405,7 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) {
if (cuesheet) {
cue = deadbeef->pl_insert_cue_from_buffer (after, it, cuesheet, strlen (cuesheet), totalsamples, samplerate);
if (cue) {
- deadbeef->pl_item_free (it);
+ deadbeef->pl_item_unref (it);
return cue;
}
}
@@ -403,23 +414,25 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) {
return after;
}
-static int
-vorbis_trackdeleted (DB_event_track_t *ev, uintptr_t data) {
- if (ev->track == ptrack) {
- ptrack = NULL;
- }
- return 0;
-}
+// that won't be needed with refcounting
+
+//static int
+//vorbis_trackdeleted (DB_event_track_t *ev, uintptr_t data) {
+// if (ev->track == info->ptrack) {
+// info->ptrack = NULL;
+// }
+// return 0;
+//}
static int
vorbis_start (void) {
- deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_TRACKDELETED, DB_CALLBACK (vorbis_trackdeleted), 0);
+// deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_TRACKDELETED, DB_CALLBACK (vorbis_trackdeleted), 0);
return 0;
}
static int
vorbis_stop (void) {
- deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_TRACKDELETED, DB_CALLBACK (vorbis_trackdeleted), 0);
+// deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_TRACKDELETED, DB_CALLBACK (vorbis_trackdeleted), 0);
return 0;
}
@@ -432,6 +445,7 @@ static DB_decoder_t plugin = {
.plugin.version_major = 0,
.plugin.version_minor = 1,
.plugin.type = DB_PLUGIN_DECODER,
+ .plugin.id = "stdogg",
.plugin.name = "OggVorbis decoder",
.plugin.descr = "OggVorbis decoder using standard xiph.org libraries",
.plugin.author = "Alexey Yakovenko",
@@ -448,7 +462,6 @@ static DB_decoder_t plugin = {
.seek_sample = cvorbis_seek_sample,
.insert = cvorbis_insert,
.exts = exts,
- .id = "stdogg",
.filetypes = filetypes
};
diff --git a/plugins/vtx/vtx.c b/plugins/vtx/vtx.c
index cbf63e61..8d0291f2 100644
--- a/plugins/vtx/vtx.c
+++ b/plugins/vtx/vtx.c
@@ -33,22 +33,26 @@ static DB_functions_t *deadbeef;
static const char * exts[] = { "vtx", NULL };
static const char *filetypes[] = { "VTX", NULL };
-static ayemu_vtx_t *decoder;
-static ayemu_ay_t ay;
-
#define AY_FRAME_SIZE 14
-static char regs[AY_FRAME_SIZE];
-static int vtx_pos;
-static int left;
-static int rate;
-static int currentsample;
-static int16_t soundbuffer[];
-
-static int
+typedef struct {
+ DB_fileinfo_t info;
+ ayemu_vtx_t *decoder;
+ ayemu_ay_t ay;
+ char regs[AY_FRAME_SIZE];
+ int vtx_pos;
+ int left;
+ int rate;
+ int currentsample;
+} vtx_info_t;
+
+static DB_fileinfo_t *
vtx_init (DB_playItem_t *it) {
// prepare to decode the track
// return -1 on failure
+ DB_fileinfo_t *_info = malloc (sizeof (vtx_info_t));
+ vtx_info_t *info = (vtx_info_t *)_info;
+ memset (info, 0, sizeof (vtx_info_t));
size_t sz = 0;
char *buf = NULL;
@@ -56,64 +60,73 @@ vtx_init (DB_playItem_t *it) {
DB_FILE *fp = deadbeef->fopen (it->fname);
if (!fp) {
trace ("vtx: failed to open file %s\n", it->fname);
- return -1;
+ plugin.free (_info);
+ return NULL;
}
sz = deadbeef->fgetlength (fp);
if (sz <= 0) {
trace ("vtx: bad file size\n");
- return -1;
+ plugin.free (_info);
+ return NULL;
}
buf = malloc (sz);
if (!buf) {
trace ("vtx: out of memory\n");
- return -1;
+ plugin.free (_info);
+ return NULL;
}
if (deadbeef->fread (buf, 1, sz, fp) != sz) {
trace ("vtx: read failed\n");
free (buf);
- return -1;
+ plugin.free (_info);
+ return NULL;
}
- decoder = ayemu_vtx_load (buf, sz);
- if (!decoder) {
+ info->decoder = ayemu_vtx_load (buf, sz);
+ if (!info->decoder) {
trace ("vtx: ayemu_vtx_load failed\n");
free (buf);
- return -1;
+ plugin.free (_info);
+ return NULL;
}
- trace ("vtx: data=%p, size=%d\n", decoder->regdata, decoder->regdata_size);
+ trace ("vtx: data=%p, size=%d\n", info->decoder->regdata, info->decoder->regdata_size);
free (buf);
- ayemu_init (&ay);
- ayemu_set_chip_type (&ay, decoder->chiptype, NULL);
- ayemu_set_chip_freq(&ay, decoder->chipFreq);
- ayemu_set_stereo (&ay, decoder->stereo, NULL);
+ ayemu_init (&info->ay);
+ ayemu_set_chip_type (&info->ay, info->decoder->chiptype, NULL);
+ ayemu_set_chip_freq (&info->ay, info->decoder->chipFreq);
+ ayemu_set_stereo (&info->ay, info->decoder->stereo, NULL);
- int samplerate = deadbeef->get_output ()->samplerate ();
+ int samplerate = deadbeef->conf_get_int ("synth.samplerate", 48000);
- ayemu_set_sound_format (&ay, samplerate, deadbeef->get_output ()->channels (), deadbeef->get_output ()->bitspersample ());
+ ayemu_set_sound_format (&info->ay, samplerate, deadbeef->get_output ()->channels (), deadbeef->get_output ()->bitspersample ());
- left = 0;
- rate = deadbeef->get_output ()->channels () * deadbeef->get_output ()->bitspersample () / 8;
- vtx_pos = 0;
- memset (regs, 0, sizeof (regs));
- plugin.info.bps = deadbeef->get_output ()->bitspersample ();
- plugin.info.channels = deadbeef->get_output ()->channels ();
- plugin.info.samplerate = samplerate;
- plugin.info.readpos = 0;
- return 0;
+ info->left = 0;
+ info->rate = deadbeef->get_output ()->channels () * deadbeef->get_output ()->bitspersample () / 8;
+ info->vtx_pos = 0;
+ _info->plugin = &plugin;
+ _info->bps = deadbeef->get_output ()->bitspersample ();
+ _info->channels = deadbeef->get_output ()->channels ();
+ _info->samplerate = samplerate;
+ _info->readpos = 0;
+ return _info;
}
static void
-vtx_free (void) {
+vtx_free (DB_fileinfo_t *_info) {
// free everything allocated in _init
- if (decoder) {
- ayemu_vtx_free (decoder);
- decoder = NULL;
+ vtx_info_t *info = (vtx_info_t *)_info;
+ if (_info) {
+ if (info->decoder) {
+ ayemu_vtx_free (info->decoder);
+ info->decoder = NULL;
+ }
+ ayemu_reset (&info->ay);
+ free (_info);
}
- ayemu_reset (&ay);
}
/** Get next 14-bytes frame of AY register data.
@@ -121,93 +134,93 @@ vtx_free (void) {
* Return value: 1 on success, 0 on eof
*/
static int
-ayemu_vtx_get_next_frame (ayemu_vtx_t *vtx, char *regs)
+ayemu_vtx_get_next_frame (vtx_info_t *info)
{
- int numframes = vtx->regdata_size / AY_FRAME_SIZE;
- if (vtx_pos++ >= numframes) {
+ int numframes = info->decoder->regdata_size / AY_FRAME_SIZE;
+ if (info->vtx_pos++ >= numframes) {
return 0;
}
- else {
- int n;
- char *p = vtx->regdata + vtx_pos;
- for(n = 0 ; n < AY_FRAME_SIZE ; n++, p += numframes) {
- regs[n] = *p;
- }
- return 1;
+ int n;
+ char *p = info->decoder->regdata + info->vtx_pos;
+ for(n = 0 ; n < AY_FRAME_SIZE ; n++, p += numframes) {
+ info->regs[n] = *p;
}
+ return 1;
}
static int
-vtx_read_int16 (char *bytes, int size) {
+vtx_read_int16 (DB_fileinfo_t *_info, char *bytes, int size) {
// try decode `size' bytes
// return number of decoded bytes
// return 0 on EOF
+ vtx_info_t *info = (vtx_info_t *)_info;
int initsize = size;
int donow = 0;
while (size > 0) {
- if (left > 0) {
- donow = (size > left) ? left : size;
- left -= donow;
- bytes = ayemu_gen_sound (&ay, (char *)bytes, donow);
+ if (info->left > 0) {
+ donow = (size > info->left) ? info->left : size;
+ info->left -= donow;
+ bytes = ayemu_gen_sound (&info->ay, (char *)bytes, donow);
size -= donow;
}
else {
- if ((ayemu_vtx_get_next_frame (decoder, regs) == 0)) {
+ if ((ayemu_vtx_get_next_frame (info) == 0)) {
break; // eof
}
else {
// number of samples it current frame
- left = plugin.info.samplerate / decoder->playerFreq;
+ info->left = _info->samplerate / info->decoder->playerFreq;
// mul by rate to get number of bytes;
- left *= rate;
- ayemu_set_regs (&ay, regs);
+ info->left *= info->rate;
+ ayemu_set_regs (&info->ay, info->regs);
donow = 0;
}
}
}
- currentsample += (initsize - size) / 4;
- plugin.info.readpos = (float)currentsample / plugin.info.samplerate;
+ info->currentsample += (initsize - size) / 4;
+ _info->readpos = (float)info->currentsample / _info->samplerate;
return initsize - size;
}
static int
-vtx_seek_sample (int sample) {
+vtx_seek_sample (DB_fileinfo_t *_info, int sample) {
// seek to specified sample (frame)
// return 0 on success
// return -1 on failure
+ vtx_info_t *info = (vtx_info_t *)_info;
// get frame
- int num_frames = decoder->regdata_size / AY_FRAME_SIZE;
- int samples_per_frame = plugin.info.samplerate / decoder->playerFreq;
+ int num_frames = info->decoder->regdata_size / AY_FRAME_SIZE;
+ int samples_per_frame = _info->samplerate / info->decoder->playerFreq;
// start of frame
- vtx_pos = sample / samples_per_frame;
- if (vtx_pos >= num_frames) {
+ info->vtx_pos = sample / samples_per_frame;
+ if (info->vtx_pos >= num_frames) {
return -1; // eof
}
// copy register data
int n;
- char *p = decoder->regdata + vtx_pos;
+ char *p = info->decoder->regdata + info->vtx_pos;
for(n = 0 ; n < AY_FRAME_SIZE ; n++, p += num_frames) {
- regs[n] = *p;
+ info->regs[n] = *p;
}
// set number of bytes left in frame
- left = plugin.info.samplerate / decoder->playerFreq - (sample % samples_per_frame);
+ info->left = _info->samplerate / info->decoder->playerFreq - (sample % samples_per_frame);
// mul by rate to get number of bytes
- left *= rate;
- currentsample = sample;
- plugin.info.readpos = (float)currentsample / plugin.info.samplerate;
+ info->left *= info->rate;
+ info->currentsample = sample;
+ _info->readpos = (float)info->currentsample / _info->samplerate;
return 0;
}
static int
-vtx_seek (float time) {
+vtx_seek (DB_fileinfo_t *_info, float time) {
// seek to specified time in seconds
// return 0 on success
// return -1 on failure
- return vtx_seek_sample (time * plugin.info.samplerate);
+ return vtx_seek_sample (_info, time * _info->samplerate);
}
static DB_playItem_t *
@@ -242,7 +255,7 @@ vtx_insert (DB_playItem_t *after, const char *fname) {
DB_playItem_t *it = deadbeef->pl_item_alloc ();
- it->decoder = &plugin;
+ it->decoder_id = deadbeef->plug_get_decoder_id (plugin.plugin.id);
it->fname = strdup (fname);
it->filetype = filetypes[0];
@@ -282,6 +295,7 @@ static DB_decoder_t plugin = {
.plugin.version_major = 0,
.plugin.version_minor = 1,
.plugin.type = DB_PLUGIN_DECODER,
+ .plugin.id = "vtx",
.plugin.name = "VTX decoder",
.plugin.descr = "AY8910/12 chip emulator and vtx file player",
.plugin.author = "Alexey Yakovenko",
@@ -297,7 +311,6 @@ static DB_decoder_t plugin = {
.seek_sample = vtx_seek_sample,
.insert = vtx_insert,
.exts = exts,
- .id = "vtx",
.filetypes = filetypes
};
diff --git a/plugins/wavpack/wavpack.c b/plugins/wavpack/wavpack.c
index cb55d490..e8027786 100644
--- a/plugins/wavpack/wavpack.c
+++ b/plugins/wavpack/wavpack.c
@@ -20,6 +20,7 @@
#include <string.h>
#include <wavpack/wavpack.h>
#include <stdio.h>
+#include <stdlib.h>
#include "../../deadbeef.h"
#define min(x,y) ((x)<(y)?(x):(y))
@@ -32,14 +33,13 @@ static DB_decoder_t plugin;
static DB_functions_t *deadbeef;
typedef struct {
+ DB_fileinfo_t info;
DB_FILE *file;
WavpackContext *ctx;
int startsample;
int endsample;
} wvctx_t;
-static wvctx_t wvctx;
-
int32_t wv_read_bytes(void *id, void *data, int32_t bcount) {
trace ("wv_read_bytes\n");
return deadbeef->fread (data, 1, bcount, id);
@@ -91,120 +91,131 @@ static WavpackStreamReader wsr = {
.write_bytes = wv_write_bytes
};
-static int
+static DB_fileinfo_t *
wv_init (DB_playItem_t *it) {
- memset (&wvctx, 0, sizeof (wvctx));
+ DB_fileinfo_t *_info = malloc (sizeof (wvctx_t));
+ wvctx_t *info = (wvctx_t *)_info;
+ memset (info, 0, sizeof (wvctx_t));
- wvctx.file = deadbeef->fopen (it->fname);
- if (!wvctx.file) {
- return -1;
+ info->file = deadbeef->fopen (it->fname);
+ if (!info->file) {
+ plugin.free (_info);
+ return NULL;
}
- wvctx.ctx = WavpackOpenFileInputEx (&wsr, wvctx.file, NULL, NULL, OPEN_2CH_MAX/*|OPEN_WVC*/, 0);
- if (!wvctx.ctx) {
- plugin.free ();
- return -1;
+ info->ctx = WavpackOpenFileInputEx (&wsr, info->file, NULL, NULL, OPEN_2CH_MAX/*|OPEN_WVC*/, 0);
+ if (!info->ctx) {
+ plugin.free (_info);
+ return NULL;
}
- plugin.info.bps = WavpackGetBitsPerSample (wvctx.ctx);
- plugin.info.channels = WavpackGetNumChannels (wvctx.ctx);
- plugin.info.samplerate = WavpackGetSampleRate (wvctx.ctx);
- plugin.info.readpos = 0;
+ _info->plugin = &plugin;
+ _info->bps = WavpackGetBitsPerSample (info->ctx);
+ _info->channels = WavpackGetNumChannels (info->ctx);
+ _info->samplerate = WavpackGetSampleRate (info->ctx);
+ _info->readpos = 0;
if (it->endsample > 0) {
- wvctx.startsample = it->startsample;
- wvctx.endsample = it->endsample;
- if (plugin.seek_sample (0) < 0) {
- plugin.free ();
- return -1;
+ info->startsample = it->startsample;
+ info->endsample = it->endsample;
+ if (plugin.seek_sample (_info, 0) < 0) {
+ plugin.free (_info);
+ return NULL;
}
}
else {
- wvctx.startsample = 0;
- wvctx.endsample = WavpackGetNumSamples (wvctx.ctx)-1;
+ info->startsample = 0;
+ info->endsample = WavpackGetNumSamples (info->ctx)-1;
}
- return 0;
+ return _info;
}
static void
-wv_free (void) {
- if (wvctx.file) {
- deadbeef->fclose (wvctx.file);
- wvctx.file = NULL;
- }
- if (wvctx.ctx) {
- WavpackCloseFile (wvctx.ctx);
- wvctx.ctx = NULL;
+wv_free (DB_fileinfo_t *_info) {
+ if (_info) {
+ wvctx_t *info = (wvctx_t *)_info;
+ if (info->file) {
+ deadbeef->fclose (info->file);
+ info->file = NULL;
+ }
+ if (info->ctx) {
+ WavpackCloseFile (info->ctx);
+ info->ctx = NULL;
+ }
+ free (_info);
}
- memset (&wvctx, 0, sizeof (wvctx));
}
static int
-wv_read_int16 (char *bytes, int size) {
- int currentsample = WavpackGetSampleIndex (wvctx.ctx);
- if (size / (2 * plugin.info.channels) + currentsample > wvctx.endsample) {
- size = (wvctx.endsample - currentsample + 1) * 2 * plugin.info.channels;
- trace ("wv: size truncated to %d bytes, cursample=%d, endsample=%d\n", size, currentsample, wvctx.endsample);
+wv_read_int16 (DB_fileinfo_t *_info, char *bytes, int size) {
+ wvctx_t *info = (wvctx_t *)_info;
+ int currentsample = WavpackGetSampleIndex (info->ctx);
+ if (size / (2 * _info->channels) + currentsample > info->endsample) {
+ size = (info->endsample - currentsample + 1) * 2 * _info->channels;
+ trace ("wv: size truncated to %d bytes, cursample=%d, endsample=%d\n", size, currentsample, info->endsample);
if (size <= 0) {
return 0;
}
}
int32_t buffer[size/2];
- int nchannels = WavpackGetNumChannels (wvctx.ctx);
- int n = WavpackUnpackSamples (wvctx.ctx, buffer, size/(2*nchannels));
+ int nchannels = WavpackGetNumChannels (info->ctx);
+ int n = WavpackUnpackSamples (info->ctx, buffer, size/(2*nchannels));
size = n * 2 * nchannels;
// convert to int16
int32_t *p = buffer;
n *= nchannels;
while (n > 0) {
- *((int16_t *)bytes) = (int16_t)((*p) >> (plugin.info.bps-16));
+ *((int16_t *)bytes) = (int16_t)((*p) >> (_info->bps-16));
bytes += sizeof (int16_t);
p++;
n--;
}
- plugin.info.readpos = (float)(WavpackGetSampleIndex (wvctx.ctx)-wvctx.startsample)/WavpackGetSampleRate (wvctx.ctx);
+ _info->readpos = (float)(WavpackGetSampleIndex (info->ctx)-info->startsample)/WavpackGetSampleRate (info->ctx);
- deadbeef->streamer_set_bitrate (WavpackGetInstantBitrate (wvctx.ctx) / 1000);
+ deadbeef->streamer_set_bitrate (WavpackGetInstantBitrate (info->ctx) / 1000);
return size;
}
static int
-wv_read_float32 (char *bytes, int size) {
- int currentsample = WavpackGetSampleIndex (wvctx.ctx);
- if (size / (4 * plugin.info.channels) + currentsample > wvctx.endsample) {
- size = (wvctx.endsample - currentsample + 1) * 4 * plugin.info.channels;
- trace ("wv: size truncated to %d bytes, cursample=%d, endsample=%d\n", size, currentsample, wvctx.endsample);
+wv_read_float32 (DB_fileinfo_t *_info, char *bytes, int size) {
+ wvctx_t *info = (wvctx_t *)_info;
+ int currentsample = WavpackGetSampleIndex (info->ctx);
+ if (size / (4 * _info->channels) + currentsample > info->endsample) {
+ size = (info->endsample - currentsample + 1) * 4 * _info->channels;
+ trace ("wv: size truncated to %d bytes, cursample=%d, endsample=%d\n", size, currentsample, info->endsample);
if (size <= 0) {
return 0;
}
}
int32_t buffer[size/4];
- int nchannels = WavpackGetNumChannels (wvctx.ctx);
- int n = WavpackUnpackSamples (wvctx.ctx, buffer, size/(4*nchannels));
+ int nchannels = WavpackGetNumChannels (info->ctx);
+ int n = WavpackUnpackSamples (info->ctx, buffer, size/(4*nchannels));
size = n * 4 * nchannels;
// convert to int16
int32_t *p = buffer;
n *= nchannels;
- float mul = 1.f/ ((1 << (plugin.info.bps-1))-1);
+ float mul = 1.f/ ((1 << (_info->bps-1))-1);
while (n > 0) {
*((float *)bytes) = (*p) * mul;
bytes += sizeof (float);
p++;
n--;
}
- plugin.info.readpos = (float)(WavpackGetSampleIndex (wvctx.ctx)-wvctx.startsample)/WavpackGetSampleRate (wvctx.ctx);
- deadbeef->streamer_set_bitrate (WavpackGetInstantBitrate (wvctx.ctx) / 1000);
+ _info->readpos = (float)(WavpackGetSampleIndex (info->ctx)-info->startsample)/WavpackGetSampleRate (info->ctx);
+ deadbeef->streamer_set_bitrate (WavpackGetInstantBitrate (info->ctx) / 1000);
return size;
}
static int
-wv_seek_sample (int sample) {
- WavpackSeekSample (wvctx.ctx, sample + wvctx.startsample);
- plugin.info.readpos = (float)(WavpackGetSampleIndex (wvctx.ctx) - wvctx.startsample) / WavpackGetSampleRate (wvctx.ctx);
+wv_seek_sample (DB_fileinfo_t *_info, int sample) {
+ wvctx_t *info = (wvctx_t *)_info;
+ WavpackSeekSample (info->ctx, sample + info->startsample);
+ _info->readpos = (float)(WavpackGetSampleIndex (info->ctx) - info->startsample) / WavpackGetSampleRate (info->ctx);
return 0;
}
static int
-wv_seek (float sec) {
- return wv_seek_sample (sec * WavpackGetSampleRate (wvctx.ctx));
+wv_seek (DB_fileinfo_t *_info, float sec) {
+ wvctx_t *info = (wvctx_t *)_info;
+ return wv_seek_sample (_info, sec * WavpackGetSampleRate (info->ctx));
}
static DB_playItem_t *
@@ -226,7 +237,7 @@ wv_insert (DB_playItem_t *after, const char *fname) {
float duration = (float)totalsamples / samplerate;
DB_playItem_t *it = deadbeef->pl_item_alloc ();
- it->decoder = &plugin;
+ it->decoder_id = deadbeef->plug_get_decoder_id (plugin.plugin.id);
it->fname = strdup (fname);
it->filetype = "wv";
deadbeef->pl_set_item_duration (it, duration);
@@ -253,7 +264,7 @@ wv_insert (DB_playItem_t *after, const char *fname) {
if (cuesheet) {
DB_playItem_t *last = deadbeef->pl_insert_cue_from_buffer (after, it, cuesheet, strlen (cuesheet), totalsamples, samplerate);
if (last) {
- deadbeef->pl_item_free (it);
+ deadbeef->pl_item_unref (it);
return last;
}
}
@@ -273,6 +284,7 @@ static DB_decoder_t plugin = {
.plugin.version_major = 0,
.plugin.version_minor = 1,
.plugin.type = DB_PLUGIN_DECODER,
+ .plugin.id = "wv",
.plugin.name = "WavPack decoder",
.plugin.descr = ".wv player using libwavpack",
.plugin.author = "Alexey Yakovenko",
@@ -286,7 +298,6 @@ static DB_decoder_t plugin = {
.seek_sample = wv_seek_sample,
.insert = wv_insert,
.exts = exts,
- .id = "wv",
.filetypes = filetypes
};
diff --git a/session.c b/session.c
index 58ecb6d7..4be42deb 100644
--- a/session.c
+++ b/session.c
@@ -118,56 +118,6 @@ read_i32_be (uint32_t *pval, FILE *fp) {
}
int
-session_save (const char *fname) {
- unlink (fname);
-#if 0
- FILE *fp = fopen (fname, "w+b");
- if (!fp) {
- fprintf (stderr, "failed to save session, file %s could not be opened\n");
- return -1;
- }
- // magic
- if (fwrite (sessfile_magic, 1, 4, fp) != 4) {
- goto session_save_fail;
- }
- uint8_t version = SESS_CURRENT_VER;
- if (fwrite (&version, 1, 1, fp) != 1) {
- goto session_save_fail;
- }
- uint16_t l = strlen (session_dir);
- if (write_i16_be (l, fp) != 2) {
- goto session_save_fail;
- }
- if (fwrite (session_dir, 1, l, fp) != l) {
- goto session_save_fail;
- }
- if (write_i32_be (*((uint32_t*)&session_volume), fp) != 4) {
- goto session_save_fail;
- }
- if (fwrite (&session_playlist_order, 1, 1, fp) != 1) {
- goto session_save_fail;
- }
- if (fwrite (&session_playlist_looping, 1, 1, fp) != 1) {
- goto session_save_fail;
- }
- if (fwrite (&session_scroll_follows_playback, 1, 1, fp) != 1) {
- goto session_save_fail;
- }
- for (int k = 0; k < 5; k++) {
- if (write_i32_be (session_win_attrs[k], fp) != 4) {
- goto session_save_fail;
- }
- }
- fclose (fp);
- return 0;
-session_save_fail:
- fprintf (stderr, "failed to save session, seems to be a disk error\n");
- fclose (fp);
- return -1;
-#endif
-}
-
-int
session_load (const char *fname) {
char session_dir[2048];
float session_volume;
diff --git a/session.h b/session.h
index a1c04744..92b605e8 100644
--- a/session.h
+++ b/session.h
@@ -22,9 +22,6 @@
#include <stdint.h>
int
-session_save (const char *fname);
-
-int
session_load (const char *fname);
#endif // __SESSION_H
diff --git a/streamer.c b/streamer.c
index e07dd499..94779773 100644
--- a/streamer.c
+++ b/streamer.c
@@ -79,11 +79,14 @@ static float playpos = 0; // play position of current song
static int avg_bitrate = -1; // avg bitrate of current song
static int last_bitrate = -1; // last bitrate of current song
+// copies of current playing and streaming tracks
playItem_t str_playing_song;
playItem_t str_streaming_song;
// remember pointers to original instances of playitems
static playItem_t *orig_playing_song;
static playItem_t *orig_streaming_song;
+// current decoder
+static DB_fileinfo_t *str_current_decoder;
static int streamer_buffering;
@@ -97,7 +100,7 @@ streamer_get_streaming_track (void) {
playItem_t *
streamer_get_playing_track (void) {
- return orig_playing_song ? orig_playing_song : &str_playing_song;
+ return &str_playing_song;
}
// playlist must call that whenever item was removed
@@ -115,7 +118,7 @@ streamer_song_removed_notify (playItem_t *it) {
// queue new next song for streaming
if (bytes_until_next_song > 0) {
streambuffer_fill = bytes_until_next_song;
- pl_nextsong (0);
+ streamer_move_nextsong (0);
}
}
}
@@ -124,32 +127,30 @@ streamer_song_removed_notify (playItem_t *it) {
static int
streamer_set_current (playItem_t *it) {
int from, to;
+ streamer_buffering = 1;
from = orig_playing_song ? pl_get_idx_of (orig_playing_song) : -1;
to = it ? pl_get_idx_of (it) : -1;
+ if (to != -1) {
+ messagepump_push (M_TRACKCHANGED, 0, to, 0);
+ }
+#if 0
+ // this breaks redraw
if (!orig_playing_song || p_isstopped ()) {
- streamer_buffering = 1;
- playlist_current_ptr = it;
- //trace ("from=%d, to=%d\n", from, to);
- //messagepump_push (M_SONGCHANGED, 0, from, to);
+ orig_playing_song = it;
}
+#endif
trace ("streamer_set_current %p, buns=%d\n", it);
- mutex_lock (decodemutex);
- if(str_streaming_song.decoder) {
- str_streaming_song.decoder->free ();
- pl_item_free (&str_streaming_song);
+ if(str_current_decoder) {
+ str_current_decoder->plugin->free (str_current_decoder);
+ str_current_decoder = NULL;
+ pl_item_unref (&str_streaming_song);
}
- mutex_unlock (decodemutex);
orig_streaming_song = it;
if (!it) {
goto success;
}
- if (to != -1) {
- messagepump_push (M_TRACKCHANGED, 0, to, 0);
- }
- if (from != -1) {
- messagepump_push (M_TRACKCHANGED, 0, from, 0);
- }
- if (!it->decoder && it->filetype && !strcmp (it->filetype, "content")) {
+ DB_decoder_t *dec = NULL;
+ if (!it->decoder_id && it->filetype && !strcmp (it->filetype, "content")) {
// try to get content-type
DB_FILE *fp = streamer_file = vfs_fopen (it->fname);
const char *plug = NULL;
@@ -168,46 +169,41 @@ streamer_set_current (playItem_t *it) {
vfs_fclose (fp);
}
if (plug) {
- DB_decoder_t **decoders = plug_get_decoder_list ();
- // match by decoder
- for (int i = 0; decoders[i]; i++) {
- if (!strcmp (decoders[i]->id, plug)) {
- it->decoder = decoders[i];
- it->filetype = decoders[i]->filetypes[0];
- }
+ dec = plug_get_decoder_for_id (plug);
+ if (dec) {
+ it->decoder_id = plug_get_decoder_id (plug);
+ it->filetype = dec->filetypes[0];
}
}
}
- if (it->decoder) {
- mutex_lock (decodemutex);
- int ret = it->decoder->init (DB_PLAYITEM (it));
+ else if (it->decoder_id) {
+ dec = plug_get_decoder_for_id (it->decoder_id);
+ }
+ if (dec) {
+ str_current_decoder = dec->init (DB_PLAYITEM (it));
+ trace ("str: acquired decoder ptr %p\n", str_current_decoder);
pl_item_copy (&str_streaming_song, it);
- mutex_unlock (decodemutex);
- if (ret < 0) {
- it->played = 1;
- trace ("decoder->init returned %d\n", ret);
+ if (!str_current_decoder) {
+ trace ("decoder->init returned NULL\n");
trace ("orig_playing_song = %p\n", orig_playing_song);
- orig_playing_song = NULL;
- streamer_buffering = 0;
- if (playlist_current_ptr == it) {
+ if (orig_playing_song == it) {
+ orig_playing_song = NULL;
messagepump_push (M_TRACKCHANGED, 0, to, 0);
}
- return ret;
+ return -1;
}
else {
- trace ("bps=%d, channels=%d, samplerate=%d\n", it->decoder->info.bps, it->decoder->info.channels, it->decoder->info.samplerate);
+ trace ("bps=%d, channels=%d, samplerate=%d\n", str_current_decoder->bps, str_current_decoder->channels, str_current_decoder->samplerate);
}
streamer_reset (0); // reset SRC
}
else {
- trace ("no decoder in playitem!\n");
- it->played = 1;
streamer_buffering = 0;
- if (playlist_current_ptr == it) {
- playlist_current_ptr = NULL;
+ if (to != -1) {
messagepump_push (M_TRACKCHANGED, 0, to, 0);
}
- //orig_streaming_song = NULL;
+ trace ("no decoder in playitem!\n");
+ orig_streaming_song = NULL;
return -1;
}
if (bytes_until_next_song == -1) {
@@ -245,9 +241,6 @@ streamer_set_nextsong (int song, int pstate) {
// no sense to wait until end of previous song, reset buffer
bytes_until_next_song = 0;
playpos = 0;
- // try to interrupt file operation
- streamer_lock ();
- streamer_unlock ();
}
}
@@ -285,12 +278,8 @@ streamer_thread (void *ctx) {
if (!try) { // track is not in playlist
trace ("track #%d is not in playlist; stopping playback\n", sng);
p_stop ();
- pl_item_free (&str_playing_song);
-
- mutex_lock (decodemutex);
- pl_item_free (&str_streaming_song);
- mutex_unlock (decodemutex);
-
+ pl_item_unref (&str_playing_song);
+ pl_item_unref (&str_streaming_song);
orig_playing_song = NULL;
orig_streaming_song = NULL;
messagepump_push (M_SONGCHANGED, 0, -1, -1);
@@ -298,14 +287,14 @@ streamer_thread (void *ctx) {
}
int ret = streamer_set_current (try);
if (ret < 0) {
- trace ("\033[0;31mfailed to play track %s, skipping (current=%p)...\033[37;0m\n", try->fname, orig_streaming_song);
+ trace ("failed to play track %s, skipping...\n", try->fname);
// remember bad song number in case of looping
if (badsong == -1) {
badsong = sng;
}
// try jump to next song
- pl_nextsong (0);
- trace ("pl_nextsong switched to track %d\n", nextsong);
+ streamer_move_nextsong (0);
+ trace ("streamer_move_nextsong switched to track %d\n", nextsong);
usleep (50000);
continue;
}
@@ -333,12 +322,12 @@ streamer_thread (void *ctx) {
trace ("nextsong=-2\n");
nextsong = -1;
p_stop ();
- if (str_playing_song.decoder) {
+ if (str_current_decoder) {
trace ("sending songfinished to plugins [1]\n");
plug_trigger_event (DB_EV_SONGFINISHED, 0);
}
streamer_set_current (NULL);
- pl_item_free (&str_playing_song);
+ pl_item_unref (&str_playing_song);
orig_playing_song = NULL;
messagepump_push (M_SONGCHANGED, 0, from, -1);
continue;
@@ -364,12 +353,12 @@ streamer_thread (void *ctx) {
messagepump_push (M_SONGCHANGED, 0, from, to);
bytes_until_next_song = -1;
// plugin will get pointer to str_playing_song
- if (str_playing_song.decoder) {
+ if (str_current_decoder) {
trace ("sending songfinished to plugins [2]\n");
plug_trigger_event (DB_EV_SONGFINISHED, 0);
}
// free old copy of playing
- pl_item_free (&str_playing_song);
+ pl_item_unref (&str_playing_song);
// copy streaming into playing
pl_item_copy (&str_playing_song, &str_streaming_song);
last_bitrate = -1;
@@ -380,7 +369,6 @@ streamer_thread (void *ctx) {
orig_playing_song->started_timestamp = time (NULL);
str_playing_song.started_timestamp = time (NULL);
}
- playlist_current_ptr = orig_playing_song;
// that is needed for playlist drawing
// plugin will get pointer to new str_playing_song
trace ("sending songstarted to plugins\ncurrent playtrack: %s\n", str_playing_song.fname);
@@ -392,19 +380,16 @@ streamer_thread (void *ctx) {
// don't switch if unchanged
int prevtrack_samplerate = p_get_rate ();
- if (prevtrack_samplerate != str_playing_song.decoder->info.samplerate) {
- int newrate = plug_get_output ()->change_rate (str_playing_song.decoder->info.samplerate);
+ if (prevtrack_samplerate != str_current_decoder->samplerate) {
+ int newrate = plug_get_output ()->change_rate (str_current_decoder->samplerate);
if (newrate != prevtrack_samplerate) {
// restart streaming of current track
trace ("streamer: output samplerate changed from %d to %d; restarting track\n", prevtrack_samplerate, newrate);
- mutex_lock (decodemutex);
- str_streaming_song.decoder->free ();
- str_streaming_song.decoder->init (DB_PLAYITEM (orig_streaming_song));
- mutex_unlock (decodemutex);
+ str_current_decoder->plugin->seek (str_current_decoder, 0);
bytes_until_next_song = -1;
streamer_buffering = 1;
streamer_reset (1);
- prevtrack_samplerate = str_playing_song.decoder->info.samplerate;
+ prevtrack_samplerate = str_current_decoder->samplerate;
}
}
@@ -426,36 +411,32 @@ streamer_thread (void *ctx) {
if (orig_playing_song != orig_streaming_song) {
trace ("streamer already switched to next track\n");
-
// restart playing from new position
-
- mutex_lock (decodemutex);
- if(str_streaming_song.decoder) {
- str_streaming_song.decoder->free ();
- pl_item_free (&str_streaming_song);
+ if(str_current_decoder) {
+ str_current_decoder->plugin->free (str_current_decoder);
+ str_current_decoder = NULL;
+ pl_item_unref (&str_streaming_song);
}
orig_streaming_song = orig_playing_song;
pl_item_copy (&str_streaming_song, orig_streaming_song);
- mutex_unlock (decodemutex);
-
bytes_until_next_song = -1;
streamer_buffering = 1;
int trk = pl_get_idx_of (orig_streaming_song);
if (trk != -1) {
messagepump_push (M_TRACKCHANGED, 0, trk, 0);
}
-
- mutex_lock (decodemutex);
- int ret = str_streaming_song.decoder->init (DB_PLAYITEM (orig_streaming_song));
- mutex_unlock (decodemutex);
-
- if (ret < 0) {
+ DB_decoder_t *plug = plug_get_decoder_for_id (orig_streaming_song->decoder_id);
+ if (plug) {
+ str_current_decoder = plug->init (DB_PLAYITEM (orig_streaming_song));
+ }
+ if (!plug || !str_current_decoder) {
+ streamer_buffering = 0;
if (trk != -1) {
messagepump_push (M_TRACKCHANGED, 0, trk, 0);
}
trace ("failed to restart prev track on seek, trying to jump to next track\n");
- pl_nextsong (0);
- trace ("pl_nextsong switched to track %d\n", nextsong);
+ streamer_move_nextsong (0);
+ trace ("streamer_move_nextsong switched to track %d\n", nextsong);
usleep (50000);
continue;
}
@@ -466,13 +447,13 @@ streamer_thread (void *ctx) {
if (trk != -1) {
messagepump_push (M_TRACKCHANGED, 0, trk, 0);
}
- if (str_playing_song.decoder && str_playing_song._duration > 0) {
+ if (str_current_decoder && str_playing_song._duration > 0) {
streamer_lock ();
streambuffer_fill = 0;
streambuffer_pos = 0;
src_remaining = 0;
- if (str_playing_song.decoder->seek (pos) >= 0) {
- playpos = str_playing_song.decoder->info.readpos;
+ if (str_current_decoder->plugin->seek (str_current_decoder, pos) >= 0) {
+ playpos = str_current_decoder->readpos;
}
last_bitrate = -1;
avg_bitrate = -1;
@@ -480,26 +461,16 @@ streamer_thread (void *ctx) {
}
}
- // read ahead at 2x speed of output samplerate, in 4k blocks
- int rate = p_get_rate ();
- if (!rate) {
- trace ("str: got 0 output samplerate\n");
- usleep(20000);
- continue;
- }
- int channels = 2; // FIXME: needs to be queried from output plugin
- int bytes_in_one_second = rate * sizeof (int16_t) * channels;
- const int blocksize = 4096;
- int alloc_time = 1000 / (bytes_in_one_second * 2 / blocksize);
+ // read ahead at 384K per second
+ // that means 10ms per 4k block, or 40ms per 16k block
+ int alloc_time = 1000 / (96000 * 4 / 4096);
streamer_lock ();
- if (streambuffer_fill < (STREAM_BUFFER_SIZE-blocksize)) {
+ if (streambuffer_fill < (STREAM_BUFFER_SIZE-4096)/* && bytes_until_next_song == 0*/) {
int sz = STREAM_BUFFER_SIZE - streambuffer_fill;
- int minsize = blocksize;
-
- // speed up buffering when empty
+ int minsize = 4096;
if (streambuffer_fill < 16384) {
- minsize *= 4;
+ minsize = 16384;
alloc_time *= 4;
}
sz = min (minsize, sz);
@@ -534,14 +505,12 @@ streamer_thread (void *ctx) {
}
// stop streaming song
- mutex_lock (decodemutex);
- if(str_streaming_song.decoder) {
- str_streaming_song.decoder->free ();
+ if(str_current_decoder) {
+ str_current_decoder->plugin->free (str_current_decoder);
+ str_current_decoder = NULL;
}
- pl_item_free (&str_streaming_song);
- mutex_unlock (decodemutex);
-
- pl_item_free (&str_playing_song);
+ pl_item_unref (&str_streaming_song);
+ pl_item_unref (&str_playing_song);
if (src) {
src_delete (src);
src = NULL;
@@ -744,20 +713,18 @@ float32_to_int16 (float *in, int16_t *out, int nsamples) {
static int
streamer_read_data_for_src (int16_t *buffer, int frames) {
- DB_decoder_t *decoder = str_streaming_song.decoder;
- int channels = decoder->info.channels;
+ DB_decoder_t *decoder = str_current_decoder->plugin;
+ int channels = str_current_decoder->channels;
if (channels > 2) {
channels = 2;
}
- int bytesread = decoder->read_int16 ((uint8_t*)buffer, frames * sizeof (int16_t) * channels);
- apply_replay_gain_int16 (&str_streaming_song, (uint8_t*)buffer, bytesread);
+ int bytesread = decoder->read_int16 (str_current_decoder, (uint8_t*)buffer, frames * sizeof (int16_t) * channels);
if (channels == 1) {
// convert to stereo
int n = frames-1;
while (n >= 0) {
buffer[n*2+0] = buffer[n];
buffer[n*2+1] = buffer[n];
- n--;
}
}
return bytesread / (sizeof (int16_t) * channels);
@@ -765,28 +732,26 @@ streamer_read_data_for_src (int16_t *buffer, int frames) {
static int
streamer_read_data_for_src_float (float *buffer, int frames) {
- DB_decoder_t *decoder = str_streaming_song.decoder;
- int channels = decoder->info.channels;
+ DB_decoder_t *decoder = str_current_decoder->plugin;
+ int channels = str_current_decoder->channels;
if (channels > 2) {
channels = 2;
}
if (decoder->read_float32) {
- {
- int bytesread = decoder->read_float32 ((uint8_t*)buffer, frames * sizeof (float) * channels);
- apply_replay_gain_float32 (&str_streaming_song, (uint8_t*)buffer, bytesread);
+// trace ("call read_float32 (%d frames -> %d bytes)\n", frames, frames * sizeof (float) * channels);
+ int bytesread = decoder->read_float32 (str_current_decoder, (uint8_t*)buffer, frames * sizeof (float) * channels);
+// trace ("got %d bytes -> %d frames\n", bytesread, bytesread / (sizeof (float) * channels));
if (channels == 1) {
// convert to stereo
int n = frames-1;
while (n >= 0) {
- buffer[n*2+1] = buffer[n];
buffer[n*2+0] = buffer[n];
- n--;
+ buffer[n*2+1] = buffer[n];
}
+ bytesread *= 2;
}
return bytesread / (sizeof (float) * channels);
- }
}
-
// trace ("read_float32 not impl\n");
int16_t intbuffer[frames*2];
int res = streamer_read_data_for_src (intbuffer, frames);
@@ -801,8 +766,8 @@ static int
streamer_decode_src_libsamplerate (uint8_t *bytes, int size) {
int initsize = size;
int16_t *out = (int16_t *)bytes;
- DB_decoder_t *decoder = str_streaming_song.decoder;
- int samplerate = decoder->info.samplerate;
+ DB_decoder_t *decoder = str_current_decoder->plugin;
+ int samplerate = str_current_decoder->samplerate;
float ratio = (float)p_get_rate ()/samplerate;
while (size > 0) {
int n_output_frames = size / sizeof (int16_t) / 2;
@@ -898,29 +863,26 @@ streamer_read_async (char *bytes, int size) {
int initsize = size;
for (;;) {
int bytesread = 0;
- mutex_lock (decodemutex);
- DB_decoder_t *decoder = str_streaming_song.decoder;
- if (!decoder) {
+ if (!str_current_decoder) {
// means there's nothing left to stream, so just do nothing
- mutex_unlock (decodemutex);
break;
}
- if (decoder->info.samplerate != -1) {
- int nchannels = decoder->info.channels;
+ if (str_current_decoder->samplerate != -1) {
+ int nchannels = str_current_decoder->channels;
if (nchannels > 2) {
nchannels = 2;
}
- int samplerate = decoder->info.samplerate;
- if (decoder->info.samplerate == p_get_rate ()) {
+ int samplerate = str_current_decoder->samplerate;
+ if (str_current_decoder->samplerate == p_get_rate () && str_current_decoder->plugin->read_int16) {
// samplerate match
if (nchannels == 2) {
- bytesread = decoder->read_int16 (bytes, size);
- apply_replay_gain_int16 (&str_streaming_song, bytes, bytesread);
+ bytesread = str_current_decoder->plugin->read_int16 (str_current_decoder, bytes, size);
+ apply_replay_gain_int16 (&str_streaming_song, bytes, size);
}
else {
uint8_t buffer[size>>1];
- bytesread = decoder->read_int16 (buffer, size>>1);
- apply_replay_gain_int16 (&str_streaming_song, buffer, bytesread);
+ bytesread = str_current_decoder->plugin->read_int16 (str_current_decoder, buffer, size>>1);
+ apply_replay_gain_int16 (&str_streaming_song, buffer, size>>1);
mono_int16_to_stereo_int16 ((int16_t*)buffer, (int16_t*)bytes, size>>2);
bytesread *= 2;
}
@@ -932,7 +894,8 @@ streamer_read_async (char *bytes, int size) {
fprintf (stderr, "invalid ratio! %d / %d = %f", p_get_rate (), samplerate, p_get_rate ()/(float)samplerate);
}
}
- mutex_unlock (decodemutex);
+ else {
+ }
bytes += bytesread;
size -= bytesread;
if (size == 0) {
@@ -949,7 +912,7 @@ streamer_read_async (char *bytes, int size) {
streamer_set_nextsong (-2, 1);
}
else {
- pl_nextsong (0);
+ streamer_move_nextsong (0);
}
}
break;
@@ -982,11 +945,9 @@ streamer_read (char *bytes, int size) {
streambuffer_fill -= sz;
playpos += (float)sz/p_get_rate ()/4.f;
str_playing_song.playtime += (float)sz/p_get_rate ()/4.f;
- if (playlist_current_ptr) {
- str_playing_song.filetype = playlist_current_ptr->filetype;
- }
- if (playlist_current_ptr) {
- playlist_current_ptr->playtime = str_playing_song.playtime;
+ if (orig_playing_song) {
+ str_playing_song.filetype = orig_playing_song->filetype;
+ orig_playing_song->playtime = str_playing_song.playtime;
}
if (bytes_until_next_song > 0) {
bytes_until_next_song -= sz;
@@ -1079,12 +1040,13 @@ streamer_configchanged (void) {
void
streamer_play_current_track (void) {
- if (p_ispaused () && orig_playing_song) {
+ playlist_t *plt = plt_get_curr_ptr ();
+ if (p_ispaused ()) {
// unpause currently paused track
p_unpause ();
plug_trigger_event_paused (0);
}
- else if (playlist_current_row[PL_MAIN] != -1) {
+ else if (plt->current_row[PL_MAIN] != -1) {
// play currently selected track
p_stop ();
// get next song in queue
@@ -1095,7 +1057,7 @@ streamer_play_current_track (void) {
pl_playqueue_pop ();
}
else {
- idx = playlist_current_row[PL_MAIN];
+ idx = plt->current_row[PL_MAIN];
}
streamer_set_nextsong (idx, 1);
@@ -1107,3 +1069,212 @@ streamer_play_current_track (void) {
}
}
+int
+streamer_move_prevsong (void) {
+ playlist_t *plt = plt_get_curr_ptr ();
+ pl_playqueue_clear ();
+ if (!plt->head[PL_MAIN]) {
+ streamer_set_nextsong (-2, 1);
+ return 0;
+ }
+ int pl_order = conf_get_int ("playback.order", 0);
+ int pl_loop_mode = conf_get_int ("playback.loop", 0);
+ if (pl_order == PLAYBACK_ORDER_SHUFFLE) { // shuffle
+ if (!orig_playing_song) {
+ return streamer_move_nextsong (1);
+ }
+ else {
+ orig_playing_song->played = 0;
+ // find already played song with maximum shuffle rating below prev song
+ int rating = orig_playing_song->shufflerating;
+ playItem_t *pmax = NULL; // played maximum
+ playItem_t *amax = NULL; // absolute maximum
+ for (playItem_t *i = plt->head[PL_MAIN]; i; i = i->next[PL_MAIN]) {
+ if (i != orig_playing_song && i->played && (!amax || i->shufflerating > amax->shufflerating)) {
+ amax = i;
+ }
+ if (i == orig_playing_song || i->shufflerating > rating || !i->played) {
+ continue;
+ }
+ if (!pmax || i->shufflerating > pmax->shufflerating) {
+ pmax = i;
+ }
+ }
+ playItem_t *it = pmax;
+ if (!it) {
+ // that means 1st in playlist, take amax
+ if (pl_loop_mode == PLAYBACK_MODE_LOOP_ALL) {
+ if (!amax) {
+ pl_reshuffle (NULL, &amax);
+ }
+ it = amax;
+ }
+ }
+
+ if (!it) {
+ return -1;
+ }
+ int r = pl_get_idx_of (it);
+ streamer_set_nextsong (r, 1);
+ return 0;
+ }
+ }
+ else if (pl_order == PLAYBACK_ORDER_LINEAR) { // linear
+ playItem_t *it = NULL;
+ if (orig_playing_song) {
+ it = orig_playing_song->prev[PL_MAIN];
+ }
+ if (!it) {
+ if (pl_loop_mode == PLAYBACK_MODE_LOOP_ALL) {
+ it = plt->tail[PL_MAIN];
+ }
+ }
+ if (!it) {
+ return -1;
+ }
+ int r = pl_get_idx_of (it);
+ streamer_set_nextsong (r, 1);
+ return 0;
+ }
+ else if (pl_order == PLAYBACK_ORDER_RANDOM) { // random
+ streamer_move_randomsong ();
+ }
+ return -1;
+}
+
+int
+streamer_move_nextsong (int reason) {
+ playlist_t *plt = plt_get_curr_ptr ();
+ playItem_t *it = pl_playqueue_getnext ();
+ if (it) {
+ pl_playqueue_pop ();
+ int r = pl_get_idx_of (it);
+ streamer_set_nextsong (r, 1);
+ return 0;
+ }
+
+ playItem_t *curr = streamer_get_streaming_track ();
+ if (!plt->head[PL_MAIN]) {
+ streamer_set_nextsong (-2, 1);
+ return 0;
+ }
+ int pl_order = conf_get_int ("playback.order", 0);
+ int pl_loop_mode = conf_get_int ("playback.loop", 0);
+ if (pl_order == PLAYBACK_ORDER_SHUFFLE) { // shuffle
+ if (!curr) {
+ // find minimal notplayed
+ playItem_t *pmin = NULL; // notplayed minimum
+ for (playItem_t *i = plt->head[PL_MAIN]; i; i = i->next[PL_MAIN]) {
+ if (i->played) {
+ continue;
+ }
+ if (!pmin || i->shufflerating < pmin->shufflerating) {
+ pmin = i;
+ }
+ }
+ playItem_t *it = pmin;
+ if (!it) {
+ // all songs played, reshuffle and try again
+ if (pl_loop_mode == PLAYBACK_MODE_LOOP_ALL) { // loop
+ pl_reshuffle (&it, NULL);
+ }
+ }
+ if (!it) {
+ return -1;
+ }
+ int r = pl_get_idx_of (it);
+ streamer_set_nextsong (r, 1);
+ return 0;
+ }
+ else {
+ trace ("pl_next_song: reason=%d, loop=%d\n", reason, pl_loop_mode);
+ if (reason == 0 && pl_loop_mode == PLAYBACK_MODE_LOOP_SINGLE) { // song finished, loop mode is "loop 1 track"
+ int r = pl_get_idx_of (curr);
+ streamer_set_nextsong (r, 1);
+ return 0;
+ }
+ // find minimal notplayed above current
+ int rating = curr->shufflerating;
+ playItem_t *pmin = NULL; // notplayed minimum
+ for (playItem_t *i = plt->head[PL_MAIN]; i; i = i->next[PL_MAIN]) {
+ if (i->played || i->shufflerating < rating) {
+ continue;
+ }
+ if (!pmin || i->shufflerating < pmin->shufflerating) {
+ pmin = i;
+ }
+ }
+ playItem_t *it = pmin;
+ if (!it) {
+ trace ("all songs played! reshuffle\n");
+ // all songs played, reshuffle and try again
+ if (pl_loop_mode == PLAYBACK_MODE_LOOP_ALL) { // loop
+ pl_reshuffle (&it, NULL);
+ }
+ }
+ if (!it) {
+ return -1;
+ }
+ int r = pl_get_idx_of (it);
+ streamer_set_nextsong (r, 1);
+ return 0;
+ }
+ }
+ else if (pl_order == PLAYBACK_ORDER_LINEAR) { // linear
+ playItem_t *it = NULL;
+ if (curr) {
+ if (reason == 0 && pl_loop_mode == PLAYBACK_MODE_LOOP_SINGLE) { // loop same track
+ int r = pl_get_idx_of (curr);
+ streamer_set_nextsong (r, 1);
+ return 0;
+ }
+ it = curr->next[PL_MAIN];
+ }
+ if (!it) {
+ trace ("streamer_move_nextsong: was last track\n");
+ if (pl_loop_mode == PLAYBACK_MODE_LOOP_ALL) {
+ it = plt->head[PL_MAIN];
+ }
+ else {
+ streamer_set_nextsong (-2, 1);
+ return 0;
+ }
+ }
+ if (!it) {
+ return -1;
+ }
+ int r = pl_get_idx_of (it);
+ streamer_set_nextsong (r, 1);
+ return 0;
+ }
+ else if (pl_order == PLAYBACK_ORDER_RANDOM) { // random
+ if (reason == 0 && pl_loop_mode == PLAYBACK_MODE_LOOP_SINGLE && curr) {
+ int r = pl_get_idx_of (curr);
+ streamer_set_nextsong (r, 1);
+ return 0;
+ }
+ return streamer_move_randomsong ();
+ }
+ return -1;
+}
+
+int
+streamer_move_randomsong (void) {
+ int cnt = pl_getcount (PL_MAIN);
+ if (!cnt) {
+ return -1;
+ }
+ int r = rand () / (float)RAND_MAX * cnt;
+ streamer_set_nextsong (r, 1);
+ return 0;
+}
+
+playItem_t *
+streamer_get_current (void) {
+ return orig_playing_song;
+}
+
+struct DB_fileinfo_s *
+streamer_get_current_decoder (void) {
+ return str_current_decoder;
+}
diff --git a/streamer.h b/streamer.h
index cc762477..9389a4f8 100644
--- a/streamer.h
+++ b/streamer.h
@@ -84,4 +84,21 @@ streamer_set_bitrate (int bitrate);
int
streamer_get_apx_bitrate (void);
+// returns -1 if theres no next song, or playlist finished
+// reason 0 means "song finished", 1 means "user clicked next"
+int
+streamer_move_nextsong (int reason);
+
+int
+streamer_move_prevsong (void);
+
+int
+streamer_move_randomsong (void);
+
+playItem_t *
+streamer_get_current (void);
+
+struct DB_fileinfo_s *
+streamer_get_current_decoder (void);
+
#endif // __STREAMER_H
diff --git a/vfs.c b/vfs.c
index aff6c0ad..432e844f 100644
--- a/vfs.c
+++ b/vfs.c
@@ -21,8 +21,8 @@
#include "vfs.h"
#include "plugins.h"
-//#define trace(...) { fprintf(stderr, __VA_ARGS__); }
-#define trace(fmt,...)
+#define trace(...) { fprintf(stderr, __VA_ARGS__); }
+//#define trace(fmt,...)
DB_FILE *
vfs_fopen (const char *fname) {