mirror of
https://github.com/danog/libdvb.git
synced 2024-11-26 20:04:39 +01:00
Fixes
This commit is contained in:
parent
4e8bf47e16
commit
01687203e8
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "libdvb-rs"
|
name = "libdvb-rs"
|
||||||
version = "0.4.4"
|
version = "0.4.5"
|
||||||
description = "Safer and feature-complete pure-Rust interface for DVB-API v5 devices in Linux"
|
description = "Safer and feature-complete pure-Rust interface for DVB-API v5 devices in Linux"
|
||||||
authors = ["Cesbo Developers Team <info@cesbo.com>", "Daniil Gentili <daniil@daniil.it>"]
|
authors = ["Cesbo Developers Team <info@cesbo.com>", "Daniil Gentili <daniil@daniil.it>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -199,18 +199,18 @@ impl FeStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn normalize_snr(&mut self, stats: DtvFrontendStats) {
|
fn normalize_snr(&mut self, stats: DtvFrontendStats) {
|
||||||
self.signal_strength_decibel = stats.get_decibel_float();
|
self.snr_decibel = stats.get_decibel_float();
|
||||||
self.signal_strength_percentage = match (stats.get_relative(), stats.get_decibel()) {
|
self.snr_percentage = match (stats.get_relative(), stats.get_decibel()) {
|
||||||
(Some(v), _) => Some(((v as u32) * 100 / 65535) as u8),
|
(Some(v), _) => Some(((v as u32) * 100 / 65535) as u8),
|
||||||
(None, Some(decibel)) if self.status.contains(fe_status::FE_HAS_CARRIER) => {
|
(None, Some(decibel)) if self.status.contains(fe_status::FE_HAS_CARRIER) => {
|
||||||
match match self.delivery_system {
|
match match self.delivery_system {
|
||||||
Some(SYS_DVBS | SYS_DVBS2) => Some(15000),
|
Some(SYS_DVBS) | Some(SYS_DVBS2) => Some(15000),
|
||||||
|
|
||||||
Some(SYS_DVBC_ANNEX_A | SYS_DVBC_ANNEX_B | SYS_DVBC_ANNEX_C | SYS_DVBC2) => {
|
Some(SYS_DVBC_ANNEX_A) | Some(SYS_DVBC_ANNEX_B) | Some(SYS_DVBC_ANNEX_C) | Some(SYS_DVBC2) => {
|
||||||
Some(28000)
|
Some(28000)
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(SYS_DVBT | SYS_DVBT2) => Some(19000),
|
Some(SYS_DVBT) | Some(SYS_DVBT2) => Some(19000),
|
||||||
|
|
||||||
Some(SYS_ATSC) => Some(match self.modulation {
|
Some(SYS_ATSC) => Some(match self.modulation {
|
||||||
Some(VSB_8 | VSB_16) => 19000,
|
Some(VSB_8 | VSB_16) => 19000,
|
||||||
@ -252,12 +252,12 @@ impl FeStatus {
|
|||||||
self.normalize_snr(snr);
|
self.normalize_snr(snr);
|
||||||
self.ber = match ber.get_counter() {
|
self.ber = match ber.get_counter() {
|
||||||
Some(v) => Some(v),
|
Some(v) => Some(v),
|
||||||
None if self.status.contains(fe_status::FE_HAS_LOCK) => Some(fe.read_ber()?),
|
None if self.status.contains(fe_status::FE_HAS_LOCK) => fe.read_ber().ok(),
|
||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
self.unc = match unc.get_counter() {
|
self.unc = match unc.get_counter() {
|
||||||
Some(v) => Some(v),
|
Some(v) => Some(v),
|
||||||
None if self.status.contains(fe_status::FE_HAS_LOCK) => Some(fe.read_unc()?),
|
None if self.status.contains(fe_status::FE_HAS_LOCK) => fe.read_unc().ok(),
|
||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -860,18 +860,21 @@ pub enum DtvProperty {
|
|||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! dtv_property {
|
macro_rules! dtv_property {
|
||||||
|
( $property:ident ) => {
|
||||||
|
$property($crate::fe::sys::DtvPropertyRequest::new(()))
|
||||||
|
};
|
||||||
( $property:ident($data:expr) ) => {
|
( $property:ident($data:expr) ) => {
|
||||||
$property(DtvPropertyRequest::new($data))
|
$property($crate::fe::sys::DtvPropertyRequest::new($data))
|
||||||
};
|
};
|
||||||
( $property:ident, $data:expr ) => {
|
( $property:ident, $data:expr ) => {
|
||||||
$property(DtvPropertyRequest::new($data))
|
$property($crate::fe::sys::DtvPropertyRequest::new($data))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! dtv_property_parse {
|
macro_rules! dtv_property_parse {
|
||||||
( $property:ident($data:expr)) => {
|
( $property:ident($data:expr)) => {
|
||||||
$property(DtvPropertyRequest::new($data.parse().with_context(||format!("Invalid {}: {}", stringify!($property), $data))?))
|
$property($crate::fe::sys::DtvPropertyRequest::new($data.parse().with_context(||format!("Invalid {}: {}", stringify!($property), $data))?))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user