diff --git a/deps/ffmpeg/build.zig b/deps/ffmpeg/build.zig index fc1e88ee..78ef3e81 100644 --- a/deps/ffmpeg/build.zig +++ b/deps/ffmpeg/build.zig @@ -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", .{}); diff --git a/docs/port/platform.md b/docs/port/platform.md index b638f018..623ee236 100644 --- a/docs/port/platform.md +++ b/docs/port/platform.md @@ -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.