Compare commits
No commits in common. "fa892558f123c5d5395663fa666466c73b997245" and "07a5fbca27ec941c841ad93f2ac65bc529225a51" have entirely different histories.
fa892558f1
...
07a5fbca27
6 changed files with 30 additions and 71 deletions
43
flake.lock
generated
43
flake.lock
generated
|
|
@ -30,11 +30,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1763384566,
|
"lastModified": 1752689277,
|
||||||
"narHash": "sha256-r+wgI+WvNaSdxQmqaM58lVNvJYJ16zoq+tKN20cLst4=",
|
"narHash": "sha256-uldUBFkZe/E7qbvxa3mH1ItrWZyT6w1dBKJQF/3ZSsc=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "naersk",
|
"repo": "naersk",
|
||||||
"rev": "d4155d6ebb70fbe2314959842f744aa7cabbbf6a",
|
"rev": "0e72363d0938b0208d6c646d10649164c43f4d64",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -45,11 +45,11 @@
|
||||||
},
|
},
|
||||||
"nix-filter": {
|
"nix-filter": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1757882181,
|
"lastModified": 1731533336,
|
||||||
"narHash": "sha256-+cCxYIh2UNalTz364p+QYmWHs0P+6wDhiWR4jDIKQIU=",
|
"narHash": "sha256-oRam5PS1vcrr5UPgALW0eo1m/5/pls27Z/pabHNy2Ms=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "nix-filter",
|
"repo": "nix-filter",
|
||||||
"rev": "59c44d1909c72441144b93cf0f054be7fe764de5",
|
"rev": "f7653272fd234696ae94229839a99b73c9ab7de0",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -60,16 +60,16 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1764677808,
|
"lastModified": 1757545623,
|
||||||
"narHash": "sha256-H3lC7knbXOBrHI9hITQ7modLuX20mYJVhZORL5ioms0=",
|
"narHash": "sha256-mCxPABZ6jRjUQx3bPP4vjA68ETbPLNz9V2pk9tO7pRQ=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "1aab89277eb2d87823d5b69bae631a2496cff57a",
|
"rev": "8cd5ce828d5d1d16feff37340171a98fc3bf6526",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"ref": "nixos-25.11",
|
"ref": "nixos-25.05",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|
@ -78,8 +78,7 @@
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"naersk": "naersk",
|
"naersk": "naersk",
|
||||||
"nix-filter": "nix-filter",
|
"nix-filter": "nix-filter",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs"
|
||||||
"treefmt-nix": "treefmt-nix"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-analyzer-src": {
|
"rust-analyzer-src": {
|
||||||
|
|
@ -98,26 +97,6 @@
|
||||||
"repo": "rust-analyzer",
|
"repo": "rust-analyzer",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"treefmt-nix": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1762938485,
|
|
||||||
"narHash": "sha256-AlEObg0syDl+Spi4LsZIBrjw+snSVU4T8MOeuZJUJjM=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "treefmt-nix",
|
|
||||||
"rev": "5b4ee75aeefd1e2d5a1cc43cf6ba65eba75e83e4",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "treefmt-nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
|
||||||
20
flake.nix
20
flake.nix
|
|
@ -2,16 +2,12 @@
|
||||||
description = "Flake for command line interface of the ServicePoint display.";
|
description = "Flake for command line interface of the ServicePoint display.";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||||
nix-filter.url = "github:numtide/nix-filter";
|
nix-filter.url = "github:numtide/nix-filter";
|
||||||
naersk = {
|
naersk = {
|
||||||
url = "github:nix-community/naersk";
|
url = "github:nix-community/naersk";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
treefmt-nix = {
|
|
||||||
url = "github:numtide/treefmt-nix";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
|
|
@ -20,18 +16,9 @@
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
naersk,
|
naersk,
|
||||||
nix-filter,
|
nix-filter,
|
||||||
treefmt-nix,
|
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
treefmt-config = {
|
|
||||||
projectRootFile = "flake.nix";
|
|
||||||
programs = {
|
|
||||||
nixfmt.enable = true;
|
|
||||||
keep-sorted.enable = true;
|
|
||||||
rustfmt.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
supported-systems = [
|
supported-systems = [
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
"aarch64-linux"
|
"aarch64-linux"
|
||||||
|
|
@ -44,7 +31,6 @@
|
||||||
system:
|
system:
|
||||||
f rec {
|
f rec {
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
treefmt-eval = treefmt-nix.lib.evalModule pkgs treefmt-config;
|
|
||||||
inherit system;
|
inherit system;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -77,7 +63,7 @@
|
||||||
[
|
[
|
||||||
xe
|
xe
|
||||||
xz
|
xz
|
||||||
ffmpeg_6-headless.dev
|
ffmpeg-headless
|
||||||
]
|
]
|
||||||
++ lib.optionals pkgs.stdenv.isLinux (
|
++ lib.optionals pkgs.stdenv.isLinux (
|
||||||
with pkgs;
|
with pkgs;
|
||||||
|
|
@ -134,6 +120,6 @@
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
formatter = forAllSystems ({ treefmt-eval, ... }: treefmt-eval.config.build.wrapper);
|
formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt-tree);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,9 @@ impl ImageProcessingPipeline {
|
||||||
let result = (width, height);
|
let result = (width, height);
|
||||||
trace!(
|
trace!(
|
||||||
"scaling {:?} to {:?} to fit {:?}",
|
"scaling {:?} to {:?} to fit {:?}",
|
||||||
source, result, self.render_size
|
source,
|
||||||
|
result,
|
||||||
|
self.render_size
|
||||||
);
|
);
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,8 +92,7 @@ fn pixels_video(
|
||||||
) {
|
) {
|
||||||
ffmpeg::init().unwrap();
|
ffmpeg::init().unwrap();
|
||||||
|
|
||||||
let mut ictx =
|
let mut ictx = ffmpeg::format::input(&options.file_name).expect("failed to open video input file");
|
||||||
ffmpeg::format::input(&options.file_name).expect("failed to open video input file");
|
|
||||||
|
|
||||||
let input = ictx
|
let input = ictx
|
||||||
.streams()
|
.streams()
|
||||||
|
|
@ -104,9 +103,7 @@ fn pixels_video(
|
||||||
|
|
||||||
let context_decoder = ffmpeg::codec::context::Context::from_parameters(input.parameters())
|
let context_decoder = ffmpeg::codec::context::Context::from_parameters(input.parameters())
|
||||||
.expect("could not extract video context from parameters");
|
.expect("could not extract video context from parameters");
|
||||||
let mut decoder = context_decoder
|
let mut decoder = context_decoder.decoder().video()
|
||||||
.decoder()
|
|
||||||
.video()
|
|
||||||
.expect("failed to create decoder for video stream");
|
.expect("failed to create decoder for video stream");
|
||||||
|
|
||||||
let src_width = decoder.width();
|
let src_width = decoder.width();
|
||||||
|
|
@ -120,8 +117,7 @@ fn pixels_video(
|
||||||
src_width,
|
src_width,
|
||||||
src_height,
|
src_height,
|
||||||
ffmpeg::software::scaling::Flags::BILINEAR,
|
ffmpeg::software::scaling::Flags::BILINEAR,
|
||||||
)
|
).expect("failed to create scaling context");
|
||||||
.expect("failed to create scaling context");
|
|
||||||
|
|
||||||
let mut frame_index = 0;
|
let mut frame_index = 0;
|
||||||
|
|
||||||
|
|
@ -132,16 +128,14 @@ fn pixels_video(
|
||||||
let mut decoded = ffmpeg::util::frame::video::Video::empty();
|
let mut decoded = ffmpeg::util::frame::video::Video::empty();
|
||||||
let mut rgb_frame = ffmpeg::util::frame::video::Video::empty();
|
let mut rgb_frame = ffmpeg::util::frame::video::Video::empty();
|
||||||
while decoder.receive_frame(&mut decoded).is_ok() {
|
while decoder.receive_frame(&mut decoded).is_ok() {
|
||||||
scaler
|
scaler.run(&decoded, &mut rgb_frame)
|
||||||
.run(&decoded, &mut rgb_frame)
|
|
||||||
.expect("failed to scale frame");
|
.expect("failed to scale frame");
|
||||||
|
|
||||||
let image = RgbImage::from_raw(src_width, src_height, rgb_frame.data(0).to_owned())
|
let image = RgbImage::from_raw(src_width, src_height, rgb_frame.data(0).to_owned())
|
||||||
.expect("could not read rgb data to image");
|
.expect("could not read rgb data to image");
|
||||||
let image = DynamicImage::from(image);
|
let image = DynamicImage::from(image);
|
||||||
let bitmap= processing_pipeline.process(image);
|
let bitmap= processing_pipeline.process(image);
|
||||||
connection
|
connection.send_command(BitmapCommand::from(bitmap))
|
||||||
.send_command(BitmapCommand::from(bitmap))
|
|
||||||
.expect("failed to send image command");
|
.expect("failed to send image command");
|
||||||
|
|
||||||
frame_index += 1;
|
frame_index += 1;
|
||||||
|
|
@ -151,13 +145,13 @@ fn pixels_video(
|
||||||
|
|
||||||
for (stream, packet) in ictx.packets() {
|
for (stream, packet) in ictx.packets() {
|
||||||
if stream.index() == video_stream_index {
|
if stream.index() == video_stream_index {
|
||||||
decoder
|
decoder.send_packet(&packet)
|
||||||
.send_packet(&packet)
|
|
||||||
.expect("failed to send video packet");
|
.expect("failed to send video packet");
|
||||||
receive_and_process_decoded_frames(&mut decoder)
|
receive_and_process_decoded_frames(&mut decoder)
|
||||||
.expect("failed to process video packet");
|
.expect("failed to process video packet");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
decoder.send_eof().expect("failed to send eof");
|
decoder.send_eof().expect("failed to send eof");
|
||||||
receive_and_process_decoded_frames(&mut decoder).expect("failed to eof packet");
|
receive_and_process_decoded_frames(&mut decoder)
|
||||||
|
.expect("failed to eof packet");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,7 @@ use servicepoint::*;
|
||||||
use std::thread::sleep;
|
use std::thread::sleep;
|
||||||
|
|
||||||
pub(crate) fn stream_stdin(connection: &Transport, slow: bool) {
|
pub(crate) fn stream_stdin(connection: &Transport, slow: bool) {
|
||||||
warn!(
|
warn!("This mode will break when using multi-byte characters and does not support ANSI escape sequences yet.");
|
||||||
"This mode will break when using multi-byte characters and does not support ANSI escape sequences yet."
|
|
||||||
);
|
|
||||||
let mut app = App {
|
let mut app = App {
|
||||||
connection,
|
connection,
|
||||||
mirror: CharGrid::new(TILE_WIDTH, TILE_HEIGHT),
|
mirror: CharGrid::new(TILE_WIDTH, TILE_HEIGHT),
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@ use image::{DynamicImage, ImageBuffer, Rgb, Rgba};
|
||||||
use log::{debug, error, info, trace, warn};
|
use log::{debug, error, info, trace, warn};
|
||||||
use scap::{
|
use scap::{
|
||||||
capturer::{Capturer, Options},
|
capturer::{Capturer, Options},
|
||||||
frame::Frame,
|
|
||||||
frame::convert_bgra_to_rgb,
|
frame::convert_bgra_to_rgb,
|
||||||
|
frame::Frame,
|
||||||
};
|
};
|
||||||
use servicepoint::{BitmapCommand, CompressionCode, FRAME_PACING, Origin};
|
use servicepoint::{BitmapCommand, CompressionCode, Origin, FRAME_PACING};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
pub fn stream_window(
|
pub fn stream_window(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue