From: Kostya Shishkov Date: Tue, 10 Feb 2026 17:23:54 +0000 (+0100) Subject: videoplayer: use explicit conversion from DecodingState to u8 X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=5ba3e91152f5d271ebf64ad2abb492cf85346274;p=nihav-player.git videoplayer: use explicit conversion from DecodingState to u8 --- diff --git a/videoplayer/src/main.rs b/videoplayer/src/main.rs index 658a55c..71cdf4b 100644 --- a/videoplayer/src/main.rs +++ b/videoplayer/src/main.rs @@ -51,6 +51,19 @@ enum DecodingState { End, } +impl From for u8 { + fn from(val: DecodingState) -> Self { + match val { + DecodingState::Normal => 0, + DecodingState::Waiting => 1, + DecodingState::Flush => 2, + DecodingState::Prefetch => 3, + DecodingState::End => 4, + DecodingState::Error => 5, + } + } +} + impl From for DecodingState { fn from(val: u8) -> Self { match val { @@ -75,7 +88,7 @@ impl DecoderState { } } fn set_state(&self, state: DecodingState) { - self.state.store(state as u8, Ordering::Release); + self.state.store(state.into(), Ordering::Release); } fn get_state(&self) -> DecodingState { self.state.load(Ordering::Acquire).into()