From 7e00e8c90b583df75824cff8fce3f56dfd648aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 21 Apr 2025 11:05:12 +0300 Subject: [PATCH] fmp4mux: Add TODO comments for creating codec specific boxes when receiving caps Keeps error checking up-front and keeps things more consistent overall. Part-of: --- mux/fmp4/src/fmp4mux/boxes.rs | 5 +++++ mux/fmp4/src/fmp4mux/imp.rs | 2 ++ 2 files changed, 7 insertions(+) diff --git a/mux/fmp4/src/fmp4mux/boxes.rs b/mux/fmp4/src/fmp4mux/boxes.rs index 09eace653..322d062b9 100644 --- a/mux/fmp4/src/fmp4mux/boxes.rs +++ b/mux/fmp4/src/fmp4mux/boxes.rs @@ -1048,6 +1048,7 @@ fn write_visual_sample_entry( let map = codec_data .map_readable() .context("codec_data not mappable")?; + // TODO: create codec_specific_boxes when receiving caps write_box(v, b"avcC", move |v| { v.extend_from_slice(&map); Ok(()) @@ -1060,12 +1061,14 @@ fn write_visual_sample_entry( let map = codec_data .map_readable() .context("codec_data not mappable")?; + // TODO: create codec_specific_boxes when receiving caps write_box(v, b"hvcC", move |v| { v.extend_from_slice(&map); Ok(()) })?; } "video/x-vp9" => { + // TODO: create codec_specific_boxes when receiving caps let profile: u8 = match s.get::<&str>("profile").expect("no vp9 profile") { "0" => Some(0), "1" => Some(1), @@ -1129,6 +1132,7 @@ fn write_visual_sample_entry( })?; } "video/x-av1" => { + // TODO: create codec_specific_boxes when receiving caps write_box(v, b"av1C", move |v| { if let Ok(codec_data) = s.get::<&gst::BufferRef>("codec_data") { let map = codec_data @@ -1441,6 +1445,7 @@ fn write_audio_sample_entry( if map.len() < 2 { bail!("too small codec_data"); } + // TODO: create codec_specific_boxes when receiving caps write_esds_aac(v, cfg, stream, &map)?; } "audio/x-opus" => { diff --git a/mux/fmp4/src/fmp4mux/imp.rs b/mux/fmp4/src/fmp4mux/imp.rs index 759ba80d5..0faf76ea7 100644 --- a/mux/fmp4/src/fmp4mux/imp.rs +++ b/mux/fmp4/src/fmp4mux/imp.rs @@ -1195,6 +1195,8 @@ impl FMP4Mux { stream.dts_offset.display(), ); + // TODO: Move this to the stream creation + // If the stream is AV1, we need to parse the SequenceHeader OBU to include in the // extra data of the 'av1C' box. It makes the stream playable in some browsers. let s = stream.caps.structure(0).unwrap();