| 108 | } |
| 109 | |
| 110 | void FrontendData::doParseStreamString( |
| 111 | const int streamID, |
| 112 | const std::string &msg, |
| 113 | const std::string &method) { |
| 114 | // Save freq FIRST because of possible initializing of channel data |
| 115 | const double oldFreq = _freq / 1000.0; |
| 116 | const double reqFreq = StringConverter::getDoubleParameter(msg, method, "freq="); |
| 117 | if (reqFreq != -1.0) { |
| 118 | if (reqFreq != oldFreq) { |
| 119 | // New frequency, so initialize FrontendData and 'remove' all used PIDS |
| 120 | SI_LOG_INFO("Stream: %d, New frequency requested, clearing old channel data...", streamID); |
| 121 | initialize(); |
| 122 | _freq = reqFreq * 1000.0; |
| 123 | _changed = true; |
| 124 | } else if (method == "SETUP" || method == "PLAY") { |
| 125 | const std::string list = StringConverter::getStringParameter(msg, method, "pids="); |
| 126 | if (msg.find("pids=") == std::string::npos) { |
| 127 | // TvHeadend Bug #4809 |
| 128 | // Channel change within the same frequency and no 'xxxpids=', 'remove' all used PIDS |
| 129 | SI_LOG_INFO("Stream: %d, %s method with query and no pids=, clearing old pids...", streamID, method.c_str()); |
| 130 | _filter.clear(); |
| 131 | } else if (!list.empty()) { |
| 132 | SI_LOG_INFO("Stream: %d, %s method with query and pids=, clearing old pids...", streamID, method.c_str()); |
| 133 | _filter.clear(); |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | const int sr = StringConverter::getIntParameter(msg, method, "sr="); |
| 138 | if (sr != -1) { |
| 139 | _srate = sr * 1000; |
| 140 | } |
| 141 | const input::InputSystem msys = StringConverter::getMSYSParameter(msg, method); |
| 142 | if (msys != input::InputSystem::UNDEFINED) { |
| 143 | _delsys = msys; |
| 144 | } |
| 145 | const std::string pol = StringConverter::getStringParameter(msg, method, "pol="); |
| 146 | if (!pol.empty()) { |
| 147 | if (pol == "h") { |
| 148 | _pol = Lnb::Polarization::Horizontal; |
| 149 | } else if (pol == "v") { |
| 150 | _pol = Lnb::Polarization::Vertical; |
| 151 | } |
| 152 | } |
| 153 | const int src = StringConverter::getIntParameter(msg, method, "src="); |
| 154 | if (src >= 1) { |
| 155 | _src = src; |
| 156 | } |
| 157 | const std::string plts = StringConverter::getStringParameter(msg, method, "plts="); |
| 158 | if (!plts.empty()) { |
| 159 | // "on", "off"[, "auto"] |
| 160 | if (plts == "on") { |
| 161 | _pilot = PILOT_ON; |
| 162 | } else if (plts == "off") { |
| 163 | _pilot = PILOT_OFF; |
| 164 | } else if (plts == "auto") { |
| 165 | _pilot = PILOT_AUTO; |
| 166 | } else { |
| 167 | SI_LOG_ERROR("Stream: %d, Unknown Pilot Tone [%s]", streamID, plts.c_str()); |