Skip to content

Commit

Permalink
Merge pull request #78 from kazuki0824/feat/dvb
Browse files Browse the repository at this point in the history
Add dvbv5 functionalities
  • Loading branch information
kazuki0824 authored Nov 1, 2023
2 parents 9e80c8c + 6d2fae7 commit 06d184a
Show file tree
Hide file tree
Showing 17 changed files with 1,453 additions and 310 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
container:
image: ${{ matrix.os }}
steps:
- name: Install PCSC, git, build-essential, cmake, wget, clang, pkg-config
- name: Install PCSC, udev, dvbv5, git, build-essential, cmake, wget, clang, pkg-config
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install build-essential cmake libpcsclite-dev git wget clang pkg-config -qy
apt-get install build-essential cmake libpcsclite-dev libdvbv5-dev libudev-dev git wget clang pkg-config -qy
if: matrix.os != 'alpine:latest'
- name: Install PCSC, git, alpine-sdk, cmake, clang
run: apk add --update alpine-sdk cmake pcsc-lite-dev git clang-static llvm-dev
Expand All @@ -49,14 +49,14 @@ jobs:
profile: minimal
toolchain: stable
override: true
- name: Build
run: cargo build --workspace --verbose
- name: Check
run: cargo check --workspace --verbose -F dvb
if: matrix.os != 'alpine:latest'
- name: Build
run: cargo build --workspace --verbose --no-default-features -F bg-static
- name: Check
run: cargo check --workspace --verbose --no-default-features -F bg-static
if: matrix.os == 'alpine:latest'
- name: Run tests
run: cargo test --workspace --verbose
run: cargo test --workspace --verbose -F dvb
if: matrix.os != 'alpine:latest'
- name: Run tests
run: cargo test --workspace --verbose --no-default-features -F bg-static
Expand Down
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
[workspace]
resolver = "2"
members = [
"b25-sys",
"recisdb-rs"
]

[patch.crates-io]
dvbv5 = { git = "https://gitlab.com/kazuki08241/rust-libdvbv5.git", branch = "make-fd-ptr-public" }
dvbv5-sys = { git = "https://gitlab.com/kazuki08241/rust-libdvbv5-sys.git", branch = "fix/latest-bindgen-unaligned-access" }
26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```bash
git clone https://github.com/kazuki0824/recisdb-rs.git
cd recisdb-rs
sudo apt install -y build-essential cmake clang libpcsclite-dev pkg-config
cargo build --release
sudo apt install -y build-essential cmake clang libpcsclite-dev pkg-config libdvbv5-dev
cargo build -F dvb --release
sudo cp -a target/release/recisdb /usr/local/bin
```

Expand All @@ -51,28 +51,34 @@ Rust がインストールされている場合は、上記のコマンドでビ
- `decode` `-i [ <input_path> | - ] [ <output_path> | - ]`
- `checksignal` `-c <channel> -device <device>`

チャンネルは以下のように、物理チャンネルで指定します。
チャンネルは以下のような記法で、物理チャンネルで指定します。

- -c 24 (地上波: 24ch)
- -c T24 (地上波: 24ch)
- -c T60 (地上波: 60ch: 通常地上波は 52ch までだが、CATV のコミュニティチャンネルでは 62ch まで使われていることがある)
- -c C30 (CATV: 30ch)
- -c BS01_0 (BS: BS01/TS0)
- -c BS1_0 (BS: BS01/TS0)
- -c BS03 --tsid 16433 (BS: BS03/TS1(TSID=0x4031))
- -c BS23_3 (BS: BS23/TS3)
- -c CS02 (CS: ND02)
- -c CS24 (CS: ND24)

### Linux

```bash
recisdb tune --device /dev/px4video0 -c T18 - | ffplay
recisdb decode -i $HOME/hoge.m2ts ./descrambled.m2ts
recisdb checksignal --device /dev/px4video2 -c T18 # キャラクタデバイスをオープンし、地上波 18ch を選局
recisdb tune --device /dev/px4video0 -c BS3_1 --lnb low - | ffplay -i - # キャラクタデバイスをオープンし、BS3 の相対TS番号 1 を選局(LNB なし)
recisdb tune --device /dev/dvb/adapter2/frontend0 -c BS03_1 --lnb low - | ffplay -i - # DVB デバイスをオープンし、BS3 の相対TS番号 1 を選局
recisdb tune --device "2|0" -c BS3 --tsid 0x4031 --lnb low - | ffplay -i - # 略記法で DVB デバイスをオープンし、BS3 の TSID=0x4031 を選局(LNB なし)
recisdb decode -i $HOME/hoge.m2ts ./descrambled.m2ts # ローカルに置かれたファイルのスクランブル解除
```

Video4Linux DVB デバイスは、dvbv5-zap の出力を標準入力から受ける形で対応します。
フィーチャーフラグ`dvb`を有効にすると、DVBデバイスでの録画がサポートされます。
DVB 版ドライバをお使いの場合、BS のみ V4L-DVB ドライバの API 仕様上選局時に TSID を明示的に指定する必要があるため、recisdb には BS の各スロットごとの TSID がハードコードされています。
DVB 版ドライバでは、チューナの TMCC 情報へのアクセス手段がなく、このような制約が発生します。
そのため、今後 BS の帯域再編が行われた場合、recisdb 本体を更新する必要があります。
可能であれば、BS の選局時に相対 TS 番号を利用でき、ハードコードされた TSID に依存しない chardev 版ドライバへの切り替えをおすすめします。

```bash
dvbv5-zap -a 1 -c ./isdbt.conf -r -P 24 | recisdb decode -i - - | ffplay
```

### Windows

Expand Down
13 changes: 9 additions & 4 deletions recisdb-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,29 @@ categories = ["command-line-utilities"]
#https://gitlab.alpinelinux.org/alpine/aports/-/issues/12226
bg-static = ["bindgen/static"]
bg-runtime = ["bindgen/runtime"]
default = ["bg-runtime"]
crypto = [ "b25-sys/block00cbc", "b25-sys/block40cbc" ]
dvb = [ "dvbv5", "dvbv5-sys" ]
default = [ "bg-runtime" ]

[dependencies]
b25-sys = { path = "../b25-sys", features = [] }
b25-sys = { path = "../b25-sys" }
chrono = "^0.4.26"
clap = { version = "^3.2", features = ["derive"] }
clap-num = "1"
colored = "^2.0.0"
cpp_utils = "0.3.0"
ctrlc = { version = "^3.0", features = ["termination"] }
dvbv5 = { version = "0.2.6", optional = true }
dvbv5-sys = { version = "*", optional = true }
env_logger = "^0.10.0"
fancy-regex = "^0.11"
futures-executor = "0.3.26"
futures-time = "3.0.0"
futures-util = { version = "0.3.26", features = ["io"] }
futures-util = { version = "0.3.26", features = ["io"], default-features = false }
indicatif = "0.17"
libloading = "^0.8.0"
log = "^0.4.17"
nix = { version = "^0.27.1", features = ["ioctl"] }
nom = "7.1.3"
pin-project-lite = "0.2.9"

[build-dependencies]
Expand Down
Loading

0 comments on commit 06d184a

Please sign in to comment.