fmp4mux: Write lmsg as compatible brand into the last fragment

While this is only defined as such in DASH, it's used more widely and
shouldn't hurt to always have it there.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2222>
This commit is contained in:
Sebastian Dröge 2025-05-02 15:45:25 +03:00
parent d10993e15e
commit 86d2f2ce1f
3 changed files with 11 additions and 3 deletions

View file

@ -1818,11 +1818,15 @@ pub(super) fn create_fmp4_fragment_header(
) -> Result<(gst::Buffer, u64), Error> {
let mut v = vec![];
// Don't write a `styp` if this is only a chunk.
if !cfg.chunk {
let (brand, compatible_brands) =
// Don't write a `styp` if this is only a chunk unless it's the last.
if !cfg.chunk || cfg.last_fragment {
let (brand, mut compatible_brands) =
brands_from_variant_and_caps(cfg.variant, cfg.streams.iter().map(|s| &s.caps));
if cfg.last_fragment {
compatible_brands.push(b"lmsg");
}
write_box(&mut v, b"styp", |v| {
// major brand
v.extend(brand);

View file

@ -3211,6 +3211,7 @@ impl FMP4Mux {
chunk: !fragment_start,
streams: streams.as_slice(),
buffers: interleaved_buffers.as_slice(),
last_fragment: at_eos,
})
.map_err(|err| {
gst::error!(

View file

@ -240,6 +240,9 @@ pub(crate) struct FragmentHeaderConfiguration<'a> {
streams: &'a [FragmentHeaderStream],
buffers: &'a [Buffer],
/// If this is for the last fragment.
last_fragment: bool,
}
#[derive(Debug)]