1d03938a67bbd666c4a45e2de32841d1c33ebf7b
[vpproxy.git] / vlcclient / vlcmessages.py
1 '''
2 Minimal VLC client for AceProxy. Messages class.
3 '''
4
5
6 class VlcMessage(object):
7
8     class request(object):
9         SHUTDOWN = 'shutdown'
10
11         @staticmethod
12         def startBroadcast(stream_name, input, out_port, muxer='ts', pre_access='',qtype='default'):
13             command = 'new "' + stream_name + '" broadcast input "' + input + '" output ' + (pre_access + ':' if pre_access else '#')
14             if qtype=='mp4':
15                 command = command + 'transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128}:'
16             elif qtype=='ogg':
17                 command = command + 'transcode{vcodec=theora,acodec=vorbis,vb=800,ab=128}:'    
18                 muxer='ogg'
19 #            elif qtype=='webm':
20 #                command = command + 'transcode{vcodec=VP80,acodec=vorbis,vb=512,ab=64}:'
21 #                muxer='ffmpeg{mux=ogg}'
22             command = command +'http{mux=' + muxer + ',dst=:' + \
23                 str(out_port) + '/' + stream_name + '} option sout-keep option sout-all enabled' + \
24                 "\r\n" + 'control "' + stream_name + '" play'
25             return command    
26
27         @staticmethod
28         def stopBroadcast(stream_name):
29             return 'del "' + stream_name + '"'
30
31         @staticmethod
32         def pauseBroadcast(stream_name):
33             return 'control "' + stream_name + '" pause'
34
35         @staticmethod
36         def playBroadcast(stream_name):
37             return 'control "' + stream_name + '" play'
38
39     class response(object):
40         WRONGPASS = 'Wrong password'
41         AUTHOK = 'Welcome, Master'
42         BROADCASTEXISTS = 'Name already in use'
43         SYNTAXERR = 'Wrong command syntax'
44         STARTOK = 'new'
45         STOPOK = 'del'
46         STOPERR = 'media unknown'
47         SHUTDOWN = 'Bye-bye!'