diff -r 605cbc483e09 -r 7f0a3066f6ab gmyth-stream/server/plugins/media/gstreamer.py --- a/gmyth-stream/server/plugins/media/gstreamer.py Wed Apr 11 18:40:50 2007 +0100 +++ b/gmyth-stream/server/plugins/media/gstreamer.py Fri Apr 13 20:07:32 2007 +0100 @@ -7,40 +7,40 @@ from threading import Thread class Media: - class StreamListener(Thread): - def __init__ (self, stream_data): - Thread.__init__(self) - self.stream = stream_data - print "Thread Created" + class StreamListener(Thread): + def __init__ (self, stream_data): + Thread.__init__(self) + self.stream = stream_data + print "Thread Created" - def run (self): - #Create socket - print "Waiting connection" - self.stream.Socket.listen(1) - self.stream.Connection, self.stream.Addr = self.stream.Socket.accept () - print "Connection requested" - self.stream.Sink.set_property ("fd", self.stream.Connection.fileno()) - self.stream.Pipe.set_state(gst.STATE_PLAYING) - print "PLAYING" + def run (self): + #Create socket + print "Waiting connection" + self.stream.Socket.listen(1) + self.stream.Connection, self.stream.Addr = self.stream.Socket.accept () + print "Connection requested" + self.stream.Sink.set_property ("fd", self.stream.Connection.fileno()) + self.stream.Pipe.set_state(gst.STATE_PLAYING) + print "PLAYING" class StreamData: stream_count = 0 - def __init__ (self, pipe, abin, vbin, sink): - self.stream_count += 1 - self.Id = self.stream_count - self.Pipe = pipe - self.Abin = abin - self.Vbin = vbin - self.Sink = sink - self.Loop = gobject.MainLoop() - self.ACaps = "" - self.VCaps = "" - self.Ready = False - self.Socket = None - self.Connection = None - self.Addr = None + def __init__ (self, pipe, abin, vbin, sink): + self.stream_count += 1 + self.Id = self.stream_count + self.Pipe = pipe + self.Abin = abin + self.Vbin = vbin + self.Sink = sink + self.Loop = gobject.MainLoop() + self.ACaps = "" + self.VCaps = "" + self.Ready = False + self.Socket = None + self.Connection = None + self.Addr = None def __init__(self, config): # set gstreamer basic options @@ -49,7 +49,7 @@ self.socket = None self.connection = None self.addr = None - self.ready = False + self.ready = False def setup(self, uri, mux, vcodec, vbitrate, @@ -181,26 +181,25 @@ print "End run" - #Create socket - stream_data.Socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - print "Bind on port %d" % port - stream_data.Socket.bind(('', int (port))) + #Create socket + stream_data.Socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + print "Bind on port %d" % port + stream_data.Socket.bind(('', int (port))) + self.streams.append (stream_data) + return (True, "") - self.streams.append (stream_data) - return True - - def play(self): - stream = self.streams[0] - current = self.StreamListener(stream) - current.start () - print "Saindo" - return True + def play(self): + stream = self.streams[0] + current = self.StreamListener(stream) + current.start () + print "Saindo" + return (True, "") def stop(self): - stream = self.streams[0] - stream.Pipe.set_state(gst.STATE_NULL) - stream.Connection.close () - return True + stream = self.streams[0] + stream.Pipe.set_state(gst.STATE_NULL) + stream.Connection.close () + return (True, "") def __on_bus_message (self, bus, message, stream_data):