Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Software:VLC media player

From ReverseEngineering.wiki
Software
Developer VideoLAN
Uses Library:Lua, Library:Libogg, Library:Libvorbis, Library:Libopus
Platforms Windows, macOS, Linux, Android, iOS
Versions 3.0.23 (Windows x64) examined
License GPL-2.0-or-later (libVLC LGPL-2.1-or-later)
Website https://www.videolan.org/vlc/
On this wiki Facts · Code · Notes · Topics

Open-source media player by VideoLAN (GPL-2.0-or-later, libVLC under LGPL-2.1-or-later). Its playlist parsers, extensions, web/telnet interfaces and metadata fetchers are Lua scripts run by an embedded Lua 5.1, shipped precompiled on Windows.

Overview

VLC is a modular player: almost every feature is a plugin DLL under plugins/. Scripting is the lua plugin (plugins/lua/liblua_plugin.dll on Windows), which embeds Library:Lua 5.1 (lua_ident $Lua: Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio $ in 3.0.23 x64) and runs the scripts in the lua/ folder: playlist/ (site parsers such as youtube), extensions/, intf/ (http, telnet, cli), meta/ and modules/.

Lua scripts

In the Windows build the scripts are shipped as Format:Lua bytecode (.luac, 36 files in 3.0.23), not as source. They are standard Lua 5.1 chunks except that the header records a 4-byte size_t on the x64 build, see the note on this page. The source of every script is in VLC's public source repository (share/lua/), so decompiling them is rarely needed; the chunks are useful as real-world 5.1 test data.

Engine & libraries used

Codec and container libraries are linked statically into their plugins (3.0.23 Windows x64, read from the files, nothing run):

  • plugins/demux/libogg_plugin.dll (Format:Ogg demuxer): Library:Libogg 1.3.4 or later (the slicing-by-8 CRC tables at RVA 0x4A7C0 and 0x4ABC0) and Library:Libvorbis 1.3.6 strings ("Xiph.Org libVorbis 1.3.6", "Xiph.Org libVorbis I 20180316 (Now 100% fewer shells)") for header parsing.
  • plugins/codec/libvorbis_plugin.dll: libvorbis 1.3.6, without libogg's CRC table (libvorbis needs only libogg's bit packer).
  • plugins/codec/libopus_plugin.dll: Library:Libopus "libopus 1.3".
  • plugins/codec/libflac_plugin.dll: "reference libFLAC 1.3.4 20220220" plus the libogg 1.3.4+ CRC tables and "OggS" (Ogg FLAC support).
  • plugins/codec/libtheora_plugin.dll, libspeex_plugin.dll: Theora and Speex decoders (not examined).

Pitfalls

  • A stock 64-bit Lua 5.1 refuses VLC's x64 chunks (bad header in precompiled chunk) because of the size_t byte; a parser must read the sizes from the header instead of assuming the host's.

Evidence & references

  • Files of the VLC 3.0.23 Windows x64 installation read with luascan.py and luacinfo.py; nothing was run.