mod imp;
mod pad;
use crate::signaller::Signallable;
use crate::signaller::WebRTCSignallerRole;
use gst::prelude::*;
use gst::{glib, prelude::StaticType};
glib::wrapper! {
pub struct BaseWebRTCSrc(ObjectSubclass<imp::BaseWebRTCSrc>) @extends gst::Bin, gst::Element, gst::Object, @implements gst::ChildProxy;
}
glib::wrapper! {
pub struct WebRTCSrc(ObjectSubclass<imp::WebRTCSrc>) @extends BaseWebRTCSrc, gst::Bin, gst::Element, gst::Object, @implements gst::URIHandler, gst::ChildProxy;
}
#[cfg(feature = "whip")]
glib::wrapper! {
pub struct WhipServerSrc(ObjectSubclass<imp::whip::WhipServerSrc>) @extends BaseWebRTCSrc, gst::Bin, gst::Element, gst::Object, @implements gst::URIHandler, gst::ChildProxy;
}
#[cfg(feature = "livekit")]
glib::wrapper! {
pub struct LiveKitWebRTCSrc(ObjectSubclass<imp::livekit::LiveKitWebRTCSrc>) @extends BaseWebRTCSrc, gst::Bin, gst::Element, gst::Object, gst::ChildProxy;
}
#[cfg(feature = "janus")]
glib::wrapper! {
pub struct JanusVRWebRTCSrc(ObjectSubclass<imp::janus::JanusVRWebRTCSrc>) @extends BaseWebRTCSrc, gst::Bin, gst::Element, gst::Object, @implements gst::URIHandler, gst::ChildProxy;
}
#[cfg(feature = "whep")]
glib::wrapper! {
pub struct WhepClientSrc(ObjectSubclass<imp::whep::WhepClientSrc>) @extends BaseWebRTCSrc, gst::Bin, gst::Element, gst::Object, @implements gst::URIHandler, gst::ChildProxy;
}
glib::wrapper! {
pub struct WebRTCSrcPad(ObjectSubclass<pad::WebRTCSrcPad>) @extends gst::GhostPad, gst::ProxyPad, gst::Pad, gst::Object;
}
#[cfg(feature = "livekit")]
glib::wrapper! {
pub struct LiveKitWebRTCSrcPad(ObjectSubclass<imp::livekit::LiveKitWebRTCSrcPad>) @extends WebRTCSrcPad, gst::GhostPad, gst::ProxyPad, gst::Pad, gst::Object;
}
pub fn register(plugin: Option<&gst::Plugin>) -> Result<(), glib::BoolError> {
BaseWebRTCSrc::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty());
WebRTCSignallerRole::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty());
WebRTCSrcPad::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty());
#[cfg(feature = "livekit")]
LiveKitWebRTCSrcPad::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty());
Signallable::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty());
gst::Element::register(
plugin,
"webrtcsrc",
gst::Rank::PRIMARY,
WebRTCSrc::static_type(),
)?;
#[cfg(feature = "whip")]
gst::Element::register(
plugin,
"whipserversrc",
gst::Rank::PRIMARY,
WhipServerSrc::static_type(),
)?;
#[cfg(feature = "livekit")]
gst::Element::register(
plugin,
"livekitwebrtcsrc",
gst::Rank::NONE,
LiveKitWebRTCSrc::static_type(),
)?;
#[cfg(feature = "janus")]
gst::Element::register(
plugin,
"janusvrwebrtcsrc",
gst::Rank::NONE,
JanusVRWebRTCSrc::static_type(),
)?;
#[cfg(feature = "whep")]
gst::Element::register(
plugin,
"whepclientsrc",
gst::Rank::PRIMARY,
WhepClientSrc::static_type(),
)?;
Ok(())
}