6 # @brief <p> Plugin for GMyth-Stream
8 # Copyright (C) 2007 INdT - Instituto Nokia de Tecnologia.
9 # @author Artur Duque de Souza <artur.souza@indt.org.br>
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU Lesser General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU Lesser General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
36 def __init__(self, config):
40 self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
42 self.path = config.get("Vlc", "path")
43 self.host = config.get("Vlc", "host")
44 self.port = int(config.get("Vlc", "port"))
45 self.pwd = config.get("Vlc", "pwd")
51 print "ESTOU EM CHILD"
52 self.path += " -I telnet -d 1> /dev/null 2> /dev/null &"
56 print "ESTOU EM PARENT 1"
58 print "ESTOU EM PARENT 2"
59 self.sock.connect( (self.host, self.port) )
60 self.sock.send("%s\n" % self.pwd)
63 def insert_file(self, filename):
65 self.sock.send("setup output0 input %s\n" % filename)
68 def setup(self, filename, codec, bitrate, width, height, port):
70 self.filename = filename
72 self.bitrate = int(bitrate)
73 self.width = int(width)
74 self.height = int(height)
77 self.pipe = "#transcode{vcodec=%s,vb=%d,"\
78 "fps=25.0,scale=1,acodec=mpga,"\
79 "ab=64,channels=1,width=%d,height=%d}"\
80 ":duplicate{dst=std{access=http,"\
81 "mux=mpeg1,dst=:%d}}" % (self.codec, self.bitrate,\
82 self.widht, self.height,\
85 self.sock.send("setup output0 broadcast %s\n" % self.pipe)
86 self.insert_file(self.filename)
90 print "Trying to play: %s" % self.pipe
91 self.sock.send("control output0 play\n")
96 print "Trying to stop: %s" % self.pipe
97 self.sock.send("control output0 stop\n")