Refactor the src/video_output/video_output.c code as a state machine
Hi,
A while ago, @rom1v suggested to reimplement the vout_thread
code as a command queue. After discussion, what was really meant is more about a state machine.
The current code is indeed not far away from a state machine, but the state representation is not based on only one state variable, making it really hard to reason with.
What we got in the end looks like the following diagram. What's interesting here is that the interruption feature showcased in !324 (though, as I mentioned, it doesn't fix the starvation itself so the name is confusing) becomes really easy to implement at the interruption call site as a state transition back to the idle state, instead of checking the interruption state at the beginning of each state transition like in the merge request. It also makes it really easy to understand the behaviour of the vout thread, and even more importantly, to actually test the behaivour of the vout thread.
I don't know how much @rom1v has started the rework so I'm assigning him.