mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-06-16 13:10:34 +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>
66 lines
2.2 KiB
Rust
66 lines
2.2 KiB
Rust
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
use crate::webrtcsrc::signaller::WebRTCSignallerRole;
|
|
use gst::prelude::*;
|
|
use gst::{glib, prelude::StaticType};
|
|
|
|
/**
|
|
* element-webrtcsrc:
|
|
*
|
|
* `webrtcsrc` is the source counterpart of the #webrtcsink element and can be
|
|
* used to receive streams from it, it can also be used to easily playback WebRTC
|
|
* streams coming from a web browser.
|
|
*
|
|
* To try the element, you should run #webrtcsink as described in its documentation,
|
|
* finding its `peer-id` (in the signalling server logs for example) and then
|
|
* run:
|
|
*
|
|
* ``` bash
|
|
* gst-launch-1.0 webrtcsrc signaller::producer-peer-id=<webrtcsink-peer-id> ! videoconvert ! autovideosink
|
|
* ```
|
|
*
|
|
* or directly using `playbin`:
|
|
*
|
|
* ``` bash
|
|
* gst-launch-1.0 playbin3 uri="gstwebrtc://localhost:8443?peer-id=<webrtcsink-peer-id>"
|
|
* ```
|
|
*
|
|
* ## Decoding
|
|
*
|
|
* To be able to precisely negotiate the WebRTC SDP, `webrtcsrc` is able to decode streams.
|
|
* During SDP negotiation we expose our pads based on the peer offer and right after query caps
|
|
* to see what downstream supports.
|
|
* In practice in `uridecodebinX` or `playbinX`, decoding will happen
|
|
* in `decodebinX` but for the case where a `videoconvert` is placed after a `video_XX` pad,
|
|
* decoding will happen inside `webrtcsrc`.
|
|
*
|
|
* Since: 0.10
|
|
*/
|
|
mod imp;
|
|
mod pad;
|
|
pub mod signaller;
|
|
|
|
pub use signaller::{SignallableImpl, SignallableImplExt};
|
|
|
|
use self::signaller::Signallable;
|
|
|
|
glib::wrapper! {
|
|
pub struct WebRTCSrc(ObjectSubclass<imp::WebRTCSrc>) @extends 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;
|
|
}
|
|
|
|
pub fn register(plugin: Option<&gst::Plugin>) -> Result<(), glib::BoolError> {
|
|
WebRTCSignallerRole::static_type().mark_as_plugin_api(gst::PluginAPIFlags::empty());
|
|
WebRTCSrcPad::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(),
|
|
)
|
|
}
|