From 36153a826a8fb0c587f8bb8a37d553917e9b6d6b Mon Sep 17 00:00:00 2001 From: tsukumi Date: Sat, 17 Aug 2024 04:34:43 +0900 Subject: [PATCH 1/2] Revert "Merge pull request #105 from kazuki0824/fix/buffere-sz-for-cs" This reverts commit d78b4eff7cda792531d2ad354a1e7061a28bb691, reversing changes made to 1c02c31febb3a12cd65505b28f873e2b27cdc3a4. --- recisdb-rs/src/commands/utils.rs | 11 +++-------- recisdb-rs/src/context.rs | 2 -- recisdb-rs/src/io.rs | 3 ++- recisdb-rs/src/tuner/linux/character_device.rs | 2 +- recisdb-rs/src/tuner/linux/dvbv5.rs | 2 +- recisdb-rs/src/tuner/windows/mod.rs | 2 +- 6 files changed, 8 insertions(+), 14 deletions(-) diff --git a/recisdb-rs/src/commands/utils.rs b/recisdb-rs/src/commands/utils.rs index 93322f1..7d5a363 100644 --- a/recisdb-rs/src/commands/utils.rs +++ b/recisdb-rs/src/commands/utils.rs @@ -113,10 +113,8 @@ pub(crate) fn get_src( (None, None, Some(src)) => { if src == "-" { info!("Waiting for stdin..."); - let input = BufReader::with_capacity( - crate::context::BUF_SZ, - AllowStdIo::new(std::io::stdin().lock()), - ); + let input = + BufReader::with_capacity(8192, AllowStdIo::new(std::io::stdin().lock())); return Ok((Box::new(input) as Box, None)); } @@ -132,10 +130,7 @@ pub(crate) fn get_src( } }); - let input = BufReader::with_capacity( - crate::context::BUF_SZ, - AllowStdIo::new(fs::File::open(src)?), - ); + let input = BufReader::with_capacity(20000, AllowStdIo::new(fs::File::open(src)?)); Ok((Box::new(input) as Box, src_sz)) } _ => unreachable!("Either device & channel or source must be specified."), diff --git a/recisdb-rs/src/context.rs b/recisdb-rs/src/context.rs index 2282d25..0342934 100644 --- a/recisdb-rs/src/context.rs +++ b/recisdb-rs/src/context.rs @@ -3,8 +3,6 @@ use clap_num::maybe_hex; use crate::tuner::Voltage; -pub(crate) const BUF_SZ: usize = 512 * 1024; - #[derive(Debug, Parser)] #[clap(name = "recisdb")] #[clap(about = "recisdb can read both Unix chardev-based and BonDriver-based TV sources. ", long_about = None)] diff --git a/recisdb-rs/src/io.rs b/recisdb-rs/src/io.rs index 6731b01..c8b3b10 100644 --- a/recisdb-rs/src/io.rs +++ b/recisdb-rs/src/io.rs @@ -28,6 +28,7 @@ pin_project! { } impl AsyncInOutTriple { + const CAP: usize = 1600000; pub fn new( i: Box, o: Box, @@ -54,7 +55,7 @@ impl AsyncInOutTriple { let dec = { let buffered_decoder = raw .map(AllowStdIo::new) - .map(|raw| BufReader::with_capacity(crate::context::BUF_SZ, raw)); + .map(|raw| BufReader::with_capacity(Self::CAP, raw)); RefCell::new(buffered_decoder) }; diff --git a/recisdb-rs/src/tuner/linux/character_device.rs b/recisdb-rs/src/tuner/linux/character_device.rs index d0df1c6..4ec28b1 100644 --- a/recisdb-rs/src/tuner/linux/character_device.rs +++ b/recisdb-rs/src/tuner/linux/character_device.rs @@ -28,7 +28,7 @@ impl UnTunedTuner { let f = std::fs::OpenOptions::new().read(true).open(path)?; Ok(Self { - inner: BufReader::with_capacity(crate::context::BUF_SZ, AllowStdIo::new(f)), + inner: BufReader::new(AllowStdIo::new(f)), }) } pub fn tune(self, ch: Channel, lnb: Option) -> Result { diff --git a/recisdb-rs/src/tuner/linux/dvbv5.rs b/recisdb-rs/src/tuner/linux/dvbv5.rs index 178d9dc..109acbe 100644 --- a/recisdb-rs/src/tuner/linux/dvbv5.rs +++ b/recisdb-rs/src/tuner/linux/dvbv5.rs @@ -186,7 +186,7 @@ impl UnTunedTuner { Ok(Tuner { inner: self, state: TunedDvbInternalState::Locked, - stream: BufReader::with_capacity(crate::context::BUF_SZ, AllowStdIo::new(f)), + stream: BufReader::new(AllowStdIo::new(f)), }) } } diff --git a/recisdb-rs/src/tuner/windows/mod.rs b/recisdb-rs/src/tuner/windows/mod.rs index 345c7bb..537ecd7 100644 --- a/recisdb-rs/src/tuner/windows/mod.rs +++ b/recisdb-rs/src/tuner/windows/mod.rs @@ -97,7 +97,7 @@ impl UnTunedTuner { Ok(Self { inner: BufReader::with_capacity( - crate::context::BUF_SZ, + 81920, BonDriverInner { dll_imported, interface, From d8c38699f33d1843874583efb3c92c737cc191f5 Mon Sep 17 00:00:00 2001 From: tsukumi Date: Sat, 17 Aug 2024 04:36:25 +0900 Subject: [PATCH 2/2] Update README --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 63ccc86..ec7d0d1 100644 --- a/README.md +++ b/README.md @@ -29,18 +29,18 @@ recisdb-rs and b25-sys are more convenient Rust wrapper for libaribb25. recisdb [Releases](https://github.com/kazuki0824/recisdb-rs/releases) に Ubuntu 20.04 以降向けの Debian パッケージ (.deb) と、Windows (x64) 向けの実行ファイル (.exe) を用意しています。 Linux では、下記のコマンドで recisdb をインストールできます。 -以下は v1.2.1 をインストールする例です。依存パッケージは自動的にインストールされます。 +以下は v1.2.2 をインストールする例です。依存パッケージは自動的にインストールされます。 ```bash # x86_64 環境 -wget https://github.com/kazuki0824/recisdb-rs/releases/download/1.2.1/recisdb_1.2.1_amd64.deb -sudo apt install ./recisdb_1.2.1_amd64.deb -rm ./recisdb_1.2.1_amd64.deb +wget https://github.com/kazuki0824/recisdb-rs/releases/download/1.2.2/recisdb_1.2.2_amd64.deb +sudo apt install ./recisdb_1.2.2_amd64.deb +rm ./recisdb_1.2.2_amd64.deb # arm64 環境 -wget https://github.com/kazuki0824/recisdb-rs/releases/download/1.2.1/recisdb_1.2.1_arm64.deb -sudo apt install ./recisdb_1.2.1_arm64.deb -rm ./recisdb_1.2.1_arm64.deb +wget https://github.com/kazuki0824/recisdb-rs/releases/download/1.2.2/recisdb_1.2.2_arm64.deb +sudo apt install ./recisdb_1.2.2_arm64.deb +rm ./recisdb_1.2.2_arm64.deb ``` Windows では `recisdb.exe` をダウンロードし、適当なフォルダに配置してください。