baudm / mplayer.py

Lightweight Python wrapper for MPlayer
http://pypi.python.org/pypi/mplayer.py
GNU Lesser General Public License v3.0
117 stars 32 forks source link

Add a gevent-friendly Player subclass. #2

Closed ekimekim closed 11 years ago

ekimekim commented 11 years ago

This requires gevent version 1.0rc1 or greater. There are a few problems (eg. proc.wait()) but it does the main job of replacing the stdout and stderr processing threads.

It's worth noting that the non-posix fallback for gevent's FileObject is to use threads anyway. So this is effectively a noop on windows.

I used the async.py code as a guideline for how to implement this. For now, all this does is allow you to use greenlets instead of threads for IO, but I'd also like to fix any other place where non-gevent-friendly blocking may occur, in particular: