gmyth-stream/server/plugins/media/vlc.py
branchtrunk
changeset 565 ed34b1dab103
parent 564 1b897f699097
child 566 25f194cfa60b
     1.1 --- a/gmyth-stream/server/plugins/media/vlc.py	Wed Apr 18 15:47:40 2007 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,80 +0,0 @@
     1.4 -import os
     1.5 -import sys
     1.6 -import time
     1.7 -import socket
     1.8 -import ConfigParser
     1.9 -
    1.10 -class Media:
    1.11 -
    1.12 -    def __init__(self, config):
    1.13 -
    1.14 -        self.config = config
    1.15 -        self.pipe = ""
    1.16 -        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    1.17 -
    1.18 -        self.path = config.get("Vlc", "path")
    1.19 -        self.host = config.get("Vlc", "host")
    1.20 -        self.port = int(config.get("Vlc", "port"))
    1.21 -        self.pwd = config.get("Vlc", "pwd")
    1.22 -
    1.23 -        # exec VLC
    1.24 -        pid = os.fork()
    1.25 -        if (pid == 0):
    1.26 -            #child
    1.27 -            print "ESTOU EM CHILD"
    1.28 -            self.path += " -I telnet -d 1> /dev/null 2> /dev/null &"
    1.29 -            os.system(self.path)
    1.30 -            sys.exit(0)
    1.31 -        else:
    1.32 -            print "ESTOU EM PARENT 1"
    1.33 -            time.sleep(3)
    1.34 -            print "ESTOU EM PARENT 2"
    1.35 -            self.sock.connect( (self.host, self.port) )
    1.36 -            self.sock.send("%s\n" % self.pwd)
    1.37 -
    1.38 -
    1.39 -    def insert_file(self, filename):
    1.40 -
    1.41 -        self.sock.send("setup output0 input %s\n" % filename)
    1.42 -
    1.43 -
    1.44 -
    1.45 -    def setup(self, filename, mux, vcodec, vbitrate,\
    1.46 -              fps, acodec, abitrate, width, height, port):
    1.47 -
    1.48 -        self.filename = filename
    1.49 -        self.mux = mux
    1.50 -        self.vcodec = vcodec
    1.51 -        self.vbitrate = int(vbitrate)
    1.52 -        self.fps = int(fps)
    1.53 -        self.acodec = acodec
    1.54 -        self.abitrate = int(abitrate)
    1.55 -        self.width = int(width)
    1.56 -        self.height = int(height)
    1.57 -
    1.58 -        self.port = int(port)
    1.59 -
    1.60 -
    1.61 -        self.pipe = "#transcode{vcodec=%s,vb=%d,"\
    1.62 -                    "fps=25.0,scale=1,acodec=mpga,"\
    1.63 -                    "ab=64,channels=1,width=%d,height=%d}"\
    1.64 -                    ":duplicate{dst=std{access=http,"\
    1.65 -                    "mux=mpeg1,dst=:%d}}" % (self.vcodec, self.vbitrate,\
    1.66 -                                             self.widht, self.height,\
    1.67 -                                             self.port)
    1.68 -
    1.69 -        self.sock.send("setup output0 broadcast %s\n" % self.pipe)
    1.70 -        self.insert_file(self.filename)
    1.71 -
    1.72 -    def play(self):
    1.73 -
    1.74 -        print "Trying to play: %s" % self.pipe
    1.75 -        self.sock.send("control output0 play\n")
    1.76 -
    1.77 -
    1.78 -    def stop(self):
    1.79 -
    1.80 -        print "Trying to stop: %s" % self.pipe
    1.81 -        self.sock.send("control output0 stop\n")
    1.82 -
    1.83 -