cleanup mplayer slave on exit

This commit is contained in:
Damien Elmes 2009-06-12 20:26:00 +09:00
parent d67b4b2ed9
commit 9d8df81e11

View file

@ -8,7 +8,7 @@ Sound support
"""
__docformat__ = 'restructuredtext'
import re, sys, threading, time, subprocess, os, signal
import re, sys, threading, time, subprocess, os, signal, atexit
# Shared utils
##########################################################################
@ -160,8 +160,17 @@ def clearMplayerQueue():
mplayerQueue.append(None)
mplayerCond.release()
def stopMplayer():
mplayerCond.acquire()
if mplayerManager.mplayer:
mplayerManager.mplayer.communicate("quit\n")
mplayerManager.mplayer = -1
mplayerCond.notify()
mplayerCond.release()
mplayerManager = MplayerMonitor()
mplayerManager.start()
atexit.register(stopMplayer)
# PyAudio recording
##########################################################################