Menu

Plugin_HOWTO

waker
There is a newer version of this page. You can find it here.

Plugin types

We have several plugin types in Deadbeef. As a plugin author, you need to decide which type of plugin you want

Decoder

Reads a source file(s), and converts it to PCM format for playback. Also, decoder is responsible for checking file format (probing), seeking in the file, reading and writing metadata. Some of these features are optional to implement, but all of them are highly desirable from a good decoder plugin. There is a decoder plugin template in the root folder of source distribution. It might be slightly outdated though, but should be very handy to start off.

Output

Accepts PCM input, and plays it back through some sound API. For example ALSA or OSS. Also needs to handle play/pause/stop commands. It is easiest to start off some existing plugin. OSS and NULL output plugins are very simple.

DSP

DSP plugins accept PCM, and do some processing on it. Good example is EQ. I'm sure most people willing to write a DSP plugin already know what to do :)

VFS

VFS plugins implement multiple data transfer protocols over a unified interface, which is similar to stdio file API. By default, Deadbeef ships with stdio (normal local files) and vfs_curl (streaming over procols provided by libcurl, such as http, ftp, etc) plugins. This plugin type can be used to implement support for GIO, archive formats, etc. Though it might need some work on the API side. At the time of writing (0.4.2) VFS plugin API only supports open/read/close operation, and some extra functions for http/icy specific stuff.

Miscellaneous

Plugins that can do anything not directly related to audio and I/O. For example, user interface, or last.fm scrobbler. Usually, they are running in their own thread, sending and receiving signals to and from Deadbeef core.

Where to start

Normally, you need to #include <deadbeef/deadbeef.h>, and build your plugin as a shared library, like this:

gcc -std=c99 -shared -O2 -o myplugin.so myplugin.c

The file /usr/include/deadbeef/deadbeef.h should've been installed with the player itself. If not -- look for deadbeef-devel package, or something like this. Or get the file from a source tarball. deadbeef.h has some important comments, so you should read it.

In the beginning of the file, there is description on how to write your plugin entry point function.

This entry point normally should only do one thing: return a pointer to plugin declaration structure. See source code of other plugins to see how it works. It is very simple concept.

What's next?

Read other plugin's source code, come chat with devs on IRC, don't be afraid to ask. We are trying to be as friendly to newcomers as possible, and we are willing to help.


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.