aboutsummaryrefslogtreecommitdiff
path: root/stream/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'stream/src/lib.rs')
-rw-r--r--stream/src/lib.rs30
1 files changed, 28 insertions, 2 deletions
diff --git a/stream/src/lib.rs b/stream/src/lib.rs
index 4df87ae..ccc5cb9 100644
--- a/stream/src/lib.rs
+++ b/stream/src/lib.rs
@@ -14,17 +14,43 @@ use anyhow::{anyhow, bail, Context, Result};
use fragment::fragment_stream;
use fragment_index::fragment_index_stream;
use hls::{hls_multivariant_stream, hls_supermultivariant_stream, hls_variant_stream};
-use jellybase::common::{
+use jellycommon::{
stream::{StreamContainer, StreamSpec},
Node,
};
-use std::{collections::BTreeSet, io::SeekFrom, ops::Range, path::PathBuf, sync::Arc};
+use serde::{Deserialize, Serialize};
+use std::{
+ collections::BTreeSet,
+ io::SeekFrom,
+ ops::Range,
+ path::PathBuf,
+ sync::{Arc, LazyLock},
+};
use stream_info::{stream_info, write_stream_info};
use tokio::{
fs::File,
io::{duplex, AsyncReadExt, AsyncSeekExt, AsyncWriteExt, DuplexStream},
+ sync::Mutex,
};
+#[rustfmt::skip]
+#[derive(Debug, Deserialize, Serialize, Default)]
+pub struct Config {
+ #[serde(default)] pub offer_avc: bool,
+ #[serde(default)] pub offer_hevc: bool,
+ #[serde(default)] pub offer_vp8: bool,
+ #[serde(default)] pub offer_vp9: bool,
+ #[serde(default)] pub offer_av1: bool,
+}
+
+static CONF: LazyLock<Config> = LazyLock::new(|| {
+ CONF_PRELOAD
+ .blocking_lock()
+ .take()
+ .expect("cache config not preloaded. logic error")
+});
+static CONF_PRELOAD: Mutex<Option<Config>> = Mutex::const_new(None);
+
#[derive(Debug)]
pub struct SMediaInfo {
pub info: Arc<Node>,