Skip to content

Commit

Permalink
Move types to compositor_api crate (#629)
Browse files Browse the repository at this point in the history
Co-authored-by: Wojciech Kozyra <[email protected]>
  • Loading branch information
wkazmierczak and wkozyra95 authored Jul 18, 2024
1 parent 287c0a3 commit 643dac2
Show file tree
Hide file tree
Showing 52 changed files with 117 additions and 69 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,15 @@ jobs:

- name: 📥 Checkout repo
uses: actions/checkout@v4
with:
submodules: 'true'

- name: 🧩 Git submodules update
run: |
cat > .gitmodules << EOF
[submodule "snapshot_tests/snapshots"]
path = snapshot_tests/snapshots
url = https://github.com/membraneframework-labs/video_compositor_snapshot_tests.git
EOF
git submodule update --init
- name: 📁 Rust cache
uses: Swatinem/rust-cache@v2
Expand Down
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "snapshot_tests/snapshots"]
path = snapshot_tests/snapshots
url = [email protected]:membraneframework-labs/video_compositor_snapshot_tests.git
update = none
15 changes: 15 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 14 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,24 @@ members = [
"integration_tests",
"generate",
"decklink",
"compositor_api",
]
resolver = "2"

[features]
default = ["web_renderer"]
decklink = ["compositor_pipeline/decklink"]
web_renderer = ["dep:compositor_chromium", "compositor_render/web_renderer"]
decklink = ["compositor_api/decklink"]
web_renderer = [
"dep:compositor_chromium",
"compositor_api/web_renderer"
]

[workspace.dependencies]
live_compositor = { path = "." }
compositor_api = { path = "compositor_api" }
compositor_pipeline = { path = "compositor_pipeline" }
compositor_chromium = { path = "compositor_chromium" }
compositor_render = { path = "compositor_render" }
bytes = "1.4.0"
serde_json = { version = "1.0.99", features = ["preserve_order"] }
serde = { version = "1.0.164", features = ["derive", "rc"] }
Expand All @@ -40,7 +49,6 @@ rtcp = "0.10.0"
rand = "0.8.5"
tracing = "0.1.40"
socket2 = "0.5.5"
compositor_render = { path = "compositor_render" }
webrtc-util = "0.8.0"
opus = "0.3.0"
rubato = "0.15.0"
Expand All @@ -52,9 +60,10 @@ schemars = { git = "https://github.com/membraneframework-labs/schemars", rev = "
] }

[dependencies]
compositor_api = { workspace = true }
compositor_render = { workspace = true }
compositor_pipeline = { path = "compositor_pipeline" }
compositor_chromium = { path = "compositor_chromium", optional = true }
compositor_pipeline = { workspace = true }
compositor_chromium = { workspace = true, optional = true }
serde = { workspace = true }
serde_json = { workspace = true }
anyhow = { workspace = true }
Expand Down
17 changes: 17 additions & 0 deletions compositor_api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "compositor_api"
version = "0.1.0"
edition = "2021"
license = "BUSL-1.1"

[features]
decklink = ["compositor_pipeline/decklink"]
web_renderer = ["compositor_render/web_renderer"]

[dependencies]
compositor_pipeline = { workspace = true }
compositor_render = { workspace = true }
serde = { workspace = true }
schemars = { workspace = true }
bytes = { workspace = true }
axum = { version = "0.7.4", features = ["ws"] }
File renamed without changes.
2 changes: 2 additions & 0 deletions compositor_api/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod error;
pub mod types;
16 changes: 0 additions & 16 deletions src/types.rs → compositor_api/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,25 @@ mod video;
mod from_util_test;

pub use component::Component;
#[allow(unused_imports)]
pub use component::Image;
#[allow(unused_imports)]
pub use component::InputStream;
#[allow(unused_imports)]
pub use component::Rescaler;
#[allow(unused_imports)]
pub use component::Shader;
#[allow(unused_imports)]
pub use component::Text;
#[allow(unused_imports)]
pub use component::Tiles;
#[allow(unused_imports)]
pub use component::View;
#[allow(unused_imports)]
pub use component::WebView;

#[allow(unused_imports)]
pub use register_input::Mp4;
#[allow(unused_imports)]
pub use register_output::RtpOutputStream;

#[allow(unused_imports)]
pub use register_input::DeckLink;
#[allow(unused_imports)]
pub use register_input::RtpInputStream;

#[allow(unused_imports)]
pub use renderer::ImageSpec;
#[allow(unused_imports)]
pub use renderer::ShaderSpec;
#[allow(unused_imports)]
pub use renderer::WebRendererSpec;

#[allow(unused_imports)]
pub use util::Resolution;
pub use util::TypeError;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion compositor_render/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ web_renderer = ["dep:compositor_chromium"]
pollster = "0.3.0"
thiserror = { workspace = true }
wgpu = { workspace = true }
compositor_chromium = { path = "../compositor_chromium", optional = true }
compositor_chromium = { workspace = true, optional = true }
image = { workspace = true }
reqwest = { workspace = true }
bytes = { workspace = true }
Expand Down
5 changes: 4 additions & 1 deletion generate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ license = "BUSL-1.1"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = ["web_renderer" ]
decklink = ["live_compositor/decklink"]
web_renderer = ["live_compositor/web_renderer"]

