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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2208>
This commit is contained in:
Sebastian Dröge 2025-04-21 11:05:12 +03:00 committed by GStreamer Marge Bot
parent 3e5da7a783
commit 7e00e8c90b
2 changed files with 7 additions and 0 deletions

View file

@ -1048,6 +1048,7 @@ fn write_visual_sample_entry(
let map = codec_data let map = codec_data
.map_readable() .map_readable()
.context("codec_data not mappable")?; .context("codec_data not mappable")?;
// TODO: create codec_specific_boxes when receiving caps
write_box(v, b"avcC", move |v| { write_box(v, b"avcC", move |v| {
v.extend_from_slice(&map); v.extend_from_slice(&map);
Ok(()) Ok(())
@ -1060,12 +1061,14 @@ fn write_visual_sample_entry(
let map = codec_data let map = codec_data
.map_readable() .map_readable()
.context("codec_data not mappable")?; .context("codec_data not mappable")?;
// TODO: create codec_specific_boxes when receiving caps
write_box(v, b"hvcC", move |v| { write_box(v, b"hvcC", move |v| {
v.extend_from_slice(&map); v.extend_from_slice(&map);
Ok(()) Ok(())
})?; })?;
} }
"video/x-vp9" => { "video/x-vp9" => {
// TODO: create codec_specific_boxes when receiving caps
let profile: u8 = match s.get::<&str>("profile").expect("no vp9 profile") { let profile: u8 = match s.get::<&str>("profile").expect("no vp9 profile") {
"0" => Some(0), "0" => Some(0),
"1" => Some(1), "1" => Some(1),
@ -1129,6 +1132,7 @@ fn write_visual_sample_entry(
})?; })?;
} }
"video/x-av1" => { "video/x-av1" => {
// TODO: create codec_specific_boxes when receiving caps
write_box(v, b"av1C", move |v| { write_box(v, b"av1C", move |v| {
if let Ok(codec_data) = s.get::<&gst::BufferRef>("codec_data") { if let Ok(codec_data) = s.get::<&gst::BufferRef>("codec_data") {
let map = codec_data let map = codec_data
@ -1441,6 +1445,7 @@ fn write_audio_sample_entry(
if map.len() < 2 { if map.len() < 2 {
bail!("too small codec_data"); bail!("too small codec_data");
} }
// TODO: create codec_specific_boxes when receiving caps
write_esds_aac(v, cfg, stream, &map)?; write_esds_aac(v, cfg, stream, &map)?;
} }
"audio/x-opus" => { "audio/x-opus" => {

View file

@ -1195,6 +1195,8 @@ impl FMP4Mux {
stream.dts_offset.display(), 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 // 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. // extra data of the 'av1C' box. It makes the stream playable in some browsers.
let s = stream.caps.structure(0).unwrap(); let s = stream.caps.structure(0).unwrap();