diff options
author | Jordan Petridis <jordan@centricular.com> | 2022-11-29 16:02:37 +0300 |
---|---|---|
committer | Jordan Petridis <jordan@centricular.com> | 2022-11-29 22:06:12 +0300 |
commit | a84eeeb240200be5a9f63a043d14939e0630095d (patch) | |
tree | b7f1b440d679e1e7ca243f5f5d8c7ec6f57c858d /mux/mp4 | |
parent | 821c23e202c87b7b9784165dbf2f3b354dd244e1 (diff) |
mux/{mp4, fmp4}: Hard depend on feature v1_18
Else --no-default-features was failing to compile.
v1_18 is needed to for the aggregator code.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/588>
Diffstat (limited to 'mux/mp4')
-rw-r--r-- | mux/mp4/Cargo.toml | 15 | ||||
-rw-r--r-- | mux/mp4/src/mp4mux/boxes.rs | 90 |
2 files changed, 31 insertions, 74 deletions
diff --git a/mux/mp4/Cargo.toml b/mux/mp4/Cargo.toml index dbcd89c53..121baf12c 100644 --- a/mux/mp4/Cargo.toml +++ b/mux/mp4/Cargo.toml @@ -10,11 +10,11 @@ rust-version = "1.63" [dependencies] anyhow = "1" -gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } -gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } -gst-audio = { package = "gstreamer-audio", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } -gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } -gst-pbutils = { package = "gstreamer-pbutils", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } +gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_18"] } +gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_18"] } +gst-audio = { package = "gstreamer-audio", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_18"] } +gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_18"] } +gst-pbutils = { package = "gstreamer-pbutils", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_18"] } once_cell = "1.0" [lib] @@ -30,11 +30,10 @@ url = "2" gst-plugin-version-helper = { path="../../version-helper" } [features] -default = ["v1_18"] +default = [] static = [] capi = [] -v1_18 = ["gst-video/v1_18"] -doc = ["gst/v1_18"] +doc = [] [package.metadata.capi] min_version = "0.8.0" diff --git a/mux/mp4/src/mp4mux/boxes.rs b/mux/mp4/src/mp4mux/boxes.rs index b160ce2b9..760e627d3 100644 --- a/mux/mp4/src/mp4mux/boxes.rs +++ b/mux/mp4/src/mp4mux/boxes.rs @@ -904,50 +904,11 @@ fn write_visual_sample_entry( write_box(v, b"colr", move |v| { v.extend(b"nclx"); let (primaries, transfer, matrix) = { - #[cfg(feature = "v1_18")] - { - ( - (colorimetry.primaries().to_iso() as u16), - (colorimetry.transfer().to_iso() as u16), - (colorimetry.matrix().to_iso() as u16), - ) - } - #[cfg(not(feature = "v1_18"))] - { - let primaries = match colorimetry.primaries() { - gst_video::VideoColorPrimaries::Bt709 => 1u16, - gst_video::VideoColorPrimaries::Bt470m => 4u16, - gst_video::VideoColorPrimaries::Bt470bg => 5u16, - gst_video::VideoColorPrimaries::Smpte170m => 6u16, - gst_video::VideoColorPrimaries::Smpte240m => 7u16, - gst_video::VideoColorPrimaries::Film => 8u16, - gst_video::VideoColorPrimaries::Bt2020 => 9u16, - _ => 2, - }; - let transfer = match colorimetry.transfer() { - gst_video::VideoTransferFunction::Bt709 => 1u16, - gst_video::VideoTransferFunction::Gamma22 => 4u16, - gst_video::VideoTransferFunction::Gamma28 => 5u16, - gst_video::VideoTransferFunction::Smpte240m => 7u16, - gst_video::VideoTransferFunction::Gamma10 => 8u16, - gst_video::VideoTransferFunction::Log100 => 9u16, - gst_video::VideoTransferFunction::Log316 => 10u16, - gst_video::VideoTransferFunction::Srgb => 13u16, - gst_video::VideoTransferFunction::Bt202012 => 15u16, - _ => 2, - }; - let matrix = match colorimetry.matrix() { - gst_video::VideoColorMatrix::Rgb => 0u16, - gst_video::VideoColorMatrix::Bt709 => 1u16, - gst_video::VideoColorMatrix::Fcc => 4u16, - gst_video::VideoColorMatrix::Bt601 => 6u16, - gst_video::VideoColorMatrix::Smpte240m => 7u16, - gst_video::VideoColorMatrix::Bt2020 => 9u16, - _ => 2, - }; - - (primaries, transfer, matrix) - } + ( + (colorimetry.primaries().to_iso() as u16), + (colorimetry.transfer().to_iso() as u16), + (colorimetry.matrix().to_iso() as u16), + ) }; let full_range = match colorimetry.range() { @@ -965,29 +926,26 @@ fn write_visual_sample_entry( })?; } - #[cfg(feature = "v1_18")] - { - if let Ok(cll) = gst_video::VideoContentLightLevel::from_caps(&stream.caps) { - write_box(v, b"clli", move |v| { - v.extend((cll.max_content_light_level() as u16).to_be_bytes()); - v.extend((cll.max_frame_average_light_level() as u16).to_be_bytes()); - Ok(()) - })?; - } + if let Ok(cll) = gst_video::VideoContentLightLevel::from_caps(&stream.caps) { + write_box(v, b"clli", move |v| { + v.extend((cll.max_content_light_level() as u16).to_be_bytes()); + v.extend((cll.max_frame_average_light_level() as u16).to_be_bytes()); + Ok(()) + })?; + } - if let Ok(mastering) = gst_video::VideoMasteringDisplayInfo::from_caps(&stream.caps) { - write_box(v, b"mdcv", move |v| { - for primary in mastering.display_primaries() { - v.extend(primary.x.to_be_bytes()); - v.extend(primary.y.to_be_bytes()); - } - v.extend(mastering.white_point().x.to_be_bytes()); - v.extend(mastering.white_point().y.to_be_bytes()); - v.extend(mastering.max_display_mastering_luminance().to_be_bytes()); - v.extend(mastering.max_display_mastering_luminance().to_be_bytes()); - Ok(()) - })?; - } + if let Ok(mastering) = gst_video::VideoMasteringDisplayInfo::from_caps(&stream.caps) { + write_box(v, b"mdcv", move |v| { + for primary in mastering.display_primaries() { + v.extend(primary.x.to_be_bytes()); + v.extend(primary.y.to_be_bytes()); + } + v.extend(mastering.white_point().x.to_be_bytes()); + v.extend(mastering.white_point().y.to_be_bytes()); + v.extend(mastering.max_display_mastering_luminance().to_be_bytes()); + v.extend(mastering.max_display_mastering_luminance().to_be_bytes()); + Ok(()) + })?; } // Write fiel box for codecs that require it |