Skip to main content

CaDescrambler

Struct CaDescrambler 

Source
pub struct CaDescrambler<D: CaDevice, C: CiDataDevice> { /* private fields */ }
Expand description

Turnkey CAS descrambler (#763 Layer 2): a Driver (control plane, caM) paired with a CiDataDevice (data plane, ciM) for one CI slot. See the module docs for the feed-filter policy.

Implementations§

Source§

impl<D: CaDevice, C: CiDataDevice> CaDescrambler<D, C>

Source

pub fn new(driver: Driver<D>, ci: C) -> Self

New descrambler over an already-constructed control-plane driver and data-plane ci device (both left for the caller to init()/wire up as needed before use).

Source

pub fn add_service(&mut self, pmt: &PmtSection<'_>) -> Result<(), CaError>

Add a service to the descrambled set (delegates to Driver::add_service).

§Errors

See Driver::add_service.

Source

pub fn set_cat(&mut self, cat: &CatSection<'_>) -> Result<(), CaError>

Feed a freshly-parsed CAT to the managed CAS-layer state (delegates to Driver::set_cat).

§Errors

See Driver::set_cat.

Source

pub fn feed_ts(&mut self, scrambled: &[u8]) -> Result<Vec<u8>>

Filter scrambled to required_pids and write only those packets to ci0, then drain and return all currently-available descrambled TS.

§Errors

io::ErrorKind::InvalidInput if scrambled is not a whole number of TS_PACKET_LEN-byte packets or carries a misaligned packet (sync byte != 0x47); otherwise any I/O error from the underlying CiDataDevice.

Source

pub fn required_pids(&self) -> Vec<u16>

descramble_pids ∪ ca_pids ∪ emm_pids ∪ PCR — the PIDs the CAM needs on ci0 (delegates to Driver::required_pids).

Source

pub fn take_notifications(&mut self) -> Vec<Notification>

Drain the notifications collected so far (delegates to Driver::take_notifications).

Source

pub fn pump(&mut self, timeout: Duration) -> Result<bool>

Pump the control-plane device (delegates to Driver::pump).

§Errors

See Driver::pump.

Source

pub fn driver(&self) -> &Driver<D>

Borrow the control-plane Driver.

Source

pub fn driver_mut(&mut self) -> &mut Driver<D>

Mutably borrow the control-plane Driver (e.g. to drive it directly for control-plane-only operations this wrapper doesn’t re-expose).

Source

pub fn ci(&self) -> &C

Borrow the data-plane CiDataDevice.

Source

pub fn ci_mut(&mut self) -> &mut C

Mutably borrow the data-plane CiDataDevice.

Auto Trait Implementations§

§

impl<D, C> !RefUnwindSafe for CaDescrambler<D, C>

§

impl<D, C> !Send for CaDescrambler<D, C>

§

impl<D, C> !Sync for CaDescrambler<D, C>

§

impl<D, C> !UnwindSafe for CaDescrambler<D, C>

§

impl<D, C> Freeze for CaDescrambler<D, C>
where C: Freeze, D: Freeze,

§

impl<D, C> Unpin for CaDescrambler<D, C>
where C: Unpin, D: Unpin,

§

impl<D, C> UnsafeUnpin for CaDescrambler<D, C>
where C: UnsafeUnpin, D: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.