Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 75 lines (69 sloc) 2.301 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
/*
rtmpdump://channel?-v&-r=http%3A//example.com&-y=yvalue&-W=Wvalue

-o is set automatically
-r or --rtmp is required
boolean values can be set without a value e.g. rtmpdump://channel?url=http%3A//example.com&--live&--foo=bar
values *must* be URL-encoded
keys can be, but hyphens are not special characters, so they don't need to be
*/

init {
    profile ('rtmpdump://') {
        pattern {
            protocol 'rtmpdump'
         // match { RTMPDUMP }
        }

        action {
            def ffmpegArgs = []
            def pairs = $HTTP.getNameValuePairs($URI) // uses URLDecoder.decode to decode the name and value
            def seenURL = false
def args = ''
def swfUrl=''

            for (pair in pairs) {
                def name = pair.name
                def value = pair.value

                switch (name) {
                    case 'url': // deprecated
                    case '-r':
                    case '--rtmp':
                        if (value) {
                            $URI = value//quoteURI(value)
                            seenURL = true
                        }
                        break
case '-y':
args+=' playpath='+value
break
case '-s':
swfUrl=' swfUrl='+value
break
case '-a':
args+=' app='+value
break
case '-W':
swfUrl=' swfUrl='+value
case '--swfVfy':
args+=' swfVfy=1'
break
case '-v':
args+=' live=1'
break
                    default:
                       // ffmpegArgs << name
                        // not all values are URIs, but quoteURI() is harmless on Windows and a no-op on other platforms
                        if (value)
                            rtmpdumpArgs << quoteURI(value)
                }
            }

            if (seenURL) {
                // rtmpdump doesn't log to stdout, so no need to use -q on Windows
$PARAMS.waitbeforestart = 2000L
$URI+=args+swfUrl
               $TRANSCODER = $FFMPEG + ffmpegArgs
/*$DOWNLOADER = "$RTMPDUMP -o $DOWNLOADER_OUT -r ${$URI}"
$DOWNLOADER += rtmpdumpArgs*/
            } else {
                log.error("invalid rtmpdump:// URI: no -r or --rtmp parameter supplied: ${$URI}")
            }
        }
    }
}
Something went wrong with that request. Please try again.