Move code which runs in the player thread to player_thread.c. Having a lot of player thread code in decode.c isn't easy to understand.