Skip to main content

videocall_cli/consumers/
mod.rs

1/*
2 * Copyright 2025 Security Union LLC
3 *
4 * Licensed under either of
5 *
6 * * Apache License, Version 2.0
7 *   (http://www.apache.org/licenses/LICENSE-2.0)
8 * * MIT license
9 *   (http://opensource.org/licenses/MIT)
10 *
11 * at your option.
12 *
13 * Unless you explicitly state otherwise, any contribution intentionally
14 * submitted for inclusion in the work by you, as defined in the Apache-2.0
15 * license, shall be dual licensed as above, without any additional terms or
16 * conditions.
17 */
18
19use camera_synk::CameraSynk;
20use dead_synk::DeadSynk;
21use webtransport::WebTransportClient;
22
23pub mod camera_synk;
24pub mod dead_synk;
25pub mod local_window_synk;
26pub mod webtransport;
27
28pub enum CameraSynks {
29    DeadSynk(DeadSynk),
30    CameraSynk(Box<WebTransportClient>),
31    // LocalWindowSynk(LocalWindowSynk)
32}
33
34impl CameraSynk for CameraSynks {
35    async fn connect(&mut self) -> anyhow::Result<()> {
36        match self {
37            CameraSynks::DeadSynk(dead_synk) => dead_synk.connect().await,
38            CameraSynks::CameraSynk(client) => client.connect().await,
39        }
40    }
41
42    async fn send_packet(&self, data: Vec<u8>) -> anyhow::Result<()> {
43        match self {
44            CameraSynks::CameraSynk(client) => client.send_packet(data).await,
45            CameraSynks::DeadSynk(dead_synk) => dead_synk.send_packet(data).await,
46        }
47    }
48}