webrtc: Update Signallable interface to new interface definition API

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1570>
This commit is contained in:
Sebastian Dröge 2024-05-10 14:13:35 +03:00
parent f842aff6df
commit e8e173d0d0

View file

@ -6,7 +6,7 @@ use once_cell::sync::Lazy;
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
#[repr(C)] #[repr(C)]
pub struct Signallable { pub struct SignallableInterface {
_parent: glib::gobject_ffi::GTypeInterface, _parent: glib::gobject_ffi::GTypeInterface,
pub start: fn(&super::Signallable), pub start: fn(&super::Signallable),
pub stop: fn(&super::Signallable), pub stop: fn(&super::Signallable),
@ -15,6 +15,12 @@ pub struct Signallable {
pub end_session: fn(&super::Signallable, &str), pub end_session: fn(&super::Signallable, &str),
} }
unsafe impl InterfaceStruct for SignallableInterface {
type Type = Signallable;
}
pub enum Signallable {}
impl Signallable { impl Signallable {
fn request_meta(_iface: &super::Signallable) -> Option<gst::Structure> { fn request_meta(_iface: &super::Signallable) -> Option<gst::Structure> {
None None
@ -39,16 +45,17 @@ impl Signallable {
} }
#[glib::object_interface] #[glib::object_interface]
unsafe impl prelude::ObjectInterface for Signallable { impl prelude::ObjectInterface for Signallable {
const NAME: &'static ::std::primitive::str = "GstRSWebRTCSignallableIface"; const NAME: &'static ::std::primitive::str = "GstRSWebRTCSignallableIface";
type Interface = SignallableInterface;
type Prerequisites = (glib::Object,); type Prerequisites = (glib::Object,);
fn interface_init(&mut self) { fn interface_init(iface: &mut SignallableInterface) {
self.start = Signallable::start; iface.start = Signallable::start;
self.stop = Signallable::stop; iface.stop = Signallable::stop;
self.send_sdp = Signallable::send_sdp; iface.send_sdp = Signallable::send_sdp;
self.add_ice = Signallable::add_ice; iface.add_ice = Signallable::add_ice;
self.end_session = Signallable::end_session; iface.end_session = Signallable::end_session;
} }
fn signals() -> &'static [Signal] { fn signals() -> &'static [Signal] {