remove stub.rs, it is really hard to remove scrap totally, which is used
all where
This commit is contained in:
parent
45072a4de1
commit
40aaddf108
@ -4,7 +4,6 @@ use cpal::{
|
||||
traits::{DeviceTrait, HostTrait, StreamTrait},
|
||||
Device, Host, StreamConfig,
|
||||
};
|
||||
#[cfg(not(features = "cli"))]
|
||||
use magnum_opus::{Channels::*, Decoder as AudioDecoder};
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::{
|
||||
@ -37,7 +36,6 @@ use hbb_common::{
|
||||
};
|
||||
pub use helper::LatencyController;
|
||||
pub use helper::*;
|
||||
#[cfg(not(features = "cli"))]
|
||||
use scrap::{
|
||||
codec::{Decoder, DecoderCfg},
|
||||
record::{Recorder, RecorderContext},
|
||||
@ -49,7 +47,7 @@ pub use super::lang::*;
|
||||
pub mod file_trait;
|
||||
pub mod helper;
|
||||
pub mod io_loop;
|
||||
use crate::video_service::{SCRAP_X11_REQUIRED, SCRAP_X11_REF_URL};
|
||||
use crate::server::video_service::{SCRAP_X11_REF_URL, SCRAP_X11_REQUIRED};
|
||||
pub static SERVER_KEYBOARD_ENABLED: AtomicBool = AtomicBool::new(true);
|
||||
pub static SERVER_FILE_TRANSFER_ENABLED: AtomicBool = AtomicBool::new(true);
|
||||
pub static SERVER_CLIPBOARD_ENABLED: AtomicBool = AtomicBool::new(true);
|
||||
@ -587,7 +585,6 @@ impl Client {
|
||||
}
|
||||
|
||||
/// Audio handler for the [`Client`].
|
||||
#[cfg(not(features = "cli"))]
|
||||
#[derive(Default)]
|
||||
pub struct AudioHandler {
|
||||
audio_decoder: Option<(AudioDecoder, Vec<f32>)>,
|
||||
@ -604,7 +601,6 @@ pub struct AudioHandler {
|
||||
latency_controller: Arc<Mutex<LatencyController>>,
|
||||
}
|
||||
|
||||
#[cfg(not(features = "cli"))]
|
||||
impl AudioHandler {
|
||||
/// Create a new audio handler.
|
||||
pub fn new(latency_controller: Arc<Mutex<LatencyController>>) -> Self {
|
||||
@ -800,7 +796,6 @@ impl AudioHandler {
|
||||
}
|
||||
|
||||
/// Video handler for the [`Client`].
|
||||
#[cfg(not(features = "cli"))]
|
||||
pub struct VideoHandler {
|
||||
decoder: Decoder,
|
||||
latency_controller: Arc<Mutex<LatencyController>>,
|
||||
@ -809,7 +804,6 @@ pub struct VideoHandler {
|
||||
record: bool,
|
||||
}
|
||||
|
||||
#[cfg(not(features = "cli"))]
|
||||
impl VideoHandler {
|
||||
/// Create a new video handler.
|
||||
pub fn new(latency_controller: Arc<Mutex<LatencyController>>) -> Self {
|
||||
@ -1530,7 +1524,6 @@ where
|
||||
let latency_controller = LatencyController::new();
|
||||
let latency_controller_cl = latency_controller.clone();
|
||||
|
||||
#[cfg(not(features = "cli"))]
|
||||
std::thread::spawn(move || {
|
||||
let mut video_handler = VideoHandler::new(latency_controller);
|
||||
loop {
|
||||
@ -1555,7 +1548,6 @@ where
|
||||
}
|
||||
log::info!("Video decoder loop exits");
|
||||
});
|
||||
#[cfg(not(features = "cli"))]
|
||||
std::thread::spawn(move || {
|
||||
let mut audio_handler = AudioHandler::new(latency_controller_cl);
|
||||
loop {
|
||||
|
@ -50,7 +50,6 @@ lazy_static::lazy_static! {
|
||||
}
|
||||
|
||||
pub fn global_init() -> bool {
|
||||
#[cfg(not(feature = "cli"))]
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
if !scrap::is_x11() {
|
||||
|
11
src/main.rs
11
src/main.rs
@ -36,7 +36,6 @@ fn main() {
|
||||
use hbb_common::log;
|
||||
let args = format!(
|
||||
"-p, --port-forward=[PORT-FORWARD-OPTIONS] 'Format: remote-id:local-port:remote-port[:remote-host]'
|
||||
-c, --connect=[REMOTE_ID] 'test only'
|
||||
-k, --key=[KEY] ''
|
||||
-s, --server... 'Start server'",
|
||||
);
|
||||
@ -72,8 +71,6 @@ fn main() {
|
||||
if options.len() > 3 {
|
||||
remote_host = options[3].clone();
|
||||
}
|
||||
common::test_rendezvous_server();
|
||||
common::test_nat_type();
|
||||
let key = matches.value_of("key").unwrap_or("").to_owned();
|
||||
let token = LocalConfig::get_option("access_token");
|
||||
cli::start_one_port_forward(
|
||||
@ -84,14 +81,6 @@ fn main() {
|
||||
key,
|
||||
token,
|
||||
);
|
||||
} else if let Some(p) = matches.value_of("connect") {
|
||||
common::test_rendezvous_server();
|
||||
common::test_nat_type();
|
||||
let key = matches.value_of("key").unwrap_or("").to_owned();
|
||||
let token = LocalConfig::get_option("access_token");
|
||||
cli::connect_test(p, key, token);
|
||||
} else if let Some(p) = matches.value_of("server") {
|
||||
crate::start_server(true);
|
||||
}
|
||||
common::global_clean();
|
||||
}
|
||||
|
@ -26,12 +26,10 @@ use std::{
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
#[cfg(not(feature = "cli"))]
|
||||
pub mod audio_service;
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(not(any(target_os = "android", target_os = "ios")))] {
|
||||
mod clipboard_service;
|
||||
#[cfg(not(feature = "cli"))]
|
||||
#[cfg(target_os = "linux")]
|
||||
pub(crate) mod wayland;
|
||||
#[cfg(target_os = "linux")]
|
||||
@ -55,14 +53,8 @@ mod connection;
|
||||
pub mod portable_service;
|
||||
mod service;
|
||||
mod video_qos;
|
||||
#[cfg(not(feature = "cli"))]
|
||||
pub mod video_service;
|
||||
|
||||
#[cfg(feature = "cli")]
|
||||
mod stub;
|
||||
#[cfg(feature = "cli")]
|
||||
pub use stub::*;
|
||||
|
||||
use hbb_common::tcp::new_listener;
|
||||
|
||||
pub type Childs = Arc<Mutex<Vec<std::process::Child>>>;
|
||||
@ -319,7 +311,6 @@ impl Drop for Server {
|
||||
for s in self.services.values() {
|
||||
s.join();
|
||||
}
|
||||
#[cfg(not(feature = "cli"))]
|
||||
#[cfg(target_os = "linux")]
|
||||
wayland::clear();
|
||||
}
|
||||
|
@ -500,7 +500,6 @@ impl Connection {
|
||||
let _ = privacy_mode::turn_off_privacy(0);
|
||||
}
|
||||
video_service::notify_video_frame_feched(id, None);
|
||||
#[cfg(not(feature = "cli"))]
|
||||
scrap::codec::Encoder::update_video_encoder(id, scrap::codec::EncoderUpdate::Remove);
|
||||
video_service::VIDEO_QOS.lock().unwrap().reset();
|
||||
if conn.authorized {
|
||||
@ -1077,20 +1076,17 @@ impl Connection {
|
||||
if let Some(o) = lr.option.as_ref() {
|
||||
self.update_option(o).await;
|
||||
if let Some(q) = o.video_codec_state.clone().take() {
|
||||
#[cfg(not(feature = "cli"))]
|
||||
scrap::codec::Encoder::update_video_encoder(
|
||||
self.inner.id(),
|
||||
scrap::codec::EncoderUpdate::State(q),
|
||||
);
|
||||
} else {
|
||||
#[cfg(not(feature = "cli"))]
|
||||
scrap::codec::Encoder::update_video_encoder(
|
||||
self.inner.id(),
|
||||
scrap::codec::EncoderUpdate::DisableHwIfNotExist,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
#[cfg(not(feature = "cli"))]
|
||||
scrap::codec::Encoder::update_video_encoder(
|
||||
self.inner.id(),
|
||||
scrap::codec::EncoderUpdate::DisableHwIfNotExist,
|
||||
@ -1649,7 +1645,6 @@ impl Connection {
|
||||
}
|
||||
}
|
||||
if let Some(q) = o.video_codec_state.clone().take() {
|
||||
#[cfg(not(feature = "cli"))]
|
||||
scrap::codec::Encoder::update_video_encoder(
|
||||
self.inner.id(),
|
||||
scrap::codec::EncoderUpdate::State(q),
|
||||
|
@ -1,48 +0,0 @@
|
||||
use super::*;
|
||||
|
||||
pub mod audio_service {
|
||||
use super::*;
|
||||
pub const NAME: &'static str = "audio";
|
||||
pub fn new() -> GenericService {
|
||||
let sp = GenericService::new(NAME, true);
|
||||
sp
|
||||
}
|
||||
pub fn restart() {}
|
||||
}
|
||||
|
||||
pub mod video_service {
|
||||
use super::*;
|
||||
pub const NAME: &'static str = "video";
|
||||
pub fn new() -> GenericService {
|
||||
let sp = GenericService::new(NAME, true);
|
||||
sp
|
||||
}
|
||||
pub fn is_privacy_mode_supported() -> bool {
|
||||
false
|
||||
}
|
||||
pub fn test_create_capturer(privacy_mode_id: i32, timeout_millis: u64) -> bool {
|
||||
false
|
||||
}
|
||||
pub fn refresh() {}
|
||||
pub async fn switch_display(i: i32) {}
|
||||
pub async fn get_displays() -> ResultType<(usize, Vec<DisplayInfo>)> {
|
||||
bail!("No displayes");
|
||||
}
|
||||
pub fn is_inited_msg() -> Option<Message> {
|
||||
None
|
||||
}
|
||||
pub fn capture_cursor_embeded() -> bool {
|
||||
false
|
||||
}
|
||||
pub async fn switch_to_primary() {}
|
||||
pub fn set_privacy_mode_conn_id(_: i32) {}
|
||||
pub fn get_privacy_mode_conn_id() -> i32 {
|
||||
0
|
||||
}
|
||||
pub fn notify_video_frame_feched(_: i32, _: Option<std::time::Instant>) {}
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref VIDEO_QOS: Arc<Mutex<video_qos::VideoQoS>> = Default::default();
|
||||
}
|
||||
pub const SCRAP_X11_REQUIRED: &str = "";
|
||||
pub const SCRAP_X11_REF_URL: &str = "";
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user