Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sdroege/gst-plugin-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2021-01-21 21:21:29 +0300
committerSebastian Dröge <sebastian@centricular.com>2021-01-25 15:43:05 +0300
commitd4ce1a33f2257ea19f873711c78b7b57d5cb7e5f (patch)
tree7a4ff75e550640afd69786a2d8a41f07b6b6c593 /audio/lewton
parent875c3efb916f2400df355f8517f1daeff6f7ae85 (diff)
Update for glib/gstreamer bindings API changes
Diffstat (limited to 'audio/lewton')
-rw-r--r--audio/lewton/src/lewtondec/imp.rs85
1 files changed, 48 insertions, 37 deletions
diff --git a/audio/lewton/src/lewtondec/imp.rs b/audio/lewton/src/lewtondec/imp.rs
index 3573a55e..c0816775 100644
--- a/audio/lewton/src/lewtondec/imp.rs
+++ b/audio/lewton/src/lewtondec/imp.rs
@@ -47,6 +47,7 @@ impl ObjectSubclass for LewtonDec {
const NAME: &'static str = "LewtonDec";
type Type = super::LewtonDec;
type ParentType = gst_audio::AudioDecoder;
+ type Interfaces = ();
type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>;
@@ -57,48 +58,58 @@ impl ObjectSubclass for LewtonDec {
state: AtomicRefCell::new(None),
}
}
+}
- fn class_init(klass: &mut Self::Class) {
- klass.set_metadata(
- "lewton Vorbis decoder",
- "Decoder/Audio",
- "lewton Vorbis decoder",
- "Sebastian Dröge <sebastian@centricular.com>",
- );
+impl ObjectImpl for LewtonDec {}
- let sink_caps = gst::Caps::new_simple("audio/x-vorbis", &[]);
- let sink_pad_template = gst::PadTemplate::new(
- "sink",
- gst::PadDirection::Sink,
- gst::PadPresence::Always,
- &sink_caps,
- )
- .unwrap();
- klass.add_pad_template(sink_pad_template);
-
- let src_caps = gst::Caps::new_simple(
- "audio/x-raw",
- &[
- ("format", &gst_audio::AUDIO_FORMAT_F32.to_str()),
- ("rate", &gst::IntRange::<i32>::new(1, std::i32::MAX)),
- ("channels", &gst::IntRange::<i32>::new(1, 255)),
- ("layout", &"interleaved"),
- ],
- );
- let src_pad_template = gst::PadTemplate::new(
- "src",
- gst::PadDirection::Src,
- gst::PadPresence::Always,
- &src_caps,
- )
- .unwrap();
- klass.add_pad_template(src_pad_template);
+impl ElementImpl for LewtonDec {
+ fn metadata() -> Option<&'static gst::subclass::ElementMetadata> {
+ static ELEMENT_METADATA: Lazy<gst::subclass::ElementMetadata> = Lazy::new(|| {
+ gst::subclass::ElementMetadata::new(
+ "lewton Vorbis decoder",
+ "Decoder/Audio",
+ "lewton Vorbis decoder",
+ "Sebastian Dröge <sebastian@centricular.com>",
+ )
+ });
+
+ Some(&*ELEMENT_METADATA)
}
-}
-impl ObjectImpl for LewtonDec {}
+ fn pad_templates() -> &'static [gst::PadTemplate] {
+ static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| {
+ let sink_caps = gst::Caps::new_simple("audio/x-vorbis", &[]);
+ let sink_pad_template = gst::PadTemplate::new(
+ "sink",
+ gst::PadDirection::Sink,
+ gst::PadPresence::Always,
+ &sink_caps,
+ )
+ .unwrap();
+
+ let src_caps = gst::Caps::new_simple(
+ "audio/x-raw",
+ &[
+ ("format", &gst_audio::AUDIO_FORMAT_F32.to_str()),
+ ("rate", &gst::IntRange::<i32>::new(1, std::i32::MAX)),
+ ("channels", &gst::IntRange::<i32>::new(1, 255)),
+ ("layout", &"interleaved"),
+ ],
+ );
+ let src_pad_template = gst::PadTemplate::new(
+ "src",
+ gst::PadDirection::Src,
+ gst::PadPresence::Always,
+ &src_caps,
+ )
+ .unwrap();
+
+ vec![sink_pad_template, src_pad_template]
+ });
-impl ElementImpl for LewtonDec {}
+ PAD_TEMPLATES.as_ref()
+ }
+}
impl AudioDecoderImpl for LewtonDec {
fn stop(&self, _element: &Self::Type) -> Result<(), gst::ErrorMessage> {