9 def __init__(self, config):
13 self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
15 self.path = config.get("Vlc", "path")
16 self.host = config.get("Vlc", "host")
17 self.port = int(config.get("Vlc", "port"))
18 self.pwd = config.get("Vlc", "pwd")
24 print "ESTOU EM CHILD"
25 self.path += " -I telnet -d 1> /dev/null 2> /dev/null &"
29 print "ESTOU EM PARENT 1"
31 print "ESTOU EM PARENT 2"
32 self.sock.connect( (self.host, self.port) )
33 self.sock.send("%s\n" % self.pwd)
36 def insert_file(self, filename):
38 self.sock.send("setup output0 input %s\n" % filename)
42 def setup(self, filename, mux, vcodec, vbitrate,\
43 fps, acodec, abitrate, width, height, port):
45 self.filename = filename
48 self.vbitrate = int(vbitrate)
51 self.abitrate = int(abitrate)
52 self.width = int(width)
53 self.height = int(height)
58 self.pipe = "#transcode{vcodec=%s,vb=%d,"\
59 "fps=25.0,scale=1,acodec=mpga,"\
60 "ab=64,channels=1,width=%d,height=%d}"\
61 ":duplicate{dst=std{access=http,"\
62 "mux=mpeg1,dst=:%d}}" % (self.vcodec, self.vbitrate,\
63 self.widht, self.height,\
66 self.sock.send("setup output0 broadcast %s\n" % self.pipe)
67 self.insert_file(self.filename)
71 print "Trying to play: %s" % self.pipe
72 self.sock.send("control output0 play\n")
77 print "Trying to stop: %s" % self.pipe
78 self.sock.send("control output0 stop\n")