gst-plugins-rs/utils/fallbackswitch/src/fallbackswitch/mod.rs
Jan Schmidt bd2ff494c7 fallbackswitch: Replace with priorityswitch
fallbackswitch now supports multiple sink pads, and on a timeout of the
active pad, it will automatically switch to the next lowest priority pad
that has data available.

fallbackswitch sink pads follow the `sink_%u` template and have
`priority` as a pad property.

Co-authored-by: Vivia Nikolaidou <vivia.nikolaidou@ltnglobal.com>
2022-04-05 18:52:31 +03:00

38 lines
1.3 KiB
Rust

// Copyright (C) 2020 Sebastian Dröge <sebastian@centricular.com>
// Copyright (C) 2021 Jan Schmidt <jan@centricular.com>
// Copyright (C) 2020 Mathieu Duponchelle <mathieu@centricular.com>
// Copyright (C) 2022 Vivia Nikolaidou <vivia.nikolaidou@ltnglobal.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License, v2.0.
// If a copy of the MPL was not distributed with this file, You can obtain one at
// <https://mozilla.org/MPL/2.0/>.
//
// SPDX-License-Identifier: MPL-2.0
use gst::glib;
use gst::prelude::*;
mod imp;
// The public Rust wrapper type for our element
glib::wrapper! {
pub struct FallbackSwitch(ObjectSubclass<imp::FallbackSwitch>) @extends gst::Element, gst::Object, @implements gst::ChildProxy;
}
// The public Rust wrapper type for our sink pad
glib::wrapper! {
pub struct FallbackSwitchSinkPad(ObjectSubclass<imp::FallbackSwitchSinkPad>) @extends gst::Pad, gst::Object;
}
// Registers the type for our element, and then registers in GStreamer under
// the name "fallbackswitch" for being able to instantiate it via e.g.
// gst::ElementFactory::make().
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(
Some(plugin),
"fallbackswitch",
gst::Rank::None,
FallbackSwitch::static_type(),
)
}