public PushRequestContent ( string outboundContent, bool append ) : void | ||
outboundContent | string | |
append | bool | |
return | void |
private bool HandleRTSPResponse200Options(RtspProtocol rtspProtocol, Variant requestHeaders, ref string requestContent, Variant responseHeaders, ref string responseContent) { if (rtspProtocol.HasConnectivity) return true; if (rtspProtocol.CustomParameters["connectionType"] == null) { FATAL("Bogus connection"); rtspProtocol.EnqueueForDelete(); return false; } //1. Sanitize if (responseHeaders[RTSP_HEADERS, RTSP_HEADERS_PUBLIC] == null) { FATAL("Invalid response:\n{0}", (responseHeaders.ToString())); return false; } //2. get the raw options string raw = responseHeaders[RTSP_HEADERS, RTSP_HEADERS_PUBLIC]; //3. split and normalize the options var parts = raw.Split(',').Select(x => x.Split(':')).ToDictionary(x => x[0], x => x[1]); string url = requestHeaders[RTSP_FIRST_LINE, RTSP_URL]; switch ((string)rtspProtocol.CustomParameters["connectionType"]) { case "pull": //4. Test the presence of the wanted methods if (!parts.ContainsKey(RTSP_METHOD_DESCRIBE) || !parts.ContainsKey(RTSP_METHOD_SETUP) || !parts.ContainsKey(RTSP_METHOD_PLAY)) { FATAL("Some of the supported methods are missing: {0}", (raw)); return false; } rtspProtocol.PushRequestFirstLine(RTSP_METHOD_DESCRIBE, url, RTSP_VERSION_1_0); rtspProtocol.PushRequestHeader(RTSP_HEADERS_ACCEPT, RTSP_HEADERS_ACCEPT_APPLICATIONSDP); return rtspProtocol.SendRequestMessage(); case "push": //4. Test the presence of the wanted methods if (!parts.ContainsKey(RTSP_METHOD_ANNOUNCE) || !parts.ContainsKey(RTSP_METHOD_SETUP) || !parts.ContainsKey(RTSP_METHOD_RECORD)) { FATAL("Some of the supported methods are missing: {0}", (raw)); return false; } var parameters = rtspProtocol.CustomParameters; rtspProtocol.PushRequestFirstLine(RTSP_METHOD_ANNOUNCE,url,RTSP_VERSION_1_0); var sdp = ComputeSDP(rtspProtocol, parameters["customParameters","localStreamConfig","localStreamName"], parameters["customParameters","localStreamConfig","targetStreamName"], parameters["customParameters","localStreamConfig","targetUri","host"]); if (sdp == "") { FATAL("Unable to compute sdp"); return false; } rtspProtocol.PushRequestHeader(RTSP_HEADERS_CONTENT_TYPE, RTSP_HEADERS_ACCEPT_APPLICATIONSDP); rtspProtocol.PushRequestContent(sdp,false); return rtspProtocol.SendRequestMessage(); default: FATAL("Bogus connection"); rtspProtocol.EnqueueForDelete(); return false; } }