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": {
|
||||
"lastModified": 1763384566,
|
||||
"narHash": "sha256-r+wgI+WvNaSdxQmqaM58lVNvJYJ16zoq+tKN20cLst4=",
|
||||
"lastModified": 1752689277,
|
||||
"narHash": "sha256-uldUBFkZe/E7qbvxa3mH1ItrWZyT6w1dBKJQF/3ZSsc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "naersk",
|
||||
"rev": "d4155d6ebb70fbe2314959842f744aa7cabbbf6a",
|
||||
"rev": "0e72363d0938b0208d6c646d10649164c43f4d64",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -45,11 +45,11 @@
|
|||
},
|
||||
"nix-filter": {
|
||||
"locked": {
|
||||
"lastModified": 1757882181,
|
||||
"narHash": "sha256-+cCxYIh2UNalTz364p+QYmWHs0P+6wDhiWR4jDIKQIU=",
|
||||
"lastModified": 1731533336,
|
||||
"narHash": "sha256-oRam5PS1vcrr5UPgALW0eo1m/5/pls27Z/pabHNy2Ms=",
|
||||
"owner": "numtide",
|
||||
"repo": "nix-filter",
|
||||
"rev": "59c44d1909c72441144b93cf0f054be7fe764de5",
|
||||
"rev": "f7653272fd234696ae94229839a99b73c9ab7de0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -60,16 +60,16 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1764677808,
|
||||
"narHash": "sha256-H3lC7knbXOBrHI9hITQ7modLuX20mYJVhZORL5ioms0=",
|
||||
"lastModified": 1757545623,
|
||||
"narHash": "sha256-mCxPABZ6jRjUQx3bPP4vjA68ETbPLNz9V2pk9tO7pRQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1aab89277eb2d87823d5b69bae631a2496cff57a",
|
||||
"rev": "8cd5ce828d5d1d16feff37340171a98fc3bf6526",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-25.11",
|
||||
"ref": "nixos-25.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
@ -78,8 +78,7 @@
|
|||
"inputs": {
|
||||
"naersk": "naersk",
|
||||
"nix-filter": "nix-filter",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"rust-analyzer-src": {
|
||||
|
|
@ -98,26 +97,6 @@
|
|||
"repo": "rust-analyzer",
|
||||
"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",
|
||||
|
|
|
|||
20
flake.nix
20
flake.nix
|
|
@ -2,16 +2,12 @@
|
|||
description = "Flake for command line interface of the ServicePoint display.";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||
nix-filter.url = "github:numtide/nix-filter";
|
||||
naersk = {
|
||||
url = "github:nix-community/naersk";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
treefmt-nix = {
|
||||
url = "github:numtide/treefmt-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
|
|
@ -20,18 +16,9 @@
|
|||
nixpkgs,
|
||||
naersk,
|
||||
nix-filter,
|
||||
treefmt-nix,
|
||||
}:
|
||||
let
|
||||
lib = nixpkgs.lib;
|
||||
treefmt-config = {
|
||||
projectRootFile = "flake.nix";
|
||||
programs = {
|
||||
nixfmt.enable = true;
|
||||
keep-sorted.enable = true;
|
||||
rustfmt.enable = true;
|
||||
};
|
||||
};
|
||||
supported-systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
|
|
@ -44,7 +31,6 @@
|
|||
system:
|
||||
f rec {
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
treefmt-eval = treefmt-nix.lib.evalModule pkgs treefmt-config;
|
||||
inherit system;
|
||||
}
|
||||
);
|
||||
|
|
@ -77,7 +63,7 @@
|
|||
[
|
||||
xe
|
||||
xz
|
||||
ffmpeg_6-headless.dev
|
||||
ffmpeg-headless
|
||||
]
|
||||
++ lib.optionals pkgs.stdenv.isLinux (
|
||||
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);
|
||||
trace!(
|
||||
"scaling {:?} to {:?} to fit {:?}",
|
||||
source, result, self.render_size
|
||||
source,
|
||||
result,
|
||||
self.render_size
|
||||
);
|
||||
result
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,8 +92,7 @@ fn pixels_video(
|
|||
) {
|
||||
ffmpeg::init().unwrap();
|
||||
|
||||
let mut ictx =
|
||||
ffmpeg::format::input(&options.file_name).expect("failed to open video input file");
|
||||
let mut ictx = ffmpeg::format::input(&options.file_name).expect("failed to open video input file");
|
||||
|
||||
let input = ictx
|
||||
.streams()
|
||||
|
|
@ -104,9 +103,7 @@ fn pixels_video(
|
|||
|
||||
let context_decoder = ffmpeg::codec::context::Context::from_parameters(input.parameters())
|
||||
.expect("could not extract video context from parameters");
|
||||
let mut decoder = context_decoder
|
||||
.decoder()
|
||||
.video()
|
||||
let mut decoder = context_decoder.decoder().video()
|
||||
.expect("failed to create decoder for video stream");
|
||||
|
||||
let src_width = decoder.width();
|
||||
|
|
@ -120,8 +117,7 @@ fn pixels_video(
|
|||
src_width,
|
||||
src_height,
|
||||
ffmpeg::software::scaling::Flags::BILINEAR,
|
||||
)
|
||||
.expect("failed to create scaling context");
|
||||
).expect("failed to create scaling context");
|
||||
|
||||
let mut frame_index = 0;
|
||||
|
||||
|
|
@ -132,16 +128,14 @@ fn pixels_video(
|
|||
let mut decoded = ffmpeg::util::frame::video::Video::empty();
|
||||
let mut rgb_frame = ffmpeg::util::frame::video::Video::empty();
|
||||
while decoder.receive_frame(&mut decoded).is_ok() {
|
||||
scaler
|
||||
.run(&decoded, &mut rgb_frame)
|
||||
scaler.run(&decoded, &mut rgb_frame)
|
||||
.expect("failed to scale frame");
|
||||
|
||||
let image = RgbImage::from_raw(src_width, src_height, rgb_frame.data(0).to_owned())
|
||||
.expect("could not read rgb data to image");
|
||||
let image = DynamicImage::from(image);
|
||||
let bitmap= processing_pipeline.process(image);
|
||||
connection
|
||||
.send_command(BitmapCommand::from(bitmap))
|
||||
connection.send_command(BitmapCommand::from(bitmap))
|
||||
.expect("failed to send image command");
|
||||
|
||||
frame_index += 1;
|
||||
|
|
@ -151,13 +145,13 @@ fn pixels_video(
|
|||
|
||||
for (stream, packet) in ictx.packets() {
|
||||
if stream.index() == video_stream_index {
|
||||
decoder
|
||||
.send_packet(&packet)
|
||||
decoder.send_packet(&packet)
|
||||
.expect("failed to send video packet");
|
||||
receive_and_process_decoded_frames(&mut decoder)
|
||||
.expect("failed to process video packet");
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
pub(crate) fn stream_stdin(connection: &Transport, slow: bool) {
|
||||
warn!(
|
||||
"This mode will break when using multi-byte characters and does not support ANSI escape sequences yet."
|
||||
);
|
||||
warn!("This mode will break when using multi-byte characters and does not support ANSI escape sequences yet.");
|
||||
let mut app = App {
|
||||
connection,
|
||||
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 scap::{
|
||||
capturer::{Capturer, Options},
|
||||
frame::Frame,
|
||||
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};
|
||||
|
||||
pub fn stream_window(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue