mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-06-13 03:39:23 +00:00
ce3bb2f1d4
Updating the docker image to include: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3236 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/932>
46 lines
1.2 KiB
Rust
46 lines
1.2 KiB
Rust
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
use gst::glib;
|
|
use gst::subclass::prelude::*;
|
|
use std::sync::atomic::AtomicBool;
|
|
use std::sync::atomic::Ordering;
|
|
use std::sync::Mutex;
|
|
|
|
#[derive(Default)]
|
|
pub struct WebRTCSrcPad {
|
|
needs_raw: AtomicBool,
|
|
stream_id: Mutex<Option<String>>,
|
|
}
|
|
|
|
impl WebRTCSrcPad {
|
|
pub fn set_needs_decoding(&self, raw_wanted: bool) {
|
|
self.needs_raw.store(raw_wanted, Ordering::SeqCst);
|
|
}
|
|
|
|
pub fn needs_decoding(&self) -> bool {
|
|
self.needs_raw.load(Ordering::SeqCst)
|
|
}
|
|
|
|
pub fn set_stream_id(&self, stream_id: &str) {
|
|
*self.stream_id.lock().unwrap() = Some(stream_id.to_string());
|
|
}
|
|
|
|
pub fn stream_id(&self) -> String {
|
|
let stream_id = self.stream_id.lock().unwrap();
|
|
stream_id.as_ref().unwrap().clone()
|
|
}
|
|
}
|
|
|
|
#[glib::object_subclass]
|
|
impl ObjectSubclass for WebRTCSrcPad {
|
|
const NAME: &'static str = "GstWebRTCSrcPad";
|
|
type Type = super::WebRTCSrcPad;
|
|
type ParentType = gst::GhostPad;
|
|
}
|
|
|
|
impl ObjectImpl for WebRTCSrcPad {}
|
|
impl GstObjectImpl for WebRTCSrcPad {}
|
|
impl PadImpl for WebRTCSrcPad {}
|
|
impl ProxyPadImpl for WebRTCSrcPad {}
|
|
impl GhostPadImpl for WebRTCSrcPad {}
|