Skip to content

Commit

Permalink
Merge pull request #116 from kazuki0824/fix/revert-buffer-size
Browse files Browse the repository at this point in the history
Fix/revert buffer size
  • Loading branch information
tsukumijima authored Aug 16, 2024
2 parents 13c8ac6 + d8c3869 commit e1022c4
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 21 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` をダウンロードし、適当なフォルダに配置してください。

Expand Down
11 changes: 3 additions & 8 deletions recisdb-rs/src/commands/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<dyn AsyncBufRead + Unpin>, None));
}

Expand All @@ -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<dyn AsyncBufRead + Unpin>, src_sz))
}
_ => unreachable!("Either device & channel or source must be specified."),
Expand Down
2 changes: 0 additions & 2 deletions recisdb-rs/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
3 changes: 2 additions & 1 deletion recisdb-rs/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pin_project! {
}

impl AsyncInOutTriple {
const CAP: usize = 1600000;
pub fn new(
i: Box<dyn AsyncBufRead + Unpin>,
o: Box<dyn Write>,
Expand All @@ -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)
};
Expand Down
2 changes: 1 addition & 1 deletion recisdb-rs/src/tuner/linux/character_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Voltage>) -> Result<Tuner, std::io::Error> {
Expand Down
2 changes: 1 addition & 1 deletion recisdb-rs/src/tuner/linux/dvbv5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion recisdb-rs/src/tuner/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl UnTunedTuner {

Ok(Self {
inner: BufReader::with_capacity(
crate::context::BUF_SZ,
81920,
BonDriverInner {
dll_imported,
interface,
Expand Down

0 comments on commit e1022c4

Please sign in to comment.