mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-25 13:01:07 +00:00
Update for caps/structure-related string API changes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1048>
This commit is contained in:
parent
0c954135a3
commit
6132788b02
16 changed files with 89 additions and 84 deletions
|
@ -1331,16 +1331,14 @@ impl AudioFormat {
|
|||
|
||||
if self.rate != 0 {
|
||||
if let Some(ref mut caps) = caps.as_mut() {
|
||||
caps.get_mut()
|
||||
.unwrap()
|
||||
.set_simple(&[("rate", &(self.rate as i32))])
|
||||
caps.get_mut().unwrap().set("rate", self.rate as i32)
|
||||
}
|
||||
}
|
||||
if self.channels != 0 {
|
||||
if let Some(ref mut caps) = caps.as_mut() {
|
||||
caps.get_mut()
|
||||
.unwrap()
|
||||
.set_simple(&[("channels", &(self.channels as i32))])
|
||||
.set("channels", self.channels as i32)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1441,19 +1439,19 @@ impl VideoFormat {
|
|||
|
||||
if let (Some(width), Some(height)) = (self.width, self.height) {
|
||||
if let Some(ref mut caps) = caps.as_mut() {
|
||||
caps.get_mut()
|
||||
.unwrap()
|
||||
.set_simple(&[("width", &(width as i32)), ("height", &(height as i32))])
|
||||
let caps = caps.get_mut().unwrap();
|
||||
caps.set("width", width as i32);
|
||||
caps.set("height", height as i32);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(par) = self.pixel_aspect_ratio {
|
||||
if *par.numer() != 0 && par.numer() != par.denom() {
|
||||
if let Some(ref mut caps) = caps.as_mut() {
|
||||
caps.get_mut().unwrap().set_simple(&[(
|
||||
caps.get_mut().unwrap().set(
|
||||
"pixel-aspect-ratio",
|
||||
&gst::Fraction::new(*par.numer(), *par.denom()),
|
||||
)])
|
||||
gst::Fraction::new(*par.numer(), *par.denom()),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1461,10 +1459,9 @@ impl VideoFormat {
|
|||
if let Some(fps) = self.framerate {
|
||||
if *fps.numer() != 0 {
|
||||
if let Some(ref mut caps) = caps.as_mut() {
|
||||
caps.get_mut().unwrap().set_simple(&[(
|
||||
"framerate",
|
||||
&gst::Fraction::new(*fps.numer(), *fps.denom()),
|
||||
)])
|
||||
caps.get_mut()
|
||||
.unwrap()
|
||||
.set("framerate", gst::Fraction::new(*fps.numer(), *fps.denom()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ fn write_full_box<T, F: FnOnce(&mut Vec<u8>) -> Result<T, Error>>(
|
|||
|
||||
fn cmaf_brands_from_caps(caps: &gst::CapsRef, compatible_brands: &mut Vec<&'static [u8; 4]>) {
|
||||
let s = caps.structure(0).unwrap();
|
||||
match s.name() {
|
||||
match s.name().as_str() {
|
||||
"video/x-h264" => {
|
||||
let width = s.get::<i32>("width").ok();
|
||||
let height = s.get::<i32>("height").ok();
|
||||
|
@ -411,7 +411,10 @@ fn write_moov(v: &mut Vec<u8>, cfg: &super::HeaderConfiguration) -> Result<(), E
|
|||
for (idx, other_stream) in cfg.streams.iter().enumerate() {
|
||||
let s = other_stream.caps.structure(0).unwrap();
|
||||
|
||||
if matches!(s.name(), "video/x-h264" | "video/x-h265" | "image/jpeg") {
|
||||
if matches!(
|
||||
s.name().as_str(),
|
||||
"video/x-h264" | "video/x-h265" | "image/jpeg"
|
||||
) {
|
||||
references.push(TrackReference {
|
||||
reference_type: *b"cdsc",
|
||||
track_ids: vec![idx as u32 + 1],
|
||||
|
@ -600,7 +603,7 @@ fn write_tkhd(
|
|||
|
||||
// Volume
|
||||
let s = stream.caps.structure(0).unwrap();
|
||||
match s.name() {
|
||||
match s.name().as_str() {
|
||||
"audio/mpeg" | "audio/x-opus" | "audio/x-alaw" | "audio/x-mulaw" | "audio/x-adpcm" => {
|
||||
v.extend((1u16 << 8).to_be_bytes())
|
||||
}
|
||||
|
@ -628,7 +631,7 @@ fn write_tkhd(
|
|||
);
|
||||
|
||||
// Width/height
|
||||
match s.name() {
|
||||
match s.name().as_str() {
|
||||
"video/x-h264" | "video/x-h265" | "video/x-vp9" | "image/jpeg" => {
|
||||
let width = s.get::<i32>("width").context("video caps without width")? as u32;
|
||||
let height = s
|
||||
|
@ -738,7 +741,7 @@ fn write_hdlr(
|
|||
v.extend([0u8; 4]);
|
||||
|
||||
let s = stream.caps.structure(0).unwrap();
|
||||
let (handler_type, name) = match s.name() {
|
||||
let (handler_type, name) = match s.name().as_str() {
|
||||
"video/x-h264" | "video/x-h265" | "video/x-vp9" | "image/jpeg" => {
|
||||
(b"vide", b"VideoHandler\0".as_slice())
|
||||
}
|
||||
|
@ -768,7 +771,7 @@ fn write_minf(
|
|||
) -> Result<(), Error> {
|
||||
let s = stream.caps.structure(0).unwrap();
|
||||
|
||||
match s.name() {
|
||||
match s.name().as_str() {
|
||||
"video/x-h264" | "video/x-h265" | "video/x-vp9" | "image/jpeg" => {
|
||||
// Flags are always 1 for unspecified reasons
|
||||
write_full_box(v, b"vmhd", FULL_BOX_VERSION_0, 1, |v| write_vmhd(v, cfg))?
|
||||
|
@ -879,7 +882,7 @@ fn write_stsd(
|
|||
v.extend(1u32.to_be_bytes());
|
||||
|
||||
let s = stream.caps.structure(0).unwrap();
|
||||
match s.name() {
|
||||
match s.name().as_str() {
|
||||
"video/x-h264" | "video/x-h265" | "video/x-vp9" | "image/jpeg" => {
|
||||
write_visual_sample_entry(v, cfg, stream)?
|
||||
}
|
||||
|
@ -915,7 +918,7 @@ fn write_visual_sample_entry(
|
|||
stream: &super::HeaderStream,
|
||||
) -> Result<(), Error> {
|
||||
let s = stream.caps.structure(0).unwrap();
|
||||
let fourcc = match s.name() {
|
||||
let fourcc = match s.name().as_str() {
|
||||
"video/x-h264" => {
|
||||
let stream_format = s.get::<&str>("stream-format").context("no stream-format")?;
|
||||
match stream_format {
|
||||
|
@ -977,7 +980,7 @@ fn write_visual_sample_entry(
|
|||
v.extend((-1i16).to_be_bytes());
|
||||
|
||||
// Codec specific boxes
|
||||
match s.name() {
|
||||
match s.name().as_str() {
|
||||
"video/x-h264" => {
|
||||
let codec_data = s
|
||||
.get::<&gst::BufferRef>("codec_data")
|
||||
|
@ -1132,7 +1135,7 @@ fn write_visual_sample_entry(
|
|||
}
|
||||
|
||||
// Write fiel box for codecs that require it
|
||||
if ["image/jpeg"].contains(&s.name()) {
|
||||
if ["image/jpeg"].contains(&s.name().as_str()) {
|
||||
let interlace_mode = s
|
||||
.get::<&str>("interlace-mode")
|
||||
.ok()
|
||||
|
@ -1176,7 +1179,7 @@ fn write_audio_sample_entry(
|
|||
stream: &super::HeaderStream,
|
||||
) -> Result<(), Error> {
|
||||
let s = stream.caps.structure(0).unwrap();
|
||||
let fourcc = match s.name() {
|
||||
let fourcc = match s.name().as_str() {
|
||||
"audio/mpeg" => b"mp4a",
|
||||
"audio/x-opus" => b"Opus",
|
||||
"audio/x-alaw" => b"alaw",
|
||||
|
@ -1192,7 +1195,7 @@ fn write_audio_sample_entry(
|
|||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
let sample_size = match s.name() {
|
||||
let sample_size = match s.name().as_str() {
|
||||
"audio/x-adpcm" => {
|
||||
let bitrate = s.get::<i32>("bitrate").context("no ADPCM bitrate field")?;
|
||||
(bitrate / 8000) as u16
|
||||
|
@ -1223,7 +1226,7 @@ fn write_audio_sample_entry(
|
|||
v.extend((u32::from(rate) << 16).to_be_bytes());
|
||||
|
||||
// Codec specific boxes
|
||||
match s.name() {
|
||||
match s.name().as_str() {
|
||||
"audio/mpeg" => {
|
||||
let codec_data = s
|
||||
.get::<&gst::BufferRef>("codec_data")
|
||||
|
@ -1439,7 +1442,7 @@ fn write_xml_meta_data_sample_entry(
|
|||
stream: &super::HeaderStream,
|
||||
) -> Result<(), Error> {
|
||||
let s = stream.caps.structure(0).unwrap();
|
||||
let namespace = match s.name() {
|
||||
let namespace = match s.name().as_str() {
|
||||
"application/x-onvif-metadata" => b"http://www.onvif.org/ver10/schema",
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
|
|
@ -1638,7 +1638,7 @@ impl FMP4Mux {
|
|||
let s = caps.structure(0).unwrap();
|
||||
|
||||
let mut delta_frames = DeltaFrames::IntraOnly;
|
||||
match s.name() {
|
||||
match s.name().as_str() {
|
||||
"video/x-h264" | "video/x-h265" => {
|
||||
if !s.has_field_with_type("codec_data", gst::Buffer::static_type()) {
|
||||
gst::error!(CAT, obj: pad, "Received caps without codec_data");
|
||||
|
|
|
@ -190,7 +190,10 @@ fn write_moov(v: &mut Vec<u8>, header: &super::Header) -> Result<(), Error> {
|
|||
for (idx, other_stream) in header.streams.iter().enumerate() {
|
||||
let s = other_stream.caps.structure(0).unwrap();
|
||||
|
||||
if matches!(s.name(), "video/x-h264" | "video/x-h265" | "image/jpeg") {
|
||||
if matches!(
|
||||
s.name().as_str(),
|
||||
"video/x-h264" | "video/x-h265" | "image/jpeg"
|
||||
) {
|
||||
references.push(TrackReference {
|
||||
reference_type: *b"cdsc",
|
||||
track_ids: vec![idx as u32 + 1],
|
||||
|
@ -378,7 +381,7 @@ fn write_tkhd(
|
|||
|
||||
// Volume
|
||||
let s = stream.caps.structure(0).unwrap();
|
||||
match s.name() {
|
||||
match s.name().as_str() {
|
||||
"audio/mpeg" | "audio/x-opus" | "audio/x-alaw" | "audio/x-mulaw" | "audio/x-adpcm" => {
|
||||
v.extend((1u16 << 8).to_be_bytes())
|
||||
}
|
||||
|
@ -406,7 +409,7 @@ fn write_tkhd(
|
|||
);
|
||||
|
||||
// Width/height
|
||||
match s.name() {
|
||||
match s.name().as_str() {
|
||||
"video/x-h264" | "video/x-h265" | "video/x-vp9" | "image/jpeg" => {
|
||||
let width = s.get::<i32>("width").context("video caps without width")? as u32;
|
||||
let height = s
|
||||
|
@ -507,7 +510,7 @@ fn write_hdlr(
|
|||
v.extend([0u8; 4]);
|
||||
|
||||
let s = stream.caps.structure(0).unwrap();
|
||||
let (handler_type, name) = match s.name() {
|
||||
let (handler_type, name) = match s.name().as_str() {
|
||||
"video/x-h264" | "video/x-h265" | "video/x-vp9" | "image/jpeg" => {
|
||||
(b"vide", b"VideoHandler\0".as_slice())
|
||||
}
|
||||
|
@ -537,7 +540,7 @@ fn write_minf(
|
|||
) -> Result<(), Error> {
|
||||
let s = stream.caps.structure(0).unwrap();
|
||||
|
||||
match s.name() {
|
||||
match s.name().as_str() {
|
||||
"video/x-h264" | "video/x-h265" | "video/x-vp9" | "image/jpeg" => {
|
||||
// Flags are always 1 for unspecified reasons
|
||||
write_full_box(v, b"vmhd", FULL_BOX_VERSION_0, 1, |v| write_vmhd(v, header))?
|
||||
|
@ -696,7 +699,7 @@ fn write_stsd(
|
|||
v.extend(1u32.to_be_bytes());
|
||||
|
||||
let s = stream.caps.structure(0).unwrap();
|
||||
match s.name() {
|
||||
match s.name().as_str() {
|
||||
"video/x-h264" | "video/x-h265" | "video/x-vp9" | "image/jpeg" => {
|
||||
write_visual_sample_entry(v, header, stream)?
|
||||
}
|
||||
|
@ -732,7 +735,7 @@ fn write_visual_sample_entry(
|
|||
stream: &super::Stream,
|
||||
) -> Result<(), Error> {
|
||||
let s = stream.caps.structure(0).unwrap();
|
||||
let fourcc = match s.name() {
|
||||
let fourcc = match s.name().as_str() {
|
||||
"video/x-h264" => {
|
||||
let stream_format = s.get::<&str>("stream-format").context("no stream-format")?;
|
||||
match stream_format {
|
||||
|
@ -794,7 +797,7 @@ fn write_visual_sample_entry(
|
|||
v.extend((-1i16).to_be_bytes());
|
||||
|
||||
// Codec specific boxes
|
||||
match s.name() {
|
||||
match s.name().as_str() {
|
||||
"video/x-h264" => {
|
||||
let codec_data = s
|
||||
.get::<&gst::BufferRef>("codec_data")
|
||||
|
@ -949,7 +952,7 @@ fn write_visual_sample_entry(
|
|||
}
|
||||
|
||||
// Write fiel box for codecs that require it
|
||||
if ["image/jpeg"].contains(&s.name()) {
|
||||
if ["image/jpeg"].contains(&s.name().as_str()) {
|
||||
let interlace_mode = s
|
||||
.get::<&str>("interlace-mode")
|
||||
.ok()
|
||||
|
@ -993,7 +996,7 @@ fn write_audio_sample_entry(
|
|||
stream: &super::Stream,
|
||||
) -> Result<(), Error> {
|
||||
let s = stream.caps.structure(0).unwrap();
|
||||
let fourcc = match s.name() {
|
||||
let fourcc = match s.name().as_str() {
|
||||
"audio/mpeg" => b"mp4a",
|
||||
"audio/x-opus" => b"Opus",
|
||||
"audio/x-alaw" => b"alaw",
|
||||
|
@ -1009,7 +1012,7 @@ fn write_audio_sample_entry(
|
|||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
let sample_size = match s.name() {
|
||||
let sample_size = match s.name().as_str() {
|
||||
"audio/x-adpcm" => {
|
||||
let bitrate = s.get::<i32>("bitrate").context("no ADPCM bitrate field")?;
|
||||
(bitrate / 8000) as u16
|
||||
|
@ -1040,7 +1043,7 @@ fn write_audio_sample_entry(
|
|||
v.extend((u32::from(rate) << 16).to_be_bytes());
|
||||
|
||||
// Codec specific boxes
|
||||
match s.name() {
|
||||
match s.name().as_str() {
|
||||
"audio/mpeg" => {
|
||||
let codec_data = s
|
||||
.get::<&gst::BufferRef>("codec_data")
|
||||
|
@ -1256,7 +1259,7 @@ fn write_xml_meta_data_sample_entry(
|
|||
stream: &super::Stream,
|
||||
) -> Result<(), Error> {
|
||||
let s = stream.caps.structure(0).unwrap();
|
||||
let namespace = match s.name() {
|
||||
let namespace = match s.name().as_str() {
|
||||
"application/x-onvif-metadata" => b"http://www.onvif.org/ver10/schema",
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
|
|
@ -870,7 +870,7 @@ impl MP4Mux {
|
|||
let s = caps.structure(0).unwrap();
|
||||
|
||||
let mut delta_frames = super::DeltaFrames::IntraOnly;
|
||||
match s.name() {
|
||||
match s.name().as_str() {
|
||||
"video/x-h264" | "video/x-h265" => {
|
||||
if !s.has_field_with_type("codec_data", gst::Buffer::static_type()) {
|
||||
gst::error!(CAT, obj: pad, "Received caps without codec_data");
|
||||
|
|
|
@ -389,7 +389,7 @@ impl BinImpl for HlsSink3 {
|
|||
}
|
||||
|
||||
let s = msg.structure().unwrap();
|
||||
match s.name() {
|
||||
match s.name().as_str() {
|
||||
"splitmuxsink-fragment-opened" => {
|
||||
if let Ok(new_fragment_opened_at) = s.get::<gst::ClockTime>("running-time")
|
||||
{
|
||||
|
|
|
@ -148,9 +148,9 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
|||
}
|
||||
|
||||
static TIMECODE_CAPS: Lazy<gst::Caps> =
|
||||
Lazy::new(|| gst::Caps::new_simple("timestamp/x-ndi-timecode", &[]));
|
||||
Lazy::new(|| gst::Caps::new_empty_simple("timestamp/x-ndi-timecode"));
|
||||
static TIMESTAMP_CAPS: Lazy<gst::Caps> =
|
||||
Lazy::new(|| gst::Caps::new_simple("timestamp/x-ndi-timestamp", &[]));
|
||||
Lazy::new(|| gst::Caps::new_empty_simple("timestamp/x-ndi-timestamp"));
|
||||
|
||||
gst::plugin_define!(
|
||||
ndi,
|
||||
|
|
|
@ -91,7 +91,7 @@ impl OnvifMetadataOverlay {
|
|||
|
||||
let upstream_has_meta = caps
|
||||
.features(0)
|
||||
.map(|f| f.contains(&gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION))
|
||||
.map(|f| f.contains(gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION))
|
||||
.unwrap_or(false);
|
||||
|
||||
if !upstream_has_meta {
|
||||
|
@ -99,7 +99,7 @@ impl OnvifMetadataOverlay {
|
|||
let overlay_caps = caps_clone.make_mut();
|
||||
|
||||
if let Some(features) = overlay_caps.features_mut(0) {
|
||||
features.add(&gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
|
||||
features.add(gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
|
||||
let peercaps = self.srcpad.peer_query_caps(Some(&caps_clone));
|
||||
downstream_accepts_meta = !peercaps.is_empty();
|
||||
if downstream_accepts_meta {
|
||||
|
|
|
@ -379,7 +379,7 @@ impl ReqwestHttpSrc {
|
|||
|
||||
if let Some(ref extra_headers) = settings.extra_headers {
|
||||
for (field, value) in extra_headers.iter() {
|
||||
let field = match HeaderName::try_from(field) {
|
||||
let field = match HeaderName::try_from(field.as_str()) {
|
||||
Ok(field) => field,
|
||||
Err(err) => {
|
||||
gst::warning!(
|
||||
|
|
|
@ -263,12 +263,12 @@ impl Default for Settings {
|
|||
fn default() -> Self {
|
||||
Self {
|
||||
video_caps: ["video/x-vp8", "video/x-h264", "video/x-vp9", "video/x-h265"]
|
||||
.iter()
|
||||
.map(|s| gst::Structure::new_empty(s))
|
||||
.into_iter()
|
||||
.map(gst::Structure::new_empty)
|
||||
.collect::<gst::Caps>(),
|
||||
audio_caps: ["audio/x-opus"]
|
||||
.iter()
|
||||
.map(|s| gst::Structure::new_empty(s))
|
||||
.into_iter()
|
||||
.map(gst::Structure::new_empty)
|
||||
.collect::<gst::Caps>(),
|
||||
stun_server: DEFAULT_STUN_SERVER.map(String::from),
|
||||
turn_servers: gst::Array::new(Vec::new() as Vec<glib::SendValue>),
|
||||
|
@ -848,7 +848,7 @@ impl Session {
|
|||
|
||||
{
|
||||
let payloader_caps_mut = payloader_caps.make_mut();
|
||||
payloader_caps_mut.set_simple(&[("ssrc", &ssrc)]);
|
||||
payloader_caps_mut.set("ssrc", ssrc);
|
||||
}
|
||||
|
||||
gst::info!(
|
||||
|
@ -949,7 +949,7 @@ impl Session {
|
|||
.property::<gst_webrtc::WebRTCRTPTransceiver>("transceiver");
|
||||
transceiver.set_property("codec-preferences", None::<gst::Caps>);
|
||||
|
||||
let mut global_caps = gst::Caps::new_simple("application/x-unknown", &[]);
|
||||
let mut global_caps = gst::Caps::new_empty_simple("application/x-unknown");
|
||||
|
||||
let sdp = self.sdp.as_ref().unwrap();
|
||||
let sdp_media = sdp.media(webrtc_pad.media_idx).unwrap();
|
||||
|
@ -1107,10 +1107,9 @@ impl NavigationEventHandler {
|
|||
"create-data-channel",
|
||||
&[
|
||||
&"input",
|
||||
&gst::Structure::new(
|
||||
"config",
|
||||
&[("priority", &gst_webrtc::WebRTCPriorityType::High)],
|
||||
),
|
||||
&gst::Structure::builder("config")
|
||||
.field("priority", gst_webrtc::WebRTCPriorityType::High)
|
||||
.build(),
|
||||
],
|
||||
);
|
||||
|
||||
|
@ -2138,7 +2137,7 @@ impl WebRTCSink {
|
|||
|
||||
if let Some(s) = caps.structure(0) {
|
||||
let mut s = s.to_owned();
|
||||
s.remove_fields(&[
|
||||
s.remove_fields([
|
||||
"timestamp-offset",
|
||||
"seqnum-offset",
|
||||
"ssrc",
|
||||
|
@ -2173,7 +2172,7 @@ impl WebRTCSink {
|
|||
) -> (String, gst::Caps) {
|
||||
let sink_caps = in_caps.as_ref().to_owned();
|
||||
|
||||
let is_video = match sink_caps.structure(0).unwrap().name() {
|
||||
let is_video = match sink_caps.structure(0).unwrap().name().as_str() {
|
||||
"video/x-raw" => true,
|
||||
"audio/x-raw" => false,
|
||||
_ => unreachable!(),
|
||||
|
@ -2710,15 +2709,15 @@ impl ElementImpl for WebRTCSink {
|
|||
.structure(gst::Structure::builder("video/x-raw").build())
|
||||
.structure_with_features(
|
||||
gst::Structure::builder("video/x-raw").build(),
|
||||
gst::CapsFeatures::new(&[CUDA_MEMORY_FEATURE]),
|
||||
gst::CapsFeatures::new([CUDA_MEMORY_FEATURE]),
|
||||
)
|
||||
.structure_with_features(
|
||||
gst::Structure::builder("video/x-raw").build(),
|
||||
gst::CapsFeatures::new(&[GL_MEMORY_FEATURE]),
|
||||
gst::CapsFeatures::new([GL_MEMORY_FEATURE]),
|
||||
)
|
||||
.structure_with_features(
|
||||
gst::Structure::builder("video/x-raw").build(),
|
||||
gst::CapsFeatures::new(&[NVMM_MEMORY_FEATURE]),
|
||||
gst::CapsFeatures::new([NVMM_MEMORY_FEATURE]),
|
||||
)
|
||||
.build();
|
||||
let video_pad_template = gst::PadTemplate::new(
|
||||
|
|
|
@ -59,12 +59,12 @@ impl Default for Settings {
|
|||
"video/x-h265",
|
||||
"video/x-av1",
|
||||
]
|
||||
.iter()
|
||||
.map(|s| gst::Structure::new_empty(s))
|
||||
.into_iter()
|
||||
.map(gst::Structure::new_empty)
|
||||
.collect::<gst::Caps>(),
|
||||
audio_caps: ["audio/x-opus"]
|
||||
.iter()
|
||||
.map(|s| gst::Structure::new_empty(s))
|
||||
.into_iter()
|
||||
.map(gst::Structure::new_empty)
|
||||
.collect::<gst::Caps>(),
|
||||
stun_server: None,
|
||||
turn_server: None,
|
||||
|
|
|
@ -202,7 +202,7 @@ impl ObjectImpl for RegEx {
|
|||
}
|
||||
};
|
||||
|
||||
match operation {
|
||||
match operation.as_str() {
|
||||
"replace-all" | "replace_all" => {
|
||||
let replacement = match s.get::<Option<String>>("replacement") {
|
||||
Ok(Some(pattern)) => pattern,
|
||||
|
|
|
@ -860,7 +860,7 @@ impl FallbackSwitch {
|
|||
let caps = caps.caps();
|
||||
debug!(CAT, obj: pad, "Received caps {}", caps);
|
||||
|
||||
let caps_info = match caps.structure(0).unwrap().name() {
|
||||
let caps_info = match caps.structure(0).unwrap().name().as_str() {
|
||||
"audio/x-raw" => {
|
||||
CapsInfo::Audio(gst_audio::AudioInfo::from_caps(caps).unwrap())
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ impl VideoDecoderImpl for CdgDec {
|
|||
let pools = query.allocation_pools();
|
||||
if let Some((Some(ref pool), _, _, _)) = pools.first() {
|
||||
let mut config = pool.config();
|
||||
config.add_option(&gst_video::BUFFER_POOL_OPTION_VIDEO_META);
|
||||
config.add_option(gst_video::BUFFER_POOL_OPTION_VIDEO_META);
|
||||
pool.set_config(config)
|
||||
.map_err(|_| gst::loggable_error!(CAT, "Failed to configure buffer pool"))?;
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ impl Cea608Overlay {
|
|||
|
||||
let upstream_has_meta = caps
|
||||
.features(0)
|
||||
.map(|f| f.contains(&gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION))
|
||||
.map(|f| f.contains(gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION))
|
||||
.unwrap_or(false);
|
||||
|
||||
if !upstream_has_meta {
|
||||
|
@ -274,7 +274,7 @@ impl Cea608Overlay {
|
|||
let overlay_caps = caps_clone.make_mut();
|
||||
|
||||
if let Some(features) = overlay_caps.features_mut(0) {
|
||||
features.add(&gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
|
||||
features.add(gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
|
||||
let peercaps = self.srcpad.peer_query_caps(Some(&caps_clone));
|
||||
downstream_accepts_meta = !peercaps.is_empty();
|
||||
if downstream_accepts_meta {
|
||||
|
|
|
@ -147,10 +147,16 @@ impl ElementImpl for PaintableSink {
|
|||
|
||||
for features in [
|
||||
None,
|
||||
Some(&["memory:GLMemory", "meta:GstVideoOverlayComposition"][..]),
|
||||
Some(&["memory:GLMemory"][..]),
|
||||
Some(&["memory:SystemMemory", "meta:GstVideoOverlayComposition"][..]),
|
||||
Some(&["meta:GstVideoOverlayComposition"][..]),
|
||||
Some(gst::CapsFeatures::new([
|
||||
"memory:GLMemory",
|
||||
"meta:GstVideoOverlayComposition",
|
||||
])),
|
||||
Some(gst::CapsFeatures::new(["memory:GLMemory"])),
|
||||
Some(gst::CapsFeatures::new([
|
||||
"memory:SystemMemory",
|
||||
"meta:GstVideoOverlayComposition",
|
||||
])),
|
||||
Some(gst::CapsFeatures::new(["meta:GstVideoOverlayComposition"])),
|
||||
] {
|
||||
let mut c = gst_video::video_make_raw_caps(&[
|
||||
gst_video::VideoFormat::Bgra,
|
||||
|
@ -163,15 +169,12 @@ impl ElementImpl for PaintableSink {
|
|||
.build();
|
||||
|
||||
if let Some(features) = features {
|
||||
c.get_mut()
|
||||
.unwrap()
|
||||
.set_features_simple(Some(gst::CapsFeatures::new(features)));
|
||||
let c = c.get_mut().unwrap();
|
||||
|
||||
if features.contains(&"memory:GLMemory") {
|
||||
c.get_mut()
|
||||
.unwrap()
|
||||
.set_simple(&[("texture-target", &"2D")])
|
||||
if features.contains("memory:GLMemory") {
|
||||
c.set("texture-target", "2D")
|
||||
}
|
||||
c.set_features_simple(Some(features));
|
||||
}
|
||||
|
||||
caps.append(c);
|
||||
|
|
Loading…
Reference in a new issue