This commit is contained in:
Mathieu Duponchelle 2021-06-25 03:18:13 +02:00
Родитель ece1c45e46
Коммит 50ac48da54
17 изменённых файлов: 101 добавлений и 99 удалений

134
Cargo.lock сгенерированный
Просмотреть файл

@ -380,6 +380,73 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "auteur"
version = "0.1.0"
dependencies = [
"actix",
"actix-files",
"actix-http",
"actix-rt",
"actix-service",
"actix-web",
"actix-web-actors",
"actix-web-httpauth",
"anyhow",
"auteur-controlling",
"chrono",
"futures 0.3.15",
"glib 0.10.3",
"gstreamer",
"gstreamer-app",
"gstreamer-base",
"gstreamer-video",
"openssl",
"priority-queue",
"serde",
"serde_json",
"smallvec 1.6.1",
"structopt",
"test-env-log",
"tokio 1.6.1",
"tracing",
"tracing-actix",
"tracing-actix-web",
"tracing-appender",
"tracing-error",
"tracing-futures 0.1.1",
"tracing-log",
"tracing-subscriber",
"uuid",
]
[[package]]
name = "auteur-controller"
version = "0.1.0"
dependencies = [
"anyhow",
"async-tungstenite",
"auteur-controlling",
"chrono",
"clap 3.0.0-beta.2",
"env_logger",
"futures 0.3.15",
"log",
"openssl",
"serde_json",
"tokio 0.2.25",
"uuid",
]
[[package]]
name = "auteur-controlling"
version = "0.1.0"
dependencies = [
"chrono",
"serde",
"uuid",
]
[[package]]
name = "autocfg"
version = "1.0.1"
@ -1979,73 +2046,6 @@ version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "rtmp-switcher"
version = "0.1.0"
dependencies = [
"actix",
"actix-files",
"actix-http",
"actix-rt",
"actix-service",
"actix-web",
"actix-web-actors",
"actix-web-httpauth",
"anyhow",
"chrono",
"futures 0.3.15",
"glib 0.10.3",
"gstreamer",
"gstreamer-app",
"gstreamer-base",
"gstreamer-video",
"openssl",
"priority-queue",
"rtmp-switcher-controlling",
"serde",
"serde_json",
"smallvec 1.6.1",
"structopt",
"test-env-log",
"tokio 1.6.1",
"tracing",
"tracing-actix",
"tracing-actix-web",
"tracing-appender",
"tracing-error",
"tracing-futures 0.1.1",
"tracing-log",
"tracing-subscriber",
"uuid",
]
[[package]]
name = "rtmp-switcher-controller"
version = "0.1.0"
dependencies = [
"anyhow",
"async-tungstenite",
"chrono",
"clap 3.0.0-beta.2",
"env_logger",
"futures 0.3.15",
"log",
"openssl",
"rtmp-switcher-controlling",
"serde_json",
"tokio 0.2.25",
"uuid",
]
[[package]]
name = "rtmp-switcher-controlling"
version = "0.1.0"
dependencies = [
"chrono",
"serde",
"uuid",
]
[[package]]
name = "rustc_version"
version = "0.2.3"

Просмотреть файл

@ -1,4 +1,4 @@
# RTMP switcher
# Auteur
The current scope of this project is that of a basic live node
compositor, with a service exposing a JSON API for creating,
@ -46,13 +46,13 @@ cargo build
Run the service:
``` shell
RTMP_SWITCHER_LOG=debug cargo run --bin rtmp-switcher
AUTEUR_LOG=debug cargo run --bin auteur
```
Explore and test the API with the client:
``` shell
cargo run --bin rtmp-switcher-controller -- help
cargo run --bin auteur-controller -- help
```
You can also find the API definition in `common/src/controller.rs`.

Просмотреть файл

@ -1,5 +1,5 @@
[package]
name = "rtmp-switcher-controlling"
name = "auteur-controlling"
version = "0.1.0"
authors = ["Mathieu Duponchelle <mathieu@centricular.com>"]
edition = "2018"

Просмотреть файл

