net/quic: Rename to quinnquicsink/src

There might be other QUIC elements in the future based on other
libraries. To prevent namespace collision, namespace the elements
with `quinn` prefix.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1036>
This commit is contained in:
Sanchayan Maity 2024-04-30 16:23:53 +05:30
parent 8b64c734e7
commit 22c6a98914
7 changed files with 44 additions and 40 deletions

View file

@ -14,13 +14,13 @@
* Since: plugins-rs-0.11.0
*/
use gst::glib;
mod quicsink;
mod quicsrc;
mod quinnquicsink;
mod quinnquicsrc;
mod utils;
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
quicsink::register(plugin)?;
quicsrc::register(plugin)?;
quinnquicsink::register(plugin)?;
quinnquicsrc::register(plugin)?;
Ok(())
}

View file

@ -37,7 +37,11 @@ const DEFAULT_TIMEOUT: u32 = 15;
const DEFAULT_SECURE_CONNECTION: bool = true;
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new("quicsink", gst::DebugColorFlags::empty(), Some("QUIC Sink"))
gst::DebugCategory::new(
"quinnquicsink",
gst::DebugColorFlags::empty(),
Some("Quinn QUIC Sink"),
)
});
struct Started {
@ -81,13 +85,13 @@ impl Default for Settings {
}
}
pub struct QuicSink {
pub struct QuinnQuicSink {
settings: Mutex<Settings>,
state: Mutex<State>,
canceller: Mutex<Option<future::AbortHandle>>,
}
impl Default for QuicSink {
impl Default for QuinnQuicSink {
fn default() -> Self {
Self {
settings: Mutex::new(Settings::default()),
@ -97,13 +101,13 @@ impl Default for QuicSink {
}
}
impl GstObjectImpl for QuicSink {}
impl GstObjectImpl for QuinnQuicSink {}
impl ElementImpl for QuicSink {
impl ElementImpl for QuinnQuicSink {
fn metadata() -> Option<&'static gst::subclass::ElementMetadata> {
static ELEMENT_METADATA: Lazy<gst::subclass::ElementMetadata> = Lazy::new(|| {
gst::subclass::ElementMetadata::new(
"QUIC Sink",
"Quinn QUIC Sink",
"Source/Network/QUIC",
"Send data over the network via QUIC",
"Sanchayan Maity <sanchayan@asymptotic.io>",
@ -129,7 +133,7 @@ impl ElementImpl for QuicSink {
}
}
impl ObjectImpl for QuicSink {
impl ObjectImpl for QuinnQuicSink {
fn constructed(&self) {
self.parent_constructed();
}
@ -264,13 +268,13 @@ impl ObjectImpl for QuicSink {
}
#[glib::object_subclass]
impl ObjectSubclass for QuicSink {
const NAME: &'static str = "GstQUICSink";
type Type = super::QuicSink;
impl ObjectSubclass for QuinnQuicSink {
const NAME: &'static str = "GstQuinnQUICSink";
type Type = super::QuinnQuicSink;
type ParentType = gst_base::BaseSink;
}
impl BaseSinkImpl for QuicSink {
impl BaseSinkImpl for QuinnQuicSink {
fn start(&self) -> Result<(), gst::ErrorMessage> {
let settings = self.settings.lock().unwrap();
let timeout = settings.timeout;
@ -392,7 +396,7 @@ impl BaseSinkImpl for QuicSink {
}
}
impl QuicSink {
impl QuinnQuicSink {
fn send_buffer(&self, src: &[u8]) -> Result<(), Option<gst::ErrorMessage>> {
let settings = self.settings.lock().unwrap();
let timeout = settings.timeout;

View file

@ -13,14 +13,14 @@ use gst::prelude::*;
pub mod imp;
glib::wrapper! {
pub struct QuicSink(ObjectSubclass<imp::QuicSink>) @extends gst_base::BaseSink, gst::Element, gst::Object;
pub struct QuinnQuicSink(ObjectSubclass<imp::QuinnQuicSink>) @extends gst_base::BaseSink, gst::Element, gst::Object;
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(
Some(plugin),
"quicsink",
"quinnquicsink",
gst::Rank::MARGINAL,
QuicSink::static_type(),
QuinnQuicSink::static_type(),
)
}

View file

@ -41,9 +41,9 @@ const DEFAULT_SECURE_CONNECTION: bool = true;
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
"quicsrc",
"quinnquicsrc",
gst::DebugColorFlags::empty(),
Some("QUIC Source"),
Some("Quinn QUIC Source"),
)
});
@ -90,13 +90,13 @@ impl Default for Settings {
}
}
pub struct QuicSrc {
pub struct QuinnQuicSrc {
settings: Mutex<Settings>,
state: Mutex<State>,
canceller: Mutex<Option<future::AbortHandle>>,
}
impl Default for QuicSrc {
impl Default for QuinnQuicSrc {
fn default() -> Self {
Self {
settings: Mutex::new(Settings::default()),
@ -106,15 +106,15 @@ impl Default for QuicSrc {
}
}
impl GstObjectImpl for QuicSrc {}
impl GstObjectImpl for QuinnQuicSrc {}
impl ElementImpl for QuicSrc {
impl ElementImpl for QuinnQuicSrc {
fn metadata() -> Option<&'static gst::subclass::ElementMetadata> {
static ELEMENT_METADATA: Lazy<gst::subclass::ElementMetadata> = Lazy::new(|| {
#[cfg(feature = "doc")]
QuicPrivateKeyType::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty());
gst::subclass::ElementMetadata::new(
"QUIC Source",
"Quinn QUIC Source",
"Source/Network/QUIC",
"Receive data over the network via QUIC",
"Sanchayan Maity <sanchayan@asymptotic.io>",
@ -164,7 +164,7 @@ impl ElementImpl for QuicSrc {
}
}
impl ObjectImpl for QuicSrc {
impl ObjectImpl for QuinnQuicSrc {
fn constructed(&self) {
self.parent_constructed();
self.obj().set_format(gst::Format::Bytes);
@ -314,13 +314,13 @@ impl ObjectImpl for QuicSrc {
}
#[glib::object_subclass]
impl ObjectSubclass for QuicSrc {
const NAME: &'static str = "GstQUICSrc";
type Type = super::QuicSrc;
impl ObjectSubclass for QuinnQuicSrc {
const NAME: &'static str = "GstQuinnQUICSrc";
type Type = super::QuinnQuicSrc;
type ParentType = gst_base::BaseSrc;
}
impl BaseSrcImpl for QuicSrc {
impl BaseSrcImpl for QuinnQuicSrc {
fn is_seekable(&self) -> bool {
false
}
@ -458,7 +458,7 @@ impl BaseSrcImpl for QuicSrc {
}
}
impl QuicSrc {
impl QuinnQuicSrc {
fn get(&self, _offset: u64, length: u64) -> Result<Bytes, Option<gst::ErrorMessage>> {
let settings = self.settings.lock().unwrap();
let timeout = settings.timeout;

View file

@ -23,14 +23,14 @@ pub enum QuicPrivateKeyType {
}
glib::wrapper! {
pub struct QuicSrc(ObjectSubclass<imp::QuicSrc>) @extends gst_base::BaseSrc, gst::Element, gst::Object;
pub struct QuinnQuicSrc(ObjectSubclass<imp::QuinnQuicSrc>) @extends gst_base::BaseSrc, gst::Element, gst::Object;
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(
Some(plugin),
"quicsrc",
"quinnquicsrc",
gst::Rank::MARGINAL,
QuicSrc::static_type(),
QuinnQuicSrc::static_type(),
)
}

View file

@ -7,7 +7,7 @@
//
// SPDX-License-Identifier: MPL-2.0
use crate::quicsrc::QuicPrivateKeyType;
use crate::quinnquicsrc::QuicPrivateKeyType;
use futures::future;
use futures::prelude::*;
use gst::ErrorMessage;

View file

@ -36,7 +36,7 @@ fn test_send_receive_without_datagram() {
thread::spawn(move || {
let mut h1 = gst_check::Harness::new_empty();
h1.add_parse("quicsink secure-connection=false");
h1.add_parse("quinnquicsink secure-connection=false");
h1.set_src_caps(gst::Caps::builder("text/plain").build());
@ -52,7 +52,7 @@ fn test_send_receive_without_datagram() {
});
let mut h2 = gst_check::Harness::new_empty();
h2.add_parse("quicsrc secure-connection=false");
h2.add_parse("quinnquicsrc secure-connection=false");
h2.play();
@ -79,7 +79,7 @@ fn test_send_receive_with_datagram() {
// in the other test. We get a address already in use error otherwise.
thread::spawn(move || {
let mut h1 = gst_check::Harness::new_empty();
h1.add_parse("quicsrc use-datagram=true server-address=127.0.0.1 server-port=6000 secure-connection=false");
h1.add_parse("quinnquicsrc use-datagram=true server-address=127.0.0.1 server-port=6000 secure-connection=false");
h1.play();
@ -96,7 +96,7 @@ fn test_send_receive_with_datagram() {
});
let mut h2 = gst_check::Harness::new_empty();
h2.add_parse("quicsink use-datagram=true client-address=127.0.0.1 client-port=6001 server-address=127.0.0.1 server-port=6000 secure-connection=false");
h2.add_parse("quinnquicsink use-datagram=true client-address=127.0.0.1 client-port=6001 server-address=127.0.0.1 server-port=6000 secure-connection=false");
h2.set_src_caps(gst::Caps::builder("text/plain").build());