| 260 | } |
| 261 | |
| 262 | bool PrepareStreamNames(const map<string,vector<string>>& params, bool mode_output) |
| 263 | { |
| 264 | vector<string> v; |
| 265 | string flag; |
| 266 | |
| 267 | if (mode_output) |
| 268 | { |
| 269 | // You have an incoming stream over SRT and you need to |
| 270 | // redirect it to the correct locally defined output stream. |
| 271 | |
| 272 | if (params.count("o") && !params.at("o").empty()) |
| 273 | { |
| 274 | // We have a defined list of parameters. |
| 275 | // Check if there's just one item and it's a file pattern |
| 276 | |
| 277 | // Each stream needs to be defined separately, at least to have IDs |
| 278 | // If this is a file without path, use the default file pattern. |
| 279 | |
| 280 | v = params.at("o"); |
| 281 | flag = "o"; |
| 282 | } |
| 283 | } |
| 284 | else |
| 285 | { |
| 286 | // You have some input media and you want to send them all |
| 287 | // over SRT medium. |
| 288 | if (params.count("i")) |
| 289 | { |
| 290 | v = params.at("i"); |
| 291 | flag = "i"; |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | if ( v.empty() ) |
| 296 | return false; |
| 297 | |
| 298 | for (string& s: v) |
| 299 | { |
| 300 | UriParser u(s); |
| 301 | string id = u["id"]; |
| 302 | if ( id != "" ) |
| 303 | { |
| 304 | defined_streams[id] = s; |
| 305 | } |
| 306 | else |
| 307 | { |
| 308 | cerr << "Parameter at -" << flag << " without id: " << s << endl; |
| 309 | return false; |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | return true; |
| 314 | } |
| 315 | |
| 316 | bool SelectAndLink(SrtModel& m, string id, bool mode_output, string& w_msg) |
| 317 | { |