servo_media_streams/
lib.rs

1pub mod capture;
2pub mod device_monitor;
3pub mod registry;
4
5use std::any::Any;
6
7pub use registry::*;
8
9pub trait MediaStream: Any + Send {
10    fn as_any(&self) -> &dyn Any;
11    fn as_mut_any(&mut self) -> &mut dyn Any;
12    fn set_id(&mut self, id: registry::MediaStreamId);
13    fn ty(&self) -> MediaStreamType;
14}
15
16/// A MediaSocket is a way for a backend to represent a
17/// yet-to-be-connected source side of a MediaStream
18pub trait MediaSocket: Any + Send {
19    fn as_any(&self) -> &dyn Any;
20}
21
22/// This isn't part of the webrtc spec; it's a leaky abstaction while media streams
23/// are under development and example consumers need to be able to inspect them.
24pub trait MediaOutput: Send {
25    fn add_stream(&mut self, stream: &registry::MediaStreamId);
26}
27
28#[derive(Clone, Copy, Debug, PartialEq)]
29pub enum MediaStreamType {
30    Video,
31    Audio,
32}