allow null a/v thread. demux thread exits only when a/v thread exits

TODO:
if demuxer read the eof packet, then it will not get that again if seek
again, why? miss resetting something?
add some functions for BlockingQueue
check null ptr
fix some mistakes
use new BlockingQueue api
fix some crash issues and can not play issues since b971c511803

TODO:
the code now is ugly! need to rewrite. e.g. how to manage the threads,
decoders and outputs etc. avthread**? managed by avthread? demux thread?
BUG:
1. sometimes no stopped signal
2. sometimes multiple stopped signal