Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/custom/bluerov.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub async fn udp() -> Vec<VideoAndStreamInformation> {
result.push(VideoAndStreamInformation {
name: format!("UDP Stream {index}"),
stream_information: StreamInformation {
endpoints: vec![endpoint],
endpoints: vec![endpoint].into(),
configuration: CaptureConfiguration::Video(VideoCaptureConfiguration {
encode: format.encode.clone(),
height: size.height,
Expand Down Expand Up @@ -137,7 +137,7 @@ pub async fn rtsp() -> Vec<VideoAndStreamInformation> {
result.push(VideoAndStreamInformation {
name: format!("RTSP Stream {index}"),
stream_information: StreamInformation {
endpoints: vec![endpoint],
endpoints: vec![endpoint].into(),
configuration: CaptureConfiguration::Video(VideoCaptureConfiguration {
encode: format.encode.clone(),
height: size.height,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/custom/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn take_webrtc_stream() -> Vec<VideoAndStreamInformation> {
vec![VideoAndStreamInformation {
name: "WebRTC fake stream for thread leak".to_string(),
stream_information: StreamInformation {
endpoints: vec![Url::parse("udp://0.0.0.0:8554/test").unwrap()],
endpoints: vec![Url::parse("udp://0.0.0.0:8554/test").unwrap()].into(),
configuration: CaptureConfiguration::Video(VideoCaptureConfiguration {
encode: VideoEncodeType::H264,
height: size.1,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/settings/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ mod tests {
let fake_streams = vec![VideoAndStreamInformation {
name: "PotatoTestStream".into(),
stream_information: StreamInformation {
endpoints: vec![Url::parse("udp://potatohost:4242").unwrap()],
endpoints: vec![Url::parse("udp://potatohost:4242").unwrap()].into(),
configuration: CaptureConfiguration::Video(VideoCaptureConfiguration {
encode: VideoEncodeType::H264,
height: 666,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/stream/sink/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub fn create_udp_sink(
let addresses = video_and_stream_information
.stream_information
.endpoints
.clone();
.to_vec();

Ok(Sink::Udp(UdpSink::try_new(id, addresses)?))
}
Expand All @@ -76,7 +76,7 @@ pub fn create_rtsp_sink(
let addresses = video_and_stream_information
.stream_information
.endpoints
.clone();
.to_vec();

Ok(Sink::Rtsp(RtspSink::try_new(id, addresses)?))
}
Expand Down
35 changes: 34 additions & 1 deletion src/lib/stream/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,44 @@ pub struct ExtendedConfiguration {

#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, Apiv2Schema)]
pub struct StreamInformation {
pub endpoints: Vec<Url>,
pub endpoints: Endpoints,
pub configuration: CaptureConfiguration,
pub extended_configuration: Option<ExtendedConfiguration>,
}

#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, Apiv2Schema)]
#[serde(untagged)]
pub enum Endpoints {
Array(Vec<Url>),
Object {
origin: Option<Url>,
destination: Vec<Url>,
},
}

impl std::ops::Deref for Endpoints {
type Target = Vec<Url>;

fn deref(&self) -> &Self::Target {
match self {
Endpoints::Array(array) => &array,
Endpoints::Object {
origin: _,
destination,
} => &destination,
}
}
}

impl From<Vec<Url>> for Endpoints {
fn from(destination: Vec<Url>) -> Self {
Endpoints::Object {
origin: None,
destination,
}
}
}

#[derive(Apiv2Schema, Debug, Deserialize, Serialize)]
pub struct StreamStatus {
pub id: uuid::Uuid,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/video/local/video_source_local_linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ mod device_identification_tests {
denominator: 1,
},
}),
endpoints: vec![url::Url::parse("udp://0.0.0.0:5600").unwrap()],
endpoints: vec![url::Url::parse("udp://0.0.0.0:5600").unwrap()].into(),
extended_configuration: None,
},
video_source: VideoSourceType::Local(VideoSourceLocal {
Expand Down
Loading