$ show DeaDBeeF-Player/deadbeef
DeaDBeeF is a cross-platform desktop music player with a modular plugin architecture. It supports a vast array of audio formats including MP3, AAC, FLAC, Ogg Vorbis, Opus, WavPack, Musepack, DTS, and numerous chiptune and video game music formats (SID, NSF, VGM, MOD, S3M, XM, IT, PSF, etc.) through bundled emulation libraries. The core player handles playlist management, metadata caching, replaygain, DSP chain processing, and streaming. Two native GUI implementations exist: a GTK2/GTK3 interface for Linux and a Cocoa interface for macOS, both offering full-featured playback controls, media library browsing, cover art display, and visualization (scope, spectrum analyzer). The player also includes a converter plugin, MPRIS integration, and extensive keyboard shortcut customization. The architecture is centered around a lightweight plugin API (DB_plugin_t) that decouples decoders, outputs, DSP effects, and UI components. The core library (libdeadbeef) provides threading, file I/O, configuration, and message passing. Plugins are loaded dynamically and register themselves via a factory pattern. The media library plugin uses SQLite for indexing and file system watchers (inotify on Linux) for automatic updates. Artwork is fetched from embedded tags and online services (Last.fm, MusicBrainz) with a local cache. The build system uses autotools, premake5, and Xcode projects, with Docker-based CI for Linux, macOS, and Windows. Key data flows include: file opening via VFS abstraction → decoder plugin → decoded audio blocks (ring buffer) → DSP chain → output plugin. Metadata flows from file tags through a caching layer to the UI and media library. The player supports CUE sheets, gapless playback, and crossfading. External dependencies include GTK2/GTK3, libcurl, libsamplerate, and various codec libraries (libmpg123, libmad, libvorbis, libFLAC, etc.), many of which are bundled as source for portability.
The LLM identified 6 files worth highlighting for reuse:
Provides a growable buffer with printf-style formatting and safe string concatenation. The buffer automatically expands as needed, and the API includes functions for appending formatted strings, binary data, and null-termination. This is a self-contained utility that can be extracted for any C project needing dynamic string or byte buffer management.
Implements a generic undo/redo manager with support for grouping operations, executing undo/redo actions, and maintaining a bounded history. The manager uses a double-linked list of undo actions and provides callbacks for execution. It is decoupled from any specific application logic and can be reused in any project requiring undo functionality.
Defines an abstract file handle interface (ddb_file_handle_t) with implementations for stdio and memory-backed files. The abstraction provides open, read, seek, tell, close, and eof operations. This pattern allows plugins to read from files or memory buffers transparently and can be reused in any project needing a simple virtual file system.
A lock-free ring buffer implementation for audio data streaming. It supports single-producer, single-consumer access with atomic head/tail pointers. The buffer is used in the audio pipeline to pass decoded audio blocks between threads. This is a well-tested, self-contained component that can be reused in any real-time audio or data streaming application.
Provides a reusable audio spectrum analyzer that computes FFT magnitudes and produces bar/peak data for visualization. It includes configurable FFT size, windowing, and smoothing. The analyzer is decoupled from any specific UI and can be integrated into any audio application needing real-time spectrum analysis.
Implements an artwork cache with expiration and disk persistence. It uses a hash map for fast lookup and a background thread for cleaning expired entries. The cache is designed to store cover art images and can be reused in any application needing a simple file-based cache with TTL.