Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion deps/ffmpeg/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ pub fn build(b: *std.Build) void {
module.addCSourceFiles(.{
.root = upstream.path(""),
.files = &sources,
.flags = &.{ "-std=c17", "-fno-math-errno", "-fno-sanitize=undefined" },
// FFmpeg's assertion messages hold their source files' paths (`__FILE__`), which name the
// package's folder with the separators of the system that builds it. Clang writes them with
// the target's separators instead, so that every system builds the same bytes.
.flags = &.{ "-std=c17", "-fno-math-errno", "-fno-sanitize=undefined", "-ffile-reproducible" },
});

lib.installHeadersDirectory(upstream.path("libavcodec"), "libavcodec", .{});
Expand Down
2 changes: 1 addition & 1 deletion docs/port/platform.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ SDL comes from the [castholm/SDL](https://github.com/castholm/SDL) package, whic

## Movies

The game's movies ([Movies](../engine/movies.md)) are decoded by [FFmpeg](https://ffmpeg.org)'s Bink decoders, in place of RAD's library, and the crew's lines in the rooms by its MP3 decoder, in place of Miles's ([The crew](../engine/rooms.md#the-crew)). Its FLAC, Vorbis and Opus decoders handle mods' music, lines and sounds in those formats ([FLAC files](../formats/flac.md), [Ogg files](../formats/ogg.md)). [`deps/ffmpeg`](../../deps/ffmpeg/build.zig) builds FFmpeg 9.0.2, pinned in its manifest by the release's tag and commit, as a static library of the Bink video and audio decoders, the MP3, FLAC, Vorbis and Opus decoders, and the parts of `libavcodec`, `libavutil` and `libswresample` they need (the Opus decoder resamples with `libswresample`). It compiles the files that FFmpeg's `configure --disable-everything --enable-decoder=bink,binkaudio_rdft,binkaudio_dct,mp3float,flac,vorbis,opus --disable-asm --disable-pthreads --disable-autodetect` would build for a program that uses the decoding calls, with the settings those files read. It is plain C for any processor, without assembly or threads, and like OpenAL Soft it is always built optimized, whatever the game is built as. None of FFmpeg's GPL parts are built.
The game's movies ([Movies](../engine/movies.md)) are decoded by [FFmpeg](https://ffmpeg.org)'s Bink decoders, in place of RAD's library, and the crew's lines in the rooms by its MP3 decoder, in place of Miles's ([The crew](../engine/rooms.md#the-crew)). Its FLAC, Vorbis and Opus decoders handle mods' music, lines and sounds in those formats ([FLAC files](../formats/flac.md), [Ogg files](../formats/ogg.md)). [`deps/ffmpeg`](../../deps/ffmpeg/build.zig) builds FFmpeg 9.0.2, pinned in its manifest by the release's tag and commit, as a static library of the Bink video and audio decoders, the MP3, FLAC, Vorbis and Opus decoders, and the parts of `libavcodec`, `libavutil` and `libswresample` they need (the Opus decoder resamples with `libswresample`). It compiles the files that FFmpeg's `configure --disable-everything --enable-decoder=bink,binkaudio_rdft,binkaudio_dct,mp3float,flac,vorbis,opus --disable-asm --disable-pthreads --disable-autodetect` would build for a program that uses the decoding calls, with the settings those files read. It is plain C for any processor, without assembly or threads, and like OpenAL Soft it is always built optimized, whatever the game is built as. Its assertion messages hold their source files' paths, which Clang writes with the target's separators (`-ffile-reproducible`), so that Windows and the other systems build the same `openreliant.exe`. None of FFmpeg's GPL parts are built.

[`platform/video.zig`](../../src/platform/video.zig) sets each decoder up as FFmpeg's demuxer would, and gives the engine the pictures, 4:2:0 in BT.601's limited range, and the sound, as 16-bit samples rounded as FFmpeg's conversion rounds them. The pictures and the sound match what the `ffmpeg` tool decodes from the same files with its plain C code (`-cpuflags 0`), to within the last bit of a sample. Since it is built without threads, FFmpeg is only called from the game's thread.

Expand Down
Loading