From aefd6b634284169dbbb3775eefa2e15c0e83f63f Mon Sep 17 00:00:00 2001 From: Matthew Jackson <1085847+MattJackson@users.noreply.github.com> Date: Fri, 26 Jun 2026 21:33:19 -0700 Subject: [PATCH] mux: single source of truth for the version label (VERSION_LABEL/MUX_APP) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CLI --version, the MKV muxing/writing-application field, and the FVI generator all derive from one libfreemkv const, so a binary reports the exact same label it stamps into the files it produces — no split-brain where an MKV claims one version and the binary another. --- src/lib.rs | 14 ++++++++++++++ src/mux/mkv.rs | 6 ++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3b03e1c..12e89b4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -85,6 +85,20 @@ //! | E8xxx | Keydb errors (fetch, parse, load) | //! | E9xxx | Stream / mux errors (URL, PES, pipeline) | +/// Single source of truth for every freemkv version surface. +/// +/// `FREEMKV_VERSION` is the package version, overridable at build time via the +/// `FREEMKV_BUILD_LABEL` env (see `build.rs`); `GIT_SUFFIX` is the git short +/// hash. The CLI's `--version`, the MKV muxing/writing-application field, and +/// the FVI generator tag all derive from these two consts, so a binary reports +/// the exact same label it stamps into the files it produces — no split-brain +/// where an MKV claims one version and the binary another. +pub const VERSION_LABEL: &str = concat!(env!("FREEMKV_VERSION"), env!("GIT_SUFFIX")); + +/// The muxing/writing-application string written into MKV output +/// (`"freemkv (g)"`). +pub const MUX_APP: &str = concat!("freemkv ", env!("FREEMKV_VERSION"), env!("GIT_SUFFIX")); + pub mod aacs; pub(crate) mod clpi; pub mod consts; diff --git a/src/mux/mkv.rs b/src/mux/mkv.rs index e1e355a..fd99cdb 100644 --- a/src/mux/mkv.rs +++ b/src/mux/mkv.rs @@ -773,10 +773,8 @@ impl MkvMuxer { } // Stamp the freemkv version so any muxed file is traceable to the build // that produced it (MediaInfo "Writing application"/"library"). - const FREEMKV_MUX_APP: &str = - concat!("freemkv ", env!("FREEMKV_VERSION"), env!("GIT_SUFFIX")); - ebml::write_string(&mut writer, ebml::MUXING_APP, FREEMKV_MUX_APP)?; - ebml::write_string(&mut writer, ebml::WRITING_APP, FREEMKV_MUX_APP)?; + ebml::write_string(&mut writer, ebml::MUXING_APP, crate::MUX_APP)?; + ebml::write_string(&mut writer, ebml::WRITING_APP, crate::MUX_APP)?; if let Some(t) = title { ebml::write_string(&mut writer, ebml::TITLE, t)?; }