TRadioPlayer
Native Delphi/Pascal internet radio playback built directly on FFmpeg 8 headers and a Windows audio backend. The project now centers on a reusable `TRadioPlayer` engine plus a reusable console UI layer and a concrete console player application.
- Active · last change 5-1-2026
- ★ 3 on GitHub
README
Delphi FFmpeg Radio Player
Native Delphi/Pascal internet radio playback built directly on FFmpeg 8 headers. The project centers on a reusable TRadioPlayer engine, a reusable console UI layer, and a concrete console player application.
What Is Included
Source/Delphi radio engine units:TRadioPlayer, stream client, decoder, resampler, PCM buffer, event bus, spectrum analyzer, and audio backends.Headers/FFmpeg 8 Delphi/Pascal header translations used by the player, based on the DelphiFFmpeg.com header set and updated in this repository for FFmpeg 8.1.ConsoleRadioPlayer/A real console radio player built on top of the reusable engine and reusableTRadioConsoleUI.SDLRadioPlayer/A separate SDL3-based GUI player built on top of the sameTRadioPlayerlibrary.build.shOptional build helper forWin32andWin64.build-fpc.shOptional build helper for Linux/FPC.
Current Feature Set
- HTTP/HTTPS radio playback through FFmpeg
- MP3 live stream playback verified
waveOutandWASAPIoutput backends on WindowsPulseAudioandaplayoutput backends on Linux/FPC- WASAPI device enumeration and explicit device selection
- WASAPI session or endpoint volume control
- reconnect handling with backoff
- metadata extraction and live updates
- configurable PCM buffer and prebuffer
- advanced runtime stats
- output-aligned VU metering
- output-aligned spectrum analysis
- event bus with dedicated-thread or main-thread dispatch
- reusable console UI component in
Source/Radio.ConsoleUI.pas
Project Structure
Source/Radio.Player.pasMain player facade and orchestration.Source/Radio.ConsoleUI.pasReusable TUI-style console UI class forTRadioPlayer.Source/Radio.Output.WASAPI.pasWASAPI backend using MfPack translations.Source/Radio.Output.WaveOut.pasSimpler fallback backend.Source/Radio.Output.APlay.pasLinux backend that streams PCM toaplay.Source/Radio.Output.PulseAudio.pasLinux backend using the PulseAudio simple API.ConsoleRadioPlayer/ConsoleRadioPlayer.dprStandalone console radio player host.SDLRadioPlayer/SDLRadioPlayer.dprStandalone SDL3 GUI radio player host.
Requirements
- Delphi 12 / RAD Studio 12 for Windows builds
- Free Pascal 3.2.2+ for Linux builds
- FFmpeg 8.1 runtime libraries available to the final executable at runtime
- MfPack available locally for the WASAPI backend
Add
MfPack\srcto the project search path in RAD Studio, or setMFPACK_DIRwhen usingbuild.sh.
Linux/FPC additionally needs:
- FFmpeg shared libraries discoverable by the linker/runtime
libpulse-simplefor the PulseAudio backendaplayavailable at runtime if you want the ALSA fallback backend
Optional:
- Embarcadero WinMD package path can still be present, but the audio backend does not depend on it
Build
RAD Studio
Open:
ConsoleRadioPlayer\ConsoleRadioPlayer.dpror:
SDLRadioPlayer\SDLRadioPlayer.dprProject search path should include:
Source
Headers
C:\Path\To\SDL3\Bindings\Units
C:\Path\To\MfPack\srcThen build the selected target platform in the normal way from RAD Studio.
Optional build.sh helper
For users who want command-line builds, build.sh can compile the project through the Delphi command-line compilers. If MfPack is not in a sibling ..\MfPack folder, set MFPACK_DIR first.
Win64:
./build.sh ConsoleRadioPlayer/ConsoleRadioPlayer.dpr Win64
./build.sh SDLRadioPlayer/SDLRadioPlayer.dpr Win64Win32:
./build.sh ConsoleRadioPlayer/ConsoleRadioPlayer.dpr Win32
./build.sh SDLRadioPlayer/SDLRadioPlayer.dpr Win32Build outputs go to:
Bin\win64\Bin\win32\
Optional build-fpc.sh helper
Linkable Linux build:
./build-fpc.sh ConsoleRadioPlayer/ConsoleRadioPlayer.dprSource and unit validation without linking system FFmpeg libraries:
./build-fpc.sh ConsoleRadioPlayer/ConsoleRadioPlayer.dpr --no-linkBuild outputs go to:
Bin/linux/
Run
Default stream:
Bin\win64\ConsoleRadioPlayer.exeExplicit backend, volume mode, buffer, and prebuffer:
Bin\win64\ConsoleRadioPlayer.exe https://stream.radio38.de/radio38-live/mp3-192 wasapi session - 1200 400List WASAPI devices:
Bin\win64\ConsoleRadioPlayer.exe --list-devicesSDL GUI player:
Bin\win64\SDLRadioPlayer.exeLinux PulseAudio backend:
export PULSE_SERVER=unix:/mnt/wslg/PulseServer
Bin/linux/ConsoleRadioPlayer https://stream.radio38.de/radio38-live/mp3-192 pulseaudioLinux aplay backend:
Bin/linux/ConsoleRadioPlayer https://stream.radio38.de/radio38-live/mp3-192 aplayConsole Hotkeys
qquitmmute+/-volumerrestartbswitch backenddnext WASAPI device on Windowsvtoggle WASAPI volume mode on Windows1..5load preset!..%save preset
Architecture Notes
The codebase is split so FFmpeg-facing ABI usage is isolated from player logic as much as practical:
Radio.FFmpeg.Apipacket/frame and common API helpersRadio.FFmpeg.Resampleswresampleand sample-layout helpers- player-facing units stream, decode, resample, output, buffering, UI
This keeps future FFmpeg version migration work focused on the adapter layer instead of the whole application.
Third-Party Sources
Headers/Based on the DelphiFFmpeg.com Pascal header translations. These files carry their own header notices and redistribution terms in the source files.MfPackUsed as the Windows Core Audio / Media Foundation translation layer for the WASAPI backend during build. This project is not bundled in this repository and should be available as a normal local dependency.FFmpegruntime DLLs The player loads FFmpeg DLLs at runtime. Their license depends on how those binaries were built.
Threading Notes
TRadioPlayerexposes snapshot-style events and lock-protected state accessors.EventDispatchMode = redmMainThreadis suitable for GUI or console apps that pumpCheckSynchronize.TRadioConsoleUIpolls player snapshots directly for rendering and keeps its own mutable UI state protected internally.
Status
This repository is in a usable V1/V1.5 state for a native Delphi radio player:
- engine and Windows console player are working
- Linux/FPC source compilation is working
- telemetry and diagnostics are in place
- repository layout has been cleaned for normal RAD Studio use
Remaining Nice-To-Haves
- playlist resolver support for
.pls/.m3u - richer automated stress tests
- optional GUI component wrappers
- further extraction of
TRadioConsoleUIinto a standalone generic console UI project - richer SDL GUI controls and station management
License
No repository license file has been added yet. Pick one before publishing publicly on GitHub.
Important:
- the code in
Source/andConsoleRadioPlayer/can be licensed separately from the third-party dependencies - the files in
Headers/already carry their own notices from DelphiFFmpeg.com and references to FFmpeg's upstream licensing - the FFmpeg runtime DLLs you distribute may be
LGPLorGPLdepending on how they were built

