WebM transcoding added
[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=='webm':
17                 command = command + 'transcode{vcodec=VP80,acodec=vorbis,vb=512,ab=64}:'
18                 muxer='ffmpeg{mux=webm}'
19             command = command +'http{mux=' + muxer + ',dst=:' + \
20                 str(out_port) + '/' + stream_name + '} option sout-keep option sout-all enabled' + \
21                 "\r\n" + 'control "' + stream_name + '" play'
22             return command    
23
24         @staticmethod
25         def stopBroadcast(stream_name):
26             return 'del "' + stream_name + '"'
27
28         @staticmethod
29         def pauseBroadcast(stream_name):
30             return 'control "' + stream_name + '" pause'
31
32         @staticmethod
33         def playBroadcast(stream_name):
34             return 'control "' + stream_name + '" play'
35
36     class response(object):
37         WRONGPASS = 'Wrong password'
38         AUTHOK = 'Welcome, Master'
39         BROADCASTEXISTS = 'Name already in use'
40         SYNTAXERR = 'Wrong command syntax'
41         STARTOK = 'new'
42         STOPOK = 'del'
43         STOPERR = 'media unknown'
44         SHUTDOWN = 'Bye-bye!'