Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 141 lines (133 sloc) 3.869 kB
5f8e85b @SharkHunter 1.50 sync
authored
1 /*
2 rtmpdump://channel?-v&-r=http%3A//example.com&-y=yvalue&-W=Wvalue
3
4 -o is set automatically
5 -r or --rtmp is required
6 boolean values can be set without a value e.g. rtmpdump://channel?url=http%3A//example.com&--live&--foo=bar
7 values *must* be URL-encoded
8 keys can be, but hyphens are not special characters, so they don't need to be
9 */
10
11 init {
12 profile ('rtmpdump://') {
13 pattern {
14 protocol 'rtmpdump'
5a4ef5b @SharkHunter Embeded subs + some new channels
authored
15 match { RTMPDUMP }
5f8e85b @SharkHunter 1.50 sync
authored
16 }
17
18 action {
19 def pairs = $HTTP.getNameValuePairs($URI) // uses URLDecoder.decode to decode the name and value
e527bad @SharkHunter Update channels
authored
20 def rtmpdumpArgs = []
5a4ef5b @SharkHunter Embeded subs + some new channels
authored
21 def mencoderArgs =[]
e527bad @SharkHunter Update channels
authored
22 def ffmpegArgs = []
23 def seenURL = false
5a4ef5b @SharkHunter Embeded subs + some new channels
authored
24 def seenSub = false
e527bad @SharkHunter Update channels
authored
25 def args = ''
26 def swfUrl=''
bee21a1 @SharkHunter RTMP fixes + RTMPGui ch
authored
27 def force=pmsConf['rtmpdump.force']
5a4ef5b @SharkHunter Embeded subs + some new channels
authored
28
e527bad @SharkHunter Update channels
authored
29 //mencoderArgs << '-mc' << '0.1'
30 //mencoderArgs << '-channels' << '6'
be0564e @SharkHunter Added illegal/code
authored
31 ffmpegArgs << '-b' << '1024k'
5f8e85b @SharkHunter 1.50 sync
authored
32
33 for (pair in pairs) {
34 def name = pair.name
35 def value = pair.value
5a4ef5b @SharkHunter Embeded subs + some new channels
authored
36
5f8e85b @SharkHunter 1.50 sync
authored
37 switch (name) {
38 case 'url': // deprecated
39 case '-r':
40 case '--rtmp':
e527bad @SharkHunter Update channels
authored
41 case 'rtmp':
5f8e85b @SharkHunter 1.50 sync
authored
42 if (value) {
e527bad @SharkHunter Update channels
authored
43 $URI = value//quoteURI(value)
5f8e85b @SharkHunter 1.50 sync
authored
44 seenURL = true
45 }
46 break
e527bad @SharkHunter Update channels
authored
47 case '-y':
48 args+=' playpath='+value
49 rtmpdumpArgs << name
50 rtmpdumpArgs << quoteURI(value)
51 break
52 case '-s':
53 swfUrl=' swfUrl='+value
54 rtmpdumpArgs << name
55 rtmpdumpArgs << quoteURI(value)
56 break
57 case '-a':
58 args+=' app='+value
59 rtmpdumpArgs << name
60 rtmpdumpArgs << quoteURI(value)
61 break
62 case '-W':
63 case 'swfVfy':
64 case '--swfVfy':
65 swfUrl=' swfUrl='+value
66 args+=' swfVfy=1'
67 rtmpdumpArgs << name
68 rtmpdumpArgs << quoteURI(value)
69 break
70 case '-v':
71 args+=' live=1'
72 rtmpdumpArgs << name
73 break
7d30033 @SharkHunter NaviX rtmp fix
authored
74 case '-p':
be0564e @SharkHunter Added illegal/code
authored
75 args+=' pageurl='+value
7d30033 @SharkHunter NaviX rtmp fix
authored
76 rtmpdumpArgs << name
77 rtmpdumpArgs << quoteURI(value)
78 break
79
5a4ef5b @SharkHunter Embeded subs + some new channels
authored
80 case 'subs':
81 if(value) {
82 mencoderArgs << '-sub' << quoteURI(value)
83 seenSub = true
84 }
85 break
86 case 'subcp':
87 if(value)
88 mencoderArgs << '-subcp' << quoteURI(value)
5f8e85b @SharkHunter 1.50 sync
authored
89 break
5a4ef5b @SharkHunter Embeded subs + some new channels
authored
90 case 'subtext':
91 if(value)
92 mencoderArgs << '-subfont-text-scale' << quoteURI(value)
5f8e85b @SharkHunter 1.50 sync
authored
93 break
5a4ef5b @SharkHunter Embeded subs + some new channels
authored
94 case 'subtext':
95 if(value)
96 mencoderArgs << '-subfont-outline' << quoteURI(value)
5f8e85b @SharkHunter 1.50 sync
authored
97 break
5a4ef5b @SharkHunter Embeded subs + some new channels
authored
98 case 'subblur':
99 if(value)
100 mencoderArgs << '-subfont-blur' << quoteURI(value)
5f8e85b @SharkHunter 1.50 sync
authored
101 break
5a4ef5b @SharkHunter Embeded subs + some new channels
authored
102 case 'subpos':
103 if(value)
104 mencoderArgs << '-subpos' << quoteURI(value)
5f8e85b @SharkHunter 1.50 sync
authored
105 break
e527bad @SharkHunter Update channels
authored
106 case 'subout':
107 break
5f8e85b @SharkHunter 1.50 sync
authored
108 default:
e527bad @SharkHunter Update channels
authored
109 if (value)
110 args+=' '+name+"="+value
111 rtmpdumpArgs << name
5f8e85b @SharkHunter 1.50 sync
authored
112 // not all values are URIs, but quoteURI() is harmless on Windows and a no-op on other platforms
113 if (value)
5a4ef5b @SharkHunter Embeded subs + some new channels
authored
114 rtmpdumpArgs << quoteURI(value)
5f8e85b @SharkHunter 1.50 sync
authored
115 }
116 }
117 if (seenURL) {
118 // rtmpdump doesn't log to stdout, so no need to use -q on Windows
e527bad @SharkHunter Update channels
authored
119 $PARAMS.waitbeforestart = 6000L
35ef412 @SharkHunter Channels and scripts
authored
120 if(!seenSub&&!force) {
e527bad @SharkHunter Update channels
authored
121 $URI+=args+swfUrl
122 $TRANSCODER = $FFMPEG + ffmpegArgs
123 }
124 else {
125 $URI=quoteURI($URI)
126 $DOWNLOADER = "$RTMPDUMP -o $DOWNLOADER_OUT -r ${$URI}"
127 $DOWNLOADER += rtmpdumpArgs
35ef412 @SharkHunter Channels and scripts
authored
128 if(seenSub) {
129 $TRANSCODER = $MENCODER + mencoderArgs
be0564e @SharkHunter Added illegal/code
authored
130 }
131 else {
132 $TRANSCODER = $FFMPEG + ffmpegArgs
133 }
5a4ef5b @SharkHunter Embeded subs + some new channels
authored
134 }
5f8e85b @SharkHunter 1.50 sync
authored
135 } else {
136 log.error("invalid rtmpdump:// URI: no -r or --rtmp parameter supplied: ${$URI}")
137 }
138 }
139 }
5a4ef5b @SharkHunter Embeded subs + some new channels
authored
140 }
Something went wrong with that request. Please try again.