8 config = ConfigParser.ConfigParser()
9 config.read("stream.conf")
11 media_plugin = config.get("Media", "engine")
12 exec("from plugins.media.%s import *" % media_plugin)
16 comm_plugin = config.get("Comm", "engine")
17 exec("from plugins.comm.%s import *" % comm_plugin)
20 server = Server(config)
22 lib.log("Starting GMyth-Stream server")
32 |-> used to setup transcoding and streaming parameters
33 |-> must be used before any "PLAY" command
36 file://file_name mux vcodec vbitrate fps acodec abitrate width height options
37 dvd://title_number mux vcodec vbitrate fps acodec abitrate width height options
40 |-> used to start transcoding and streaming of file
41 |-> must be used just if SETUP was used before
42 |-> after it, _must_ send STOP
45 |-> used to stop transcoding and streaming process
46 |-> must be used just if PLAY was used before
47 |-> must be used after PLAY
50 |-> used to quit the main loop (quit program)
55 while (server.finish == 0):
56 conn, client, port = server.getRequest()
57 server.sendMsg("Welcome to GMyth-Streamer Master")
62 msg = server.getMsg(1024).strip()
66 lib.log("Received %s from: %s" % (msg, client) )
69 setup = server.getMsg(1024).strip().split(" ")
74 server.sendMsg(lib.log("Wrong SETUP command from: %s" % client[0]))
81 options.append(setup[i])
85 ret = media.setup(setup[0], setup[1], setup[2], \
86 setup[3], setup[4], setup[5],
87 setup[6], setup[7], setup[8],
93 server.sendMsg(lib.log(ret))
99 server.sendMsg("STREAM PORT=%d" % nextport)
111 lib.log("Closing connection with %s" % client[0])
112 server.disconnect_client(conn)
116 lib.log("Server stopped. Closing...")