[dependencies]
live_compositor = { path = ".." }
live_compositor = { workspace = true }
compositor_api = { workspace = true }
reqwest = { workspace = true }
anyhow = { workspace = true }
serde = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion generate/src/bin/generate_from_types/generate_docs.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::docs_config::DocsConfig;
use super::document::generate;
use super::markdown::overrides;
use live_compositor::types::{
use compositor_api::types::{
DeckLink, Image, ImageSpec, InputStream, Mp4, Rescaler, RtpInputStream, RtpOutputStream,
Shader, ShaderSpec, Text, Tiles, View, WebRendererSpec, WebView,
};
Expand Down
3 changes: 2 additions & 1 deletion generate/src/bin/generate_from_types/generate_json_schema.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{fs, io, path::PathBuf};

use live_compositor::{routes, types};
use compositor_api::types;
use live_compositor::routes;
use schemars::{
schema::{RootSchema, Schema, SchemaObject},
schema_for, JsonSchema,
Expand Down
17 changes: 6 additions & 11 deletions integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@ license = "BUSL-1.1"
[features]
default = ["web_renderer"]
update_snapshots = []
decklink = [
"live_compositor/decklink",
]
web_renderer = [
"dep:compositor_chromium",
"compositor_render/web_renderer",
"live_compositor/web_renderer",
]
decklink = ["live_compositor/decklink"]
web_renderer = ["dep:compositor_chromium", "live_compositor/web_renderer"]

[dependencies]
live_compositor = { path = ".." }
compositor_pipeline = { path = "../compositor_pipeline" }
live_compositor = { workspace = true }
compositor_api = { workspace = true }
compositor_pipeline = { workspace = true }
compositor_chromium = { workspace = true, optional = true }
reqwest = { workspace = true }
anyhow = { workspace = true }
serde = { workspace = true }
Expand All @@ -41,7 +37,6 @@ futures-util = { workspace = true }
log = { workspace = true }
tokio = { workspace = true }
signal-hook = { workspace = true }
compositor_chromium = { path = "../compositor_chromium", optional = true }
tokio-tungstenite = "0.21.0"
wgpu = { workspace = true }
image = { workspace = true }
3 changes: 2 additions & 1 deletion integration_tests/examples/aac_rtp_input.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Result;
use live_compositor::{server, types::Resolution};
use compositor_api::types::Resolution;
use live_compositor::server;
use log::{error, info};
use serde_json::json;
use std::{
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/examples/audio.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Result;
use live_compositor::{server, types::Resolution};
use compositor_api::types::Resolution;
use live_compositor::server;
use log::{error, info};
use serde_json::json;
use std::{
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/examples/decklink.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Result;
use live_compositor::{server, types::Resolution};
use compositor_api::types::Resolution;
use live_compositor::server;
use log::{error, info};
use serde_json::json;
use std::{
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/examples/docker.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::{anyhow, Result};
use live_compositor::{config::read_config, types::Resolution};
use compositor_api::types::Resolution;
use live_compositor::config::read_config;
use log::{error, info, warn};
use serde_json::json;
use signal_hook::{consts, iterator::Signals};
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/examples/hls.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Result;
use live_compositor::{server, types::Resolution};
use compositor_api::types::Resolution;
use live_compositor::server;
use log::{error, info};
use serde_json::json;
use std::{env, process::Command, thread, time::Duration};
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/examples/image.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Result;
use live_compositor::{server, types::Resolution};
use compositor_api::types::Resolution;
use live_compositor::server;
use log::{error, info};
use serde_json::json;
use std::{env, path::PathBuf, thread};
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/examples/mp4.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Result;
use live_compositor::{server, types::Resolution};
use compositor_api::types::Resolution;
use live_compositor::server;
use log::{error, info};
use serde_json::json;
use std::{thread, time::Duration};
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/examples/pass_through.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Result;
use live_compositor::{server, types::Resolution};
use compositor_api::types::Resolution;
use live_compositor::server;
use log::{error, info};
use serde_json::json;
use std::{env, thread, time::Duration};
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/examples/rtp_tcp.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Result;
use live_compositor::{server, types::Resolution};
use compositor_api::types::Resolution;
use live_compositor::server;
use log::{error, info};
use serde_json::json;
use std::{
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/examples/simple.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Result;
use live_compositor::{server, types::Resolution};
use compositor_api::types::Resolution;
use live_compositor::server;
use log::{error, info};
use serde_json::json;
use std::{thread, time::Duration};
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/examples/test_pattern.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Result;
use live_compositor::{server, types::Resolution};
use compositor_api::types::Resolution;
use live_compositor::server;
use log::{error, info};
use serde::Deserialize;
use serde_json::json;
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/examples/text.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Result;
use live_compositor::{server, types::Resolution};
use compositor_api::types::Resolution;
use live_compositor::server;
use log::{error, info};
use serde_json::json;
use std::thread;
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/examples/tiles.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Result;
use live_compositor::{server, types::Resolution};
use compositor_api::types::Resolution;
use live_compositor::server;
use log::{error, info};
use serde_json::json;
use std::thread;
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/examples/transition.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Result;
use live_compositor::{server, types::Resolution};
use compositor_api::types::Resolution;
use live_compositor::server;
use log::{error, info};
use serde_json::json;
use std::{thread, time::Duration};
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/examples/web_view.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Result;
use live_compositor::{server, types::Resolution};
use compositor_api::types::Resolution;
use live_compositor::server;
use log::{error, info};
use serde_json::json;
use std::{
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/src/examples.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use anyhow::{anyhow, Result};

use compositor_api::types::Resolution;
use futures_util::{SinkExt, StreamExt};
use live_compositor::{config::read_config, types::Resolution};
use live_compositor::config::read_config;
use log::error;
use reqwest::{blocking::Response, StatusCode};
use std::{
Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
pub mod config;
pub mod error;
pub mod logger;
pub mod routes;
pub mod server;
pub mod state;

pub mod types;
Loading

0 comments on commit 643dac2

Please sign in to comment.