Added RTMP unescaping code to fix Xsplit support for wildcard streams.

This commit is contained in:
Thulinma 2016-04-13 16:16:56 +02:00
parent 230772f125
commit 87e2c774fd

View file

@ -37,6 +37,39 @@ namespace Mist {
OutRTMP::~OutRTMP() {}
/// Helper function for urlunescape.
/// Takes a single char input and outputs its integer hex value.
int unhex(char c) {
return (c >= '0' && c <= '9' ? c - '0' : c >= 'A' && c <= 'F' ? c - 'A' + 10 : c - 'a' + 10);
}
/// Unescapes URLencoded std::string data.
std::string urlunescape(const std::string & in) {
std::string out;
for (unsigned int i = 0; i < in.length(); ++i) {
if (in[i] == '%') {
char tmp = 0;
++i;
if (i < in.length()) {
tmp = unhex(in[i]) << 4;
}
++i;
if (i < in.length()) {
tmp += unhex(in[i]);
}
out += tmp;
} else {
if (in[i] == '+') {
out += ' ';
} else {
out += in[i];
}
}
}
return out;
}
void OutRTMP::parseVars(std::string data){
std::string varname;
std::string varval;
@ -613,7 +646,7 @@ namespace Mist {
int playTransaction = amfData.getContentP(1)->NumValue();
int playMessageType = messageType;
int playStreamId = streamId;
streamName = amfData.getContentP(3)->StrValue();
streamName = urlunescape(amfData.getContentP(3)->StrValue());
reqUrl += "/"+streamName;//LTS
//handle variables