From 5ba3e91152f5d271ebf64ad2abb492cf85346274 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Tue, 10 Feb 2026 18:23:54 +0100 Subject: [PATCH] videoplayer: use explicit conversion from DecodingState to u8 --- videoplayer/src/main.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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() -- 2.39.5