gstreamer-webrtc: Update manual code to 2018 edition

This commit is contained in:
Sebastian Dröge 2020-11-22 12:49:02 +02:00
parent 4686b61d78
commit 8dd288f2b9
5 changed files with 18 additions and 32 deletions

View file

@ -11,16 +11,14 @@ homepage = "https://gstreamer.freedesktop.org"
documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/gstreamer_webrtc/"
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
build = "build.rs"
edition = "2018"
[dependencies]
libc = "0.2"
glib-sys = { git = "https://github.com/gtk-rs/gtk-rs" }
gobject-sys = { git = "https://github.com/gtk-rs/gtk-rs" }
gstreamer-sys = { path = "../gstreamer/sys", features = ["v1_8"] }
gstreamer-webrtc-sys = { path = "../gstreamer-webrtc/sys" }
ffi = { package = "gstreamer-webrtc-sys", path = "../gstreamer-webrtc/sys" }
glib = { git = "https://github.com/gtk-rs/gtk-rs" }
gstreamer = { path = "../gstreamer", features = ["v1_14"] }
gstreamer-sdp = { path = "../gstreamer-sdp", features = ["v1_14"] }
gst = { package = "gstreamer", path = "../gstreamer", features = ["v1_14"] }
gst-sdp = { package = "gstreamer-sdp", path = "../gstreamer-sdp", features = ["v1_14"] }
[build-dependencies]
gstreamer-rs-lgpl-docs = { path = "../docs", optional = true }
@ -29,9 +27,9 @@ gstreamer-rs-lgpl-docs = { path = "../docs", optional = true }
default = []
embed-lgpl-docs = ["gstreamer-rs-lgpl-docs"]
purge-lgpl-docs = ["gstreamer-rs-lgpl-docs"]
dox = ["v1_18", "gstreamer-webrtc-sys/dox", "glib/dox", "gstreamer/dox", "gstreamer-sdp/dox"]
v1_16 = ["gstreamer/v1_16", "gstreamer-sdp/v1_16", "gstreamer-webrtc-sys/v1_16"]
v1_18 = ["gstreamer/v1_18", "gstreamer-sdp/v1_18", "gstreamer-webrtc-sys/v1_18", "v1_16"]
dox = ["v1_18", "ffi/dox", "glib/dox", "gst/dox", "gst-sdp/dox"]
v1_16 = ["gst/v1_16", "gst-sdp/v1_16", "ffi/v1_16"]
v1_18 = ["gst/v1_18", "gst-sdp/v1_18", "ffi/v1_18", "v1_16"]
[package.metadata.docs.rs]
features = ["dox", "embed-lgpl-docs"]

View file

@ -2,6 +2,6 @@
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use gst_web_rtc_sys;
use ffi;
use glib::translate::*;

View file

@ -8,20 +8,11 @@
#![cfg_attr(feature = "dox", feature(doc_cfg))]
extern crate libc;
#[macro_use]
extern crate glib;
extern crate glib_sys;
extern crate gobject_sys;
extern crate gstreamer as gst;
extern crate gstreamer_sdp as gst_sdp;
extern crate gstreamer_sys as gst_sys;
extern crate gstreamer_webrtc_sys as gst_web_rtc_sys;
pub use ffi;
macro_rules! assert_initialized_main_thread {
() => {
if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE {
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
panic!("GStreamer has not been initialized. Call `gst::init` first.");
}
};
@ -35,7 +26,7 @@ macro_rules! skip_assert_initialized {
#[allow(clippy::too_many_arguments)]
#[allow(clippy::match_same_arms)]
mod auto;
pub use auto::*;
pub use crate::auto::*;
#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
@ -48,5 +39,5 @@ pub mod prelude {
pub use glib::prelude::*;
pub use gst::prelude::*;
pub use auto::traits::*;
pub use crate::auto::traits::*;
}

View file

@ -6,9 +6,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use crate::WebRTCDataChannel;
use glib::translate::*;
use gst_web_rtc_sys;
use WebRTCDataChannel;
use std::mem;
@ -16,7 +15,7 @@ impl WebRTCDataChannel {
pub fn on_error(&self, error: glib::Error) {
let error = mem::ManuallyDrop::new(error);
unsafe {
gst_web_rtc_sys::gst_webrtc_data_channel_on_error(
ffi::gst_webrtc_data_channel_on_error(
self.to_glib_none().0,
mut_override(error.to_glib_none().0),
);

View file

@ -6,26 +6,24 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use crate::WebRTCSDPType;
use crate::WebRTCSessionDescription;
use glib::translate::*;
use gst_sdp;
use gst_web_rtc_sys;
use std::mem;
use WebRTCSDPType;
use WebRTCSessionDescription;
impl WebRTCSessionDescription {
pub fn new(type_: WebRTCSDPType, sdp: gst_sdp::SDPMessage) -> WebRTCSessionDescription {
assert_initialized_main_thread!();
unsafe {
let mut sdp = mem::ManuallyDrop::new(sdp);
from_glib_full(gst_web_rtc_sys::gst_webrtc_session_description_new(
from_glib_full(ffi::gst_webrtc_session_description_new(
type_.to_glib(),
sdp.to_glib_none_mut().0,
))
}
}
pub fn get_type(&self) -> ::WebRTCSDPType {
pub fn get_type(&self) -> crate::WebRTCSDPType {
unsafe { from_glib((*self.to_glib_none().0).type_) }
}