@ -158,7 +158,7 @@ pub enum Command {
Graph(GraphCommand),
}
/// Messages sent from the controller to the switcher.
/// Messages sent from the controller to the server.
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub struct ControllerMessage {

Просмотреть файл

@ -1,5 +1,5 @@
[package]
name = "rtmp-switcher-controller"
name = "auteur-controller"
version = "0.1.0"
authors = ["Mathieu Duponchelle <mathieu@centricular.com>"]
edition = "2018"
@ -18,4 +18,4 @@ env_logger = "0.8"
uuid = { version = "0.8", features = ["serde"] }
chrono = "0.4"
rtmp-switcher-controlling = { path = "../common" }
auteur-controlling = { path = "../common" }

Просмотреть файл

@ -14,7 +14,7 @@ use futures::prelude::*;
use log::{debug, error, info, trace, warn};
use rtmp_switcher_controlling::controller::{
use auteur_controlling::controller::{
Command, CommandResult, ControllerMessage, ServerMessage,
};

Просмотреть файл

@ -1,4 +1,4 @@
//! An example client to interface with the rtmp switcher service
//! An example client to interface with the Auteur service
use anyhow::Error;
use chrono::{DateTime, Utc};
@ -8,7 +8,7 @@ use std::path::PathBuf;
mod controller;
use controller::Controller;
use rtmp_switcher_controlling::controller::{
use auteur_controlling::controller::{
Command, DestinationFamily, GraphCommand, MixerCommand, MixerConfig, NodeCommand, NodeCommands,
};
@ -17,7 +17,7 @@ use rtmp_switcher_controlling::controller::{
#[clap(setting = AppSettings::ColoredHelp)]
/// Top-level options
struct Opts {
/// Address of the rtmp switcher, e.g. https://localhost:8080
/// Address of the Auteur server, e.g. https://localhost:8080
server: String,
/// TLS Certificate chain file.
pub certificate_file: Option<PathBuf>,
@ -206,8 +206,8 @@ fn main() -> Result<(), Error> {
let opts: Opts = Opts::parse();
let env = env_logger::Env::new()
.filter_or("RTMP_SWITCHER_CONTROLLER_LOG", "warn")
.write_style("RTMP_SWITCHER_CONTROLLER_LOG_STYLE");
.filter_or("AUTEUR_CONTROLLER_LOG", "warn")
.write_style("AUTEUR_CONTROLLER_LOG_STYLE");
env_logger::init_from_env(env);
let mut runtime = tokio::runtime::Builder::new()

Просмотреть файл

@ -2,11 +2,13 @@ import datetime
import subprocess
import re
import uuid
import os
import time
NOW = datetime.datetime.utcnow()
EXE = '/home/meh/devel/gst-build/sandbox/rtmp-switcher/target/debug/rtmp-switcher-controller'
HERE = os.path.dirname(os.path.abspath(__file__))
EXE = os.path.join(HERE, 'target/debug/auteur-controller')
SERVER = 'ws://127.0.0.1:8080/ws/control'
def create_source(id_, uri):
@ -137,7 +139,7 @@ def get_info(id_=None):
if __name__ == '__main__':
create_mixer('channel-1', 720, 480, 44100, fallback_image='/home/meh/Pictures/bark.jpg')
create_rtmp_destination('centricular-output', 'rtmp://learntv-transcoder.eastus.azurecontainer.io/live/centricular-output')
create_local_file_destination('local', '/home/meh/devel/gst-build/sandbox/rtmp-switcher/capture')
create_local_file_destination('local', os.path.join(HERE, 'capture'))
start_node('centricular-output')
start_node('local', later(5), later(20))
connect('channel-1', 'centricular-output')

Просмотреть файл

@ -1,5 +1,5 @@
[package]
name = "rtmp-switcher"
name = "auteur"
version = "0.1.0"
authors = ["Mathieu Duponchelle <mathieu@centricular.com>"]
edition = "2018"
@ -40,4 +40,4 @@ chrono = "0.4"
priority-queue = "1.1.0"
smallvec = "1"
rtmp-switcher-controlling = { path = "../common" }
auteur-controlling = { path = "../common" }

Просмотреть файл

@ -5,7 +5,7 @@ use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(
name = "rtmp-switcher",
name = "auteur",
about = "Manages RTMP channels through a REST API"
)]
pub struct Config {

Просмотреть файл

@ -1,7 +1,7 @@
//! Interface with remote controller
//!
//! Receives JSON messages through websockets, conforming with
//! [`this protocol`](rtmp_switcher_controlling::controller)
//! [`this protocol`](auteur_controlling::controller)
use crate::node::{CommandMessage, NodeManager};
@ -13,7 +13,7 @@ use actix_web_actors::ws;
use tracing::{debug, error, instrument, trace};
use rtmp_switcher_controlling::controller::{
use auteur_controlling::controller::{
Command, CommandResult, ControllerMessage, ServerMessage,
};

Просмотреть файл

@ -12,7 +12,7 @@ use anyhow::{anyhow, Error};
use gst::prelude::*;
use tracing::{debug, error, instrument, trace};
use rtmp_switcher_controlling::controller::{DestinationFamily, DestinationInfo, NodeInfo, State};
use auteur_controlling::controller::{DestinationFamily, DestinationInfo, NodeInfo, State};
use crate::node::{
ConsumerMessage, DestinationCommandMessage, GetNodeInfoMessage, NodeManager, NodeStatusMessage,

Просмотреть файл

@ -1,7 +1,7 @@
#![allow(rustdoc::private_intra_doc_links)]
//! rtmp-switcher is a service that implements a
//! [`control interface`](rtmp_switcher_controlling::controller)
//! Auteur is a service that implements a
//! [`control interface`](auteur_controlling::controller)
//! around a [`graph of live processing nodes`](crate::node).
//!
//! Individual nodes can be scheduled to form a timeline, an example
@ -14,7 +14,7 @@
//!
//! The service can of course be used for many other applications.
//!
//! A companion application (`rtmp_switcher_controller`) is provided as an
//! A companion application (`auteur_controller`) is provided as an
//! example client.
//!
//! The design of this project is similar to that of [Brave](https://github.com/bbc/brave),
@ -47,7 +47,7 @@ fn main() -> Result<(), Error> {
let cfg = Config::from_args();
tracing_log::LogTracer::init().expect("Failed to set logger");
let env_filter = tracing_subscriber::EnvFilter::try_from_env("RTMP_SWITCHER_LOG")
let env_filter = tracing_subscriber::EnvFilter::try_from_env("AUTEUR_LOG")
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("warn"));
let (writer, _guard) = {
@ -59,7 +59,7 @@ fn main() -> Result<(), Error> {
Err(anyhow!("Log path is not a directory: {:?}", path))?;
}
let file_appender = tracing_appender::rolling::never(&path, "rtmp-switcher.log");
let file_appender = tracing_appender::rolling::never(&path, "auteur.log");
let (writer, guard) = tracing_appender::non_blocking(file_appender);
(writer, guard)

Просмотреть файл

@ -11,7 +11,7 @@ use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use tracing::{debug, error, instrument, trace};
use rtmp_switcher_controlling::controller::{
use auteur_controlling::controller::{
MixerCommand, MixerConfig, MixerInfo, MixerSlotInfo, NodeInfo, State,
};

Просмотреть файл

@ -16,7 +16,7 @@ use anyhow::{anyhow, Error};
use chrono::{DateTime, Utc};
use futures::channel::oneshot;
use futures::prelude::*;
use rtmp_switcher_controlling::controller::{
use auteur_controlling::controller::{
Command, CommandResult, DestinationCommand, DestinationFamily, GraphCommand, Info,
MixerCommand, MixerConfig, NodeCommand, NodeCommands, NodeInfo, SourceCommand, State,
};
@ -233,7 +233,7 @@ impl Message for NodeStatusMessage {
type Result = ();
}
/// Sent from any [`NodeMessage`] recipient to [`NodeManager`] to register
/// Sent from any [`NodeStatusMessage`] recipient to [`NodeManager`] to register
/// a state listener
#[derive(Debug)]
pub struct RegisterListenerMessage {

Просмотреть файл

@ -30,7 +30,7 @@ use actix::prelude::*;
use anyhow::Error;
use chrono::{DateTime, Utc};
use gst::prelude::*;
use rtmp_switcher_controlling::controller::{NodeInfo, SourceInfo, State};
use auteur_controlling::controller::{NodeInfo, SourceInfo, State};
use tracing::{debug, error, instrument, trace};
/// The pipeline and various GStreamer elements that the source

Просмотреть файл

@ -13,7 +13,7 @@ use crate::node::{NodeManager, NodeStatusMessage};
use anyhow::{anyhow, Error};
use chrono::{DateTime, Utc};
use futures::channel::oneshot;
use rtmp_switcher_controlling::controller::State;
use auteur_controlling::controller::State;
use tracing::{debug, error, instrument, trace, warn};
/// The interface for transporting media data from one node
@ -836,7 +836,7 @@ pub mod tests {
use anyhow::{anyhow, Error};
use chrono::{DateTime, Utc};
use futures::channel::oneshot;
use rtmp_switcher_controlling::controller::{
use auteur_controlling::controller::{
Command, CommandResult, GraphCommand, NodeInfo, State,
};
use std::collections::VecDeque;