gmyth-stream/plugins/media/ffmpeg.py
branchtrunk
changeset 471 2eef40885322
parent 470 57833200a415
child 473 b94790c04fd5
     1.1 --- a/gmyth-stream/plugins/media/ffmpeg.py	Fri Mar 30 04:12:52 2007 +0100
     1.2 +++ b/gmyth-stream/plugins/media/ffmpeg.py	Fri Mar 30 23:07:54 2007 +0100
     1.3 @@ -38,13 +38,13 @@
     1.4              del(self.socket)
     1.5  
     1.6          self.socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
     1.7 +        self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
     1.8          self.socket.bind( ('', self.port) )
     1.9          self.socket.settimeout(10)
    1.10 +        self.socket.listen(1)
    1.11  
    1.12      def play(self):
    1.13  
    1.14 -        self.socket.listen(1)
    1.15 -
    1.16          lib.log("Starting FFmpeg: %s" % self.path)
    1.17  
    1.18          # exec FFmpeg and get stdout
    1.19 @@ -82,8 +82,9 @@
    1.20  
    1.21      def stop(self):
    1.22  
    1.23 -        lib.log("Closing socket")
    1.24 -        self.socket.close()
    1.25 +        if (self.socket != None):
    1.26 +            lib.log("Closing socket")
    1.27 +            self.socket.close()
    1.28  
    1.29          lib.log("Trying to stop FFmpeg process")
    1.30          if (self.child_pid != None):